8-Bit Software Online Conversion

:0.S.Snip - Listing

10REM SNIP utility 20REM by M.Bobrowski 2'90 30: 40pptr=&A8:ptr=&70:lineno=&72:number= &74:osargs=&FFDA:osword=&FFF1 50: 60FOR pass=0 TO 3 STEP 3 70P%=&900 80[OPT pass 90.read`command 100LDA #1:LDX #pptr:LDY #0:JSR osargs 110LDA #5:LDX #pptr:LDY #0:JSR osword 120LDA pptr+4:CMP #13:BNE snip 130BRK:EQUB 128:EQUS "Syntax: *SNIP <l ineno>":BRK 140: 150.snip 160JSR read`param 170LDA &18:STA ptr+1:LDA #0:STA ptr 180JSR read`program 190CLC:LDA ptr:ADC #2:STA &12:STA &00 200LDA ptr+1:ADC #0:STA &13:STA &01 210RTS 220: 230.read`param 240LDA #0:STA number:STA number+1:TAY 250.getchar 260LDA (pptr),Y 270CMP #13:BEQ edn 280JSR mult`ten 290LDA (pptr),Y 300SEC:SBC #ASC"0" 310CMP #10:BCS badnum 320JSR inc`num 330CPY #6:BNE getchar 340BEQ toobig 350.edn 360LDA number+1:BMI toobig 370RTS 380: 390.badnum 400BRK:EQUB 255:EQUS"Bad number" 410.toobig 420BRK:EQUB 20:EQUS"Too big":BRK 430: 440.inc`num 450CLC:ADC number:STA number 460LDA number+1:ADC #0:STA number+1 470INY:RTS 480: 490.mult`ten 500JSR mult`two 510LDA number+1:PHA:LDA number:PHA 520JSR mult`two:JSR mult`two 530PLA:CLC:ADC number:STA number 540PLA:ADC number+1:STA number+1 550RTS 560: 570.mult`two 580ASL number:ROL number+1 590RTS 600: 610.read`program 620LDY #0:LDA (ptr),Y 630CMP #&0D:BNE badprog 640INY:LDA (ptr),Y:STA lineno+1 650CMP #&FF:BEQ notfound 660INY:LDA (ptr),Y:STA lineno 670½compare 680LDA lineno+1:CMP number+1:BCC getne xtline 690BNE set`endpointer 700LDA lineno:CMP number:BCC getnextli ne 710.set`endpointer 720LDA #&FF:DEY:STA (ptr),Y 730RTS 740: 750.getnextline 760INY:LDA (ptr),Y 770CLC:ADC ptr:STA ptr:BCC continue 780INC ptr+1 790.continue 800JMP read`program 810: 820.badprog 830BRK:EQUB 0:EQUS"Bad program" 840.notfound 850BRK:EQUB 41:EQUS"No such line":BRK 860] 870NEXT 880: 890PRINT'"To save object code press CO PY";:REPEAT UNTIL INKEY-106:PRINT 900OSCLI"SAVE SNIP 900 "+STR$÷P% 910END