Fix Pico build

This commit is contained in:
Terence Boldt 2024-03-20 10:48:11 -04:00
parent 3441a73d9d
commit de156de730
16 changed files with 26 additions and 1415 deletions

12
.gitignore vendored
View File

@ -1,7 +1,19 @@
*-bak
*.o
*.DS_Store
*.bin
*.lst
RaspberryPi/apple2driver/apple2driver
RaspberryPi/Apple2-IO-RPi.log
RaspberryPiPico/build/
Hardware/Apple2IORPi-backups/
RaspberryPiPico/Apple2-IO-RPi.*
RaspberryPiPico/CMakeCache.txt
RaspberryPiPico/CMakeFiles/
RaspberryPiPico/Makefile
RaspberryPiPico/_deps/
RaspberryPiPico/cmake_install.cmake
RaspberryPiPico/elf2uf2/
RaspberryPiPico/generated/
RaspberryPiPico/pico-sdk/
RaspberryPiPico/pioasm/

View File

@ -1,195 +0,0 @@
ca65 V2.18 - Debian 2.19-1
Main file : CommandFirmware.asm
Current file: CommandFirmware.asm
000000r 1 ; Copyright Terence J. Boldt (c)2020-2024
000000r 1 ; Use of this source code is governed by an MIT
000000r 1 ; license that can be found in the LICENSE file.
000000r 1
000000r 1 ; This file contains the source for the firmware
000000r 1 ; that was formerly used to act as a pseudo-shell
000000r 1
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 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
000000r 1
000000r 1 InputString = $fd67
000000r 1 PrintChar = $fded
000000r 1 Keyboard = $c000
000000r 1 ClearKeyboard = $c010
000000r 1 Wait = $fca8
000000r 1
000000r 1 .org SLOT*$100 + $C000
00C700 1 ;ID bytes for booting and drive detection
00C700 1 E0 20 cpx #$20 ;ID bytes for ProDOS and the
00C702 1 E0 00 cpx #$00 ; Apple Autostart ROM
00C704 1 E0 03 cpx #$03 ;
00C706 1
00C706 1 A2 70 ldx #SLOT*$10
00C708 1 86 2B stx $2b
00C70A 1 86 43 stx Unit
00C70C 1
00C70C 1 ;force EPROM to second page on boot
00C70C 1 A9 3F lda #$3f ;set all flags high and page 3 of EPROM for menu
00C70E 1 PageJump:
00C70E 1 8D F7 C0 sta OutputFlags
00C711 1 4C 19 C7 jmp Start ;this jump is only called if coming in from PageJump with A=$2f
00C714 1
00C714 1 ;entry points for ProDOS
00C714 1 DriverEntry:
00C714 1 A9 0F lda #$0f ;set all flags high and page 0 of EPROM
00C716 1 8D F7 C0 sta OutputFlags
00C719 1
00C719 1 Start:
00C719 1 20 00 C3 jsr $c300 ;enable 80 columns
00C71C 1 A9 05 lda #$05 ;execute command
00C71E 1 20 95 C7 jsr SendByte
00C721 1 A0 00 ldy #$00
00C723 1 sendHelp:
00C723 1 B9 8E C7 lda HelpCommand,y
00C726 1 F0 06 beq endSendHelp
00C728 1 20 95 C7 jsr SendByte
00C72B 1 C8 iny
00C72C 1 D0 F5 bne sendHelp
00C72E 1 endSendHelp:
00C72E 1 A9 00 lda #$00
00C730 1 20 95 C7 jsr SendByte
00C733 1 20 6B C7 jsr DumpOutput
00C736 1
00C736 1 A5 33 lda $33
00C738 1 48 pha
00C739 1 A9 A4 lda #$a4
00C73B 1 85 33 sta $33
00C73D 1 GetCommand:
00C73D 1 20 67 FD jsr InputString
00C740 1 AD 00 02 lda $0200
00C743 1 C9 8D cmp #$8d ;skip when return found
00C745 1 F0 F6 beq GetCommand
00C747 1 20 4D C7 jsr SendCommand
00C74A 1 18 clc
00C74B 1 90 F0 bcc GetCommand
00C74D 1
00C74D 1 SendCommand:
00C74D 1 2C 10 C0 bit ClearKeyboard
00C750 1 A9 05 lda #$05 ;send command 5 = exec
00C752 1 20 95 C7 jsr SendByte
00C755 1 A0 00 ldy #$00
00C757 1 getInput:
00C757 1 B9 00 02 lda $0200,y
00C75A 1 C9 8D cmp #$8d
00C75C 1 F0 08 beq sendNullTerminator
00C75E 1 29 7F and #$7f
00C760 1 20 95 C7 jsr SendByte
00C763 1 C8 iny
00C764 1 D0 F1 bne getInput
00C766 1 sendNullTerminator:
00C766 1 A9 00 lda #$00
00C768 1 20 95 C7 jsr SendByte
00C76B 1 DumpOutput:
00C76B 1 20 AD C7 jsr GetByte
00C76E 1 B0 07 bcs skipOutput
00C770 1 C9 00 cmp #$00
00C772 1 F0 19 beq endOutput
00C774 1 20 ED FD jsr PrintChar
00C777 1 skipOutput:
00C777 1 2C 00 C0 bit Keyboard ;check for keypress
00C77A 1 10 EF bpl DumpOutput ;keep dumping output if no keypress
00C77C 1 AD 00 C0 lda Keyboard ;send keypress to RPi
00C77F 1 20 ED FD jsr PrintChar
00C782 1 29 7F and #$7f
00C784 1 20 95 C7 jsr SendByte
00C787 1 2C 10 C0 bit ClearKeyboard
00C78A 1 18 clc
00C78B 1 90 DE bcc DumpOutput
00C78D 1 endOutput:
00C78D 1 60 rts
00C78E 1
00C78E 1 HelpCommand:
00C78E 1 61 32 68 65 .byte "a2help",$00
00C792 1 6C 70 00
00C795 1
00C795 1 SendByte:
00C795 1 2C FB C0 bit InputFlags
00C798 1 70 FB bvs SendByte
00C79A 1 8D FD C0 sta OutputByte
00C79D 1 .if HW_TYPE = 0
00C79D 1 A9 1E lda #$1e ; set bit 0 low to indicate write started
00C79F 1 8D F7 C0 sta OutputFlags
00C7A2 1 finishWrite:
00C7A2 1 2C FB C0 bit InputFlags
00C7A5 1 50 FB bvc finishWrite
00C7A7 1 A9 1F lda #$1f
00C7A9 1 8D F7 C0 sta OutputFlags
00C7AC 1 .endif
00C7AC 1 60 rts
00C7AD 1
00C7AD 1 GetByte:
00C7AD 1 .if HW_TYPE = 0
00C7AD 1 A2 1D ldx #$1d ;set read flag low
00C7AF 1 8E F7 C0 stx OutputFlags
00C7B2 1 .endif
00C7B2 1 waitRead:
00C7B2 1 2C FB C0 bit InputFlags
00C7B5 1 10 0C bpl readByte
00C7B7 1 2C 00 C0 bit Keyboard ;keypress will abort waiting to read
00C7BA 1 10 F6 bpl waitRead
00C7BC 1 .if HW_TYPE = 0
00C7BC 1 A9 1F lda #$1f ;set all flags high and exit
00C7BE 1 8D F7 C0 sta OutputFlags
00C7C1 1 .endif
00C7C1 1 38 sec ;failure
00C7C2 1 60 rts
00C7C3 1 readByte:
00C7C3 1 AD FE C0 lda InputByte
00C7C6 1 .if HW_TYPE = 0
00C7C6 1 A2 1F ldx #$1f ;set all flags high
00C7C8 1 8E F7 C0 stx OutputFlags
00C7CB 1 finishRead:
00C7CB 1 2C FB C0 bit InputFlags
00C7CE 1 10 FB bpl finishRead
00C7D0 1 .endif
00C7D0 1 18 clc ;success
00C7D1 1 end:
00C7D1 1 60 rts
00C7D2 1
00C7D2 1 00 00 00 00 .repeat 251-<end
00C7D6 1 00 00 00 00
00C7DA 1 00 00 00 00
00C7DE 1 00 00 00 00
00C7E2 1 00 00 00 00
00C7E6 1 00 00 00 00
00C7EA 1 00 00 00 00
00C7EE 1 00 00 00 00
00C7F2 1 00 00 00 00
00C7F6 1 00 00 00 00
00C7FA 1 00 00
00C7FC 1 .byte 0
00C7FC 1 .endrepeat
00C7FC 1
00C7FC 1 00 00 .byte 0,0 ;0000 blocks = check status
00C7FE 1 07 .byte 7 ;bit set(0=status 1=read 2=write) unset(3=format, 4/5=number of volumes, 6=interruptable, 7=removable)
00C7FF 1 14 .byte DriverEntry&$00FF ;low byte of entry
00C7FF 1

View File

@ -1,213 +0,0 @@
ca65 V2.18 - Debian 2.19-1
Main file : DriveFirmware.asm
Current file: DriveFirmware.asm
000000r 1 ; Copyright Terence J. Boldt (c)2020-2024
000000r 1 ; Use of this source code is governed by an MIT
000000r 1 ; license that can be found in the LICENSE file.
000000r 1
000000r 1 ; This file contains the source for the firmware
000000r 1 ; that allows the Apple II to boot from the card
000000r 1 ; and for ProDOS to recognize the card as two
000000r 1 ; hard drivers
000000r 1
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 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
000000r 1
000000r 1 .org SLOT*$100 + $C000
00C700 1 ;ID bytes for booting and drive detection
00C700 1 E0 20 cpx #$20 ;ID bytes for ProDOS and the
00C702 1 E0 00 cpx #$00 ; Apple Autostart ROM
00C704 1 E0 03 cpx #$03 ;
00C706 1
00C706 1 A2 70 ldx #SLOT*$10
00C708 1 86 2B stx $2b
00C70A 1 86 43 stx Unit
00C70C 1
00C70C 1 ;force EPROM to second page on boot
00C70C 1 A9 3F lda #$3f ;set all flags high and page 3 of EPROM for menu
00C70E 1 PageJump:
00C70E 1 8D F7 C0 sta OutputFlags
00C711 1 4C 1C C7 jmp Start ;this jump is only called if coming in from PageJump with A=$0f
00C714 1
00C714 1 ;entry points for ProDOS
00C714 1 DriverEntry:
00C714 1 A9 0F lda #$0f ;set all flags high and page 0 of EPROM
00C716 1 8D F7 C0 sta OutputFlags
00C719 1 4C 32 C7 jmp Driver
00C71C 1
00C71C 1 ;load first two blocks and execute to boot
00C71C 1 Start:
00C71C 1 A9 01 lda #$01 ;set read command
00C71E 1 85 42 sta Command
00C720 1
00C720 1 A9 00 lda #$00 ;block 0
00C722 1 85 46 sta BlockLo
00C724 1 85 47 sta BlockHi
00C726 1 85 44 sta BufferLo ;buffer at $800
00C728 1 A9 08 lda #$08
00C72A 1 85 45 sta BufferHi
00C72C 1 20 32 C7 jsr Driver ;get the block
00C72F 1
00C72F 1 4C 01 08 jmp $801 ;execute the block
00C732 1
00C732 1 ; ProDOS Driver code
00C732 1 ; First check that this is the right drive
00C732 1 Driver:
00C732 1 A6 43 ldx Unit
00C734 1 A5 42 lda Command; Check which command is being requested
00C736 1 F0 0C beq GetStatus ;0 = Status command
00C738 1 C9 01 cmp #ReadBlockCommand
00C73A 1 F0 10 beq ReadBlockAndSetTime
00C73C 1 C9 02 cmp #WriteBlockCommand
00C73E 1 F0 54 beq WriteBlock
00C740 1 38 sec ;set carry as we don't support any other commands
00C741 1 A9 53 lda #$53 ;Invalid parameter error
00C743 1 60 rts
00C744 1
00C744 1 ; ProDOS Status Command Handler
00C744 1 GetStatus:
00C744 1 A2 FF ldx #$ff ;low byte number of blocks
00C746 1 A0 FF ldy #$ff ;high byte number of blocks
00C748 1 A9 00 lda #$0 ;zero accumulator and clear carry for success
00C74A 1 18 clc
00C74B 1 60 rts
00C74C 1
00C74C 1 ; ProDOS Read Block Command
00C74C 1 ReadBlockAndSetTime:
00C74C 1 A5 47 lda BlockHi ; only get the time if block 0002
00C74E 1 D0 18 bne readBlock
00C750 1 A5 46 lda BlockLo
00C752 1 C9 02 cmp #$02
00C754 1 D0 12 bne readBlock
00C756 1 A0 00 ldy #$00 ;Get the current time on each block read for now
00C758 1 A9 03 lda #GetTimeCommand
00C75A 1 20 C0 C7 jsr SendByte
00C75D 1 getTimeByte:
00C75D 1 20 D8 C7 jsr GetByte
00C760 1 99 90 BF sta $bf90,y
00C763 1 C8 iny
00C764 1 C0 04 cpy #$04
00C766 1 D0 F5 bne getTimeByte
00C768 1 readBlock:
00C768 1 A9 01 lda #ReadBlockCommand ;read the block after setting the clock
00C76A 1 20 C0 C7 jsr SendByte
00C76D 1 A5 46 lda BlockLo
00C76F 1 20 C0 C7 jsr SendByte
00C772 1 A5 47 lda BlockHi
00C774 1 20 C0 C7 jsr SendByte
00C777 1 8A txa
00C778 1 20 C0 C7 jsr SendByte
00C77B 1 A0 00 ldy #$0
00C77D 1 20 8B C7 jsr read256
00C780 1 E6 45 inc BufferHi
00C782 1 20 8B C7 jsr read256
00C785 1 C6 45 dec BufferHi
00C787 1 A9 00 lda #$0 ;zero accumulator and clear carry for success
00C789 1 18 clc
00C78A 1 60 rts
00C78B 1
00C78B 1 read256:
00C78B 1 20 D8 C7 jsr GetByte
00C78E 1 91 44 sta (BufferLo),y
00C790 1 C8 iny
00C791 1 D0 F8 bne read256
00C793 1 60 rts
00C794 1
00C794 1 ; ProDOS Write Block Command
00C794 1 WriteBlock:
00C794 1 A9 02 lda #WriteBlockCommand
00C796 1 20 C0 C7 jsr SendByte
00C799 1 A5 46 lda BlockLo
00C79B 1 20 C0 C7 jsr SendByte
00C79E 1 A5 47 lda BlockHi
00C7A0 1 20 C0 C7 jsr SendByte
00C7A3 1 8A txa
00C7A4 1 20 C0 C7 jsr SendByte
00C7A7 1 A0 00 ldy #$0
00C7A9 1 20 B7 C7 jsr write256
00C7AC 1 E6 45 inc BufferHi
00C7AE 1 20 B7 C7 jsr write256
00C7B1 1 C6 45 dec BufferHi
00C7B3 1 A9 00 lda #$0 ;zero accumulator and clear carry for success
00C7B5 1 18 clc
00C7B6 1 60 rts
00C7B7 1
00C7B7 1 write256:
00C7B7 1 B1 44 lda (BufferLo),y
00C7B9 1 20 C0 C7 jsr SendByte
00C7BC 1 C8 iny
00C7BD 1 D0 F8 bne write256
00C7BF 1 60 rts
00C7C0 1
00C7C0 1 SendByte:
00C7C0 1 2C FB C0 bit InputFlags
00C7C3 1 70 FB bvs SendByte
00C7C5 1 8D FD C0 sta OutputByte
00C7C8 1 .if HW_TYPE = 0
00C7C8 1 A9 0E lda #$0e ; set bit 0 low to indicate write started
00C7CA 1 8D F7 C0 sta OutputFlags
00C7CD 1 finishWrite:
00C7CD 1 2C FB C0 bit InputFlags
00C7D0 1 50 FB bvc finishWrite
00C7D2 1 A9 0F lda #$0f
00C7D4 1 8D F7 C0 sta OutputFlags
00C7D7 1 .endif
00C7D7 1 60 rts
00C7D8 1
00C7D8 1 GetByte:
00C7D8 1 .if HW_TYPE = 0
00C7D8 1 A9 0D lda #$0d ;set read flag low
00C7DA 1 8D F7 C0 sta OutputFlags
00C7DD 1 .endif
00C7DD 1 waitRead:
00C7DD 1 2C FB C0 bit InputFlags
00C7E0 1 30 FB bmi waitRead
00C7E2 1 AD FE C0 lda InputByte
00C7E5 1 .if HW_TYPE = 0
00C7E5 1 48 pha
00C7E6 1 A9 0F lda #$0f ;set all flags high
00C7E8 1 8D F7 C0 sta OutputFlags
00C7EB 1 finishRead:
00C7EB 1 2C FB C0 bit InputFlags
00C7EE 1 10 FB bpl finishRead
00C7F0 1 68 pla
00C7F1 1 .endif
00C7F1 1 end:
00C7F1 1 60 rts
00C7F2 1
00C7F2 1 00 00 00 00 .repeat 251-<end
00C7F6 1 00 00 00 00
00C7FA 1 00 00
00C7FC 1 .byte 0
00C7FC 1 .endrepeat
00C7FC 1
00C7FC 1 00 00 .byte 0,0 ;0000 blocks = check status
00C7FE 1 17 .byte 23 ;bit set(0=status 1=read 2=write) unset(3=format, 4/5=number of volumes, 6=interruptable, 7=removable)
00C7FF 1 14 .byte DriverEntry&$00FF ;low byte of entry
00C800 1
00C800 1

View File

@ -1,183 +0,0 @@
ca65 V2.18 - Debian 2.19-1
Main file : FileAccessFirmware.asm
Current file: FileAccessFirmware.asm
000000r 1 ; Copyright Terence J. Boldt (c)2020-2024
000000r 1 ; Use of this source code is governed by an MIT
000000r 1 ; license that can be found in the LICENSE file.
000000r 1
000000r 1 ; This file contains the source for the firmware
000000r 1 ; that was formerly used to copy files from RPi
000000r 1 ; to Apple II RAM
000000r 1
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 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
000000r 1
000000r 1 InputString = $fd67
000000r 1 Monitor = $ff59
000000r 1
000000r 1 .org SLOT*$100 + $C000
00C700 1 ;ID bytes for booting and drive detection
00C700 1 E0 20 cpx #$20 ;ID bytes for ProDOS and the
00C702 1 E0 00 cpx #$00 ; Apple Autostart ROM
00C704 1 E0 03 cpx #$03 ;
00C706 1
00C706 1 A2 70 ldx #SLOT*$10
00C708 1 86 2B stx $2b
00C70A 1 86 43 stx Unit
00C70C 1
00C70C 1 ;force EPROM to second page on boot
00C70C 1 A9 3F lda #$3f ;set all flags high and page 3 of EPROM for menu
00C70E 1 PageJump:
00C70E 1 8D F7 C0 sta OutputFlags
00C711 1 4C 19 C7 jmp Start ;this jump is only called if coming in from PageJump with A=$2f
00C714 1
00C714 1 ;entry points for ProDOS
00C714 1 DriverEntry:
00C714 1 A9 0F lda #$0f ;set all flags high and page 0 of EPROM
00C716 1 8D F7 C0 sta OutputFlags
00C719 1
00C719 1 Start:
00C719 1 A9 A4 lda #$a4
00C71B 1 85 33 sta $33
00C71D 1
00C71D 1 GetFilename:
00C71D 1 20 67 FD jsr InputString
00C720 1
00C720 1 LoadFile:
00C720 1 A9 00 lda #$00
00C722 1 85 44 sta BufferLo
00C724 1 A9 20 lda #$20
00C726 1 85 45 sta BufferHi
00C728 1 A9 06 lda #$06 ; send command 6 = load
00C72A 1 20 74 C7 jsr SendByte
00C72D 1 A0 00 ldy #$00
00C72F 1 sendFilename:
00C72F 1 B9 00 02 lda $0200,y
00C732 1 C9 8D cmp #$8d
00C734 1 F0 08 beq sendNullTerminator
00C736 1 29 7F and #$7f
00C738 1 20 74 C7 jsr SendByte
00C73B 1 C8 iny
00C73C 1 D0 F1 bne sendFilename
00C73E 1 sendNullTerminator:
00C73E 1 A9 00 lda #$00
00C740 1 20 74 C7 jsr SendByte
00C743 1
00C743 1 20 8C C7 jsr GetByte
00C746 1 85 46 sta BlockLo ; not really a block, just using the memory space
00C748 1 20 8C C7 jsr GetByte
00C74B 1 85 47 sta BlockHi
00C74D 1 NextPage:
00C74D 1 A5 47 lda BlockHi
00C74F 1 F0 10 beq ReadFinalPage
00C751 1 A0 00 ldy #$00
00C753 1 NextByte:
00C753 1 20 8C C7 jsr GetByte
00C756 1 91 44 sta (BufferLo),y
00C758 1 C8 iny
00C759 1 D0 F8 bne NextByte
00C75B 1 E6 45 inc BufferHi
00C75D 1 C6 47 dec BlockHi
00C75F 1 D0 EC bne NextPage
00C761 1 ReadFinalPage:
00C761 1 A5 46 lda BlockLo
00C763 1 F0 0C beq ExitToMonitor
00C765 1 A0 00 ldy #$00
00C767 1 NextByteFinal:
00C767 1 20 8C C7 jsr GetByte
00C76A 1 91 44 sta (BufferLo),y
00C76C 1 C8 iny
00C76D 1 C4 46 cpy BlockLo
00C76F 1 D0 F6 bne NextByteFinal
00C771 1 ExitToMonitor:
00C771 1 20 59 FF jsr Monitor
00C774 1
00C774 1 SendByte:
00C774 1 2C FB C0 bit InputFlags
00C777 1 70 FB bvs SendByte
00C779 1 8D FD C0 sta OutputByte
00C77C 1 .if HW_TYPE = 0
00C77C 1 A9 2E lda #$2e ; set bit 0 low to indicate write started
00C77E 1 8D F7 C0 sta OutputFlags
00C781 1 finishWrite:
00C781 1 2C FB C0 bit InputFlags
00C784 1 50 FB bvc finishWrite
00C786 1 A9 2F lda #$2f
00C788 1 8D F7 C0 sta OutputFlags
00C78B 1 .endif
00C78B 1 60 rts
00C78C 1
00C78C 1 GetByte:
00C78C 1 .if HW_TYPE = 0
00C78C 1 A2 2D ldx #$2d ;set read flag low
00C78E 1 8E F7 C0 stx OutputFlags
00C791 1 .endif
00C791 1 waitRead:
00C791 1 2C FB C0 bit InputFlags
00C794 1 30 FB bmi waitRead
00C796 1 AD FE C0 lda InputByte
00C799 1 .if HW_TYPE = 0
00C799 1 A2 2F ldx #$2f ;set all flags high
00C79B 1 8E F7 C0 stx OutputFlags
00C79E 1 finishRead:
00C79E 1 2C FB C0 bit InputFlags
00C7A1 1 10 FB bpl finishRead
00C7A3 1 .endif
00C7A3 1 end:
00C7A3 1 60 rts
00C7A4 1
00C7A4 1 00 00 00 00 .repeat 251-<end
00C7A8 1 00 00 00 00
00C7AC 1 00 00 00 00
00C7B0 1 00 00 00 00
00C7B4 1 00 00 00 00
00C7B8 1 00 00 00 00
00C7BC 1 00 00 00 00
00C7C0 1 00 00 00 00
00C7C4 1 00 00 00 00
00C7C8 1 00 00 00 00
00C7CC 1 00 00 00 00
00C7D0 1 00 00 00 00
00C7D4 1 00 00 00 00
00C7D8 1 00 00 00 00
00C7DC 1 00 00 00 00
00C7E0 1 00 00 00 00
00C7E4 1 00 00 00 00
00C7E8 1 00 00 00 00
00C7EC 1 00 00 00 00
00C7F0 1 00 00 00 00
00C7F4 1 00 00 00 00
00C7F8 1 00 00 00 00
00C7FC 1 .byte 0
00C7FC 1 .endrepeat
00C7FC 1
00C7FC 1 00 00 .byte 0,0 ;0000 blocks = check status
00C7FE 1 07 .byte 7 ;bit set(0=status 1=read 2=write) unset(3=format, 4/5=number of volumes, 6=interruptable, 7=removable)
00C7FF 1 14 .byte DriverEntry&$00FF ;low byte of entry
00C800 1
00C800 1

View File

@ -1,231 +0,0 @@
ca65 V2.18 - Debian 2.19-1
Main file : MenuFirmware.asm
Current file: MenuFirmware.asm
000000r 1 ; Copyright Terence J. Boldt (c)2020-2024
000000r 1 ; Use of this source code is governed by an MIT
000000r 1 ; license that can be found in the LICENSE file.
000000r 1
000000r 1 ; This file contains the source for the firmware
000000r 1 ; that displays the copyright message on boot
000000r 1 ; and checks for the RPi status to be ready before
000000r 1 ; attempting to boot
000000r 1
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 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 ResetCommand = $00
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
000000r 1
000000r 1 Wait = $fca8
000000r 1 PrintChar = $fded
000000r 1 Home = $fc58
000000r 1 ReadChar = $fd0c
000000r 1 BasCalc = $fbc1
000000r 1 htab = $24
000000r 1 vtab = $25
000000r 1 BasL = $28
000000r 1 htab80 = $057b
000000r 1
000000r 1 .org SLOT*$100 + $C000
00C700 1 ;ID bytes for booting and drive detection
00C700 1 E0 20 cpx #$20 ;ID bytes for ProDOS and the
00C702 1 E0 00 cpx #$00 ; Apple Autostart ROM
00C704 1 E0 03 cpx #$03 ;
00C706 1
00C706 1 A2 70 ldx #SLOT*$10
00C708 1 86 2B stx $2b
00C70A 1 86 43 stx Unit
00C70C 1
00C70C 1 ;force EPROM to second page on boot
00C70C 1 A9 3F lda #$3f ;set all flags high and page 1 of EPROMi
00C70E 1 PageJump:
00C70E 1 8D F7 C0 sta OutputFlags
00C711 1 4C 19 C7 jmp Start
00C714 1
00C714 1 ;entry points for ProDOS
00C714 1 DriverEntry:
00C714 1 A9 0F lda #$0f ;set all flags high and page 0 of EPROM
00C716 1 8D F7 C0 sta OutputFlags
00C719 1 ;since the firmware page changes to 0, this falls through to the driver
00C719 1
00C719 1 Start:
00C719 1 A9 F0 lda #$f0 ;restore COUT after PR# called
00C71B 1 85 36 sta $36
00C71D 1 A9 FD lda #$fd
00C71F 1 85 37 sta $37
00C721 1 ;jsr Home ;clear screen and show menu options
00C721 1 A9 02 lda #$02
00C723 1 85 25 sta vtab
00C725 1 20 C1 FB jsr BasCalc
00C728 1 A0 00 ldy #$00
00C72A 1 84 24 sty htab
00C72C 1 PrintString:
00C72C 1 B9 AB C7 lda Text,y
00C72F 1 F0 08 beq WaitForRPi
00C731 1 09 80 ora #$80
00C733 1 20 ED FD jsr PrintChar
00C736 1 C8 iny
00C737 1 D0 F3 bne PrintString
00C739 1
00C739 1 .if HW_TYPE = 0
00C739 1
00C739 1 WaitForRPi:
00C739 1 2C FB C0 bit InputFlags
00C73C 1 30 0D bmi Reset
00C73E 1 A9 FF lda #$ff
00C740 1 20 A8 FC jsr Wait
00C743 1 A9 AE lda #'.'+$80
00C745 1 20 ED FD jsr PrintChar
00C748 1 4C 39 C7 jmp WaitForRPi
00C74B 1
00C74B 1 Reset:
00C74B 1 A9 DF lda #'_'|$80
00C74D 1 20 ED FD jsr PrintChar
00C750 1 A9 00 lda #ResetCommand
00C752 1 20 7B C7 jsr SendByte
00C755 1 A9 88 lda #$88
00C757 1 20 ED FD jsr PrintChar
00C75A 1 A9 AE lda #'.'|$80
00C75C 1 20 ED FD jsr PrintChar
00C75F 1 20 93 C7 jsr GetByte
00C762 1 F0 03 beq Ok
00C764 1 4C 4B C7 jmp Reset
00C767 1
00C767 1 .else
00C767 1
00C767 1 WaitForRPi:
00C767 1 @1:
00C767 1 bit InputFlags
00C767 1 bmi @2
00C767 1 lda InputByte
00C767 1 jmp @1
00C767 1 @2:
00C767 1 bit InputFlags
00C767 1 bpl @4
00C767 1 bvs @3
00C767 1 lda #ResetCommand
00C767 1 sta OutputByte
00C767 1 @3:
00C767 1 lda #$ff
00C767 1 jsr Wait
00C767 1 lda #'.'+$80
00C767 1 jsr PrintChar
00C767 1 jmp @2
00C767 1 @4:
00C767 1 lda #$ff
00C767 1 jsr Wait
00C767 1 @5:
00C767 1 bit InputFlags
00C767 1 bmi Ok
00C767 1 lda InputByte
00C767 1 jmp @5
00C767 1
00C767 1 .endif
00C767 1
00C767 1 Ok:
00C767 1 A9 8D lda #$8D
00C769 1 20 ED FD jsr PrintChar
00C76C 1 A9 CF lda #'O'|$80
00C76E 1 20 ED FD jsr PrintChar
00C771 1 A9 CB lda #'K'|$80
00C773 1 20 ED FD jsr PrintChar
00C776 1
00C776 1 Boot:
00C776 1 A9 0F lda #$0f
00C778 1 4C 0E C7 jmp PageJump
00C77B 1
00C77B 1 SendByte:
00C77B 1 2C FB C0 bit InputFlags
00C77E 1 70 FB bvs SendByte
00C780 1 8D FD C0 sta OutputByte
00C783 1 .if HW_TYPE = 0
00C783 1 A9 3E lda #$3e ; set bit 0 low to indicate write started
00C785 1 8D F7 C0 sta OutputFlags
00C788 1 finishWrite:
00C788 1 2C FB C0 bit InputFlags
00C78B 1 50 FB bvc finishWrite
00C78D 1 A9 3F lda #$3f
00C78F 1 8D F7 C0 sta OutputFlags
00C792 1 .endif
00C792 1 60 rts
00C793 1
00C793 1 GetByte:
00C793 1 .if HW_TYPE = 0
00C793 1 A2 3D ldx #$3d ;set read flag low
00C795 1 8E F7 C0 stx OutputFlags
00C798 1 .endif
00C798 1 waitRead:
00C798 1 2C FB C0 bit InputFlags
00C79B 1 30 FB bmi waitRead
00C79D 1 AD FE C0 lda InputByte
00C7A0 1 .if HW_TYPE = 0
00C7A0 1 A2 3F ldx #$3f ;set all flags high
00C7A2 1 8E F7 C0 stx OutputFlags
00C7A5 1 finishRead:
00C7A5 1 2C FB C0 bit InputFlags
00C7A8 1 10 FB bpl finishRead
00C7AA 1 .endif
00C7AA 1 60 rts
00C7AB 1
00C7AB 1 Text:
00C7AB 1 41 70 70 6C .byte "Apple2-IO-RPi",$8d
00C7AF 1 65 32 2D 49
00C7B3 1 4F 2D 52 50
00C7B7 1 69 8D
00C7B9 1 28 63 29 32 .byte "(c)2020-2024 Terence J. Boldt",$8d
00C7BD 1 30 32 30 2D
00C7C1 1 32 30 32 34
00C7C5 1 20 54 65 72
00C7C9 1 65 6E 63 65
00C7CD 1 20 4A 2E 20
00C7D1 1 42 6F 6C 64
00C7D5 1 74 8D
00C7D7 1 8D .byte $8d
00C7D8 1 .if HW_TYPE = 0
00C7D8 1 57 61 69 74 .byte "Waiting for RPi FW:0010..."
00C7DC 1 69 6E 67 20
00C7E0 1 66 6F 72 20
00C7E4 1 52 50 69 20
00C7E8 1 46 57 3A 30
00C7EC 1 30 31 30 2E
00C7F0 1 2E 2E
00C7F2 1 .else
00C7F2 1 .byte "Waiting for RPi FW:8010..."
00C7F2 1 .endif
00C7F2 1 end:
00C7F2 1 00 .byte $00
00C7F3 1
00C7F3 1 00 00 00 00 .repeat 251-<end
00C7F7 1 00 00 00 00
00C7FB 1 00
00C7FC 1 .byte 0
00C7FC 1 .endrepeat
00C7FC 1
00C7FC 1 00 00 .byte 0,0 ;0000 blocks = check status
00C7FE 1 07 .byte 7 ;bit set(0=status 1=read 2=write) unset(3=format, 4/5=number of volumes, 6=interruptable, 7=removable)
00C7FF 1 14 .byte DriverEntry&$00FF ;low byte of entry
00C800 1
00C800 1

View File

@ -1,280 +0,0 @@
ca65 V2.18 - Debian 2.19-1
Main file : RPi.Command.asm
Current file: RPi.Command.asm
000000r 1 ; Copyright Terence J. Boldt (c)2021-2024
000000r 1 ; Use of this source code is governed by an MIT
000000r 1 ; license that can be found in the LICENSE file.
000000r 1
000000r 1 ; This file contains the source for the RPI.COMMAND
000000r 1 ; application that runs on the Apple II and extends
000000r 1 ; ProDOS BASIC.SYSTEM to add the RPI command which
000000r 1 ; allows commands to be executed on the Raspberry Pi
000000r 1
000000r 1 .ORG $300
000300 1 INBUF = $200 ;GETLN input buffer.
000300 1 WAIT = $FCA8 ;Monitor wait routine.
000300 1 BELL = $FF3A ;Monitor bell routine.
000300 1 EXTRNCMD = $BE06 ;External cmd JMP vector.
000300 1 XTRNADDR = $BE50 ;Ext cmd implementation addr.
000300 1 XLEN = $BE52 ;length of command string-1.
000300 1 XCNUM = $BE53 ;CI cmd no. (ext cmd - 0).
000300 1 PBITS = $BE54 ;Command parameter bits.
000300 1 XRETURN = $FF58 ;Known RTS instruction.
000300 1 InputByte = $c08e
000300 1 OutputByte = $c08d
000300 1 InputFlags = $c08b
000300 1 OutputFlags = $c087
000300 1
000300 1 ReadBlockCommand = $01
000300 1 WriteBlockCommand = $02
000300 1 GetTimeCommand = $03
000300 1 ChangeDriveCommand = $04
000300 1 ExecCommand = $05
000300 1 LoadFileCommand = $06
000300 1 SaveFileCommand = $07
000300 1 MenuCommand = $08
000300 1
000300 1 InputString = $fd67
000300 1 PrintChar = $fded
000300 1 Keyboard = $c000
000300 1 ClearKeyboard = $c010
000300 1 Wait = $fca8
000300 1
000300 1 LastChar = $06
000300 1 SlotL = $fe
000300 1 SlotH = $ff
000300 1 ESC = $9b
000300 1
000300 1 ;macro for string with high-bit set
000300 1 .macro aschi str
000300 1 .repeat .strlen (str), c
000300 1 .byte .strat (str, c) | $80
000300 1 .endrep
000300 1 .endmacro
000300 1
000300 1 .org $2000
002000 1 A2 07 ldx #$07 ; start at slot 7
002002 1 DetectSlot:
002002 1 A0 00 ldy #$00
002004 1 A9 FC lda #$fc
002006 1 85 FE sta SlotL
002008 1 8A txa
002009 1 09 C0 ora #$c0
00200B 1 85 FF sta SlotH
00200D 1 B1 FE lda (SlotL),y
00200F 1 D0 1C bne nextSlot
002011 1 C8 iny
002012 1 B1 FE lda (SlotL),y
002014 1 D0 17 bne nextSlot
002016 1 C8 iny
002017 1 B1 FE lda (SlotL),y
002019 1 C9 17 cmp #$17
00201B 1 D0 10 bne nextSlot
00201D 1 C8 iny
00201E 1 B1 FE lda (SlotL),y
002020 1 C9 14 cmp #$14
002022 1 D0 09 bne nextSlot
002024 1 8A txa
002025 1 0A asl
002026 1 0A asl
002027 1 0A asl
002028 1 0A asl
002029 1 AA tax
00202A 1 18 clc
00202B 1 90 04 bcc Start
00202D 1 nextSlot:
00202D 1 CA dex
00202E 1 D0 D2 bne DetectSlot
002030 1 60 rts
002031 1 Start:
002031 1 8E 31 21 stx slotx + $1e01 ;set the slot for the driver
002034 1 A0 00 ldy #$00
002036 1 PrintString:
002036 1 B9 93 20 lda Text,y
002039 1 F0 08 beq copyDriver
00203B 1 09 80 ora #$80
00203D 1 20 ED FD jsr PrintChar
002040 1 C8 iny
002041 1 D0 F3 bne PrintString
002043 1 copyDriver:
002043 1 A0 00 ldy #$00
002045 1 copyDriverByte:
002045 1 B9 00 21 lda $2100,y
002048 1 99 00 03 sta $0300,y
00204B 1 C8 iny
00204C 1 C0 E6 cpy #$e6
00204E 1 D0 F5 bne copyDriverByte
002050 1 ;
002050 1 ; FIRST SAVE THE EXTERNAL COMMAND ADDRESS SO YOU WON'T
002050 1 ; DISCONNECT ANY PREVIOUSLY CONNECTED COMMAND.
002050 1 ;
002050 1 AD 07 BE LDA EXTRNCMD+1
002053 1 8D AD 03 STA NXTCMD
002056 1 AD 08 BE LDA EXTRNCMD+2
002059 1 8D AE 03 STA NXTCMD+1
00205C 1 ;
00205C 1 A9 00 LDA #<RPI ;Install the address of our
00205E 1 8D 07 BE STA EXTRNCMD+1 ; command handler in the
002061 1 A9 03 LDA #>RPI ; external command JMP
002063 1 8D 08 BE STA EXTRNCMD+2 ; vector.
002066 1
002066 1 A9 05 lda #ExecCommand
002068 1 20 6F 03 jsr SendByte
00206B 1 A0 00 ldy #$00
00206D 1 nextCommandByte:
00206D 1 B9 8C 20 lda a2help, y
002070 1 F0 07 beq finishCommand
002072 1 20 6F 03 jsr SendByte
002075 1 C8 iny
002076 1 4C 6D 20 jmp nextCommandByte
002079 1 finishCommand:
002079 1 A9 00 lda #$00
00207B 1 20 6F 03 jsr SendByte
00207E 1 showVersion:
00207E 1 20 8D 03 jsr GetByte
002081 1 C9 00 cmp #$00
002083 1 F0 06 beq FinishDriver
002085 1 20 ED FD jsr PrintChar
002088 1 4C 7E 20 jmp showVersion
00208B 1 FinishDriver:
00208B 1 60 rts
00208C 1
00208C 1 a2help:
00208C 1 61 32 68 65 .byte "a2help", $00
002090 1 6C 70 00
002093 1
002093 1 Text:
002093 1 D2 D0 C9 A0 aschi "RPI command version: 000E"
002097 1 E3 EF ED ED
00209B 1 E1 EE E4 A0
0020AC 1 8D .byte $8d
0020AD 1 end:
0020AD 1 00 .byte $00
0020AE 1
0020AE 1 00 00 00 00 .repeat 255-<end
0020B2 1 00 00 00 00
0020B6 1 00 00 00 00
002100 1 .byte 0
002100 1 .endrepeat
002100 1
002100 1 .org $0300
000300 1 A2 00 RPI: LDX #0 ;Check for our command.
000302 1 BD 00 02 NXTCHR: LDA INBUF,X ;Get first character.
000305 1 09 20 ora #$20 ;Make it lower case
000307 1 DD AA 03 CMP CMD,X ;Does it match?
00030A 1 D0 29 BNE NOTOURS ;No, back to CI.
00030C 1 E8 INX ;Next character
00030D 1 E0 03 CPX #CMDLEN ;All characters yet?
00030F 1 D0 F1 BNE NXTCHR ;No, read next one.
000311 1 ;
000311 1 A9 02 LDA #CMDLEN-1 ;Our cmd! Put cmd length-1
000313 1 ;lda #$8d
000313 1 ;sta $02ff
000313 1 ;lda #$fe
000313 1 8D 52 BE STA XLEN ; in CI global XLEN.
000316 1 A9 58 LDA #<XRETURN ;Point XTRNADDR to a known
000318 1 8D 50 BE STA XTRNADDR ; RTS since we'll handle
00031B 1 A9 FF LDA #>XRETURN ; at the time we intercept
00031D 1
00031D 1 8D 51 BE STA XTRNADDR+1 ; our command.
000320 1 A9 00 LDA #0 ;Mark the cmd number as
000322 1 8D 53 BE STA XCNUM ; zero (external).
000325 1 8D 54 BE STA PBITS ;And indicate no parameters
000328 1 8D 55 BE STA PBITS+1 ; to be parsed.
00032B 1 A9 8D lda #$8d
00032D 1 20 ED FD jsr $fded
000330 1 A2 70 slotx: ldx #$70 ; set x to slot # in high nibble
000332 1 18 clc
000333 1 90 04 bcc SendCommand
000335 1 ;
000335 1 38 NOTOURS: SEC ; ALWAYS SET CARRY IF NOT YOUR
000336 1 6C AD 03 JMP (NXTCMD) ; CMD AND LET NEXT COMMAND TRY
000339 1 ; ; TO CLAIM IT.
000339 1
000339 1 SendCommand:
000339 1 2C 10 C0 bit ClearKeyboard
00033C 1 A9 05 lda #$05 ;send command 5 = exec
00033E 1 20 6F 03 jsr SendByte
000341 1 A0 03 ldy #$03 ;skip over "RPI"
000343 1 getInput:
000343 1 B9 00 02 lda $0200,y
000346 1 C9 8D cmp #$8d
000348 1 F0 08 beq sendNullTerminator
00034A 1 29 7F and #$7f
00034C 1 20 6F 03 jsr SendByte
00034F 1 C8 iny
000350 1 D0 F1 bne getInput
000352 1 sendNullTerminator:
000352 1 A9 00 lda #$00
000354 1 20 6F 03 jsr SendByte
000357 1 DumpOutput:
000357 1 20 8D 03 jsr GetByte
00035A 1 C9 00 cmp #$00
00035C 1 F0 06 beq endOutput
00035E 1 20 ED FD jsr PrintChar
000361 1 18 clc
000362 1 90 F3 bcc DumpOutput
000364 1 endOutput:
000364 1 18 clc
000365 1 6C AD 03 jmp (NXTCMD)
000368 1
000368 1 HelpCommand:
000368 1 61 32 68 65 .byte "a2help",$00
00036C 1 6C 70 00
00036F 1
00036F 1 SendByte:
00036F 1 48 pha
000370 1 waitWrite:
000370 1 BD 8B C0 lda InputFlags,x
000373 1 2A rol
000374 1 2A rol
000375 1 B0 F9 bcs waitWrite
000377 1 68 pla
000378 1 9D 8D C0 sta OutputByte,x
00037B 1 .if HW_TYPE = 0
00037B 1 A9 1E lda #$1e ; set bit 0 low to indicate write started
00037D 1 9D 87 C0 sta OutputFlags,x
000380 1 finishWrite:
000380 1 BD 8B C0 lda InputFlags,x
000383 1 2A rol
000384 1 2A rol
000385 1 90 F9 bcc finishWrite
000387 1 A9 1F lda #$1f
000389 1 9D 87 C0 sta OutputFlags,x
00038C 1 .endif
00038C 1 60 rts
00038D 1
00038D 1 GetByte:
00038D 1 .if HW_TYPE = 0
00038D 1 A9 1D lda #$1d ;set read flag low
00038F 1 9D 87 C0 sta OutputFlags,x
000392 1 .endif
000392 1 waitRead:
000392 1 BD 8B C0 lda InputFlags,x
000395 1 2A rol
000396 1 B0 FA bcs waitRead
000398 1 readByte:
000398 1 BD 8E C0 lda InputByte,x
00039B 1 .if HW_TYPE = 0
00039B 1 48 pha
00039C 1 A9 1F lda #$1f ;set all flags high
00039E 1 9D 87 C0 sta OutputFlags,x
0003A1 1 finishRead:
0003A1 1 BD 8B C0 lda InputFlags,x
0003A4 1 2A rol
0003A5 1 90 FA bcc finishRead
0003A7 1 68 pla
0003A8 1 .endif
0003A8 1 18 clc ;success
0003A9 1 60 rts
0003AA 1
0003AA 1
0003AA 1 F2 F0 E9 CMD: aschi "rpi"
0003AD 1 CMDLEN = 3 ;Our command length
0003AD 1 ;
0003AD 1 00 00 NXTCMD: .byte 0,0 ; STORE THE NEXT EXT CMD'S
0003AF 1 ; ADDRESS HERE.
0003AF 1
0003AF 1
0003AF 1

View File

@ -1,309 +0,0 @@
ca65 V2.18 - Debian 2.19-1
Main file : Shell.asm
Current file: Shell.asm
000000r 1 ; Copyright Terence J. Boldt (c)2021-2024
000000r 1 ; Use of this source code is governed by an MIT
000000r 1 ; license that can be found in the LICENSE file.
000000r 1
000000r 1 ; This file contains the source for the SHELL
000000r 1 ; application that runs on the Apple II to talk
000000r 1 ; to the Raspberry Pi
000000r 1
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 InputByte = $c08e
000000r 1 OutputByte = $c08d
000000r 1 InputFlags = $c08b
000000r 1 OutputFlags = $c087
000000r 1
000000r 1 ResetCommand = $00
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
000000r 1 ShellCommand = $09
000000r 1
000000r 1 InputString = $fd6a
000000r 1 StringBuffer = $0200
000000r 1 PrintChar = $fded
000000r 1 Keyboard = $c000
000000r 1 ClearKeyboard = $c010
000000r 1 Home = $fc58
000000r 1 Wait = $fca8
000000r 1 PromptChar = $33
000000r 1 Read80Col = $c01f
000000r 1 TextPage1 = $c054
000000r 1 TextPage2 = $c055
000000r 1
000000r 1 htab = $24
000000r 1 vtab = $25
000000r 1 BasL = $28
000000r 1 htab80 = $057b
000000r 1 BasCalc = $fbc1
000000r 1
000000r 1 LastChar = $06
000000r 1 SlotL = $fe
000000r 1 SlotH = $ff
000000r 1 ESC = $9b
000000r 1
000000r 1 .org $2000
002000 1 A2 07 ldx #$07 ; start at slot 7
002002 1 DetectSlot:
002002 1 A0 00 ldy #$00
002004 1 A9 FC lda #$fc
002006 1 85 FE sta SlotL
002008 1 8A txa
002009 1 09 C0 ora #$c0
00200B 1 85 FF sta SlotH
00200D 1 B1 FE lda (SlotL),y
00200F 1 D0 1C bne nextSlot
002011 1 C8 iny
002012 1 B1 FE lda (SlotL),y
002014 1 D0 17 bne nextSlot
002016 1 C8 iny
002017 1 B1 FE lda (SlotL),y
002019 1 C9 17 cmp #$17
00201B 1 D0 10 bne nextSlot
00201D 1 C8 iny
00201E 1 B1 FE lda (SlotL),y
002020 1 C9 14 cmp #$14
002022 1 D0 09 bne nextSlot
002024 1 8A txa
002025 1 0A asl
002026 1 0A asl
002027 1 0A asl
002028 1 0A asl
002029 1 AA tax
00202A 1 18 clc
00202B 1 90 04 bcc Init
00202D 1 nextSlot:
00202D 1 CA dex
00202E 1 D0 D2 bne DetectSlot
002030 1 60 rts
002031 1
002031 1 Init:
002031 1 A9 8D lda #$8d
002033 1 20 00 C3 jsr $c300 ; force 80 columns
002036 1
002036 1 A0 00 ldy #$00
002038 1 PrintString:
002038 1 B9 73 21 lda Text,y
00203B 1 F0 08 beq Start
00203D 1 09 80 ora #$80
00203F 1 20 ED FD jsr PrintChar
002042 1 C8 iny
002043 1 D0 F3 bne PrintString
002045 1
002045 1 Start:
002045 1 A5 06 lda LastChar
002047 1 48 pha
002048 1 2C 10 C0 bit ClearKeyboard
00204B 1 ; lda #ResetCommand
00204B 1 ; jsr SendByte
00204B 1 A9 09 lda #ShellCommand
00204D 1 20 C7 20 jsr SendByte
002050 1 20 57 20 jsr DumpOutput
002053 1 68 pla
002054 1 85 06 sta LastChar
002056 1 60 rts
002057 1
002057 1 DumpOutput:
002057 1 20 E5 20 jsr GetByte
00205A 1 C9 00 cmp #$00
00205C 1 F0 26 beq endOutput
00205E 1 48 pha
00205F 1 20 5E 21 jsr ClearCursor
002062 1 68 pla
002063 1 C9 48 cmp #'H'
002065 1 F0 27 beq setColumn
002067 1 C9 56 cmp #'V'
002069 1 F0 31 beq setRow
00206B 1 C9 43 cmp #'C'
00206D 1 F0 16 beq clearScreen
00206F 1 C9 54 cmp #'T'
002071 1 F0 37 beq setTop
002073 1 C9 42 cmp #'B'
002075 1 F0 3B beq setBottom
002077 1 C9 55 cmp #'U'
002079 1 F0 3F beq moveUp
00207B 1 20 ED FD jsr PrintChar
00207E 1 20 2D 21 jsr SetCursor
002081 1 4C 57 20 jmp DumpOutput
002084 1 endOutput:
002084 1 60 rts
002085 1 clearScreen:
002085 1 20 58 FC jsr Home
002088 1 20 2D 21 jsr SetCursor
00208B 1 4C 57 20 jmp DumpOutput
00208E 1 setColumn:
00208E 1 20 E5 20 jsr GetByte
002091 1 85 24 sta htab
002093 1 8D 7B 05 sta htab80
002096 1 20 2D 21 jsr SetCursor
002099 1 4C 57 20 jmp DumpOutput
00209C 1 setRow:
00209C 1 20 E5 20 jsr GetByte
00209F 1 85 25 sta vtab
0020A1 1 20 C1 FB jsr BasCalc
0020A4 1 20 2D 21 jsr SetCursor
0020A7 1 4C 57 20 jmp DumpOutput
0020AA 1 setTop:
0020AA 1 20 E5 20 jsr GetByte
0020AD 1 85 22 sta $22
0020AF 1 4C 57 20 jmp DumpOutput
0020B2 1 setBottom:
0020B2 1 20 E5 20 jsr GetByte
0020B5 1 85 23 sta $23
0020B7 1 4C 57 20 jmp DumpOutput
0020BA 1 moveUp:
0020BA 1 C6 25 dec vtab
0020BC 1 A5 25 lda vtab
0020BE 1 20 C1 FB jsr BasCalc
0020C1 1 20 2D 21 jsr SetCursor
0020C4 1 4C 57 20 jmp DumpOutput
0020C7 1
0020C7 1 SendByte:
0020C7 1 48 pha
0020C8 1 waitWrite:
0020C8 1 BD 8B C0 lda InputFlags,x
0020CB 1 2A rol
0020CC 1 2A rol
0020CD 1 B0 F9 bcs waitWrite
0020CF 1 68 pla
0020D0 1 9D 8D C0 sta OutputByte,x
0020D3 1 .if HW_TYPE = 0
0020D3 1 A9 1E lda #$1e ; set bit 0 low to indicate write started
0020D5 1 9D 87 C0 sta OutputFlags,x
0020D8 1 finishWrite:
0020D8 1 BD 8B C0 lda InputFlags,x
0020DB 1 2A rol
0020DC 1 2A rol
0020DD 1 90 F9 bcc finishWrite
0020DF 1 A9 1F lda #$1f
0020E1 1 9D 87 C0 sta OutputFlags,x
0020E4 1 .endif
0020E4 1 60 rts
0020E5 1
0020E5 1 GetByte:
0020E5 1 .if HW_TYPE = 0
0020E5 1 A9 1D lda #$1d ;set read flag low
0020E7 1 9D 87 C0 sta OutputFlags,x
0020EA 1 .endif
0020EA 1 waitRead:
0020EA 1 BD 8B C0 lda InputFlags,x
0020ED 1 2A rol
0020EE 1 90 2B bcc readByte
0020F0 1 2C 00 C0 bit Keyboard ;keypress will abort waiting to read
0020F3 1 10 F5 bpl waitRead
0020F5 1 keyPressed:
0020F5 1 BD 8B C0 lda InputFlags,x
0020F8 1 2A rol
0020F9 1 2A rol
0020FA 1 B0 F9 bcs keyPressed
0020FC 1 AD 00 C0 lda Keyboard ;send keypress to RPi
0020FF 1 29 7F and #$7f
002101 1 9D 8D C0 sta OutputByte,x
002104 1 2C 10 C0 bit ClearKeyboard
002107 1 .if HW_TYPE = 0
002107 1 A9 1C lda #$1c ;set write flag low too
002109 1 9D 87 C0 sta OutputFlags,x
00210C 1 finishKeyPress:
00210C 1 BD 8B C0 lda InputFlags,x
00210F 1 2A rol
002110 1 2A rol
002111 1 90 F9 bcc finishKeyPress
002113 1 A9 1D lda #$1d ;set flags back for reading
002115 1 9D 87 C0 sta OutputFlags,x
002118 1 .endif
002118 1 4C EA 20 jmp waitRead
00211B 1 readByte:
00211B 1 BD 8E C0 lda InputByte,x
00211E 1 .if HW_TYPE = 0
00211E 1 48 pha
00211F 1 A9 1F lda #$1f ;set all flags high
002121 1 9D 87 C0 sta OutputFlags,x
002124 1 finishRead:
002124 1 BD 8B C0 lda InputFlags,x
002127 1 2A rol
002128 1 90 FA bcc finishRead
00212A 1 68 pla
00212B 1 .endif
00212B 1 18 clc ;success
00212C 1 end:
00212C 1 60 rts
00212D 1
00212D 1 SetCursor:
00212D 1 AD 7B 05 lda htab80 ;get horizontal location / 2
002130 1 4A lsr
002131 1 A8 tay
002132 1 AD 55 C0 lda TextPage2
002135 1 90 03 bcc setChar
002137 1 AD 54 C0 lda TextPage1
00213A 1 setChar:
00213A 1 B1 28 lda (BasL),y
00213C 1 85 06 sta LastChar ; save so ClearCursor will pick it up
00213E 1 C9 E0 cmp #$e0
002140 1 10 0C bpl lowerCase
002142 1 C9 C0 cmp #$c0
002144 1 10 0D bpl upperCase
002146 1 C9 A0 cmp #$a0
002148 1 10 04 bpl symbol
00214A 1 C9 80 cmp #$80
00214C 1 10 0A bpl noop
00214E 1 symbol:
00214E 1 lowerCase:
00214E 1 invert:
00214E 1 49 80 eor #$80
002150 1 4C 58 21 jmp storeChar
002153 1 upperCase:
002153 1 29 1F and #$1f
002155 1 4C 58 21 jmp storeChar
002158 1 noop:
002158 1 storeChar:
002158 1 91 28 sta (BasL),y
00215A 1 AD 54 C0 lda TextPage1
00215D 1 60 rts
00215E 1
00215E 1 ClearCursor:
00215E 1 AD 7B 05 lda htab80 ;get horizontal location / 2
002161 1 4A lsr
002162 1 A8 tay
002163 1 AD 55 C0 lda TextPage2
002166 1 90 03 bcc restoreChar
002168 1 AD 54 C0 lda TextPage1
00216B 1 restoreChar:
00216B 1 A5 06 lda LastChar
00216D 1 91 28 sta (BasL),y
00216F 1 AD 54 C0 lda TextPage1
002172 1 60 rts
002173 1
002173 1 Text:
002173 1 .if HW_TYPE = 0
002173 1 41 70 70 6C .byte "Apple2-IO-RPi Shell Version 000F",$8d
002177 1 65 32 2D 49
00217B 1 4F 2D 52 50
002194 1 .else
002194 1 .byte "Apple2-IO-RPi Shell Version 800F",$8d
002194 1 .endif
002194 1 28 63 29 32 .byte "(c)2020-2024 Terence J. Boldt",$8d
002198 1 30 32 30 2D
00219C 1 32 30 32 34
0021B2 1 8D .byte $8d
0021B3 1 00 .byte $00
0021B3 1

View File

@ -50,8 +50,10 @@ func main() {
var comm a2io.A2Io
if cdc {
comm = a2io.CDCio{}
fmt.Printf("Starting communications via serial port...\n")
} else {
comm = a2io.A2Gpio{}
fmt.Printf("Starting communications via GPIO ports...\n")
}
handlers.SetCommunication(comm)

Binary file not shown.

Binary file not shown.

View File

@ -18,11 +18,11 @@ FetchContent_Declare(a2pico
)
FetchContent_MakeAvailable(a2pico)
set_source_files_properties(incbin.S OBJECT_DEPENDS ../../RaspberryPi/driveimage/AT28C64B.bin)
set_source_files_properties(incbin.S OBJECT_DEPENDS ../RaspberryPi/driveimage/AT28C64B.bin)
add_custom_command(
WORKING_DIRECTORY ../../Apple2
WORKING_DIRECTORY ../Apple2
COMMAND ./assemble.sh 1
OUTPUT ../../RaspberryPi/driveimage/AT28C64B.bin
OUTPUT ../RaspberryPi/driveimage/AT28C64B.bin
VERBATIM
)

View File

@ -0,0 +1 @@
The setup.sh and build.sh are here for convenience of building the Pico code directly on the RPi Zero 2 W attached to the Apple II.

2
RaspberryPiPico/build.sh Executable file
View File

@ -0,0 +1,2 @@
PICO_SDK_PATH=~/pico-sdk/ cmake .
make

View File

@ -3,4 +3,4 @@
.type firmware, %object
.balign 4
firmware:
.incbin "../../RaspberryPi/driveimage/AT28C64B.bin"
.incbin "../RaspberryPi/driveimage/AT28C64B.bin"

5
RaspberryPiPico/setup.sh Executable file
View File

@ -0,0 +1,5 @@
sudo apt install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib -y
cd ~
git clone https://github.com/raspberrypi/pico-sdk.git
cd ~/pico-sdk/
git submodule update --init