> CommROM/s : OSWRCH=&FFEE:OSASCI=&FFE3 (OSNEWL=&FFE7:OSARGS=&FFDA 2: <mcode%=P+&3000:=mcode% FAddr=&A8:Temp=&AA PLineY=&AA:CommY=&AB Z Load=&AA:Exec=&AC:Length=&AE d: n P=0 1 xP%=&8000:O%=mcode% [OPT P*3+4 JMP Lang:JMP Serv !EQUB &82:EQUB copyright-&8000 EQUB 0:EQUS "COMMAND ROM" $EQUB 0:EQUS "0.01 (28 Dec 1992)" .copyright EQUB 0:EQUS "(C)J.G.Harston" EQUB 0 EQUS &8040-P%,0) JMP InitAddr JMP NextAddr JMP SkipToCR JMP pr_name  .Lang RTS : " .Serv ,TAX:LDA &A8:PHA:STX &A8 6LDX #1:.ServLp @LDA &A8,X:PHA:INX:CPX #8 JBNE ServLp TLDX &A8:JSR TryServ ^STX &A8:LDX #7:.ServLp2 h!PLA:STA &A8,X:DEX:BNE ServLp2 rLDX &A8:PLA:STA &A8 |TXA:LDX &F4:RTS :  .TryServ CPX #4:BEQ Serv4 CPX #6:BEQ Serv6 CPX #9:BEQ Serv9 RTS : .Serv9:JMP serv9 :  .Serv6 JSR RestoreArgs:LDX #6:RTS :  .Serv4 TYA:PHA:STA LineY JSR InitAddr:STY CommY  .Serv4Lp2 &#LDY LineY:LDA (&F2),Y:CMP #"." 0BEQ Serv4Dot :! #&DF:LDY CommY:CMP (Addr),Y DBNE Serv4NotFound NINC LineY:INY:STY CommY XLDA (Addr),Y:CMP #"!" bBCS Serv4Lp2:BCC Serv4Found l.Serv4NotFound vJSR SkipToCR:JSR NextAddr PLA:PHA:STA LineY LDA (Addr),Y:BNE Serv4Lp2 !PLA:TAY:LDX #4:RTS:\ No match  .Serv4Dot INC LineY:LDY CommY .Serv4Found "PLA:JSR SkipToCR:LDA LineY:PHA LDX #0:.Serv4Lp3 LDA (Addr),Y:STA Load,X INY:INX:CPX #6:BNE Serv4Lp3 TYA:CLC:ADC Addr:STA Addr  LDA Addr+1:ADC #0:STA Addr+1 \ Addr= source \ Load= dest  \ Exec= exec \ Length=len  $LDY #0:LDA Length+1:BEQ Serv4Lp6 * .Serv4Lp5 4LDA (Addr),Y:STA (Load),Y >INY:BNE Serv4Lp5 HINC Addr+1:INC Load+1 RDEC Length+1:BNE Serv4Lp5 \ .Serv4Lp6 fLDA (Addr),Y:STA (Load),Y pINY:CPY Length:BNE Serv4Lp6 zPLA:TAY:.SkipSpaces LDA (&F2),Y:INY:CMP #" " BEQ SkipSpaces:DEY TYA:CLC:ADC &F2:STA Addr LDA #0:ADC &F3:STA Addr+1 \ Addr=> parameters LDA &DBD:PHA:LDA &DBE:PHA "LDA &DBF:PHA:\ Save old ARGSXV  LDA #new_args 255:STA &DBD  LDA #new_args 256:STA &DBE LDA &F4:STA &DBF TSX:TXA:LDX &F4:STA &DF0,X  JSR CallExec:JSR RestoreArgs PLA:PLA:PLA:\ Clear stack LDX #0:RTS :  .new_args $JSR RestoreArgs .CMP #1:BNE DoOldArgs 8CPY #0:BNE DoOldArgs B\ Read command pointer LLDA Addr:PHA:LDA Addr+1 VSTA 1,X:PLA:STA 0,X `LDA #&FF:STA 2,X:STA 3,X jRTS t.DoOldArgs ~JMP OSARGS : .RestoreArgs !LDA &DBF:CMP &F4:BNE ArgsDone LDX &F4:LDA &DF0,X:TAX LDA &101,X:STA &DBF LDA &102,X:STA &DBE LDA &103,X:STA &DBD  .ArgsDone RTS :  .CallExec JMP (Exec) :  .SkipToCR LDA (Addr),Y:INY:CMP #13 BNE SkipToCR (RTS 2: < .pr_name FJSR OSNEWL:LDX #0 P.pr_name_lp ZLDA &8009,X:BEQ pr_name_end d!JSR OSWRCH:INX:BNE pr_name_lp n.pr_name_end xJMP OSNEWL :  .serv9 TYA:PHA:JSR pr_name LDX #0:.HelpLp0 $LDA &8009,X:CMP #" ":BEQ HelpOk LDA (&F2),Y:CMP #"." BEQ HelpOk # #&DF:CMP &8009,X:BNE HelpExit INX:INY:BNE HelpLp0  .HelpOk JSR InitAddr  .HelpLp3 !LDA #32:JSR OSWRCH:JSR OSWRCH  .HelpLp4 LDA (Addr),Y:JSR OSASCI INY:CMP #13:BNE HelpLp4 "JSR NextAddr ,LDA (Addr),Y:BNE HelpLp3 6!PLA:TAY:LDA (&F2),Y:CMP #"." @BEQ HelpExit2 JLDX #0:RTS T .HelpExit ^ PLA:TAY h.HelpExit2 rLDX #9:RTS |:  .InitAddr !LDA #DataStart &FF:STA Addr #LDA #DataStart 256:STA Addr+1 LDY #0:RTS :  .NextAddr INY:INY:INY:INY LDA (Addr),Y:STA Temp:INY LDA (Addr),Y:STA Temp+1 "LDA Addr:CLC:ADC Temp:STA Addr $LDA Addr+1:ADC Temp+1:STA Addr+1 !INY:TYA:CLC:ADC Addr:STA Addr  LDA Addr+1:ADC #0:STA Addr+1 LDY #0:RTS : .DataStart &EQUS "TEST":EQUB 13 0 EQUW &900:EQUW &900:EQUW &14 :$LDX #&A8:LDY #0:LDA #1:JSR &FFDA D.LP NLDA (&A8),Y:JSR &FFE3:INY XCMP #13:BNE LP:RTS b: lBRK:\ End marker v$EQUB 13:EQUW 0:EQUW 0:EQUW 0:BRK ] :"*SAVE CommROM ";~mcode%;" ";~O%;" FFFF0000 FFFBBC00"