diff --git a/Apple2/RPi.Command.asm b/Apple2/RPi.Command.asm new file mode 100644 index 0000000..e69d9bf --- /dev/null +++ b/Apple2/RPi.Command.asm @@ -0,0 +1,173 @@ + .ORG $300 +INBUF = $200 ;GETLN input buffer. +WAIT = $FCA8 ;Monitor wait routine. +BELL = $FF3A ;Monitor bell routine. +EXTRNCMD = $BE06 ;External cmd JMP vector. +XTRNADDR = $BE50 ;Ext cmd implementation addr. +XLEN = $BE52 ;length of command string-1. +XCNUM = $BE53 ;CI cmd no. (ext cmd - 0). +PBITS = $BE54 ;Command parameter bits. +XRETURN = $BE9E ;Known RTS instruction. +InputByte = $c0fe +OutputByte = $c0fd +InputFlags = $c0fb +OutputFlags = $c0f7 + +ReadBlockCommand = $01 +WriteBlockCommand = $02 +GetTimeCommand = $03 +ChangeDriveCommand = $04 +ExecCommand = $05 +LoadFileCommand = $06 +SaveFileCommand = $07 +MenuCommand = $08 + +InputString = $fd67 +PrintChar = $fded +Keyboard = $c000 +ClearKeyboard = $c010 +Wait = $fca8 + + ; + ; FIRST SAVE THE EXTERNAL COMMAND ADDRESS SO YOU WON'T + ; DISCONNECT ANY PREVIOUSLY CONNECTED COMMAND. + ; + LDA EXTRNCMD+1 + STA NXTCMD + LDA EXTRNCMD+2 + STA NXTCMD+1 + ; + LDA #RPI ; external command JMP + STA EXTRNCMD+2 ; vector. + RTS + ; + RPI: LDX #0 ;Check for our command. + NXTCHR: LDA INBUF,X ;Get first character. + ora #$20 ;Make it lower case + CMP CMD,X ;Does it match? + BNE NOTOURS ;No, back to CI. + INX ;Next character + CPX #CMDLEN ;All characters yet? + BNE NXTCHR ;No, read next one. + ; + LDA #CMDLEN-1 ;Our cmd! Put cmd length-1 + STA XLEN ; in CI global XLEN. + LDA #>XRETURN ;Point XTRNADDR to a known + STA XTRNADDR ; RTS since we'll handle + LDA #RPI ; external command JMP +000313 1 8D 08 BE STA EXTRNCMD+2 ; vector. +000316 1 60 RTS +000317 1 ; +000317 1 A2 00 RPI: LDX #0 ;Check for our command. +000319 1 BD 00 02 NXTCHR: LDA INBUF,X ;Get first character. +00031C 1 09 20 ora #$20 ;Make it lower case +00031E 1 DD DE 03 CMP CMD,X ;Does it match? +000321 1 D0 27 BNE NOTOURS ;No, back to CI. +000323 1 E8 INX ;Next character +000324 1 E0 03 CPX #CMDLEN ;All characters yet? +000326 1 D0 F1 BNE NXTCHR ;No, read next one. +000328 1 ; +000328 1 A9 02 LDA #CMDLEN-1 ;Our cmd! Put cmd length-1 +00032A 1 8D 52 BE STA XLEN ; in CI global XLEN. +00032D 1 A9 BE LDA #>XRETURN ;Point XTRNADDR to a known +00032F 1 8D 50 BE STA XTRNADDR ; RTS since we'll handle +000332 1 A9 9E LDA #