Who can help for a complex ASM routine 
Author Message
 Who can help for a complex ASM routine

I want to use the extra Real Time Clock timer on my PC 104.
I have all the data need to have access to it,  but I dont know what to do,
to call the timer for start and stop. Here is the parameters of the RCT:

Features of the clock chip include:

* 128 Bytes battery backed up CMOS RAM
* 24 or 12 Hour Format
* Automatic word addressing incrementing
* Programmable alarm, time, and interrupt function

The Real-time Clock on the PC II+ is part of the Intel 82360SL
The DOS clock is updated automatically by the RTC upon Boot Up

The PC/II+ supports the interrupt 1AH AT compatible clock funtions.

CLKGET & CLKPUT are two other real time clock functions that are
implementted on the PC/II+, accessible through INT1AH

Function    Prior To int1AH    Upon Return from INT1AH

CLKGET       AH = FFH             AL=Value in RTC egister
                       DL = register*
                       DH = 1DH
                       *register = specify RTC register

CLKPUT       AH = FFH                No values returned
                       DL = register
                       DH = 1CH
                       AL = value**
                    **value = specigy value to go into register

REGISTER    ADDRESSES       FUNCTION
Decimal           Hexadecimal
   000                    00h                    Control/Status
   001                    01h                    100ths of a Second
   002                    02h                    Seconds
   003                    03h                    Minutes
   004                    04h                    Hours
   005                    05h                    Years/Century
   006                    06h                    Month/Day
   007                    07h                    Timer
   008                    08h        Reserved for Alarm Control
   009                    09h        Res.for Alarm Regist.or Ram

010-013        0Ah-0dh                Status Registers A,B,C,D
   014                    0Eh                    Diagnostic Status Byte
   015                    0Fh                    Shutdown Status Byte

Hooping that with this infromation somebody can find a way to get access to
that clock.

Jean-Yves



Fri, 15 Feb 2002 03:00:00 GMT  
 Who can help for a complex ASM routine
Hi Jean-Yves,
There is no need to write to the CMOS directly.
There are INT 1Ah functions that do that for you (See below).
Once you have started the Real Time Clock Alarm just observe INT 4Ah.
You have to write an interupt handling routine for this.
Sound a beep or so when INT 4Ah occurs.
It's really quite easy.

Many years ago I wrote a TSR called SETALARM.
When you like to study it, just send an email.
Succes, Eric

--

Eric P. van Westendorp  Tel: +31(0252)210579
Reigerslaan 22  2215NN Voorhout  Netherlands

INT 1A 06-- - TIME - SET ALARM (AT,XT286,PS)

Category: B - BIOS

Inp.:
        AH = 06h
        CH = hour (BCD)
        CL = minutes (BCD)
        DH = seconds (BCD)
Return: CF set on error (alarm already set or clock stopped for update)
        CF clear if successful
Notes:  the alarm occurs every 24 hours until turned off, invoking INT 4A
each
          time
        the BIOS does not check for invalid values for the time, so the CMOS
          clock chip's "don't care" setting (any values between C0h and FFh)
          may be used for any or all three parts.  For example, to create an
          alarm once a minute, every minute, call with CH=FFh, CL=FFh, and
          DH=00h.

SeeAlso: AH=07h,AH=0Ch,INT 4A"SYSTEM"
INT 1A
Copied from Ralf Brown's Interrupt List

INT 1A 07-- - TIME - CANCEL ALARM (AT,XT286,PS)

Category: B - BIOS

Inp.:
        AH = 07h
Return: alarm disabled
Note:   does not disable the real-time clock's IRQ
SeeAlso: AH=06h,AH=0Dh,INT 70
INT 1A
Copied from Ralf Brown's Interrupt List

Quote:

> I want to use the extra Real Time Clock timer on my PC 104.
> I have all the data need to have access to it,  but I dont know what to do,
> to call the timer for start and stop. Here is the parameters of the RCT:

> Features of the clock chip include:

> * 128 Bytes battery backed up CMOS RAM
> * 24 or 12 Hour Format
> * Automatic word addressing incrementing
> * Programmable alarm, time, and interrupt function

> The Real-time Clock on the PC II+ is part of the Intel 82360SL
> The DOS clock is updated automatically by the RTC upon Boot Up

> The PC/II+ supports the interrupt 1AH AT compatible clock funtions.

> CLKGET & CLKPUT are two other real time clock functions that are
> implementted on the PC/II+, accessible through INT1AH

> Function    Prior To int1AH    Upon Return from INT1AH

> CLKGET       AH = FFH             AL=Value in RTC egister
>                        DL = register*
>                        DH = 1DH
>                        *register = specify RTC register

> CLKPUT       AH = FFH                No values returned
>                        DL = register
>                        DH = 1CH
>                        AL = value**
>                     **value = specigy value to go into register

> REGISTER    ADDRESSES       FUNCTION
> Decimal           Hexadecimal
>    000                    00h                    Control/Status
>    001                    01h                    100ths of a Second
>    002                    02h                    Seconds
>    003                    03h                    Minutes
>    004                    04h                    Hours
>    005                    05h                    Years/Century
>    006                    06h                    Month/Day
>    007                    07h                    Timer
>    008                    08h        Reserved for Alarm Control
>    009                    09h        Res.for Alarm Regist.or Ram

> 010-013        0Ah-0dh                Status Registers A,B,C,D
>    014                    0Eh                    Diagnostic Status Byte
>    015                    0Fh                    Shutdown Status Byte

> Hooping that with this infromation somebody can find a way to get access to
> that clock.

> Jean-Yves



Sat, 16 Feb 2002 03:00:00 GMT  
 Who can help for a complex ASM routine
Tks E.P !

First of all  I have to tell you exactly what I need. I made a Basic program
to count pulses on pin 12 of LPT1. I notice that when the mouse moved my
time base of 1 second was affected. Maybe because it creates int. somewhere,
anyway timer was not stable. Finally I found that I have a second timing
source which is the Real time clock. It seems to you very simple but for me
it's complex.

So what I want to do is use an ASM routine to replace my timer by your
routine.

Actually I use s# = timer then I

DO:LOOP UNTIL INP(889) AND 32 = 32 which is LPT1 pin 12 high
I also do another loop DO:LOOP UNTIL INP(889) AND 32 =0
to make a full cycle.

Then I say if INP(889) AND 32 = 32 THEN count% = count# +1

'After that I put

t# = timer

'and I say

LOOP UNTIL t# - s# >1     ' wich is 1 second

PRINT count%

Ok now can you tell me where to put my ASM call between that, or do you have
a better way to do it ?

Thank you in advance !

Jean-Yves



Sat, 16 Feb 2002 03:00:00 GMT  
 Who can help for a complex ASM routine
Hi,
Sorry, I misunderstood your original question.
I supposed you wanted to use the Real Time Clock Alarm.

Now I understand you need a timing of 1 second.
Isn't intercepting INT 1Ch accurate enough for your purpose?

If not, you can find many timer routines on the web.
Or post a question for one.
Succes, Eric

--

Eric P. van Westendorp  Tel: +31(0252)210579
Reigerslaan 22  2215NN Voorhout  Netherlands

Quote:

> Tks E.P !

> First of all  I have to tell you exactly what I need. I made a Basic program
> to count pulses on pin 12 of LPT1. I notice that when the mouse moved my
> time base of 1 second was affected. Maybe because it creates int. somewhere,
> anyway timer was not stable. Finally I found that I have a second timing
> source which is the Real time clock. It seems to you very simple but for me
> it's complex.

> So what I want to do is use an ASM routine to replace my timer by your
> routine.

> Actually I use s# = timer then I

> DO:LOOP UNTIL INP(889) AND 32 = 32 which is LPT1 pin 12 high
> I also do another loop DO:LOOP UNTIL INP(889) AND 32 =0
> to make a full cycle.

> Then I say if INP(889) AND 32 = 32 THEN count% = count# +1

> 'After that I put

> t# = timer

> 'and I say

> LOOP UNTIL t# - s# >1     ' wich is 1 second

> PRINT count%

> Ok now can you tell me where to put my ASM call between that, or do you have
> a better way to do it ?

> Thank you in advance !

> Jean-Yves



Sun, 17 Feb 2002 03:00:00 GMT  
 Who can help for a complex ASM routine
Hi,
It appears the layout of the first bytes of CMOS memory in your computer
is not the standard one.
Below is what I copied from Ralf Brown's Interrupt List about those
bytes.
Also the INT1Ah functions CLKGET and CLKPUT are non standard functions.

I could write a little routine, using your info about CLKGET, if you
tell me which CMOS register to read.
The date/time related registers normally have contents in BCD format.
See you, Eric

--

Eric P. van Westendorp  Tel: +31(0252)210579
Reigerslaan 22  2215NN Voorhout  Netherlands

The CMOS RAM space has an upper limit of 128 bytes because of the
structure
of port 70: only bits 0-6 are used for addressing, bit 7 is used to
enable (0) or disable (1) Non-Maskable Interrupts (NMI) and explains why
IBM uses 80h OR <address> to read/write data & follows with  a
"throw-away"
call.

Note that if the CMOS only has 64 bytes available, addressing will
generally wrap and addresses from 40h-7Fh will mirror 00h-3Fh. Output
will
be hexadecimal.

10 CLS
20 FOR i = 0 TO &H7F
30 OUT &H70, i
40 PRINT USING "\   \"; HEX$(INP(&H71));
50 NEXT i
60 PRINT " "

Note: where not otherwise noted, all data points are expressed as BYTES

      these are eight bit values and are read from MSB to LSB e.g.
      0000 0000     0101 1010 binary would be written as 5Ah
      7654 3210     where only some bits are used this is represented
with
                    Xs e.g bits 5-3 would be shown as 00xx x000

Note: the entries for AMI WinBIOS also apply to AMIBIOS with core dates
of
        12/15/95 or later

--------!---Note-----------------------------
                Organization of CMOS Memory - Clock

00h-0Eh is defined by the clock hardware and all must follow it. Other
manufacturers generally follow the same format as specified for the
region 10h - 2Fh. Some also follow the IBM format for 30h-33h but not
all

(Zenith in particular is different).

The first four{*filter*} bytes are dedicated to the MC146818 chip clock
functions
and consist of ten read/write data registers and four status registers,
two
of which are read/write and two of which are read only.

The format of the ten clock data registers (bytes 00h-09h) is:

----------R00--------------------------------
CMOS 00h - RTC - SECONDS
Desc:   (BCD 00-59, Hex 00-3B)
Note: Bit 7 is read only        
SeeAlso: CMOS 01h,CMOS 02h,CMOS 04h
----------R01--------------------------------
CMOS 01h - RTC - SECOND ALARM
Desc:   (BCD 00-59, Hex 00-3B; "don't care" if C0-FF)

SeeAlso: CMOS 00h,CMOS 03h,CMOS 05h,CMOS 7Dh
----------R02--------------------------------
CMOS 02h - RTC - MINUTES
Desc:   (BCD 00-59, Hex 00-3B)
SeeAlso: CMOS 00h,CMOS 03h,CMOS 04h
----------R03--------------------------------
CMOS 03h - RTC - MINUTE ALARM
Desc:   (BCD 00-59, Hex 00-3B; "don't care" if C0-FF))        
SeeAlso: CMOS 00h,CMOS 02h,CMOS 05h,CMOS 7Dh,CMOS 7Eh"AMD-645"
----------R04--------------------------------
CMOS 04h - RTC - HOURS
Desc:   (BCD 00-23, Hex 00-17 if 24 hr mode)
        (BCD 01-12, Hex 01-0C if 12 hr am)

        (BCD 81-92. Hex 81-8C if 12 hr pm)            
SeeAlso: CMOS 00h,CMOS 02h,CMOS 05h
----------R05--------------------------------
CMOS 05h - RTC - HOUR ALARM
Desc:   (same as hours; "don't care" if C0-FF))          
SeeAlso: CMOS 01h,CMOS 03h,CMOS 04h
----------R06--------------------------------
CMOS 06h - RTC - DAY OF WEEK
Desc:   (01-07 Sunday=1)    
SeeAlso: CMOS 07h,CMOS 08h,CMOS 09h
----------R07--------------------------------
CMOS 07h - RTC - DATE OF MONTH
Desc:   (BCD 01-31, Hex 01-1F)
SeeAlso: CMOS 06h,CMOS 08h,CMOS 09h

----------R08--------------------------------
CMOS 08h - RTC - MONTH
Desc:   (BCD 01-12, Hex 01-0C)    
SeeAlso: CMOS 06h,CMOS 07h,CMOS 09h
----------R09--------------------------------
CMOS 09h - RTC - YEAR
Desc:   (BCD 00-99, Hex 00-63)    
Notes:  BCD/Hex selection depends on Bit 2 of register B (0Bh)
        12/24 Hr selection depends on Bit 1 of register B (0Bh)
        Alarm will trigger when contents of all three Alarm byte registers
          match their companions.
SeeAlso: CMOS 06h,CMOS 07h,CMOS 08h

The following is the on-chip status register information.

----------R0A--------------------------------

CMOS 0Ah - RTC - STATUS REGISTER A (read/write) (usu 26h)

Bitfields for Real-Time Clock status register A:
Bit(s)  Description     (Table C0001)
 7      =1 time update cycle in progress, data ouputs undefined
        (bit 7 is read only)
 6-4    22 stage divider
        010 = 32768 Hz time base (default)
 3-0    rate selection bits for interrupt
        0000 none
        0011 122 microseconds (minimum)
        1111 500 milliseconds  
        0110 976.562 microseconds (default 1024 Hz)
SeeAlso: #C0002,#C0003,#C0004
----------R0B--------------------------------
CMOS 0Bh - RTC - STATUS REGISTER B (read/write)

Bitfields for Real-Time Clock status register B:

Bit(s)  Description     (Table C0002)
 7      enable clock setting by freezing updates
 6      enable periodic interrupt
 5      enable alarm interrupt
 4      enable update-ended interrupt
 3      enable square wave output
 2      Data Mode - 0: BCD, 1: Binary
 1      24/12 hour selection - 1 enables 24 hour mode
 0      Daylight Savings Enable
        =1 enables automatic switching to/from DST in April and October
SeeAlso: #C0001,#C0003,#C0004
----------R0C--------------------------------
CMOS 0Ch - RTC - STATUS REGISTER C (Read only)

Bitfields for Real-Time Clock status register C:
Bit(s)  Description     (Table C0003)
 7      Interrupt request flag
        =1 when any or all of bits 6-4 are 1 and appropriate enables

          (Register B) are set to 1. Generates IRQ 8 when triggered.
 6      Periodic Interrupt flag
 5      Alarm Interrupt flag
 4      Update-Ended Interrupt Flag
 3-0    unused
SeeAlso: #C0001,#C0002,#C0004
----------R0D--------------------------------
CMOS 0Dh - RTC - STATUS REGISTER D (read only)

Bitfields for Real-Time Clock status register D:
Bit(s)  Description     (Table C0004)
 7      Valid RAM - 1 indicates batery power good, 0 if dead or disconnected.
 6-0    unused (0)
--------!---Note-----------------------------
                Organization of CMOS Memory - non-Clock

The last two bytes in the first hexadecimal decade (hexade ?) were not

specified in the PC/AT but may have the following use on some systems:
----------R0E--------------------------------
CMOS 0Eh  - IBM PS/2 - DIAGNOSTIC STATUS BYTE

Bitfields for IBM PS/2 diagnostic status byte:
Bit(s)  Description     (Table C0005)
 7      indicates clock has lost power
 6      incorrect checksum>
 5      equipment configuration is incorrect
          (power-on check requires that atleast one floppy be installed)
 4      error in memory size
 3      controller or disk drive failed initialization
 2      time is invalid
 1      installed adaptors do not match configuration
 0      time-out while reading adaptor ID
----------R0E13------------------------------
CMOS 0Eh-13h - AMSTRAD - TIME AND DATE MACHINE LAST USED

----------R0F--------------------------------
CMOS 0Fh - IBM - RESET CODE (IBM PS/2 "Shutdown Status Byte")

(Table C0006)
Values for Reset Code / Shutdown Status Byte:
 00h-03h perform power-on reset
   00h  software reset or unexpected reset
   01h  reset after memory size check in real/virtual mode
        (or: chip set initialization for real mode reentry)
   02h  reset after successful memory test in real/virtual mode
   03h  reset after failed memory test in real/virtual mode
 04h    INT 19h reboot
 05h    flush keyboard (issue EOI) and jump via 40h:0067h
 06h    reset (after successful test in virtual mode)
        (or: jump via 40h:0067h without EOI)
 07h    reset (after failed test in virtual mode)

 08h    used by POST during protected-mode RAM test (return to POST)
 09h    used for INT 15/87h (block move) support
 0Ah    resume execution by jump via 40h:0067h
 0Bh    resume execution via IRET via 40h:0067h
 0Ch    resume execution via RETF via 40h:0067h
 0Dh-FFh perform power-on reset
--------!---Note-----------------------------

The second group of values extends from address 10h to 2Dh. The word at
2Eh-2Fh is a byte-wise summation of the values in these bytes. Most
BIOSes
will generate a CMOS Checksum error if this value is invalid however
many
programs ignore the checksum and report the apparent value. The current
version of MSD reports my XT as having 20+ MB of extended memory.

Quote:

> Tks E.P !

> First of all  I have to tell you exactly what I need. I made a Basic program
> to count pulses on pin 12 of LPT1. I notice that when the mouse moved my
> time base of 1 second was affected. Maybe because it creates int. somewhere,
> anyway timer was not stable. Finally I found that I have a second timing
> source which is the Real time clock. It seems to you very simple but for me
> it's complex.

> So what I want to do is use an ASM routine to replace my timer by your
> routine.

> Actually I use s# = timer then I

> DO:LOOP UNTIL INP(889) AND 32 = 32 which is LPT1 pin 12 high
> I also do another loop DO:LOOP UNTIL INP(889) AND 32 =0
> to make a full cycle.

> Then I say if INP(889) AND 32 = 32 THEN count% = count# +1

> 'After that I put

> t# = timer

> 'and I say

> LOOP UNTIL t# - s# >1     ' wich is 1 second

> PRINT count%

> Ok now can you tell me where to put my ASM call between that, or do you have
> a better way to do it ?

> Thank you in advance !

> Jean-Yves



Sun, 17 Feb 2002 03:00:00 GMT  
 Who can help for a complex ASM routine
Tks E.P!
Yesterday I received from Megatel the PC-104 company this description: Can
we use these 18.2 ticks for my time gate ? if so how

Here is the Megatel suggestion:

RTC gets timer ticks 18.2 times a second. On every tick, BIOS updates a word
in BIOS data area.
Least significant byte is at  location 0040:006C and most significant byte
is at 0040:006E.
Any application software can read these values directly from above
locations.

BIOS also provides a software interrupt to read the value of this counter.
Its function 00 of interrupt 1A (hex).
This interrupt is only supposed to be used by the operating systems.
Becasue this interrupt clears the timer overflow flag which is used to
update the internal clock by the operating system.
So this interrupt is not recomemded for the application softwares.

Tks again !

Jean-Yves



Sun, 17 Feb 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Interrupt Service Routine in asm help wanted

2. Interrupt Service Routine in asm help wanted

3. HELP: Beginner line drawing SetPixel() ASM routine.

4. ASM help! with weak encryption routine

5. Interrupt Service Routine in asm help wanted

6. HELP: Beginner line drawing SetPixel() ASM routine.

7. Help: VGA routines in ASM

8. complex import routine

9. ? SVD routine for COMPLEX matrix

10. Complex Optimization routines

11. WANTED: MULTI-ROOTS SEACHING ROUTINE FOR COMPLEX FUNCTION

12. Complex eigenvalue routine

 

 
Powered by phpBB® Forum Software