This is an old version from the tos.hyp. The new is on GitHub!

HomeXBIOSCT60 XBIOS extensionPrinter functions

4.9 Date, Time and Timer

Gettime Gets the date and time.
NVMaccess Configures the NVM of the real-time clock.
Settime Sets the date and time.
Xbtimer Initializes the system timer.

4.9.1 Gettime

Name: »get time« - Get the time and date.
Opcode: 23
Syntax: uint32_t Gettime( void );
Description: The XBIOS routine Gettime obtains the date and time from the computer's hardware clock.
Return value: The function returns the date and time, which are coded as follows:

Bit Description
0-4 Seconds in units of 2 (0-29)
5-10 Minutes (0-59)
11-15 Hours (0-23)
16-20 Day of month (1-31)
21-24 Month (1-12)
25-31 Year (0-119, 0 represents 1980)
Availability: All TOS versions.
Group: Date, Time and Timer
See also: Binding   Settime

4.9.1.1 Bindings for Gettime

C: #include

uint32_t Gettime( void );
Assembler:
move.w    #23,-(sp)    ; Offset 0
trap      #14          ; Call XBIOS
addq.l    #2,sp        ; Correct stack

4.9.2 NVMaccess

Name: »NVMacess« - Configure the "Non-Volatile Memory" of the real-time clock.
Opcode: 46
Syntax: int16_t NVMaccess( int16_t op, int16_t start, int16_t count, int8_t *buffer );
Description: The XBIOS routine NVMaccess permits the configuration of the NVM of the real-time clock. This has available 50 bytes of non-volatile RAM, where the last two bytes are used as a checksum. The following apply:

Parameter Meaning
op 0 = Read out NVM and check the checksum.
  1 = Write to NVM, check the checksum
      and reset it
  2 = Initialize NVM and set checksum
   
start Start-byte.
count Number of bytes to transfer.
buffer Buffer from or to which to write.
Return value: The function returns the value 0 if no error has occurred. A value of -5 means that the arguments were not within the permitted region. A return value of -12 identifies an inconsistent checksum.
Availability: Atari TT (TOS 3.xx) and Falcon (TOS 4.xx)
Group: Date, Time and Timer
See also: Binding   Assignment of the NVM

4.9.2.1 Bindings for NVMaccess

C: #include

int16_t NVMaccess( int16_t op, int16_t start, int16_t count, int8_t *buffer );
Assembler:
pea       buffer       ; Offset 8
move.w    count,-(sp)  ; Offset 6
move.w    start,-(sp)  ; Offset 4
move.w    op,-(sp)     ; Offset 2
move.w    #46,-(sp)    ; Offset 0
trap      #14          ; Call XBIOS
lea       $C(sp),sp    ; Correct stack

4.9.3 Settime

Name: »set time« - Set the time and date.
Opcode: 22
Syntax: void Settime( uint32_t time );
Description: The XBIOS routine Settime sets the date and time. The 32-bit parameter time is split up as follows:

time Meaning
0-4 Seconds in units of 2 (0-29)
5-10 Hours (0-23)
11-15 Hours (0-23)
16-20 Day of month (1-31)
21-24 Monat (1-12)
25-31 Year (subtract 1980)
Return value: The function does not return a result.
Availability: All TOS versions.
Gruppe: Date, Time and Timer
See Also: Binding   Gettime

4.9.3.1 Bindings for Settime

C: #include

void Settime( uint32_t time );
Assembler:
move.l    time,-(sp)   ; Offset 2
move.w    #22,-(sp)    ; Offset 0
trap      #14          ; Call XBIOS
addq.l    #6,sp        ; Correct stack

4.9.4 Xbtimer

Name: »timer init« - Initialize the timer in the MFP chip.
Opcode: 31
Syntax: void Xbtimer( int16_t timer, int16_t control, int16_t data, void(*vector)( ) );
Description: The XBIOS routine Xbtimer initializes one of the four timers (A-D) in the 68901 multi-function peripheral chip. The following apply:

Parameter Meaning
timer Number of the timer:
  0 = A (usable for own programs)
  1 = B (Horizontal blank interrupt)
  2 = C (System timer (200 Hz))
  3 = D (Generator for the Baud rates)
   
control Value for corresponding timer register
data Value for corresponding timer register
vector Pointer to interrupt routine
Return value: The function does not return a result.
Availability: All TOS versions.
Group: Date, Time and Timer
See also: Binding

4.9.4.1 Bindings for Xbtimer

C: #include

void Xbtimer( int16_t timer, int16_t control, int16_t data, void(*vector)( ) );
Assembler:
pea       vector        ; Offset 8
move.w    data,-(sp)    ; Offset 6
move.w    control,-(sp) ; Offset 4
move.w    timer,-(sp)   ; Offset 2
move.w    #31,-(sp)     ; Offset 0
trap      #14           ; Call XBIOS
lea       $C(sp),sp     ; Correct stack

4.9.5 Assignment of the real-time clock's NVM

The real-time clock in the Atari TT030 and Falcon030 has available 50 bytes of non-volatile memory that can be used by programs for configuration purposes. The following assignments apply:

typedef struct
{
  unsigned int bootpref;
  char reserved[4];
  unsigned char language;
  unsigned char keyboard;
  unsigned char datetime;
  char separator;
  unsigned char bootdelay;
  char reserved2[3];
  unsigned int vmode;
  unsigned char scsi;
} NVM;
bootpref Boot preference:
0x00 = No preference
0x08 = MagiC
0x10 = Linux
0x20 = NetBSD
0x40 = UNIX will be booted
0x80 = TOS will be booted
language Language:
0 = English
1 = German
2 = French
3 = Reserved
4 = Spanish
5 = Italian
keyboard Keyboard layout:
0 = USA
1 = German
2 = French
3 = British
4 = Spanish
5 = Italian
6 = Swedish
7 = (French) Swiss
8 = (German) Swiss
datetime Formatting of the date:
Bit 0..3 0 = Format "MM-DD-YY" (Month, Day, Year)
1 = Format "DD-MM-YY" (Day, Month, Year)
2 = Format "YY-MM-DD" (Year, Month, Day)
3 = Format "YY-DD-MM" (Year, Day, Month)
Bit 4..7 0 = 12-hour clock display
1 = 24-hour clock display
separator ASCII-value of the character that is to act as the separator for the date.
bootdelay Boot delay
vmode Video mode
scsi
Bit 0..2 SCSI-ID (0-7)
Bit 3..6 0, reserved
Bit 7 Flag for bus-arbitration.
The following apply:
0 = Arbitration on
1 = Arbitration off

All further bytes are not documented at present. As one can see, it is possible, in particular, to specify the SCSI ID of a TT030 or Falcon030 via the NVM.

In a Milan the NVM has a size of 224 bytes.

The following structure applies only for TOS 4.08 (2003-03-09) and Bootblock 1.02!

typedef struct
{
  unsigned int bootpref;
  char reserved[4];
  unsigned char language;
  unsigned char keyboard;
  unsigned char datetime;
  char separator;
  unsigned char bootdelay;
  unsigned char ide_drives;
  unsigned char scsi_drives;
  char reserved2;
  unsigned int vmode;
  unsigned char scsi;
  char reserved3[31];
  unsigned char memory;
  char INT1_2;
  char INT3_4;
  char reserved4[173];
} NVM_Milan;
memory
Bit 0..1 0 = 16MB ST-RAM
1 =  4MB ST-RAM
2 =  2MB ST-RAM
Bit 2 ROMPORT emulation

See also: NVMaccess   XHDI specification


HomeXBIOSCT60 XBIOS extensionPrinter functions