8-Bit Software Online Conversion

Basic program reader - Listing

10REM LISTBAS - Listing of all BASIC 20REM lines without use of Basic ROM 30REM by M.Bobrowski 9'92 Vers. 2.6 40: 50MODE 131 60page=&18:oswrch=&FFEE:osnewl=&FFE7: osbyte=&FFF4 70ptr=&70:lineno=&72:length=&74:flag= &75:num=&76 80tempy=&78:token=&79:taddr=&7A 90: 100PROCassemble 105OSCLI"K.0CALL&900|M":PRINT"Press f0 to read the program in memory":REM THIS LINE ADDED BY CJR 110END 120: 130DEF PROCassemble 140FOR pass=0 TO 2 STEP 2 150P%=&900 160[OPT pass 170PHP:LDA #14:JSR oswrch 180LDA page:STA ptr+1:LDA #0:STA ptr 190: 200.main`loop 210LDY #1:LDA (ptr),Y 220CMP #&FF:BNE notlast 230PLP:RTS 240: 250.notlast 260STA lineno+1 270INY:LDA (ptr),Y:STA lineno 280INY:LDA (ptr),Y:STA length 290LDA &FF:ROL A:BCC noesc 300LDA #&7E:JSR osbyte 310BRK:EQUB 17:EQUS "Escape":BRK 320: 330.noesc 340JSR display`lineno 350LDY #4 360: 370.lineloop 380CPY length:BEQ nextline 390LDA (ptr),Y:INY 400CMP #&F4:BEQ rem`or`data 410CMP #&22:BEQ quote 420CMP #&DC:BEQ rem`or`data 430CMP #&8D:BEQ goto 440JSR ptoken 450JMP lineloop 460: 470.rem`or`data 480JSR ptoken:JMP read`to`eol 490: 500.quote 510JSR copy`char:JMP read`to`next`quot e 520: 530.goto 540LDA (ptr),Y 550ASL A:ASL A:TAX:AND #&C0 560INY:EOR (ptr),Y:STA num 570TXA:ASL A:ASL A 580INY:EOR (ptr),Y:STA num+1 590INY:LDA #0:STA flag:JSR pnum 600JMP lineloop 610: 620.read`to`eol 630LDA (ptr),Y:INY:CMP #13:BEQ nextlin e 640JSR pchar:JMP read`to`eol 650: 660.nextline 670CLC:LDA ptr:ADC length:STA ptr 680BCC nlnc:INC ptr+1 690.nlnc JSR osnewl 700JMP main`loop 710: 720.read`to`next`quote 730LDA (ptr),Y:INY:CMP #34:BEQ rest`of `line 740CMP #13:BEQ nextline 750JSR pchar:JMP read`to`next`quote 760.rest`of`line:JSR copy`char 770JMP lineloop 780: 790.pchar 800CMP #32:BCS pchar2:LDA #46 810.pchar2:JMP copy`char 820: 830.display`lineno 840LDA #&FF:STA flag:LDA lineno:STA nu m 850LDA lineno+1:STA num+1 860: 870.pnum 880LDA num:CMP #&10:LDA num+1:SBC #&27 :BCS pdec:JSR spc 890LDA num:CMP #&E8:LDA num+1:SBC #&3: BCS pdec:JSR spc 900.byte 910LDA num+1:BNE pdec 920LDA num:CMP #100:BCS pdec:JSR spc 930.tens 940LDA num:CMP #10:BCS pdec:JSR spc 950.pdec 960TYA:PHA:TXA:PHA 970LDX #0 980.digit 990LDY #16:LDA #0 1000.tendiv 1010ASL num:ROL num+1:ROL A 1020CMP #10:BCC less 1030SBC #10:INC num 1040.less 1050DEY:BNE tendiv 1060CLC:ADC #&30:PHA:INX 1070LDA num:ORA num+1:BNE digit 1080.display 1090PLA:JSR oswrch 1100DEX:BNE display 1110PLA:TAX:PLA:TAY 1120RTS 1130: 1140.spc:LDX flag:BEQ nospace 1150PHA:LDA #32:JSR oswrch 1160PLA:.nospace:RTS 1170: 1180.ptoken 1190CMP #&80:BCC copy`char 1200STA token:STY tempy 1210LDA #token`tab MOD 256:STA taddr 1220LDA #token`tab DIV 256:STA taddr+1 1230.find`token:LDY #0 1240.find`token`loop:LDA (taddr),Y:CMP token 1250BEQ read`token 1260INC taddr:BNE find`token`loop 1270INC taddr+1 1280JMP find`token`loop 1290.read`token 1300INY 1310.read`token`loop 1320LDA (taddr),Y:BMI end`of`read 1330JSR oswrch:INY:BNE read`token`loop 1340.end`of`read 1350LDY tempy:RTS 1360.copy`char 1370PHP:JSR oswrch 1380PLP:RTS 1390: 1400.token`tab 1410]:NEXT 1420: 1430I%=0:REPEAT 1440READ A$:$P%=CHR$(&80+I%)+A$:P%=P%+L ENA$+1 1450I%=I%+1:UNTIL I%=128:!P%=&FF:P%=P%+ 1 1460ENDPROC 1470: 1480DATA AND,DIV,EOR,MOD,OR,ERROR,LINE, OFF,STEP,SPC,TAB(,ELSE,THEN,,OPENIN,PTR, PAGE,TIME,LOMEM,HIMEM,ABS,ACS,ADVAL,ASC, ASN,ATN,BGET,COS,COUNT,DEG,ERL,ERR,EVAL, EXP,EXT,FALSE,FN,GET,INKEY,INSTR(,INT,LE N,LN,LOG,NOT,OPENUP,OPENOUT,PI,POINT( 1490DATA POS,RAD,RND,SGN,SIN,SQR,TAN,TO ,TRUE,USR,VAL,VPOS,CHR$,GET$,INKEY$,LEFT $(,MID$(,RIGHT$,STR$,STRING$(,EOF,AUTO,D ELETE,LOAD,LIST,NEW,OLD,RENUMBER,SAVE,ED IT,PTR,PAGE,TIME,LOMEM,HIMEM,SOUND,BPUT, CALL,CHAIN,CLEAR,CLOSE,CLG,CLS,DATA,DEF 1500DATA DIM,DRAW,END,ENDPROC,ENVELOPE, FOR,GOSUB,GOTO,GCOL,IF,INPUT,LET,LOCAL,M ODE,MOVE,NEXT,ON,VDU,PLOT,PRINT,PROC,REA D,REM,REPEAT,REPORT,RESTORE,RETURN,RUN,S TOP,COLOUR,TRACE,UNTIL,WIDTH,OSCLI