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