10DEFFNS="LineOut" :REM Name of p
rogram
20MODE0
30FORL%=0TO2STEP 2 :REM Assembler lo
op
40P%=&900 :REM Memory locat
ion to run from
50[ ½ Start of machin
e code
60OPTL% ½ Assembler listi
ng option
70LDA#0 ½ Load the A regi
ster with 0
80STA&70 ½ Store the conte
nts of A at memory location &70
90SEI ½ Stop interrupts
to allow a change
100LDA&20E ½ Get LSB of WRCH
V (routine that sends output to screen)
110STA&72 ½ Save it
120LDA&20F ½ Get MSB of WRCH
V
130STA&73 ½ Save it
140LDA# interrupt MOD 256 ½ Put the a
ddress of my routine there instead
150STA&20E ½ ditto
160LDA# interrupt DIV 256 ½ ditto
170STA&20F ½ ditto
180CLI ½ Set the
interrupts going again
190RTS ½ Routine
now in place
200.interrupt ½ My inter
rupt routine starts here
210STA&71 ½ Save A (c
haracter going to screen) to memory &71
220PHA:TXA:PHA:TYA:PHA ½ Save all
the registers
230LDA&70 ½ Load the
count into the A register
240CMP#0 ½ Is the co
unt at 0 (not running)?
250BNE running ½ If not 0
then count running, jump to main loop
260LDA&71 ½ Get saved
character again
270CMP#10 ½ is it the
cursor down code?
280BNEout ½ If not it
's no good so jump out
290INC&70 ½ Increase
the count (This starts the count going)
300JMPout ½ Leave the
routine
310.running
320LDA&71 ½ Get the s
aved character again
330CMP#32 ½ Is it a s
pace?
340BNEnotspace
350LDA#53 ½ remove th
e space by changing it to a character
360STA&71 ½ that will
be removed later ( 0 to 9 )
370.notspace
380CMP#48 ½ is the ch
aracter smaller than 48 ( 0 ) ?
390BMIleave
400CMP#58 ½ or larger
than 57 (9) ?
410BPLleave
420LDA#0 ½ if it's 0
to 9 and a count is running, delete it
430STA&71
440.leave
450INC&70 ½ Increase
the count
460LDA&70
470CMP#7 ½ Is the co
unt 7 yet?
480BNEout
490LDA#0 ½ If yes ze
ro it and stop the routine running
500STA&70
510.out:PLA:TAY:PLA:TAX:PLA½ restore t
he registers
520LDA&71 ½ get the c
haracter to go to the screen
530JMP(&72) ½ Jump to w
rite character
540] : REM End o
f machine code assembler
550NEXT
560REM OSCLI"SA. CODE 900 "+STR$÷P% :
REM Remove REM to *RUN code later
570CALL&900 :
REM Call the routine
580PRINT"TYPE LIST NOW!"