8-Bit Software

The BBC and Master Computer Public Domain Library

Back to 8BS Or Back to Disassembly


Page Last Altered:

980D VDU

Submitted by Steve Fewell

Description:

[&980D] Get the next non-space character (from BASIC Text Pointer A) after the 'VDU' keyword.
[&9810] If end of VDU statement found (i.e. the character is ':', '<cr>' [carriage-return] or 'ELSE-token') then jump to
&9000 to execute the next command line or program statement.

If not end of statement found, then decrement BASIC Text pointer A Offset (&0A), and call routine &926F to get the
result of the expression at BASIC Text Pointer A position and convert the result to Integer (or issue 'Syntax Error' if
a String value was found).

Call routine &9840 to output the ASCII Code in the IWA LSB byte (location &2A) to the screen.

Get the next non-space character. If the character is ',' [comma] then jump back to &980D to check for any further VDU
codes.
If the character is ';' [semi-colon] then [&9808] Output the ASCII code in location &2B (the MSB byte of the 16-bit
value in the IWA) to the screen, and then continue with &980D (to check for further VDU codes to output).
If the character is '|' [vertical-bar] then output 9 ASCII-0 [Nul] bytes to complete any pending VDU statements and then
jump back to &980D to check for further VDU codes to output.

If the character isn't ',', ';' or '|' then jump back to &9810 to check for end of statement and output further
VDU codes (if end of statement isn't found).
This enables VDU calls such as 'W%=67: VDU 65W%66|68&66(69)' to be accepted and display the result: 'ACBDfE'!
And additionally allows for spaces to be used instead of commas.


Disassembly for the VDU routine

9808 + 165 043 A5 2B LDA &2B
980A   032 238 255 20 EE FF JSR &FFEE   OSWRCH
980D   032 224 142 20 E0 8E JSR &8EE0 Get next non-space char (PTR A)
9810 : 201 058 C9 3A CMP#&3A
9812 ) 240 041 F0 29 BEQ 41 --> &983D [JMP &9000 Check end of statement & execute next statement]
9814   201 013 C9 0D CMP#&0D
9816 % 240 037 F0 25 BEQ 37 --> &983D [JMP &9000 Check end of statement & execute next statement]
9818   201 139 C9 8B CMP#&8B
981A ! 240 033 F0 21 BEQ 33 --> &983D [JMP &9000 Check end of statement & execute next statement]
981C   198 010 C6 0A DEC &0A
981E o 032 111 146 20 6F 92 JSR &926F Evaluate Expression at BASIC Text pointer A convert result to integer
9821 @ 032 064 152 20 40 98 JSR &9840 Send character in ?&2A to the Output vector
9824   032 229 140 20 E5 8C JSR &8CE5 Compare next non-space [PTR A] character with ','
9827   240 228 F0 E4 BEQ -28 --> &980D
9829 ; 201 059 C9 3B CMP#&3B
982B   240 219 F0 DB BEQ -37 --> &9808
982D | 201 124 C9 7C CMP#&7C
982F   208 223 D0 DF BNE -33 --> &9810
9831   169 000 A9 00 LDA#&00
9833   160 009 A0 09 LDY#&09
9835   032 238 255 20 EE FF JSR &FFEE   OSBYTE
9838   136 88 DEY
9839   208 250 D0 FA BNE -6 --> &9835
983B   128 208 80 D0 BRA -48 --> &980D
983D L 076 000 144 4C 00 90 JMP &9000   Check end of statement & execute the next statement on the Command or Program Line

 


 Back to 8BS
Or