8-Bit Software

The BBC and Master Computer Public Domain Library

Back to 8BS Or Back to Disassembly

Page Last Altered:

9679 TIME=

Submitted by Steve Fewell


If the next character on the command or program line is '$' then call the TIME$ routine (&968E) to assign to TIME$
and not TIME.

Call &96B9: 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 convert it to Integer);
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.

Store zero in location &2E (the imaginary byte 5 (MSB) of the IWA value!), as the set TIME OSWORD call (OSWORD 2)
requires a 5-byte Integer value.
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 &002A (i.e. the IWA). The first byte at &002A is the LSB byte of the new
TIME value and the last byte (&002E) is the MSB byte of the new TIME value.
Set A to #&02, to indicate that we require the 'OSWORD 2' function.
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

9679   200 C8 INY
967A   177 011 B1 0B LDA (&0B),Y
967C $ 201 036 C9 24 CMP#&24
967E   240 014 F0 0E BEQ 14 --> &968E TIME$
9680   032 185 150 20 B9 96 JSR &96B9 Ptr B = Ptr A; Check '='; Get result; Check end of statement & convert result to Integer
9683 d. 100 046 64 2E STZ &2E
9685 * 162 042 A2 2A LDX#&2A
9687   160 000 A0 00 LDY#&00
9689   169 002 A9 02 LDA#&02
968B L 076 018 179 4C 12 B3 JMP &B312 [JSR &FFF1: BRA 11 --> &B222 [JMP &9005]] Process next statement


 Back to 8BS