8-Bit Software

The BBC and Master Computer Public Domain Library

Back to 8BS Or Back to Disassembly

Page Last Altered:

968E TIME$=

Submitted by Steve Fewell


Call &9B46: to check for '=' as the next non-space character at BASIC text pointer B location, (& generate 'Syntax error'
if another character was found instead); Get the result of the expression at BASIC text pointer B; and check
that the BASIC statement finishes after the expression (with a '<cr>', ':' or 'ELSE-token' character.
'Syntax error' is generated if the end of the statement was not found.

If the expression result (&27) is not 0 (String) then issue a 'Type mismatch' error as TIME$ must be set to a String

Set A to #&0F (the OSWORD call number for the setting of the time-date string).
Set Y to &36 (the SWA Length byte), store this value in location &05FF (i.e. the first byte of the OSWORD parameter
block) - location &05FF shouldn't be used by any other BASIC storage.

Set X (LSB) & Y (MSB) to point to the address of the start of the OSWORD parameter block that contains the new TIME$
value. This parameter block is located at &05FF (i.e. the length byte followed by the SWA).
Call OSWORD (&FFF1) to execute the Set TIME command and set the Operating System's Internal counter to the IWA value.

Lastly, jump to &9005 to start processing the next program statement.

Disassembly for the TIME$= routine

968E   230 010 E6 0A INC &0A
9690 F 032 070 155 20 46 9B JSR &9B46 Ptr B = Ptr A; Check for '=' & get result of expression; check end of statement
9693 ' 165 039 A5 27 LDA &27
9695 @ 208 064 D0 40 BNE 64 --> &96D7 [JMP &9092 'Type mismatch' error]
9697   169 015 A9 0F LDA#&0F
9699 6 164 054 A4 36 LDY &36
969B   140 255 005 8C FF 05 STY &05FF
969E   162 255 A2 FF LDX#&FF
96A0   160 005 A0 05 LDY#&05
96A2   128 231 80 E7 BRA -25 --> &968B [JMP &B312 [JSR &FFF1: BRA 11 --> &B222 [JMP &9005 Process next Statement]]]


 Back to 8BS