2021-11-05 19:15:54 +00:00
|
|
|
ca65 V2.17 - Raspbian 2.17-1
|
|
|
|
Main file : Shell.asm
|
|
|
|
Current file: Shell.asm
|
|
|
|
|
|
|
|
000000r 1 ;ProDOS Zero Page
|
|
|
|
000000r 1 Command = $42 ;ProDOS Command
|
|
|
|
000000r 1 Unit = $43 ;ProDOS unit (SDDD0000)
|
|
|
|
000000r 1 BufferLo = $44
|
|
|
|
000000r 1 BufferHi = $45
|
|
|
|
000000r 1 BlockLo = $46
|
|
|
|
000000r 1 BlockHi = $47
|
|
|
|
000000r 1
|
|
|
|
000000r 1 ; ProDOS Error Codes
|
|
|
|
000000r 1 IOError = $27
|
|
|
|
000000r 1 NoDevice = $28
|
|
|
|
000000r 1 WriteProtect = $2B
|
|
|
|
000000r 1
|
|
|
|
000000r 1 ; hard code slot to 7 for now, will make it auto-detect later
|
|
|
|
000000r 1 SLOT = 7
|
|
|
|
000000r 1
|
|
|
|
000000r 1 InputByte = $c08e+SLOT*$10
|
|
|
|
000000r 1 OutputByte = $c08d+SLOT*$10
|
|
|
|
000000r 1 InputFlags = $c08b+SLOT*$10
|
|
|
|
000000r 1 OutputFlags = $c087+SLOT*$10
|
|
|
|
000000r 1
|
|
|
|
000000r 1 ReadBlockCommand = $01
|
|
|
|
000000r 1 WriteBlockCommand = $02
|
|
|
|
000000r 1 GetTimeCommand = $03
|
|
|
|
000000r 1 ChangeDriveCommand = $04
|
|
|
|
000000r 1 ExecCommand = $05
|
|
|
|
000000r 1 LoadFileCommand = $06
|
|
|
|
000000r 1 SaveFileCommand = $07
|
|
|
|
000000r 1 MenuCommand = $08
|
2021-11-21 19:56:13 +00:00
|
|
|
000000r 1 ShellCommand = $09
|
2021-11-05 19:15:54 +00:00
|
|
|
000000r 1
|
|
|
|
000000r 1 InputString = $fd6a
|
|
|
|
000000r 1 StringBuffer = $0200
|
|
|
|
000000r 1 PrintChar = $fded
|
|
|
|
000000r 1 Keyboard = $c000
|
|
|
|
000000r 1 ClearKeyboard = $c010
|
2021-11-11 02:44:28 +00:00
|
|
|
000000r 1 Home = $fc58
|
2021-11-05 19:15:54 +00:00
|
|
|
000000r 1 Wait = $fca8
|
|
|
|
000000r 1 PromptChar = $33
|
2021-11-25 23:45:56 +00:00
|
|
|
000000r 1 Read80Col = $c01f
|
|
|
|
000000r 1 TextPage1 = $c054
|
|
|
|
000000r 1 TextPage2 = $c055
|
|
|
|
000000r 1
|
2021-11-11 02:44:28 +00:00
|
|
|
000000r 1 htab = $24
|
|
|
|
000000r 1 vtab = $25
|
2021-11-25 23:45:56 +00:00
|
|
|
000000r 1 BasL = $28
|
|
|
|
000000r 1 htab80 = $057b
|
|
|
|
000000r 1 BasCalc = $fbc1
|
2021-11-05 19:15:54 +00:00
|
|
|
000000r 1
|
|
|
|
000000r 1 ESC = $9b
|
|
|
|
000000r 1
|
|
|
|
000000r 1 .org $2000
|
|
|
|
002000 1 Start:
|
2021-11-21 19:56:13 +00:00
|
|
|
002000 1 20 00 C3 jsr $c300 ; force 80 columns
|
|
|
|
002003 1 2C 10 C0 bit ClearKeyboard
|
|
|
|
002006 1 A9 09 lda #ShellCommand
|
2021-11-26 02:55:52 +00:00
|
|
|
002008 1 20 94 20 jsr SendByte
|
2021-11-21 19:56:13 +00:00
|
|
|
00200B 1 20 0F 20 jsr DumpOutput
|
|
|
|
00200E 1 60 rts
|
|
|
|
00200F 1
|
|
|
|
00200F 1 DumpOutput:
|
2021-11-26 02:55:52 +00:00
|
|
|
00200F 1 20 B2 20 jsr GetByte
|
2021-11-25 23:45:56 +00:00
|
|
|
002012 1 B0 2A bcs checkInput
|
2021-11-21 19:56:13 +00:00
|
|
|
002014 1 C9 00 cmp #$00
|
2021-11-25 23:45:56 +00:00
|
|
|
002016 1 F0 39 beq endOutput
|
|
|
|
002018 1 48 pha
|
2021-11-26 02:55:52 +00:00
|
|
|
002019 1 20 DB 20 jsr InvertChar
|
2021-11-25 23:45:56 +00:00
|
|
|
00201C 1 68 pla
|
|
|
|
00201D 1 C9 48 cmp #'H'
|
|
|
|
00201F 1 F0 3A beq setColumn
|
|
|
|
002021 1 C9 56 cmp #'V'
|
|
|
|
002023 1 F0 44 beq setRow
|
|
|
|
002025 1 C9 43 cmp #'C'
|
|
|
|
002027 1 F0 29 beq clearScreen
|
|
|
|
002029 1 C9 54 cmp #'T'
|
|
|
|
00202B 1 F0 4A beq setTop
|
|
|
|
00202D 1 C9 42 cmp #'B'
|
2021-11-26 02:55:52 +00:00
|
|
|
00202F 1 F0 4E beq setBottom
|
2021-11-25 23:45:56 +00:00
|
|
|
002031 1 C9 55 cmp #'U'
|
2021-11-26 02:55:52 +00:00
|
|
|
002033 1 F0 52 beq moveUp
|
2021-11-25 23:45:56 +00:00
|
|
|
002035 1 20 ED FD jsr PrintChar
|
2021-11-26 02:55:52 +00:00
|
|
|
002038 1 20 DB 20 jsr InvertChar
|
2021-11-25 23:45:56 +00:00
|
|
|
00203B 1 4C 0F 20 jmp DumpOutput
|
|
|
|
00203E 1 checkInput:
|
|
|
|
00203E 1 2C 00 C0 bit Keyboard ;check for keypress
|
|
|
|
002041 1 10 CC bpl DumpOutput ;keep dumping output if no keypress
|
|
|
|
002043 1 AD 00 C0 lda Keyboard ;send keypress to RPi
|
|
|
|
002046 1 29 7F and #$7f
|
2021-11-26 02:55:52 +00:00
|
|
|
002048 1 20 94 20 jsr SendByte
|
2021-11-25 23:45:56 +00:00
|
|
|
00204B 1 2C 10 C0 bit ClearKeyboard
|
|
|
|
00204E 1 4C 0F 20 jmp DumpOutput
|
|
|
|
002051 1 endOutput:
|
|
|
|
002051 1 60 rts
|
|
|
|
002052 1 clearScreen:
|
|
|
|
002052 1 20 58 FC jsr Home
|
2021-11-26 02:55:52 +00:00
|
|
|
002055 1 20 DB 20 jsr InvertChar
|
2021-11-25 23:45:56 +00:00
|
|
|
002058 1 4C 0F 20 jmp DumpOutput
|
|
|
|
00205B 1 setColumn:
|
2021-11-26 02:55:52 +00:00
|
|
|
00205B 1 20 B2 20 jsr GetByte
|
2021-11-25 23:45:56 +00:00
|
|
|
00205E 1 85 24 sta htab
|
|
|
|
002060 1 8D 7B 05 sta htab80
|
2021-11-26 02:55:52 +00:00
|
|
|
002063 1 20 DB 20 jsr InvertChar
|
2021-11-25 23:45:56 +00:00
|
|
|
002066 1 4C 0F 20 jmp DumpOutput
|
|
|
|
002069 1 setRow:
|
2021-11-26 02:55:52 +00:00
|
|
|
002069 1 20 B2 20 jsr GetByte
|
2021-11-25 23:45:56 +00:00
|
|
|
00206C 1 85 25 sta vtab
|
|
|
|
00206E 1 20 C1 FB jsr BasCalc
|
2021-11-26 02:55:52 +00:00
|
|
|
002071 1 20 DB 20 jsr InvertChar
|
2021-11-25 23:45:56 +00:00
|
|
|
002074 1 4C 0F 20 jmp DumpOutput
|
|
|
|
002077 1 setTop:
|
2021-11-26 02:55:52 +00:00
|
|
|
002077 1 20 B2 20 jsr GetByte
|
2021-11-25 23:45:56 +00:00
|
|
|
00207A 1 85 22 sta $22
|
2021-11-26 02:55:52 +00:00
|
|
|
00207C 1 4C 0F 20 jmp DumpOutput
|
|
|
|
00207F 1 setBottom:
|
|
|
|
00207F 1 20 B2 20 jsr GetByte
|
|
|
|
002082 1 85 23 sta $23
|
|
|
|
002084 1 4C 0F 20 jmp DumpOutput
|
|
|
|
002087 1 moveUp:
|
|
|
|
002087 1 C6 25 dec vtab
|
|
|
|
002089 1 A5 25 lda vtab
|
|
|
|
00208B 1 20 C1 FB jsr BasCalc
|
|
|
|
00208E 1 20 DB 20 jsr InvertChar
|
|
|
|
002091 1 4C 0F 20 jmp DumpOutput
|
|
|
|
002094 1
|
|
|
|
002094 1 SendByte:
|
|
|
|
002094 1 48 pha
|
|
|
|
002095 1 waitWrite:
|
|
|
|
002095 1 AD FB C0 lda InputFlags
|
|
|
|
002098 1 2A rol
|
|
|
|
002099 1 2A rol
|
|
|
|
00209A 1 B0 F9 bcs waitWrite
|
|
|
|
00209C 1 68 pla
|
|
|
|
00209D 1 8D FD C0 sta OutputByte
|
|
|
|
0020A0 1 A9 1E lda #$1e ; set bit 0 low to indicate write started
|
|
|
|
0020A2 1 8D F7 C0 sta OutputFlags
|
|
|
|
0020A5 1 finishWrite:
|
|
|
|
0020A5 1 AD FB C0 lda InputFlags
|
|
|
|
0020A8 1 2A rol
|
|
|
|
0020A9 1 2A rol
|
|
|
|
0020AA 1 90 F9 bcc finishWrite
|
|
|
|
0020AC 1 A9 1F lda #$1f
|
|
|
|
0020AE 1 8D F7 C0 sta OutputFlags
|
|
|
|
0020B1 1 60 rts
|
|
|
|
0020B2 1
|
|
|
|
0020B2 1 GetByte:
|
|
|
|
0020B2 1 A9 1D lda #$1d ;set read flag low
|
2021-11-25 23:45:56 +00:00
|
|
|
0020B4 1 8D F7 C0 sta OutputFlags
|
2021-11-26 02:55:52 +00:00
|
|
|
0020B7 1 waitRead:
|
|
|
|
0020B7 1 AD FB C0 lda InputFlags
|
|
|
|
0020BA 1 2A rol
|
|
|
|
0020BB 1 90 0C bcc readByte
|
|
|
|
0020BD 1 2C 00 C0 bit Keyboard ;keypress will abort waiting to read
|
|
|
|
0020C0 1 10 F5 bpl waitRead
|
|
|
|
0020C2 1 A9 1F lda #$1f ;set all flags high and exit
|
|
|
|
0020C4 1 8D F7 C0 sta OutputFlags
|
|
|
|
0020C7 1 38 sec ;failure
|
|
|
|
0020C8 1 60 rts
|
|
|
|
0020C9 1 readByte:
|
|
|
|
0020C9 1 AD FE C0 lda InputByte
|
|
|
|
0020CC 1 48 pha
|
|
|
|
0020CD 1 A9 1F lda #$1f ;set all flags high
|
|
|
|
0020CF 1 8D F7 C0 sta OutputFlags
|
|
|
|
0020D2 1 finishRead:
|
|
|
|
0020D2 1 AD FB C0 lda InputFlags
|
|
|
|
0020D5 1 2A rol
|
|
|
|
0020D6 1 90 FA bcc finishRead
|
|
|
|
0020D8 1 68 pla
|
|
|
|
0020D9 1 18 clc ;success
|
|
|
|
0020DA 1 end:
|
|
|
|
0020DA 1 60 rts
|
|
|
|
0020DB 1
|
|
|
|
0020DB 1 InvertChar:
|
|
|
|
0020DB 1 AD 7B 05 lda htab80 ;get horizontal location / 2
|
|
|
|
0020DE 1 4A lsr
|
|
|
|
0020DF 1 A8 tay
|
|
|
|
0020E0 1 AD 55 C0 lda TextPage2
|
|
|
|
0020E3 1 90 03 bcc invert
|
|
|
|
0020E5 1 AD 54 C0 lda TextPage1
|
|
|
|
0020E8 1 invert:
|
|
|
|
0020E8 1 B1 28 lda (BasL),y
|
|
|
|
0020EA 1 49 80 eor #$80
|
|
|
|
0020EC 1 91 28 sta (BasL),y
|
|
|
|
0020EE 1 AD 54 C0 lda TextPage1
|
|
|
|
0020F1 1 screen40:
|
|
|
|
0020F1 1 60 rts
|
|
|
|
0020F2 1
|
|
|
|
0020F2 1 HelpCommand:
|
|
|
|
0020F2 1 61 32 68 65 .byte "a2help",$00
|
|
|
|
0020F6 1 6C 70 00
|
|
|
|
0020F9 1 PromptCommand:
|
|
|
|
0020F9 1 61 32 70 72 .byte "a2prompt",$00
|
|
|
|
0020FD 1 6F 6D 70 74
|
|
|
|
002101 1 00
|
|
|
|
002102 1 OldPromptChar:
|
|
|
|
002102 1 5D .byte "]"
|
|
|
|
002103 1 DrawCursor:
|
|
|
|
002103 1 80 .byte $80
|
|
|
|
002103 1
|