ô > PROGLST ô *PrList  ô Lists a BASIC program file (ô By J.G.Harston 2 ô (C) <*OSARGS=&FFDA:OSFIND=&FFCE:OSBGET=&FFD7 FOSASCI=&FFE3:OSBYTE=&FFF4 Pmcode%=&FFFF0900 Z ã P=0 ¸ 1 d P%=mcode% n [OPT P*3 x.handle:BRK ‚.num:.line_num:BRK:BRK Œ.subnum:BRK:BRK – .flag:BRK  .r_flag:BRK ª.quotes:BRK ´!\ Uses start of prog for vars ¾] È P%=mcode% Ò [OPT P*3 Ü .start æ'LDX &24B:CPX #&FF:BNE basic_present ð,BRK:OPT ¤s(½254+"BASIC not present"):BRK ú.basic_present 1LDA &F4:PHA:STX &F4:STX &FE30:\ Page in BASIC %LDY #0:LDA #1:LDX #&A8:JSR OSARGS 'LDX &A8:LDY &A9:LDA #&40:JSR OSFIND "CMP #0:BNE file_found ,)BRK:OPT ¤s(½214+"File not found"):BRK 6.file_found @STA handle:TAY J%JSR OSBGET:CMP #13:BEQ basic_file TLDA #0:JSR OSFIND ^+BRK:OPT ¤s(½254+"Not a BASIC file"):BRK h .addrs rOPT ¤w(&806D):\ BASIC 1 |OPT ¤w(&8071):\ BASIC 2 †OPT ¤w(&0000):\ ? OPT ¤w(&8071):\ HIBASIC š#OPT ¤w(&8456):\ BASIC 4, Master ¤ OPT ¤w(&8257):\ BASIC 4, Z80 ®.basic_file ¸LDA #5:LDX &8006:STX r_flag ÂBMI set_up2:LDA &8008 Ì .set_up2 Ö3ASL A:TAX:\ Find the address of the token table àLDA addrs,X:STA &AB êLDA addrs+1,X:STA &AC ô.line_loop þLDA #0:STA quotes JSR OSBGET:BCS end_of_file ;STA line_num+1:JSR OSBGET:BCS end_of_file:\ Line number !STA line_num:LDA #32:STA flag &JSR pr_line 0,JSR OSBGET:BCS end_of_file:\ Line length : .pr_loop DBIT &FF:BMI escape N)LDY handle:JSR OSBGET:BCS end_of_file XBIT quotes:BNE in_quotes bCMP #128:BCS do_token l.in_quotes vCMP #34:BNE not_a_quote €(LDA #255:‚ quotes:STA quotes:LDA #34 Š.not_a_quote ”JSR OSASCI žCMP #13:BNE pr_loop ¨BEQ line_loop ² .escape ¼.end_of_file ÆLDA #0:JSR OSFIND ÐPLA:STA &F4:STA &FE30:RTS Ú".do_token:CMP #141:BEQ do_tok2 äJSR pr_token îLDY handle:BNE pr_loop ø .do_tok2 -JSR OSBGET:BCS end_of_file:STA line_num+1  +JSR OSBGET:BCS end_of_file:STA line_num 4LDA line_num+1:ASL A:ASL A:PHA:€ #&C0:‚ line_num  /STA line_num:PLA:ASL A:ASL A:STA line_num+1 *JSR OSBGET:BCS end_of_file 4‚ line_num+1:STA line_num+1 >LDA #0:STA flag HJSR pr_line:JMP pr_loop R.pr_token:STA &A8 \#LDA &AB:STA &A9:LDA &AC:STA &AA f .loop1 p LDY #255 z .loop:INY „LDA (&A9),Y Ž BPL loop ˜CMP &A8:BEQ got_it ¢#INY:INY:TYA:CLC:ADC &A9:STA &A9 ¬$LDA #0:ADC &AA:STA &AA:JMP loop1 ¶ .got_it À INY:BIT r_flag:BMI pr_t_loop ÊLDY #0:.pr_t_loop ÔLDA (&A9),Y:BMI pr_t_end ÞBEQ pr_t_end è JSR OSASCI:INY:BNE pr_t_loop ò.pr_t_end:RTS ü .pr_line $\ General purpose 16 bit decimal \ printout routine. "\ num holds number. flag holds $ \ leading character, or zero .\ eg 32 = leading spaces 8\ eg 48 = leading zeros B"\ eg 0 = no leading characters LLDA #&27:STA subnum+1 VLDA #&10:STA subnum `JSR do_subtracts:\ 10000s jLDA #&3:STA subnum+1 tLDA #&E8:STA subnum ~JSR do_subtracts:\ 1000s ˆLDA #0:STA subnum+1 ’LDA #&64:STA subnum œJSR do_subtracts:\ 100s ¦LDA #&0A:STA subnum °JSR do_subtracts:\ 10s º"LDA num:„A #48:JMP OSASCI:\ 1s Ä.do_subtracts Î LDX #255 Ø .loop âINX ìSEC öLDA num:SBC subnum:STA num $LDA num+1:SBC subnum+1:STA num+1  BCS loop:CLC LDA num:ADC subnum:STA num $LDA num+1:ADC subnum+1:STA num+1 (TXA:BEQ zero 2„A #48:JSR OSASCI <LDA #48:STA flag F.zero_exit PRTS Z .zero dLDA flag:BEQ zero_exit nJMP OSASCI x]í ‚$ñ"*SAVE PrList ";~mcode%;" ";~P% Œà –!ݤs(A$):$P%=A$:P%=P%+©A$:=P*3  ݤw(A%):!P%=A%:P%=P%+2:=P*3 ÿ