Initial Pico hardware support

* Added assemble.cmd for Windows.

In the long run, some (c)make-based cross-plafrom solution seems preferable.

* Fill up the menu page just like the other pages.

* Allow to assemble for different hardware types.

The first script parameter is used to set the ca65 symbol HW_TYPE. Without parameter, HW_TYPE is set to 0.

* Avoid unwanted i/o access.

Depending on the 6502, LDA addr,X and/or STA addr,X produce additional phantom reads. In order to avoid those phantom reads to do i/o access, I used the "classic" approach of moving those reads from page $C0 to page $BF.

* Made use of BIT instruction to access InputFlags from firmware.

Doing the same for access from disk-based software would require selfmodifying code as there's not bit <addr>,x instruction.

* Removed push/pop from GetByte.

After the replacing the rol instructions with bit instructions with a recent chnage, the only reason left to save a to the stack was setting the OutputFlags. But that can be done using x.

* Added InputFlags check for consistency.

* Added support for an alternative hardware type.

The new hardware type has simple UART-type interface. Beside the two data registers, there are only the two bits to indicate readability and writability of the data registers.

* Added another comminucation interface implementation.

Use ACM CDC (or another proprietary) USB serial device for communication.

Currently VID / PID of a Raspberry Pi Pico SDK CDC UART are hardcoded - see https://github.com/raspberrypi/usb-pid

* Revert "Avoid unwanted i/o access."

Neither the original hardware type nor the alternative hardware type have any read and write i/o port share addresses. Therefore phantom reads aren't an issue with those hardware types.

This reverts commit ae5cb754fb.

* Adapt to the different error signatures on Linux.

So far the code was only tested on Windows.

* Added implementation of the alternative hardware type.

The implemenation is based on a Raspberry Pi Pico - see https://github.com/a2retrosystems/A2retroNET

The new hardware type has a simple UART-type interface. Beside the two data registers, there are only the two bits to indicate readability and writability of the data registers.

* Modify the HD image for the alternative hardware type.

It is likely desirable to have two HD images for the two hardware types. And likely the apple2driver program should default to the right one based on its protocol setting. BUt given that the HD image(s) shouldn't be part of the actual Git repo anyhow, I don't do anything about this here and now.

* Fixed shell startup (?)

At least on the alternative hardware, this "blindly sending" a reset command causes the shell to be terminated right away:
The driver acknowldges the reset command with a zero byte - and that byte ends up being read by DumpOutput causing it to branch to endOutput.

Maybe that sending a reset command is beneficial on the original hardware. Then another .if is required. Or DumpOutput shouldn't quit on reading a zero byte - the shell handler doesn't seem to send it on purpose(?)

* Upate HD image with recent shell change.

* Fix shell shutdown (?)

At least on the alternative hardware, things happen this way:
1. The shell 'exit' command has ptyOut signal outputComplete and terminate. At this point, ptyIn is still blocked up to one second in ReadCharacter - and can therefore not react on outputComplete.
2. The outputComplete handler in ShellCommand sends a zero byte. This makes on the A2 DumpOutput return and the caller send a zero byte. ShellCommand must not return here as ptyIn is still blocked.
3. The zero byte from the A2 has ptyIn return from ReadCharacter, signal userCancelled and terminate.
4. ShellCommand can now return, but it must not send a zero byte, as the A2 is not expecting it - and will therefore later misinterpret it.

Maybe the original hardware needs another handling, then differentiation of behavior in shell.go becomes necessary.

* Moved boot text out of IIgs copyright message area.

Having the boot text start at the left border of the third line makes it look nice on the cold boot screen of all Apple II's - and there's where the user sees it for some time while waiting for the RPi to come up.

* Several adjustements:

- Get latest Go version as of now.
- Nowadays (?) GitHub 'git clone' seems to only work with a GitHub account. Therefore the zip download workaround. The becomes hopefully unnecessary soon with Go module magic.
- Use 'go mod tidy' to update .sum file for now.
- Error handling for an empty drive 2 is currently not exactly great, so download Total Replay for drive 2. Unfortunately there's no stable URL as of now.
- Use $USER and $HOME instead of hardcoded values.
- Removed deprecated syslog output directives.

* Added brief fork description.

* Added ProDOS-Utilities reference.

* Reverted back to using 'git clone'.

I've no idea why git acted up the other day :-( Now, everything is back to normal...

* Ignore Pico build directory.

* Updated from https://github.com/a2retrosystems/A2retroNET

* Updated from https://github.com/a2retrosystems/A2retroNET

At this point, nothing at all is done on an A2 reset. This can likely be improved. However, Apple2-IO-RPi doesn't seem to handle A2 reset exactly gracefully anyhow.

In general, it seems desirable to introduce some simple framing protocol - like SLIP - that allows to recover from an A2 reset in the middle of an Apple2-IO-RPi command execution.

Such a framing protocol would allow to introduce different frame types. One frame type could then be an A2 reset frame sent by the A2retroNET firmware.

* Make use of brand new stable Total Replay download URL.

Thanks to 4am :-)

* Fixed typos.

* Clone upstream ProDOS-Utilities.

My ProDOS-Utilities pull request was merged.

* Added support for boards without LED.

* Updated link.

* Adjusted to the current A2retroNET hardware.

* Removed support for the Pico W.

* Updated URL.

* Updated URL.

* Make use A2Pico library.

* Added link to A2Pico.

* Remove intermediates from repo.

* Build intermediates from Pico build.

* Have LED reflect status of logic ACM connection.

* Update upstream repo references.

* Adjust build instructions.

* Update README.md

* Fix build and update dependencies

* Fix binary comparison

* Fix firware bug on classic hardware

---------

Co-authored-by: Oliver Schmidt <ol.sc@web.de>
This commit is contained in:
Terence Boldt 2024-02-05 22:49:09 -05:00 committed by GitHub
parent 729ea131db
commit aa5910cee8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
34 changed files with 1385 additions and 634 deletions

View File

@ -22,15 +22,10 @@ body:
label: Hardware Version label: Hardware Version
description: What version of the hardware are you running? description: What version of the hardware are you running?
options: options:
- Sixth Prototype (Purchased from Terence) - RPi Pico
- Sixth Prototype (Self-assembled) - Sixth Prototype (lastest classic hardware)
- Sixth Prototype (Purchased from third party) - Fifth Prototype (classic hardware without jumper)
- Fifth Prototype (Purchased from Terence) - Fourth Prototype (classic hardware with EPROM)
- Fifth Prototype (Self-assembled)
- Fifth Prototype (Purchased from third party)
- Fourth Prototype (Purchased from Terence)
- Fourth Prototype (Self-assembled)
- Fourth Prototype (Purchased from third party)
validations: validations:
required: true required: true
- type: dropdown - type: dropdown
@ -39,6 +34,8 @@ body:
label: Firmware Version label: Firmware Version
description: What version of the firmware are you running? (shown on boot screen) description: What version of the firmware are you running? (shown on boot screen)
options: options:
- 8010 (initial RPi Pico hardware)
- 0010 (classic hardware)
- 000F - 000F
- Older (not shown on boot, pre-2022-Feb-07) - Older (not shown on boot, pre-2022-Feb-07)
validations: validations:
@ -49,6 +46,7 @@ body:
label: Driver Version label: Driver Version
description: What version of the driver are you running? Check with `RPI a2version` description: What version of the driver are you running? Check with `RPI a2version`
options: options:
- 002D (add support for RPi Pico hardware)
- 002C (fix nano editor) - 002C (fix nano editor)
- 002B (fix keyboard delay) - 002B (fix keyboard delay)
- 002A (reduce CPU usage) - 002A (reduce CPU usage)
@ -69,6 +67,8 @@ body:
label: Shell Version label: Shell Version
description: What version of the shell are you running?` description: What version of the shell are you running?`
options: options:
- 800F (initial RPi Pico support)
- 000F (classic hardware support)
- 000E (fix hang on exit) - 000E (fix hang on exit)
- 000D (added version info) - 000D (added version info)
- Older (pre-2022-Mar-01) - Older (pre-2022-Mar-01)

1
.gitignore vendored
View File

@ -3,4 +3,5 @@
*.DS_Store *.DS_Store
RaspberryPi/apple2driver/apple2driver RaspberryPi/apple2driver/apple2driver
RaspberryPi/Apple2-IO-RPi.log RaspberryPi/Apple2-IO-RPi.log
RaspberryPiPico/build/
Hardware/Apple2IORPi-backups/ Hardware/Apple2IORPi-backups/

View File

@ -127,48 +127,45 @@ HelpCommand:
.byte "a2help",$00 .byte "a2help",$00
SendByte: SendByte:
pha bit InputFlags
waitWrite: bvs SendByte
lda InputFlags
rol
rol
bcs waitWrite
pla
sta OutputByte sta OutputByte
.if HW_TYPE = 0
lda #$1e ; set bit 0 low to indicate write started lda #$1e ; set bit 0 low to indicate write started
sta OutputFlags sta OutputFlags
finishWrite: finishWrite:
lda InputFlags bit InputFlags
rol bvc finishWrite
rol
bcc finishWrite
lda #$1f lda #$1f
sta OutputFlags sta OutputFlags
.endif
rts rts
GetByte: GetByte:
lda #$1d ;set read flag low .if HW_TYPE = 0
sta OutputFlags ldx #$1d ;set read flag low
stx OutputFlags
.endif
waitRead: waitRead:
lda InputFlags bit InputFlags
rol bpl readByte
bcc readByte
bit Keyboard ;keypress will abort waiting to read bit Keyboard ;keypress will abort waiting to read
bpl waitRead bpl waitRead
.if HW_TYPE = 0
lda #$1f ;set all flags high and exit lda #$1f ;set all flags high and exit
sta OutputFlags sta OutputFlags
.endif
sec ;failure sec ;failure
rts rts
readByte: readByte:
lda InputByte lda InputByte
pha .if HW_TYPE = 0
lda #$1f ;set all flags high ldx #$1f ;set all flags high
sta OutputFlags stx OutputFlags
finishRead: finishRead:
lda InputFlags bit InputFlags
rol bpl finishRead
bcc finishRead .endif
pla
clc ;success clc ;success
end: end:
rts rts

View File

@ -109,7 +109,7 @@ Current file: CommandFirmware.asm
00C766 1 A9 00 lda #$00 00C766 1 A9 00 lda #$00
00C768 1 20 95 C7 jsr SendByte 00C768 1 20 95 C7 jsr SendByte
00C76B 1 DumpOutput: 00C76B 1 DumpOutput:
00C76B 1 20 B3 C7 jsr GetByte 00C76B 1 20 AD C7 jsr GetByte
00C76E 1 B0 07 bcs skipOutput 00C76E 1 B0 07 bcs skipOutput
00C770 1 C9 00 cmp #$00 00C770 1 C9 00 cmp #$00
00C772 1 F0 19 beq endOutput 00C772 1 F0 19 beq endOutput
@ -132,60 +132,60 @@ Current file: CommandFirmware.asm
00C792 1 6C 70 00 00C792 1 6C 70 00
00C795 1 00C795 1
00C795 1 SendByte: 00C795 1 SendByte:
00C795 1 48 pha 00C795 1 2C FB C0 bit InputFlags
00C796 1 waitWrite: 00C798 1 70 FB bvs SendByte
00C796 1 AD FB C0 lda InputFlags 00C79A 1 8D FD C0 sta OutputByte
00C799 1 2A rol 00C79D 1 .if HW_TYPE = 0
00C79A 1 2A rol 00C79D 1 A9 1E lda #$1e ; set bit 0 low to indicate write started
00C79B 1 B0 F9 bcs waitWrite 00C79F 1 8D F7 C0 sta OutputFlags
00C79D 1 68 pla 00C7A2 1 finishWrite:
00C79E 1 8D FD C0 sta OutputByte 00C7A2 1 2C FB C0 bit InputFlags
00C7A1 1 A9 1E lda #$1e ; set bit 0 low to indicate write started 00C7A5 1 50 FB bvc finishWrite
00C7A3 1 8D F7 C0 sta OutputFlags 00C7A7 1 A9 1F lda #$1f
00C7A6 1 finishWrite: 00C7A9 1 8D F7 C0 sta OutputFlags
00C7A6 1 AD FB C0 lda InputFlags 00C7AC 1 .endif
00C7A9 1 2A rol 00C7AC 1 60 rts
00C7AA 1 2A rol 00C7AD 1
00C7AB 1 90 F9 bcc finishWrite 00C7AD 1 GetByte:
00C7AD 1 A9 1F lda #$1f 00C7AD 1 .if HW_TYPE = 0
00C7AF 1 8D F7 C0 sta OutputFlags 00C7AD 1 A2 1D ldx #$1d ;set read flag low
00C7B2 1 60 rts 00C7AF 1 8E F7 C0 stx OutputFlags
00C7B3 1 00C7B2 1 .endif
00C7B3 1 GetByte: 00C7B2 1 waitRead:
00C7B3 1 A9 1D lda #$1d ;set read flag low 00C7B2 1 2C FB C0 bit InputFlags
00C7B5 1 8D F7 C0 sta OutputFlags 00C7B5 1 10 0C bpl readByte
00C7B8 1 waitRead: 00C7B7 1 2C 00 C0 bit Keyboard ;keypress will abort waiting to read
00C7B8 1 AD FB C0 lda InputFlags 00C7BA 1 10 F6 bpl waitRead
00C7BB 1 2A rol 00C7BC 1 .if HW_TYPE = 0
00C7BC 1 90 0C bcc readByte 00C7BC 1 A9 1F lda #$1f ;set all flags high and exit
00C7BE 1 2C 00 C0 bit Keyboard ;keypress will abort waiting to read 00C7BE 1 8D F7 C0 sta OutputFlags
00C7C1 1 10 F5 bpl waitRead 00C7C1 1 .endif
00C7C3 1 A9 1F lda #$1f ;set all flags high and exit 00C7C1 1 38 sec ;failure
00C7C5 1 8D F7 C0 sta OutputFlags 00C7C2 1 60 rts
00C7C8 1 38 sec ;failure 00C7C3 1 readByte:
00C7C9 1 60 rts 00C7C3 1 AD FE C0 lda InputByte
00C7CA 1 readByte: 00C7C6 1 .if HW_TYPE = 0
00C7CA 1 AD FE C0 lda InputByte 00C7C6 1 A2 1F ldx #$1f ;set all flags high
00C7CD 1 48 pha 00C7C8 1 8E F7 C0 stx OutputFlags
00C7CE 1 A9 1F lda #$1f ;set all flags high 00C7CB 1 finishRead:
00C7D0 1 8D F7 C0 sta OutputFlags 00C7CB 1 2C FB C0 bit InputFlags
00C7D3 1 finishRead: 00C7CE 1 10 FB bpl finishRead
00C7D3 1 AD FB C0 lda InputFlags 00C7D0 1 .endif
00C7D6 1 2A rol 00C7D0 1 18 clc ;success
00C7D7 1 90 FA bcc finishRead 00C7D1 1 end:
00C7D9 1 68 pla 00C7D1 1 60 rts
00C7DA 1 18 clc ;success 00C7D2 1
00C7DB 1 end: 00C7D2 1 00 00 00 00 .repeat 251-<end
00C7DB 1 60 rts 00C7D6 1 00 00 00 00
00C7DC 1 00C7DA 1 00 00 00 00
00C7DC 1 00 00 00 00 .repeat 251-<end 00C7DE 1 00 00 00 00
00C7E0 1 00 00 00 00 00C7E2 1 00 00 00 00
00C7E4 1 00 00 00 00 00C7E6 1 00 00 00 00
00C7E8 1 00 00 00 00 00C7EA 1 00 00 00 00
00C7EC 1 00 00 00 00 00C7EE 1 00 00 00 00
00C7F0 1 00 00 00 00 00C7F2 1 00 00 00 00
00C7F4 1 00 00 00 00 00C7F6 1 00 00 00 00
00C7F8 1 00 00 00 00 00C7FA 1 00 00
00C7FC 1 .byte 0 00C7FC 1 .byte 0
00C7FC 1 .endrepeat 00C7FC 1 .endrepeat
00C7FC 1 00C7FC 1

View File

@ -161,41 +161,38 @@ write256:
rts rts
SendByte: SendByte:
pha bit InputFlags
waitWrite: bvs SendByte
lda InputFlags
rol
rol
bcs waitWrite
pla
sta OutputByte sta OutputByte
.if HW_TYPE = 0
lda #$0e ; set bit 0 low to indicate write started lda #$0e ; set bit 0 low to indicate write started
sta OutputFlags sta OutputFlags
finishWrite: finishWrite:
lda InputFlags bit InputFlags
rol bvc finishWrite
rol
bcc finishWrite
lda #$0f lda #$0f
sta OutputFlags sta OutputFlags
.endif
rts rts
GetByte: GetByte:
.if HW_TYPE = 0
lda #$0d ;set read flag low lda #$0d ;set read flag low
sta OutputFlags sta OutputFlags
.endif
waitRead: waitRead:
lda InputFlags bit InputFlags
rol bmi waitRead
bcs waitRead
lda InputByte lda InputByte
.if HW_TYPE = 0
pha pha
lda #$0f ;set all flags high lda #$0f ;set all flags high
sta OutputFlags sta OutputFlags
finishRead: finishRead:
lda InputFlags bit InputFlags
rol bpl finishRead
bcc finishRead
pla pla
.endif
end: end:
rts rts

View File

@ -108,7 +108,7 @@ Current file: DriveFirmware.asm
00C758 1 A9 03 lda #GetTimeCommand 00C758 1 A9 03 lda #GetTimeCommand
00C75A 1 20 C0 C7 jsr SendByte 00C75A 1 20 C0 C7 jsr SendByte
00C75D 1 getTimeByte: 00C75D 1 getTimeByte:
00C75D 1 20 DE C7 jsr GetByte 00C75D 1 20 D8 C7 jsr GetByte
00C760 1 99 90 BF sta $bf90,y 00C760 1 99 90 BF sta $bf90,y
00C763 1 C8 iny 00C763 1 C8 iny
00C764 1 C0 04 cpy #$04 00C764 1 C0 04 cpy #$04
@ -132,7 +132,7 @@ Current file: DriveFirmware.asm
00C78A 1 60 rts 00C78A 1 60 rts
00C78B 1 00C78B 1
00C78B 1 read256: 00C78B 1 read256:
00C78B 1 20 DE C7 jsr GetByte 00C78B 1 20 D8 C7 jsr GetByte
00C78E 1 91 44 sta (BufferLo),y 00C78E 1 91 44 sta (BufferLo),y
00C790 1 C8 iny 00C790 1 C8 iny
00C791 1 D0 F8 bne read256 00C791 1 D0 F8 bne read256
@ -165,45 +165,44 @@ Current file: DriveFirmware.asm
00C7BF 1 60 rts 00C7BF 1 60 rts
00C7C0 1 00C7C0 1
00C7C0 1 SendByte: 00C7C0 1 SendByte:
00C7C0 1 48 pha 00C7C0 1 2C FB C0 bit InputFlags
00C7C1 1 waitWrite: 00C7C3 1 70 FB bvs SendByte
00C7C1 1 AD FB C0 lda InputFlags 00C7C5 1 8D FD C0 sta OutputByte
00C7C4 1 2A rol 00C7C8 1 .if HW_TYPE = 0
00C7C5 1 2A rol 00C7C8 1 A9 0E lda #$0e ; set bit 0 low to indicate write started
00C7C6 1 B0 F9 bcs waitWrite 00C7CA 1 8D F7 C0 sta OutputFlags
00C7C8 1 68 pla 00C7CD 1 finishWrite:
00C7C9 1 8D FD C0 sta OutputByte 00C7CD 1 2C FB C0 bit InputFlags
00C7CC 1 A9 0E lda #$0e ; set bit 0 low to indicate write started 00C7D0 1 50 FB bvc finishWrite
00C7CE 1 8D F7 C0 sta OutputFlags 00C7D2 1 A9 0F lda #$0f
00C7D1 1 finishWrite: 00C7D4 1 8D F7 C0 sta OutputFlags
00C7D1 1 AD FB C0 lda InputFlags 00C7D7 1 .endif
00C7D4 1 2A rol 00C7D7 1 60 rts
00C7D5 1 2A rol 00C7D8 1
00C7D6 1 90 F9 bcc finishWrite 00C7D8 1 GetByte:
00C7D8 1 A9 0F lda #$0f 00C7D8 1 .if HW_TYPE = 0
00C7D8 1 A9 0D lda #$0d ;set read flag low
00C7DA 1 8D F7 C0 sta OutputFlags 00C7DA 1 8D F7 C0 sta OutputFlags
00C7DD 1 60 rts 00C7DD 1 .endif
00C7DE 1 00C7DD 1 waitRead:
00C7DE 1 GetByte: 00C7DD 1 2C FB C0 bit InputFlags
00C7DE 1 A9 0D lda #$0d ;set read flag low 00C7E0 1 30 FB bmi waitRead
00C7E0 1 8D F7 C0 sta OutputFlags 00C7E2 1 AD FE C0 lda InputByte
00C7E3 1 waitRead: 00C7E5 1 .if HW_TYPE = 0
00C7E3 1 AD FB C0 lda InputFlags 00C7E5 1 48 pha
00C7E6 1 2A rol 00C7E6 1 A9 0F lda #$0f ;set all flags high
00C7E7 1 B0 FA bcs waitRead 00C7E8 1 8D F7 C0 sta OutputFlags
00C7E9 1 AD FE C0 lda InputByte 00C7EB 1 finishRead:
00C7EC 1 48 pha 00C7EB 1 2C FB C0 bit InputFlags
00C7ED 1 A9 0F lda #$0f ;set all flags high 00C7EE 1 10 FB bpl finishRead
00C7EF 1 8D F7 C0 sta OutputFlags 00C7F0 1 68 pla
00C7F2 1 finishRead: 00C7F1 1 .endif
00C7F2 1 AD FB C0 lda InputFlags 00C7F1 1 end:
00C7F5 1 2A rol 00C7F1 1 60 rts
00C7F6 1 90 FA bcc finishRead 00C7F2 1
00C7F8 1 68 pla 00C7F2 1 00 00 00 00 .repeat 251-<end
00C7F9 1 end: 00C7F6 1 00 00 00 00
00C7F9 1 60 rts 00C7FA 1 00 00
00C7FA 1
00C7FA 1 00 00 .repeat 251-<end
00C7FC 1 .byte 0 00C7FC 1 .byte 0
00C7FC 1 .endrepeat 00C7FC 1 .endrepeat
00C7FC 1 00C7FC 1

View File

@ -114,41 +114,36 @@ ExitToMonitor:
jsr Monitor jsr Monitor
SendByte: SendByte:
pha bit InputFlags
waitWrite: bvs SendByte
lda InputFlags
rol
rol
bcs waitWrite
pla
sta OutputByte sta OutputByte
.if HW_TYPE = 0
lda #$2e ; set bit 0 low to indicate write started lda #$2e ; set bit 0 low to indicate write started
sta OutputFlags sta OutputFlags
finishWrite: finishWrite:
lda InputFlags bit InputFlags
rol bvc finishWrite
rol
bcc finishWrite
lda #$2f lda #$2f
sta OutputFlags sta OutputFlags
.endif
rts rts
GetByte: GetByte:
lda #$2d ;set read flag low .if HW_TYPE = 0
sta OutputFlags ldx #$2d ;set read flag low
stx OutputFlags
.endif
waitRead: waitRead:
lda InputFlags bit InputFlags
rol bmi waitRead
bcs waitRead
lda InputByte lda InputByte
pha .if HW_TYPE = 0
lda #$2f ;set all flags high ldx #$2f ;set all flags high
sta OutputFlags stx OutputFlags
finishRead: finishRead:
lda InputFlags bit InputFlags
rol bpl finishRead
bcc finishRead .endif
pla
end: end:
rts rts

View File

@ -88,16 +88,16 @@ Current file: FileAccessFirmware.asm
00C73E 1 A9 00 lda #$00 00C73E 1 A9 00 lda #$00
00C740 1 20 74 C7 jsr SendByte 00C740 1 20 74 C7 jsr SendByte
00C743 1 00C743 1
00C743 1 20 92 C7 jsr GetByte 00C743 1 20 8C C7 jsr GetByte
00C746 1 85 46 sta BlockLo ; not really a block, just using the memory space 00C746 1 85 46 sta BlockLo ; not really a block, just using the memory space
00C748 1 20 92 C7 jsr GetByte 00C748 1 20 8C C7 jsr GetByte
00C74B 1 85 47 sta BlockHi 00C74B 1 85 47 sta BlockHi
00C74D 1 NextPage: 00C74D 1 NextPage:
00C74D 1 A5 47 lda BlockHi 00C74D 1 A5 47 lda BlockHi
00C74F 1 F0 10 beq ReadFinalPage 00C74F 1 F0 10 beq ReadFinalPage
00C751 1 A0 00 ldy #$00 00C751 1 A0 00 ldy #$00
00C753 1 NextByte: 00C753 1 NextByte:
00C753 1 20 92 C7 jsr GetByte 00C753 1 20 8C C7 jsr GetByte
00C756 1 91 44 sta (BufferLo),y 00C756 1 91 44 sta (BufferLo),y
00C758 1 C8 iny 00C758 1 C8 iny
00C759 1 D0 F8 bne NextByte 00C759 1 D0 F8 bne NextByte
@ -109,7 +109,7 @@ Current file: FileAccessFirmware.asm
00C763 1 F0 0C beq ExitToMonitor 00C763 1 F0 0C beq ExitToMonitor
00C765 1 A0 00 ldy #$00 00C765 1 A0 00 ldy #$00
00C767 1 NextByteFinal: 00C767 1 NextByteFinal:
00C767 1 20 92 C7 jsr GetByte 00C767 1 20 8C C7 jsr GetByte
00C76A 1 91 44 sta (BufferLo),y 00C76A 1 91 44 sta (BufferLo),y
00C76C 1 C8 iny 00C76C 1 C8 iny
00C76D 1 C4 46 cpy BlockLo 00C76D 1 C4 46 cpy BlockLo
@ -118,64 +118,61 @@ Current file: FileAccessFirmware.asm
00C771 1 20 59 FF jsr Monitor 00C771 1 20 59 FF jsr Monitor
00C774 1 00C774 1
00C774 1 SendByte: 00C774 1 SendByte:
00C774 1 48 pha 00C774 1 2C FB C0 bit InputFlags
00C775 1 waitWrite: 00C777 1 70 FB bvs SendByte
00C775 1 AD FB C0 lda InputFlags 00C779 1 8D FD C0 sta OutputByte
00C778 1 2A rol 00C77C 1 .if HW_TYPE = 0
00C779 1 2A rol 00C77C 1 A9 2E lda #$2e ; set bit 0 low to indicate write started
00C77A 1 B0 F9 bcs waitWrite 00C77E 1 8D F7 C0 sta OutputFlags
00C77C 1 68 pla 00C781 1 finishWrite:
00C77D 1 8D FD C0 sta OutputByte 00C781 1 2C FB C0 bit InputFlags
00C780 1 A9 2E lda #$2e ; set bit 0 low to indicate write started 00C784 1 50 FB bvc finishWrite
00C782 1 8D F7 C0 sta OutputFlags 00C786 1 A9 2F lda #$2f
00C785 1 finishWrite: 00C788 1 8D F7 C0 sta OutputFlags
00C785 1 AD FB C0 lda InputFlags 00C78B 1 .endif
00C788 1 2A rol 00C78B 1 60 rts
00C789 1 2A rol 00C78C 1
00C78A 1 90 F9 bcc finishWrite 00C78C 1 GetByte:
00C78C 1 A9 2F lda #$2f 00C78C 1 .if HW_TYPE = 0
00C78E 1 8D F7 C0 sta OutputFlags 00C78C 1 A2 2D ldx #$2d ;set read flag low
00C791 1 60 rts 00C78E 1 8E F7 C0 stx OutputFlags
00C792 1 00C791 1 .endif
00C792 1 GetByte: 00C791 1 waitRead:
00C792 1 A9 2D lda #$2d ;set read flag low 00C791 1 2C FB C0 bit InputFlags
00C794 1 8D F7 C0 sta OutputFlags 00C794 1 30 FB bmi waitRead
00C797 1 waitRead: 00C796 1 AD FE C0 lda InputByte
00C797 1 AD FB C0 lda InputFlags 00C799 1 .if HW_TYPE = 0
00C79A 1 2A rol 00C799 1 A2 2F ldx #$2f ;set all flags high
00C79B 1 B0 FA bcs waitRead 00C79B 1 8E F7 C0 stx OutputFlags
00C79D 1 AD FE C0 lda InputByte 00C79E 1 finishRead:
00C7A0 1 48 pha 00C79E 1 2C FB C0 bit InputFlags
00C7A1 1 A9 2F lda #$2f ;set all flags high 00C7A1 1 10 FB bpl finishRead
00C7A3 1 8D F7 C0 sta OutputFlags 00C7A3 1 .endif
00C7A6 1 finishRead: 00C7A3 1 end:
00C7A6 1 AD FB C0 lda InputFlags 00C7A3 1 60 rts
00C7A9 1 2A rol 00C7A4 1
00C7AA 1 90 FA bcc finishRead 00C7A4 1 00 00 00 00 .repeat 251-<end
00C7AC 1 68 pla 00C7A8 1 00 00 00 00
00C7AD 1 end: 00C7AC 1 00 00 00 00
00C7AD 1 60 rts 00C7B0 1 00 00 00 00
00C7AE 1 00C7B4 1 00 00 00 00
00C7AE 1 00 00 00 00 .repeat 251-<end 00C7B8 1 00 00 00 00
00C7B2 1 00 00 00 00 00C7BC 1 00 00 00 00
00C7B6 1 00 00 00 00 00C7C0 1 00 00 00 00
00C7BA 1 00 00 00 00 00C7C4 1 00 00 00 00
00C7BE 1 00 00 00 00 00C7C8 1 00 00 00 00
00C7C2 1 00 00 00 00 00C7CC 1 00 00 00 00
00C7C6 1 00 00 00 00 00C7D0 1 00 00 00 00
00C7CA 1 00 00 00 00 00C7D4 1 00 00 00 00
00C7CE 1 00 00 00 00 00C7D8 1 00 00 00 00
00C7D2 1 00 00 00 00 00C7DC 1 00 00 00 00
00C7D6 1 00 00 00 00 00C7E0 1 00 00 00 00
00C7DA 1 00 00 00 00 00C7E4 1 00 00 00 00
00C7DE 1 00 00 00 00 00C7E8 1 00 00 00 00
00C7E2 1 00 00 00 00 00C7EC 1 00 00 00 00
00C7E6 1 00 00 00 00 00C7F0 1 00 00 00 00
00C7EA 1 00 00 00 00 00C7F4 1 00 00 00 00
00C7EE 1 00 00 00 00 00C7F8 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 .byte 0
00C7FC 1 .endrepeat 00C7FC 1 .endrepeat
00C7FC 1 00C7FC 1

View File

@ -73,10 +73,11 @@ Start:
lda #$fd lda #$fd
sta $37 sta $37
;jsr Home ;clear screen and show menu options ;jsr Home ;clear screen and show menu options
lda #$10 lda #$02
sta vtab sta vtab
jsr BasCalc jsr BasCalc
ldy #$00 ldy #$00
sty htab
PrintString: PrintString:
lda Text,y lda Text,y
beq WaitForRPi beq WaitForRPi
@ -85,10 +86,11 @@ PrintString:
iny iny
bne PrintString bne PrintString
.if HW_TYPE = 0
WaitForRPi: WaitForRPi:
lda InputFlags bit InputFlags
rol bmi Reset
bcs Reset
lda #$ff lda #$ff
jsr Wait jsr Wait
lda #'.'+$80 lda #'.'+$80
@ -108,6 +110,37 @@ Reset:
beq Ok beq Ok
jmp Reset jmp Reset
.else
WaitForRPi:
@1:
bit InputFlags
bmi @2
lda InputByte
jmp @1
@2:
bit InputFlags
bpl @4
bvs @3
lda #ResetCommand
sta OutputByte
@3:
lda #$ff
jsr Wait
lda #'.'+$80
jsr PrintChar
jmp @2
@4:
lda #$ff
jsr Wait
@5:
bit InputFlags
bmi Ok
lda InputByte
jmp @5
.endif
Ok: Ok:
lda #$8D lda #$8D
jsr PrintChar jsr PrintChar
@ -121,50 +154,53 @@ Boot:
jmp PageJump jmp PageJump
SendByte: SendByte:
pha bit InputFlags
waitWrite: bvs SendByte
lda InputFlags
rol
rol
bcs waitWrite
pla
sta OutputByte sta OutputByte
.if HW_TYPE = 0
lda #$3e ; set bit 0 low to indicate write started lda #$3e ; set bit 0 low to indicate write started
sta OutputFlags sta OutputFlags
finishWrite: finishWrite:
lda InputFlags bit InputFlags
rol bvc finishWrite
rol
bcc finishWrite
lda #$3f lda #$3f
sta OutputFlags sta OutputFlags
.endif
rts rts
GetByte: GetByte:
lda #$3d ;set read flag low .if HW_TYPE = 0
sta OutputFlags ldx #$3d ;set read flag low
stx OutputFlags
.endif
waitRead: waitRead:
lda InputFlags bit InputFlags
rol bmi waitRead
bcs waitRead
lda InputByte lda InputByte
pha .if HW_TYPE = 0
lda #$3f ;set all flags high ldx #$3f ;set all flags high
sta OutputFlags stx OutputFlags
finishRead: finishRead:
lda InputFlags bit InputFlags
rol bpl finishRead
bcc finishRead .endif
pla
end:
rts rts
; NOTE: The text below exactly fills the remaining 256 bytes of firmware
Text: Text:
.byte "Apple2-IO-RPi",$8d .byte "Apple2-IO-RPi",$8d
.byte "(c)2020-2024 Terence J. Boldt",$8d .byte "(c)2020-2024 Terence J. Boldt",$8d
.byte $8d .byte $8d
.byte "Waiting for RPi FW:000F...",$00 .if HW_TYPE = 0
.byte "Waiting for RPi FW:0010..."
.else
.byte "Waiting for RPi FW:8010..."
.endif
end:
.byte $00
.repeat 251-<end
.byte 0
.endrepeat
.byte 0,0 ;0000 blocks = check status .byte 0,0 ;0000 blocks = check status
.byte 7 ;bit set(0=status 1=read 2=write) unset(3=format, 4/5=number of volumes, 6=interruptable, 7=removable) .byte 7 ;bit set(0=status 1=read 2=write) unset(3=format, 4/5=number of volumes, 6=interruptable, 7=removable)

View File

@ -77,114 +77,152 @@ Current file: MenuFirmware.asm
00C71D 1 A9 FD lda #$fd 00C71D 1 A9 FD lda #$fd
00C71F 1 85 37 sta $37 00C71F 1 85 37 sta $37
00C721 1 ;jsr Home ;clear screen and show menu options 00C721 1 ;jsr Home ;clear screen and show menu options
00C721 1 A9 10 lda #$10 00C721 1 A9 02 lda #$02
00C723 1 85 25 sta vtab 00C723 1 85 25 sta vtab
00C725 1 20 C1 FB jsr BasCalc 00C725 1 20 C1 FB jsr BasCalc
00C728 1 A0 00 ldy #$00 00C728 1 A0 00 ldy #$00
00C72A 1 PrintString: 00C72A 1 84 24 sty htab
00C72A 1 B9 B4 C7 lda Text,y 00C72C 1 PrintString:
00C72D 1 F0 08 beq WaitForRPi 00C72C 1 B9 AB C7 lda Text,y
00C72F 1 09 80 ora #$80 00C72F 1 F0 08 beq WaitForRPi
00C731 1 20 ED FD jsr PrintChar 00C731 1 09 80 ora #$80
00C734 1 C8 iny 00C733 1 20 ED FD jsr PrintChar
00C735 1 D0 F3 bne PrintString 00C736 1 C8 iny
00C737 1 00C737 1 D0 F3 bne PrintString
00C737 1 WaitForRPi: 00C739 1
00C737 1 AD FB C0 lda InputFlags 00C739 1 .if HW_TYPE = 0
00C73A 1 2A rol 00C739 1
00C73B 1 B0 0D bcs Reset 00C739 1 WaitForRPi:
00C73D 1 A9 FF lda #$ff 00C739 1 2C FB C0 bit InputFlags
00C73F 1 20 A8 FC jsr Wait 00C73C 1 30 0D bmi Reset
00C742 1 A9 AE lda #'.'+$80 00C73E 1 A9 FF lda #$ff
00C744 1 20 ED FD jsr PrintChar 00C740 1 20 A8 FC jsr Wait
00C747 1 4C 37 C7 jmp WaitForRPi 00C743 1 A9 AE lda #'.'+$80
00C74A 1 00C745 1 20 ED FD jsr PrintChar
00C74A 1 Reset: 00C748 1 4C 39 C7 jmp WaitForRPi
00C74A 1 A9 DF lda #'_'|$80 00C74B 1
00C74C 1 20 ED FD jsr PrintChar 00C74B 1 Reset:
00C74F 1 A9 00 lda #ResetCommand 00C74B 1 A9 DF lda #'_'|$80
00C751 1 20 7A C7 jsr SendByte 00C74D 1 20 ED FD jsr PrintChar
00C754 1 A9 88 lda #$88 00C750 1 A9 00 lda #ResetCommand
00C756 1 20 ED FD jsr PrintChar 00C752 1 20 7B C7 jsr SendByte
00C759 1 A9 AE lda #'.'|$80 00C755 1 A9 88 lda #$88
00C75B 1 20 ED FD jsr PrintChar 00C757 1 20 ED FD jsr PrintChar
00C75E 1 20 98 C7 jsr GetByte 00C75A 1 A9 AE lda #'.'|$80
00C761 1 F0 03 beq Ok 00C75C 1 20 ED FD jsr PrintChar
00C763 1 4C 4A C7 jmp Reset 00C75F 1 20 93 C7 jsr GetByte
00C766 1 00C762 1 F0 03 beq Ok
00C766 1 Ok: 00C764 1 4C 4B C7 jmp Reset
00C766 1 A9 8D lda #$8D 00C767 1
00C768 1 20 ED FD jsr PrintChar 00C767 1 .else
00C76B 1 A9 CF lda #'O'|$80 00C767 1
00C76D 1 20 ED FD jsr PrintChar 00C767 1 WaitForRPi:
00C770 1 A9 CB lda #'K'|$80 00C767 1 @1:
00C772 1 20 ED FD jsr PrintChar 00C767 1 bit InputFlags
00C775 1 00C767 1 bmi @2
00C775 1 Boot: 00C767 1 lda InputByte
00C775 1 A9 0F lda #$0f 00C767 1 jmp @1
00C777 1 4C 0E C7 jmp PageJump 00C767 1 @2:
00C77A 1 00C767 1 bit InputFlags
00C77A 1 SendByte: 00C767 1 bpl @4
00C77A 1 48 pha 00C767 1 bvs @3
00C77B 1 waitWrite: 00C767 1 lda #ResetCommand
00C77B 1 AD FB C0 lda InputFlags 00C767 1 sta OutputByte
00C77E 1 2A rol 00C767 1 @3:
00C77F 1 2A rol 00C767 1 lda #$ff
00C780 1 B0 F9 bcs waitWrite 00C767 1 jsr Wait
00C782 1 68 pla 00C767 1 lda #'.'+$80
00C783 1 8D FD C0 sta OutputByte 00C767 1 jsr PrintChar
00C786 1 A9 3E lda #$3e ; set bit 0 low to indicate write started 00C767 1 jmp @2
00C788 1 8D F7 C0 sta OutputFlags 00C767 1 @4:
00C78B 1 finishWrite: 00C767 1 lda #$ff
00C78B 1 AD FB C0 lda InputFlags 00C767 1 jsr Wait
00C78E 1 2A rol 00C767 1 @5:
00C78F 1 2A rol 00C767 1 bit InputFlags
00C790 1 90 F9 bcc finishWrite 00C767 1 bmi Ok
00C792 1 A9 3F lda #$3f 00C767 1 lda InputByte
00C794 1 8D F7 C0 sta OutputFlags 00C767 1 jmp @5
00C797 1 60 rts 00C767 1
00C798 1 00C767 1 .endif
00C798 1 GetByte: 00C767 1
00C798 1 A9 3D lda #$3d ;set read flag low 00C767 1 Ok:
00C79A 1 8D F7 C0 sta OutputFlags 00C767 1 A9 8D lda #$8D
00C79D 1 waitRead: 00C769 1 20 ED FD jsr PrintChar
00C79D 1 AD FB C0 lda InputFlags 00C76C 1 A9 CF lda #'O'|$80
00C7A0 1 2A rol 00C76E 1 20 ED FD jsr PrintChar
00C7A1 1 B0 FA bcs waitRead 00C771 1 A9 CB lda #'K'|$80
00C7A3 1 AD FE C0 lda InputByte 00C773 1 20 ED FD jsr PrintChar
00C7A6 1 48 pha 00C776 1
00C7A7 1 A9 3F lda #$3f ;set all flags high 00C776 1 Boot:
00C7A9 1 8D F7 C0 sta OutputFlags 00C776 1 A9 0F lda #$0f
00C7AC 1 finishRead: 00C778 1 4C 0E C7 jmp PageJump
00C7AC 1 AD FB C0 lda InputFlags 00C77B 1
00C7AF 1 2A rol 00C77B 1 SendByte:
00C7B0 1 90 FA bcc finishRead 00C77B 1 2C FB C0 bit InputFlags
00C7B2 1 68 pla 00C77E 1 70 FB bvs SendByte
00C7B3 1 end: 00C780 1 8D FD C0 sta OutputByte
00C7B3 1 60 rts 00C783 1 .if HW_TYPE = 0
00C7B4 1 00C783 1 A9 3E lda #$3e ; set bit 0 low to indicate write started
00C7B4 1 ; NOTE: The text below exactly fills the remaining 256 bytes of firmware 00C785 1 8D F7 C0 sta OutputFlags
00C7B4 1 Text: 00C788 1 finishWrite:
00C7B4 1 41 70 70 6C .byte "Apple2-IO-RPi",$8d 00C788 1 2C FB C0 bit InputFlags
00C7B8 1 65 32 2D 49 00C78B 1 50 FB bvc finishWrite
00C7BC 1 4F 2D 52 50 00C78D 1 A9 3F lda #$3f
00C7C0 1 69 8D 00C78F 1 8D F7 C0 sta OutputFlags
00C7C2 1 28 63 29 32 .byte "(c)2020-2024 Terence J. Boldt",$8d 00C792 1 .endif
00C7C6 1 30 32 30 2D 00C792 1 60 rts
00C7CA 1 32 30 32 34 00C793 1
00C7CE 1 20 54 65 72 00C793 1 GetByte:
00C7D2 1 65 6E 63 65 00C793 1 .if HW_TYPE = 0
00C7D6 1 20 4A 2E 20 00C793 1 A2 3D ldx #$3d ;set read flag low
00C7DA 1 42 6F 6C 64 00C795 1 8E F7 C0 stx OutputFlags
00C7DE 1 74 8D 00C798 1 .endif
00C7E0 1 8D .byte $8d 00C798 1 waitRead:
00C7E1 1 57 61 69 74 .byte "Waiting for RPi FW:000F...",$00 00C798 1 2C FB C0 bit InputFlags
00C7E5 1 69 6E 67 20 00C79B 1 30 FB bmi waitRead
00C7E9 1 66 6F 72 20 00C79D 1 AD FE C0 lda InputByte
00C7ED 1 52 50 69 20 00C7A0 1 .if HW_TYPE = 0
00C7F1 1 46 57 3A 30 00C7A0 1 A2 3F ldx #$3f ;set all flags high
00C7F5 1 30 30 46 2E 00C7A2 1 8E F7 C0 stx OutputFlags
00C7F9 1 2E 2E 00 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
00C7FC 1 00 00 .byte 0,0 ;0000 blocks = check status 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) 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)

View File

@ -222,6 +222,7 @@ waitWrite:
bcs waitWrite bcs waitWrite
pla pla
sta OutputByte,x sta OutputByte,x
.if HW_TYPE = 0
lda #$1e ; set bit 0 low to indicate write started lda #$1e ; set bit 0 low to indicate write started
sta OutputFlags,x sta OutputFlags,x
finishWrite: finishWrite:
@ -231,17 +232,21 @@ finishWrite:
bcc finishWrite bcc finishWrite
lda #$1f lda #$1f
sta OutputFlags,x sta OutputFlags,x
.endif
rts rts
GetByte: GetByte:
.if HW_TYPE = 0
lda #$1d ;set read flag low lda #$1d ;set read flag low
sta OutputFlags,x sta OutputFlags,x
.endif
waitRead: waitRead:
lda InputFlags,x lda InputFlags,x
rol rol
bcs waitRead bcs waitRead
readByte: readByte:
lda InputByte,x lda InputByte,x
.if HW_TYPE = 0
pha pha
lda #$1f ;set all flags high lda #$1f ;set all flags high
sta OutputFlags,x sta OutputFlags,x
@ -250,6 +255,7 @@ finishRead:
rol rol
bcc finishRead bcc finishRead
pla pla
.endif
clc ;success clc ;success
rts rts

View File

@ -232,6 +232,7 @@ Current file: RPi.Command.asm
000375 1 B0 F9 bcs waitWrite 000375 1 B0 F9 bcs waitWrite
000377 1 68 pla 000377 1 68 pla
000378 1 9D 8D C0 sta OutputByte,x 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 00037B 1 A9 1E lda #$1e ; set bit 0 low to indicate write started
00037D 1 9D 87 C0 sta OutputFlags,x 00037D 1 9D 87 C0 sta OutputFlags,x
000380 1 finishWrite: 000380 1 finishWrite:
@ -241,17 +242,21 @@ Current file: RPi.Command.asm
000385 1 90 F9 bcc finishWrite 000385 1 90 F9 bcc finishWrite
000387 1 A9 1F lda #$1f 000387 1 A9 1F lda #$1f
000389 1 9D 87 C0 sta OutputFlags,x 000389 1 9D 87 C0 sta OutputFlags,x
00038C 1 .endif
00038C 1 60 rts 00038C 1 60 rts
00038D 1 00038D 1
00038D 1 GetByte: 00038D 1 GetByte:
00038D 1 .if HW_TYPE = 0
00038D 1 A9 1D lda #$1d ;set read flag low 00038D 1 A9 1D lda #$1d ;set read flag low
00038F 1 9D 87 C0 sta OutputFlags,x 00038F 1 9D 87 C0 sta OutputFlags,x
000392 1 .endif
000392 1 waitRead: 000392 1 waitRead:
000392 1 BD 8B C0 lda InputFlags,x 000392 1 BD 8B C0 lda InputFlags,x
000395 1 2A rol 000395 1 2A rol
000396 1 B0 FA bcs waitRead 000396 1 B0 FA bcs waitRead
000398 1 readByte: 000398 1 readByte:
000398 1 BD 8E C0 lda InputByte,x 000398 1 BD 8E C0 lda InputByte,x
00039B 1 .if HW_TYPE = 0
00039B 1 48 pha 00039B 1 48 pha
00039C 1 A9 1F lda #$1f ;set all flags high 00039C 1 A9 1F lda #$1f ;set all flags high
00039E 1 9D 87 C0 sta OutputFlags,x 00039E 1 9D 87 C0 sta OutputFlags,x
@ -260,6 +265,7 @@ Current file: RPi.Command.asm
0003A4 1 2A rol 0003A4 1 2A rol
0003A5 1 90 FA bcc finishRead 0003A5 1 90 FA bcc finishRead
0003A7 1 68 pla 0003A7 1 68 pla
0003A8 1 .endif
0003A8 1 18 clc ;success 0003A8 1 18 clc ;success
0003A9 1 60 rts 0003A9 1 60 rts
0003AA 1 0003AA 1

View File

@ -110,8 +110,8 @@ Start:
lda LastChar lda LastChar
pha pha
bit ClearKeyboard bit ClearKeyboard
lda #ResetCommand ; lda #ResetCommand
jsr SendByte ; jsr SendByte
lda #ShellCommand lda #ShellCommand
jsr SendByte jsr SendByte
jsr DumpOutput jsr DumpOutput
@ -183,6 +183,7 @@ waitWrite:
bcs waitWrite bcs waitWrite
pla pla
sta OutputByte,x sta OutputByte,x
.if HW_TYPE = 0
lda #$1e ; set bit 0 low to indicate write started lda #$1e ; set bit 0 low to indicate write started
sta OutputFlags,x sta OutputFlags,x
finishWrite: finishWrite:
@ -192,11 +193,14 @@ finishWrite:
bcc finishWrite bcc finishWrite
lda #$1f lda #$1f
sta OutputFlags,x sta OutputFlags,x
.endif
rts rts
GetByte: GetByte:
.if HW_TYPE = 0
lda #$1d ;set read flag low lda #$1d ;set read flag low
sta OutputFlags,x sta OutputFlags,x
.endif
waitRead: waitRead:
lda InputFlags,x lda InputFlags,x
rol rol
@ -204,10 +208,15 @@ waitRead:
bit Keyboard ;keypress will abort waiting to read bit Keyboard ;keypress will abort waiting to read
bpl waitRead bpl waitRead
keyPressed: keyPressed:
lda InputFlags,x
rol
rol
bcs keyPressed
lda Keyboard ;send keypress to RPi lda Keyboard ;send keypress to RPi
and #$7f and #$7f
sta OutputByte,x sta OutputByte,x
bit ClearKeyboard bit ClearKeyboard
.if HW_TYPE = 0
lda #$1c ;set write flag low too lda #$1c ;set write flag low too
sta OutputFlags,x sta OutputFlags,x
finishKeyPress: finishKeyPress:
@ -217,9 +226,11 @@ finishKeyPress:
bcc finishKeyPress bcc finishKeyPress
lda #$1d ;set flags back for reading lda #$1d ;set flags back for reading
sta OutputFlags,x sta OutputFlags,x
.endif
jmp waitRead jmp waitRead
readByte: readByte:
lda InputByte,x lda InputByte,x
.if HW_TYPE = 0
pha pha
lda #$1f ;set all flags high lda #$1f ;set all flags high
sta OutputFlags,x sta OutputFlags,x
@ -228,6 +239,7 @@ finishRead:
rol rol
bcc finishRead bcc finishRead
pla pla
.endif
clc ;success clc ;success
end: end:
rts rts
@ -278,7 +290,11 @@ restoreChar:
rts rts
Text: Text:
.byte "Apple2-IO-RPi Shell Version 000E",$8d .if HW_TYPE = 0
.byte "Apple2-IO-RPi Shell Version 000F",$8d
.else
.byte "Apple2-IO-RPi Shell Version 800F",$8d
.endif
.byte "(c)2020-2024 Terence J. Boldt",$8d .byte "(c)2020-2024 Terence J. Boldt",$8d
.byte $8d .byte $8d
.byte $00 .byte $00

View File

@ -103,7 +103,7 @@ Current file: Shell.asm
002036 1 002036 1
002036 1 A0 00 ldy #$00 002036 1 A0 00 ldy #$00
002038 1 PrintString: 002038 1 PrintString:
002038 1 B9 71 21 lda Text,y 002038 1 B9 73 21 lda Text,y
00203B 1 F0 08 beq Start 00203B 1 F0 08 beq Start
00203D 1 09 80 ora #$80 00203D 1 09 80 ora #$80
00203F 1 20 ED FD jsr PrintChar 00203F 1 20 ED FD jsr PrintChar
@ -114,180 +114,196 @@ Current file: Shell.asm
002045 1 A5 06 lda LastChar 002045 1 A5 06 lda LastChar
002047 1 48 pha 002047 1 48 pha
002048 1 2C 10 C0 bit ClearKeyboard 002048 1 2C 10 C0 bit ClearKeyboard
00204B 1 A9 00 lda #ResetCommand 00204B 1 ; lda #ResetCommand
00204D 1 20 CC 20 jsr SendByte 00204B 1 ; jsr SendByte
002050 1 A9 09 lda #ShellCommand 00204B 1 A9 09 lda #ShellCommand
002052 1 20 CC 20 jsr SendByte 00204D 1 20 C7 20 jsr SendByte
002055 1 20 5C 20 jsr DumpOutput 002050 1 20 57 20 jsr DumpOutput
002058 1 68 pla 002053 1 68 pla
002059 1 85 06 sta LastChar 002054 1 85 06 sta LastChar
00205B 1 60 rts 002056 1 60 rts
00205C 1 002057 1
00205C 1 DumpOutput: 002057 1 DumpOutput:
00205C 1 20 EA 20 jsr GetByte 002057 1 20 E5 20 jsr GetByte
00205F 1 C9 00 cmp #$00 00205A 1 C9 00 cmp #$00
002061 1 F0 26 beq endOutput 00205C 1 F0 26 beq endOutput
002063 1 48 pha 00205E 1 48 pha
002064 1 20 5C 21 jsr ClearCursor 00205F 1 20 5E 21 jsr ClearCursor
002067 1 68 pla 002062 1 68 pla
002068 1 C9 48 cmp #'H' 002063 1 C9 48 cmp #'H'
00206A 1 F0 27 beq setColumn 002065 1 F0 27 beq setColumn
00206C 1 C9 56 cmp #'V' 002067 1 C9 56 cmp #'V'
00206E 1 F0 31 beq setRow 002069 1 F0 31 beq setRow
002070 1 C9 43 cmp #'C' 00206B 1 C9 43 cmp #'C'
002072 1 F0 16 beq clearScreen 00206D 1 F0 16 beq clearScreen
002074 1 C9 54 cmp #'T' 00206F 1 C9 54 cmp #'T'
002076 1 F0 37 beq setTop 002071 1 F0 37 beq setTop
002078 1 C9 42 cmp #'B' 002073 1 C9 42 cmp #'B'
00207A 1 F0 3B beq setBottom 002075 1 F0 3B beq setBottom
00207C 1 C9 55 cmp #'U' 002077 1 C9 55 cmp #'U'
00207E 1 F0 3F beq moveUp 002079 1 F0 3F beq moveUp
002080 1 20 ED FD jsr PrintChar 00207B 1 20 ED FD jsr PrintChar
002083 1 20 2B 21 jsr SetCursor 00207E 1 20 2D 21 jsr SetCursor
002086 1 4C 5C 20 jmp DumpOutput 002081 1 4C 57 20 jmp DumpOutput
002089 1 endOutput: 002084 1 endOutput:
002089 1 60 rts 002084 1 60 rts
00208A 1 clearScreen: 002085 1 clearScreen:
00208A 1 20 58 FC jsr Home 002085 1 20 58 FC jsr Home
00208D 1 20 2B 21 jsr SetCursor 002088 1 20 2D 21 jsr SetCursor
002090 1 4C 5C 20 jmp DumpOutput 00208B 1 4C 57 20 jmp DumpOutput
002093 1 setColumn: 00208E 1 setColumn:
002093 1 20 EA 20 jsr GetByte 00208E 1 20 E5 20 jsr GetByte
002096 1 85 24 sta htab 002091 1 85 24 sta htab
002098 1 8D 7B 05 sta htab80 002093 1 8D 7B 05 sta htab80
00209B 1 20 2B 21 jsr SetCursor 002096 1 20 2D 21 jsr SetCursor
00209E 1 4C 5C 20 jmp DumpOutput 002099 1 4C 57 20 jmp DumpOutput
0020A1 1 setRow: 00209C 1 setRow:
0020A1 1 20 EA 20 jsr GetByte 00209C 1 20 E5 20 jsr GetByte
0020A4 1 85 25 sta vtab 00209F 1 85 25 sta vtab
0020A6 1 20 C1 FB jsr BasCalc 0020A1 1 20 C1 FB jsr BasCalc
0020A9 1 20 2B 21 jsr SetCursor 0020A4 1 20 2D 21 jsr SetCursor
0020AC 1 4C 5C 20 jmp DumpOutput 0020A7 1 4C 57 20 jmp DumpOutput
0020AF 1 setTop: 0020AA 1 setTop:
0020AF 1 20 EA 20 jsr GetByte 0020AA 1 20 E5 20 jsr GetByte
0020B2 1 85 22 sta $22 0020AD 1 85 22 sta $22
0020B4 1 4C 5C 20 jmp DumpOutput 0020AF 1 4C 57 20 jmp DumpOutput
0020B7 1 setBottom: 0020B2 1 setBottom:
0020B7 1 20 EA 20 jsr GetByte 0020B2 1 20 E5 20 jsr GetByte
0020BA 1 85 23 sta $23 0020B5 1 85 23 sta $23
0020BC 1 4C 5C 20 jmp DumpOutput 0020B7 1 4C 57 20 jmp DumpOutput
0020BF 1 moveUp: 0020BA 1 moveUp:
0020BF 1 C6 25 dec vtab 0020BA 1 C6 25 dec vtab
0020C1 1 A5 25 lda vtab 0020BC 1 A5 25 lda vtab
0020C3 1 20 C1 FB jsr BasCalc 0020BE 1 20 C1 FB jsr BasCalc
0020C6 1 20 2B 21 jsr SetCursor 0020C1 1 20 2D 21 jsr SetCursor
0020C9 1 4C 5C 20 jmp DumpOutput 0020C4 1 4C 57 20 jmp DumpOutput
0020CC 1 0020C7 1
0020CC 1 SendByte: 0020C7 1 SendByte:
0020CC 1 48 pha 0020C7 1 48 pha
0020CD 1 waitWrite: 0020C8 1 waitWrite:
0020CD 1 BD 8B C0 lda InputFlags,x 0020C8 1 BD 8B C0 lda InputFlags,x
0020D0 1 2A rol 0020CB 1 2A rol
0020D1 1 2A rol 0020CC 1 2A rol
0020D2 1 B0 F9 bcs waitWrite 0020CD 1 B0 F9 bcs waitWrite
0020D4 1 68 pla 0020CF 1 68 pla
0020D5 1 9D 8D C0 sta OutputByte,x 0020D0 1 9D 8D C0 sta OutputByte,x
0020D8 1 A9 1E lda #$1e ; set bit 0 low to indicate write started 0020D3 1 .if HW_TYPE = 0
0020DA 1 9D 87 C0 sta OutputFlags,x 0020D3 1 A9 1E lda #$1e ; set bit 0 low to indicate write started
0020DD 1 finishWrite: 0020D5 1 9D 87 C0 sta OutputFlags,x
0020DD 1 BD 8B C0 lda InputFlags,x 0020D8 1 finishWrite:
0020E0 1 2A rol 0020D8 1 BD 8B C0 lda InputFlags,x
0020E1 1 2A rol 0020DB 1 2A rol
0020E2 1 90 F9 bcc finishWrite 0020DC 1 2A rol
0020E4 1 A9 1F lda #$1f 0020DD 1 90 F9 bcc finishWrite
0020E6 1 9D 87 C0 sta OutputFlags,x 0020DF 1 A9 1F lda #$1f
0020E9 1 60 rts 0020E1 1 9D 87 C0 sta OutputFlags,x
0020EA 1 0020E4 1 .endif
0020EA 1 GetByte: 0020E4 1 60 rts
0020EA 1 A9 1D lda #$1d ;set read flag low 0020E5 1
0020EC 1 9D 87 C0 sta OutputFlags,x 0020E5 1 GetByte:
0020EF 1 waitRead: 0020E5 1 .if HW_TYPE = 0
0020EF 1 BD 8B C0 lda InputFlags,x 0020E5 1 A9 1D lda #$1d ;set read flag low
0020F2 1 2A rol 0020E7 1 9D 87 C0 sta OutputFlags,x
0020F3 1 90 24 bcc readByte 0020EA 1 .endif
0020F5 1 2C 00 C0 bit Keyboard ;keypress will abort waiting to read 0020EA 1 waitRead:
0020F8 1 10 F5 bpl waitRead 0020EA 1 BD 8B C0 lda InputFlags,x
0020FA 1 keyPressed: 0020ED 1 2A rol
0020FA 1 AD 00 C0 lda Keyboard ;send keypress to RPi 0020EE 1 90 2B bcc readByte
0020FD 1 29 7F and #$7f 0020F0 1 2C 00 C0 bit Keyboard ;keypress will abort waiting to read
0020FF 1 9D 8D C0 sta OutputByte,x 0020F3 1 10 F5 bpl waitRead
002102 1 2C 10 C0 bit ClearKeyboard 0020F5 1 keyPressed:
002105 1 A9 1C lda #$1c ;set write flag low too 0020F5 1 BD 8B C0 lda InputFlags,x
002107 1 9D 87 C0 sta OutputFlags,x 0020F8 1 2A rol
00210A 1 finishKeyPress: 0020F9 1 2A rol
00210A 1 BD 8B C0 lda InputFlags,x 0020FA 1 B0 F9 bcs keyPressed
00210D 1 2A rol 0020FC 1 AD 00 C0 lda Keyboard ;send keypress to RPi
00210E 1 2A rol 0020FF 1 29 7F and #$7f
00210F 1 90 F9 bcc finishKeyPress 002101 1 9D 8D C0 sta OutputByte,x
002111 1 A9 1D lda #$1d ;set flags back for reading 002104 1 2C 10 C0 bit ClearKeyboard
002113 1 9D 87 C0 sta OutputFlags,x 002107 1 .if HW_TYPE = 0
002116 1 4C EF 20 jmp waitRead 002107 1 A9 1C lda #$1c ;set write flag low too
002119 1 readByte: 002109 1 9D 87 C0 sta OutputFlags,x
002119 1 BD 8E C0 lda InputByte,x 00210C 1 finishKeyPress:
00211C 1 48 pha 00210C 1 BD 8B C0 lda InputFlags,x
00211D 1 A9 1F lda #$1f ;set all flags high 00210F 1 2A rol
00211F 1 9D 87 C0 sta OutputFlags,x 002110 1 2A rol
002122 1 finishRead: 002111 1 90 F9 bcc finishKeyPress
002122 1 BD 8B C0 lda InputFlags,x 002113 1 A9 1D lda #$1d ;set flags back for reading
002125 1 2A rol 002115 1 9D 87 C0 sta OutputFlags,x
002126 1 90 FA bcc finishRead 002118 1 .endif
002128 1 68 pla 002118 1 4C EA 20 jmp waitRead
002129 1 18 clc ;success 00211B 1 readByte:
00212A 1 end: 00211B 1 BD 8E C0 lda InputByte,x
00212A 1 60 rts 00211E 1 .if HW_TYPE = 0
00212B 1 00211E 1 48 pha
00212B 1 SetCursor: 00211F 1 A9 1F lda #$1f ;set all flags high
00212B 1 AD 7B 05 lda htab80 ;get horizontal location / 2 002121 1 9D 87 C0 sta OutputFlags,x
00212E 1 4A lsr 002124 1 finishRead:
00212F 1 A8 tay 002124 1 BD 8B C0 lda InputFlags,x
002130 1 AD 55 C0 lda TextPage2 002127 1 2A rol
002133 1 90 03 bcc setChar 002128 1 90 FA bcc finishRead
002135 1 AD 54 C0 lda TextPage1 00212A 1 68 pla
002138 1 setChar: 00212B 1 .endif
002138 1 B1 28 lda (BasL),y 00212B 1 18 clc ;success
00213A 1 85 06 sta LastChar ; save so ClearCursor will pick it up 00212C 1 end:
00213C 1 C9 E0 cmp #$e0 00212C 1 60 rts
00213E 1 10 0C bpl lowerCase 00212D 1
002140 1 C9 C0 cmp #$c0 00212D 1 SetCursor:
002142 1 10 0D bpl upperCase 00212D 1 AD 7B 05 lda htab80 ;get horizontal location / 2
002144 1 C9 A0 cmp #$a0 002130 1 4A lsr
002146 1 10 04 bpl symbol 002131 1 A8 tay
002148 1 C9 80 cmp #$80 002132 1 AD 55 C0 lda TextPage2
00214A 1 10 0A bpl noop 002135 1 90 03 bcc setChar
00214C 1 symbol: 002137 1 AD 54 C0 lda TextPage1
00214C 1 lowerCase: 00213A 1 setChar:
00214C 1 invert: 00213A 1 B1 28 lda (BasL),y
00214C 1 49 80 eor #$80 00213C 1 85 06 sta LastChar ; save so ClearCursor will pick it up
00214E 1 4C 56 21 jmp storeChar 00213E 1 C9 E0 cmp #$e0
002151 1 upperCase: 002140 1 10 0C bpl lowerCase
002151 1 29 1F and #$1f 002142 1 C9 C0 cmp #$c0
002153 1 4C 56 21 jmp storeChar 002144 1 10 0D bpl upperCase
002156 1 noop: 002146 1 C9 A0 cmp #$a0
002156 1 storeChar: 002148 1 10 04 bpl symbol
002156 1 91 28 sta (BasL),y 00214A 1 C9 80 cmp #$80
002158 1 AD 54 C0 lda TextPage1 00214C 1 10 0A bpl noop
00215B 1 60 rts 00214E 1 symbol:
00215C 1 00214E 1 lowerCase:
00215C 1 ClearCursor: 00214E 1 invert:
00215C 1 AD 7B 05 lda htab80 ;get horizontal location / 2 00214E 1 49 80 eor #$80
00215F 1 4A lsr 002150 1 4C 58 21 jmp storeChar
002160 1 A8 tay 002153 1 upperCase:
002161 1 AD 55 C0 lda TextPage2 002153 1 29 1F and #$1f
002164 1 90 03 bcc restoreChar 002155 1 4C 58 21 jmp storeChar
002166 1 AD 54 C0 lda TextPage1 002158 1 noop:
002169 1 restoreChar: 002158 1 storeChar:
002169 1 A5 06 lda LastChar 002158 1 91 28 sta (BasL),y
00216B 1 91 28 sta (BasL),y 00215A 1 AD 54 C0 lda TextPage1
00216D 1 AD 54 C0 lda TextPage1 00215D 1 60 rts
002170 1 60 rts 00215E 1
002171 1 00215E 1 ClearCursor:
002171 1 Text: 00215E 1 AD 7B 05 lda htab80 ;get horizontal location / 2
002171 1 41 70 70 6C .byte "Apple2-IO-RPi Shell Version 000E",$8d 002161 1 4A lsr
002175 1 65 32 2D 49 002162 1 A8 tay
002179 1 4F 2D 52 50 002163 1 AD 55 C0 lda TextPage2
002192 1 28 63 29 32 .byte "(c)2020-2024 Terence J. Boldt",$8d 002166 1 90 03 bcc restoreChar
002196 1 30 32 30 2D 002168 1 AD 54 C0 lda TextPage1
00219A 1 32 30 32 34 00216B 1 restoreChar:
0021B0 1 8D .byte $8d 00216B 1 A5 06 lda LastChar
0021B1 1 00 .byte $00 00216D 1 91 28 sta (BasL),y
0021B1 1 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

105
Apple2/assemble.cmd Normal file
View File

@ -0,0 +1,105 @@
@if "%1" == "" (set HW_TYPE=0) else (set HW_TYPE=%1)
ca65 DriveFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=0 -o DriveSlot0.o
@if errorlevel 1 goto exit
ca65 DriveFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=1 -o DriveSlot1.o
@if errorlevel 1 goto exit
ca65 DriveFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=2 -o DriveSlot2.o
@if errorlevel 1 goto exit
ca65 DriveFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=3 -o DriveSlot3.o
@if errorlevel 1 goto exit
ca65 DriveFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=4 -o DriveSlot4.o
@if errorlevel 1 goto exit
ca65 DriveFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=5 -o DriveSlot5.o
@if errorlevel 1 goto exit
ca65 DriveFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=6 -o DriveSlot6.o
@if errorlevel 1 goto exit
ca65 DriveFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=7 -o DriveSlot7.o --listing DriveFirmware.lst --list-bytes 255
@if errorlevel 1 goto exit
ld65 DriveSlot0.o DriveSlot1.o DriveSlot2.o DriveSlot3.o DriveSlot4.o DriveSlot5.o DriveSlot6.o DriveSlot7.o -o DriveFirmware.bin -C ../.cicd/none.cfg
@if errorlevel 1 goto exit
ca65 MenuFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=0 -o MenuSlot0.o
@if errorlevel 1 goto exit
ca65 MenuFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=1 -o MenuSlot1.o
@if errorlevel 1 goto exit
ca65 MenuFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=2 -o MenuSlot2.o
@if errorlevel 1 goto exit
ca65 MenuFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=3 -o MenuSlot3.o
@if errorlevel 1 goto exit
ca65 MenuFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=4 -o MenuSlot4.o
@if errorlevel 1 goto exit
ca65 MenuFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=5 -o MenuSlot5.o
@if errorlevel 1 goto exit
ca65 MenuFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=6 -o MenuSlot6.o
@if errorlevel 1 goto exit
ca65 MenuFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=7 -o MenuSlot7.o --listing MenuFirmware.lst --list-bytes 255
@if errorlevel 1 goto exit
ld65 MenuSlot0.o MenuSlot1.o MenuSlot2.o MenuSlot3.o MenuSlot4.o MenuSlot5.o MenuSlot6.o MenuSlot7.o -o MenuFirmware.bin -C ../.cicd/none.cfg
@if errorlevel 1 goto exit
ca65 CommandFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=0 -o CommandSlot0.o
@if errorlevel 1 goto exit
ca65 CommandFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=1 -o CommandSlot1.o
@if errorlevel 1 goto exit
ca65 CommandFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=2 -o CommandSlot2.o
@if errorlevel 1 goto exit
ca65 CommandFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=3 -o CommandSlot3.o
@if errorlevel 1 goto exit
ca65 CommandFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=4 -o CommandSlot4.o
@if errorlevel 1 goto exit
ca65 CommandFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=5 -o CommandSlot5.o
@if errorlevel 1 goto exit
ca65 CommandFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=6 -o CommandSlot6.o
@if errorlevel 1 goto exit
ca65 CommandFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=7 -o CommandSlot7.o --listing CommandFirmware.lst --list-bytes 255
@if errorlevel 1 goto exit
ld65 CommandSlot0.o CommandSlot1.o CommandSlot2.o CommandSlot3.o CommandSlot4.o CommandSlot5.o CommandSlot6.o CommandSlot7.o -o CommandFirmware.bin -C ../.cicd/none.cfg
@if errorlevel 1 goto exit
ca65 FileAccessFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=0 -o FileAccessSlot0.o
@if errorlevel 1 goto exit
ca65 FileAccessFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=1 -o FileAccessSlot1.o
@if errorlevel 1 goto exit
ca65 FileAccessFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=2 -o FileAccessSlot2.o
@if errorlevel 1 goto exit
ca65 FileAccessFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=3 -o FileAccessSlot3.o
@if errorlevel 1 goto exit
ca65 FileAccessFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=4 -o FileAccessSlot4.o
@if errorlevel 1 goto exit
ca65 FileAccessFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=5 -o FileAccessSlot5.o
@if errorlevel 1 goto exit
ca65 FileAccessFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=6 -o FileAccessSlot6.o
@if errorlevel 1 goto exit
ca65 FileAccessFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=7 -o FileAccessSlot7.o --listing FileAccessFirmware.lst --list-bytes 255
@if errorlevel 1 goto exit
ld65 FileAccessSlot0.o FileAccessSlot1.o FileAccessSlot2.o FileAccessSlot3.o FileAccessSlot4.o FileAccessSlot5.o FileAccessSlot6.o FileAccessSlot7.o -o FileAccessFirmware.bin -C ../.cicd/none.cfg
@if errorlevel 1 goto exit
copy /b DriveFirmware.bin + CommandFirmware.bin + FileAccessFirmware.bin + MenuFirmware.bin AT28C64B.bin
ca65 Shell.asm -D HW_TYPE=%HW_TYPE% -o Shell.o --listing Shell.lst
@if errorlevel 1 goto exit
ld65 Shell.o -o Shell.bin -C ../.cicd/none.cfg
@if errorlevel 1 goto exit
ca65 RPi.Command.asm -D HW_TYPE=%HW_TYPE% -o RPi.Command.o --listing RPi.Command.lst
@if errorlevel 1 goto exit
ld65 RPi.Command.o -o RPi.Command.bin -C ../.cicd/none.cfg
@if errorlevel 1 goto exit
del *.o
del DriveFirmware.bin
del MenuFirmware.bin
del CommandFirmware.bin
del FileAccessFirmware.bin
ProDOS-Utilities -d ../RaspberryPi/Apple2-IO-RPi.hdv -c put -i AT28C64B.bin -p /APPLE2.IO.RPI/AT28C64B.BIN
@if errorlevel 1 goto exit
ProDOS-Utilities -d ../RaspberryPi/Apple2-IO-RPi.hdv -c put -i Shell.bin -p /APPLE2.IO.RPI/SHELL
@if errorlevel 1 goto exit
ProDOS-Utilities -d ../RaspberryPi/Apple2-IO-RPi.hdv -c put -i RPi.Command.bin -p /APPLE2.IO.RPI/RPI.COMMAND -a 0x2000
@if errorlevel 1 goto exit
ProDOS-Utilities -d ../RaspberryPi/Apple2-IO-RPi.hdv -c ls
:exit

View File

@ -1,52 +1,54 @@
#!/bin/sh #!/bin/sh
ca65 DriveFirmware.asm -D SLOT=0 -o DriveSlot0.o || exit 1 HW_TYPE=${1-0}
ca65 DriveFirmware.asm -D SLOT=1 -o DriveSlot1.o || exit 1
ca65 DriveFirmware.asm -D SLOT=2 -o DriveSlot2.o || exit 1 ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=0 -o DriveSlot0.o || exit 1
ca65 DriveFirmware.asm -D SLOT=3 -o DriveSlot3.o || exit 1 ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=1 -o DriveSlot1.o || exit 1
ca65 DriveFirmware.asm -D SLOT=4 -o DriveSlot4.o || exit 1 ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=2 -o DriveSlot2.o || exit 1
ca65 DriveFirmware.asm -D SLOT=5 -o DriveSlot5.o || exit 1 ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=3 -o DriveSlot3.o || exit 1
ca65 DriveFirmware.asm -D SLOT=6 -o DriveSlot6.o || exit 1 ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=4 -o DriveSlot4.o || exit 1
ca65 DriveFirmware.asm -D SLOT=7 -o DriveSlot7.o --listing DriveFirmware.lst --list-bytes 255 || exit 1 ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=5 -o DriveSlot5.o || exit 1
ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=6 -o DriveSlot6.o || exit 1
ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=7 -o DriveSlot7.o --listing DriveFirmware.lst --list-bytes 255 || exit 1
ld65 DriveSlot0.o DriveSlot1.o DriveSlot2.o DriveSlot3.o DriveSlot4.o DriveSlot5.o DriveSlot6.o DriveSlot7.o -o DriveFirmware.bin -C ../.cicd/none.cfg || exit 1 ld65 DriveSlot0.o DriveSlot1.o DriveSlot2.o DriveSlot3.o DriveSlot4.o DriveSlot5.o DriveSlot6.o DriveSlot7.o -o DriveFirmware.bin -C ../.cicd/none.cfg || exit 1
ca65 MenuFirmware.asm -D SLOT=0 -o MenuSlot0.o || exit 1 ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=0 -o MenuSlot0.o || exit 1
ca65 MenuFirmware.asm -D SLOT=1 -o MenuSlot1.o || exit 1 ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=1 -o MenuSlot1.o || exit 1
ca65 MenuFirmware.asm -D SLOT=2 -o MenuSlot2.o || exit 1 ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=2 -o MenuSlot2.o || exit 1
ca65 MenuFirmware.asm -D SLOT=3 -o MenuSlot3.o || exit 1 ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=3 -o MenuSlot3.o || exit 1
ca65 MenuFirmware.asm -D SLOT=4 -o MenuSlot4.o || exit 1 ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=4 -o MenuSlot4.o || exit 1
ca65 MenuFirmware.asm -D SLOT=5 -o MenuSlot5.o || exit 1 ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=5 -o MenuSlot5.o || exit 1
ca65 MenuFirmware.asm -D SLOT=6 -o MenuSlot6.o || exit 1 ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=6 -o MenuSlot6.o || exit 1
ca65 MenuFirmware.asm -D SLOT=7 -o MenuSlot7.o --listing MenuFirmware.lst --list-bytes 255 || exit 1 ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=7 -o MenuSlot7.o --listing MenuFirmware.lst --list-bytes 255 || exit 1
ld65 MenuSlot0.o MenuSlot1.o MenuSlot2.o MenuSlot3.o MenuSlot4.o MenuSlot5.o MenuSlot6.o MenuSlot7.o -o MenuFirmware.bin -C ../.cicd/none.cfg || exit 1 ld65 MenuSlot0.o MenuSlot1.o MenuSlot2.o MenuSlot3.o MenuSlot4.o MenuSlot5.o MenuSlot6.o MenuSlot7.o -o MenuFirmware.bin -C ../.cicd/none.cfg || exit 1
ca65 CommandFirmware.asm -D SLOT=0 -o CommandSlot0.o || exit 1 ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=0 -o CommandSlot0.o || exit 1
ca65 CommandFirmware.asm -D SLOT=1 -o CommandSlot1.o || exit 1 ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=1 -o CommandSlot1.o || exit 1
ca65 CommandFirmware.asm -D SLOT=2 -o CommandSlot2.o || exit 1 ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=2 -o CommandSlot2.o || exit 1
ca65 CommandFirmware.asm -D SLOT=3 -o CommandSlot3.o || exit 1 ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=3 -o CommandSlot3.o || exit 1
ca65 CommandFirmware.asm -D SLOT=4 -o CommandSlot4.o || exit 1 ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=4 -o CommandSlot4.o || exit 1
ca65 CommandFirmware.asm -D SLOT=5 -o CommandSlot5.o || exit 1 ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=5 -o CommandSlot5.o || exit 1
ca65 CommandFirmware.asm -D SLOT=6 -o CommandSlot6.o || exit 1 ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=6 -o CommandSlot6.o || exit 1
ca65 CommandFirmware.asm -D SLOT=7 -o CommandSlot7.o --listing CommandFirmware.lst --list-bytes 255 || exit 1 ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=7 -o CommandSlot7.o --listing CommandFirmware.lst --list-bytes 255 || exit 1
ld65 CommandSlot0.o CommandSlot1.o CommandSlot2.o CommandSlot3.o CommandSlot4.o CommandSlot5.o CommandSlot6.o CommandSlot7.o -o CommandFirmware.bin -C ../.cicd/none.cfg || exit 1 ld65 CommandSlot0.o CommandSlot1.o CommandSlot2.o CommandSlot3.o CommandSlot4.o CommandSlot5.o CommandSlot6.o CommandSlot7.o -o CommandFirmware.bin -C ../.cicd/none.cfg || exit 1
ca65 FileAccessFirmware.asm -D SLOT=0 -o FileAccessSlot0.o || exit 1 ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=0 -o FileAccessSlot0.o || exit 1
ca65 FileAccessFirmware.asm -D SLOT=1 -o FileAccessSlot1.o || exit 1 ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=1 -o FileAccessSlot1.o || exit 1
ca65 FileAccessFirmware.asm -D SLOT=2 -o FileAccessSlot2.o || exit 1 ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=2 -o FileAccessSlot2.o || exit 1
ca65 FileAccessFirmware.asm -D SLOT=3 -o FileAccessSlot3.o || exit 1 ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=3 -o FileAccessSlot3.o || exit 1
ca65 FileAccessFirmware.asm -D SLOT=4 -o FileAccessSlot4.o || exit 1 ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=4 -o FileAccessSlot4.o || exit 1
ca65 FileAccessFirmware.asm -D SLOT=5 -o FileAccessSlot5.o || exit 1 ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=5 -o FileAccessSlot5.o || exit 1
ca65 FileAccessFirmware.asm -D SLOT=6 -o FileAccessSlot6.o || exit 1 ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=6 -o FileAccessSlot6.o || exit 1
ca65 FileAccessFirmware.asm -D SLOT=7 -o FileAccessSlot7.o --listing FileAccessFirmware.lst --list-bytes 255 || exit 1 ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=7 -o FileAccessSlot7.o --listing FileAccessFirmware.lst --list-bytes 255 || exit 1
ld65 FileAccessSlot0.o FileAccessSlot1.o FileAccessSlot2.o FileAccessSlot3.o FileAccessSlot4.o FileAccessSlot5.o FileAccessSlot6.o FileAccessSlot7.o -o FileAccessFirmware.bin -C ../.cicd/none.cfg || exit 1 ld65 FileAccessSlot0.o FileAccessSlot1.o FileAccessSlot2.o FileAccessSlot3.o FileAccessSlot4.o FileAccessSlot5.o FileAccessSlot6.o FileAccessSlot7.o -o FileAccessFirmware.bin -C ../.cicd/none.cfg || exit 1
cat \ cat \
DriveFirmware.bin CommandFirmware.bin FileAccessFirmware.bin MenuFirmware.bin \ DriveFirmware.bin CommandFirmware.bin FileAccessFirmware.bin MenuFirmware.bin \
> ../RaspberryPi/driveimage/AT28C64B.bin > ../RaspberryPi/driveimage/AT28C64B.bin
ca65 Shell.asm -o Shell.o --listing Shell.lst || exit 1 ca65 Shell.asm -D HW_TYPE=$HW_TYPE -o Shell.o --listing Shell.lst || exit 1
ld65 Shell.o -o ../RaspberryPi/driveimage/Shell.bin -C ../.cicd/none.cfg || exit 1 ld65 Shell.o -o ../RaspberryPi/driveimage/Shell.bin -C ../.cicd/none.cfg || exit 1
ca65 RPi.Command.asm -o RPi.Command.o --listing RPi.Command.lst || exit 1 ca65 RPi.Command.asm -D HW_TYPE=$HW_TYPE -o RPi.Command.o --listing RPi.Command.lst || exit 1
ld65 RPi.Command.o -o ../RaspberryPi/driveimage/RPi.Command.bin -C ../.cicd/none.cfg || exit 1 ld65 RPi.Command.o -o ../RaspberryPi/driveimage/RPi.Command.bin -C ../.cicd/none.cfg || exit 1
rm ./*.o rm ./*.o

View File

@ -1,52 +1,54 @@
#!/bin/sh #!/bin/sh
ca65 DriveFirmware.asm -D SLOT=0 -o DriveSlot0.o || exit 1 HW_TYPE=${1-0}
ca65 DriveFirmware.asm -D SLOT=1 -o DriveSlot1.o || exit 1
ca65 DriveFirmware.asm -D SLOT=2 -o DriveSlot2.o || exit 1 ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=0 -o DriveSlot0.o || exit 1
ca65 DriveFirmware.asm -D SLOT=3 -o DriveSlot3.o || exit 1 ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=1 -o DriveSlot1.o || exit 1
ca65 DriveFirmware.asm -D SLOT=4 -o DriveSlot4.o || exit 1 ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=2 -o DriveSlot2.o || exit 1
ca65 DriveFirmware.asm -D SLOT=5 -o DriveSlot5.o || exit 1 ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=3 -o DriveSlot3.o || exit 1
ca65 DriveFirmware.asm -D SLOT=6 -o DriveSlot6.o || exit 1 ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=4 -o DriveSlot4.o || exit 1
ca65 DriveFirmware.asm -D SLOT=7 -o DriveSlot7.o --listing DriveFirmware.lst.new --list-bytes 255 || exit 1 ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=5 -o DriveSlot5.o || exit 1
ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=6 -o DriveSlot6.o || exit 1
ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=7 -o DriveSlot7.o --listing DriveFirmware.lst.new --list-bytes 255 || exit 1
ld65 DriveSlot0.o DriveSlot1.o DriveSlot2.o DriveSlot3.o DriveSlot4.o DriveSlot5.o DriveSlot6.o DriveSlot7.o -o DriveFirmware.bin.new -C ../.cicd/none.cfg || exit 1 ld65 DriveSlot0.o DriveSlot1.o DriveSlot2.o DriveSlot3.o DriveSlot4.o DriveSlot5.o DriveSlot6.o DriveSlot7.o -o DriveFirmware.bin.new -C ../.cicd/none.cfg || exit 1
ca65 MenuFirmware.asm -D SLOT=0 -o MenuSlot0.o || exit 1 ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=0 -o MenuSlot0.o || exit 1
ca65 MenuFirmware.asm -D SLOT=1 -o MenuSlot1.o || exit 1 ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=1 -o MenuSlot1.o || exit 1
ca65 MenuFirmware.asm -D SLOT=2 -o MenuSlot2.o || exit 1 ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=2 -o MenuSlot2.o || exit 1
ca65 MenuFirmware.asm -D SLOT=3 -o MenuSlot3.o || exit 1 ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=3 -o MenuSlot3.o || exit 1
ca65 MenuFirmware.asm -D SLOT=4 -o MenuSlot4.o || exit 1 ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=4 -o MenuSlot4.o || exit 1
ca65 MenuFirmware.asm -D SLOT=5 -o MenuSlot5.o || exit 1 ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=5 -o MenuSlot5.o || exit 1
ca65 MenuFirmware.asm -D SLOT=6 -o MenuSlot6.o || exit 1 ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=6 -o MenuSlot6.o || exit 1
ca65 MenuFirmware.asm -D SLOT=7 -o MenuSlot7.o --listing MenuFirmware.lst.new --list-bytes 255 || exit 1 ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=7 -o MenuSlot7.o --listing MenuFirmware.lst.new --list-bytes 255 || exit 1
ld65 MenuSlot0.o MenuSlot1.o MenuSlot2.o MenuSlot3.o MenuSlot4.o MenuSlot5.o MenuSlot6.o MenuSlot7.o -o MenuFirmware.bin.new -C ../.cicd/none.cfg || exit 1 ld65 MenuSlot0.o MenuSlot1.o MenuSlot2.o MenuSlot3.o MenuSlot4.o MenuSlot5.o MenuSlot6.o MenuSlot7.o -o MenuFirmware.bin.new -C ../.cicd/none.cfg || exit 1
ca65 CommandFirmware.asm -D SLOT=0 -o CommandSlot0.o || exit 1 ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=0 -o CommandSlot0.o || exit 1
ca65 CommandFirmware.asm -D SLOT=1 -o CommandSlot1.o || exit 1 ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=1 -o CommandSlot1.o || exit 1
ca65 CommandFirmware.asm -D SLOT=2 -o CommandSlot2.o || exit 1 ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=2 -o CommandSlot2.o || exit 1
ca65 CommandFirmware.asm -D SLOT=3 -o CommandSlot3.o || exit 1 ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=3 -o CommandSlot3.o || exit 1
ca65 CommandFirmware.asm -D SLOT=4 -o CommandSlot4.o || exit 1 ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=4 -o CommandSlot4.o || exit 1
ca65 CommandFirmware.asm -D SLOT=5 -o CommandSlot5.o || exit 1 ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=5 -o CommandSlot5.o || exit 1
ca65 CommandFirmware.asm -D SLOT=6 -o CommandSlot6.o || exit 1 ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=6 -o CommandSlot6.o || exit 1
ca65 CommandFirmware.asm -D SLOT=7 -o CommandSlot7.o --listing CommandFirmware.lst.new --list-bytes 255 || exit 1 ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=7 -o CommandSlot7.o --listing CommandFirmware.lst.new --list-bytes 255 || exit 1
ld65 CommandSlot0.o CommandSlot1.o CommandSlot2.o CommandSlot3.o CommandSlot4.o CommandSlot5.o CommandSlot6.o CommandSlot7.o -o CommandFirmware.bin.new -C ../.cicd/none.cfg || exit 1 ld65 CommandSlot0.o CommandSlot1.o CommandSlot2.o CommandSlot3.o CommandSlot4.o CommandSlot5.o CommandSlot6.o CommandSlot7.o -o CommandFirmware.bin.new -C ../.cicd/none.cfg || exit 1
ca65 FileAccessFirmware.asm -D SLOT=0 -o FileAccessSlot0.o || exit 1 ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=0 -o FileAccessSlot0.o || exit 1
ca65 FileAccessFirmware.asm -D SLOT=1 -o FileAccessSlot1.o || exit 1 ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=1 -o FileAccessSlot1.o || exit 1
ca65 FileAccessFirmware.asm -D SLOT=2 -o FileAccessSlot2.o || exit 1 ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=2 -o FileAccessSlot2.o || exit 1
ca65 FileAccessFirmware.asm -D SLOT=3 -o FileAccessSlot3.o || exit 1 ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=3 -o FileAccessSlot3.o || exit 1
ca65 FileAccessFirmware.asm -D SLOT=4 -o FileAccessSlot4.o || exit 1 ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=4 -o FileAccessSlot4.o || exit 1
ca65 FileAccessFirmware.asm -D SLOT=5 -o FileAccessSlot5.o || exit 1 ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=5 -o FileAccessSlot5.o || exit 1
ca65 FileAccessFirmware.asm -D SLOT=6 -o FileAccessSlot6.o || exit 1 ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=6 -o FileAccessSlot6.o || exit 1
ca65 FileAccessFirmware.asm -D SLOT=7 -o FileAccessSlot7.o --listing FileAccessFirmware.lst.new --list-bytes 255 || exit 1 ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=7 -o FileAccessSlot7.o --listing FileAccessFirmware.lst.new --list-bytes 255 || exit 1
ld65 FileAccessSlot0.o FileAccessSlot1.o FileAccessSlot2.o FileAccessSlot3.o FileAccessSlot4.o FileAccessSlot5.o FileAccessSlot6.o FileAccessSlot7.o -o FileAccessFirmware.bin.new -C ../.cicd/none.cfg || exit 1 ld65 FileAccessSlot0.o FileAccessSlot1.o FileAccessSlot2.o FileAccessSlot3.o FileAccessSlot4.o FileAccessSlot5.o FileAccessSlot6.o FileAccessSlot7.o -o FileAccessFirmware.bin.new -C ../.cicd/none.cfg || exit 1
cat \ cat \
DriveFirmware.bin.new CommandFirmware.bin.new FileAccessFirmware.bin.new MenuFirmware.bin.new \ DriveFirmware.bin.new CommandFirmware.bin.new FileAccessFirmware.bin.new MenuFirmware.bin.new \
> AT28C64B.bin.new > AT28C64B.bin.new
ca65 Shell.asm -o Shell.o --listing Shell.lst.new || exit 1 ca65 Shell.asm -D HW_TYPE=$HW_TYPE -o Shell.o --listing Shell.lst.new || exit 1
ld65 Shell.o -o Shell.bin.new -C ../.cicd/none.cfg || exit 1 ld65 Shell.o -o Shell.bin.new -C ../.cicd/none.cfg || exit 1
ca65 RPi.Command.asm -o RPi.Command.o --listing RPi.Command.lst.new || exit 1 ca65 RPi.Command.asm -D HW_TYPE=$HW_TYPE -o RPi.Command.o --listing RPi.Command.lst.new || exit 1
ld65 RPi.Command.o -o RPi.Command.bin.new -C ../.cicd/none.cfg || exit 1 ld65 RPi.Command.o -o RPi.Command.bin.new -C ../.cicd/none.cfg || exit 1
rm ./*.o rm ./*.o

View File

@ -4,7 +4,7 @@ Apple II expansion card using a Raspberry Pi for I/O
![Image of Board](/Hardware/Apple2IORPi.jpg) ![Image of Board](/Hardware/Apple2IORPi.jpg)
## Purpose ## Purpose
The purpose of this project is to provide I/O for an Apple II series 8 bit computer via a Raspberry Pi Zero W which is powered by the Apple II expansion bus. This includes using the attached RPi Zero W for it's storage, network and processor to provide new functionality for the Apple II. The purpose of this project is to provide I/O for an Apple II series 8 bit computer via a Raspberry Pi Zero 2 W which is powered by the Apple II expansion bus. This includes using the attached RPi Zero 2 W for it's storage, network and processor to provide new functionality for the Apple II.
## Features ## Features
1. Boot message which waits for RPi to be ready 1. Boot message which waits for RPi to be ready
@ -16,22 +16,30 @@ The purpose of this project is to provide I/O for an Apple II series 8 bit compu
7. Supports "RPI" command from BASIC to execute Linux commands from the command prompt or inside BASIC programs: `10 PRINT CHR$(4);"RPI ls -al /"` 7. Supports "RPI" command from BASIC to execute Linux commands from the command prompt or inside BASIC programs: `10 PRINT CHR$(4);"RPI ls -al /"`
## Project Status ## Project Status
### Classic Hardware
So far, this is still a project and not a finished product. The current prototype is on the sixth revision. I have sold about 60 boards including previous prototypes. There are more than 100 in the wild between self made and ones purchased in places like eBay that were made by others. The sixth prototype is functionally equivalent to the fifth, other than a new jumper to select internal/external power. So far, this is still a project and not a finished product. The current prototype is on the sixth revision. I have sold about 60 boards including previous prototypes. There are more than 100 in the wild between self made and ones purchased in places like eBay that were made by others. The sixth prototype is functionally equivalent to the fifth, other than a new jumper to select internal/external power.
The card enables the Apple II to boot from and write to virtual hard drive images stored on the RPi in any slot (except slot 3), execute Linux commands from Applesoft BASIC and run a bash shell with VT100 emulation. The code has very few tests and is incomplete. Note that currently the firmware assumes an 80 column card is in slot 3 and than you have lowercase support. Most development has been done with an enhanced Apple //e with the card in slot 7. If you have other drive controllers earlier in the boot cycle, you can still boot from the Apple2-IO-RPi. For example, if the card was in slot 4, you could type `PR#4` from the BASIC prompt to boot the card. Note that the Raspberry Pi Zero W (and W 2) consume 170 - 250 mA and there is only 500 mA available to all expansion slots according to Apple. It is not recommended to have a lot of other cards in the system at the same time. With the sixth revision of the prototype, it is possible to remove the power jumper and run the RPi on an external USB power source. If configured for external power, note that the card's firmware will hang on boot without USB power on as the latch chips are powered by the 3.3V output of the RPi. The card enables the Apple II to boot from and write to virtual hard drive images stored on the RPi in any slot (except slot 3), execute Linux commands from Applesoft BASIC and run a bash shell with VT100 emulation. The code has very few tests and is incomplete. Note that currently the firmware assumes an 80 column card is in slot 3 and than you have lowercase support. Most development has been done with an enhanced Apple //e with the card in slot 7. If you have other drive controllers earlier in the boot cycle, you can still boot from the Apple2-IO-RPi. For example, if the card was in slot 4, you could type `PR#4` from the BASIC prompt to boot the card. Note that the Raspberry Pi Zero W (and W 2) consume 170 - 250 mA and there is only 500 mA available to all expansion slots according to Apple. It is not recommended to have a lot of other cards in the system at the same time. With the sixth revision of the prototype, it is possible to remove the power jumper and run the RPi on an external USB power source. If configured for external power, note that the card's firmware will hang on boot without USB power on as the latch chips are powered by the 3.3V output of the RPi.
If you have a problem or idea for enhancement, log an issue [here](https://github.com/tjboldt/Apple2-IO-RPi/issues) or start a [discussion](https://github.com/tjboldt/Apple2-IO-RPi/discussions/categories/general). I recommend starring/watching the project for updates on GitHub. You are welcome to fork the project and submit pull requests which I will review. The latest version has an in-memory virtual drive representing current working directory in Linux for ease of copying files between Linux and ProDOS when the drive 1 is not specified as a file. If you have a problem or idea for enhancement, log an issue [here](https://github.com/tjboldt/Apple2-IO-RPi/issues) or start a [discussion](https://github.com/tjboldt/Apple2-IO-RPi/discussions/categories/general). I recommend starring/watching the project for updates on GitHub. You are welcome to fork the project and submit pull requests which I will review. The latest version has an in-memory virtual drive representing current working directory in Linux for ease of copying files between Linux and ProDOS when the drive 1 is not specified as a file.
### Pico Hardware
Ralle Palaveev has a version of the hardware that uses a RPi Pico to handle firmware and communications to the host over USB. This uses Oliver Schmidt's PIO code.
## Roadmap ## Roadmap
See [List of issues tagged roadmap](https://github.com/tjboldt/Apple2-IO-RPi/issues?q=is%3Aissue+is%3Aopen+label%3Aroadmap+author%3Atjboldt) See [List of issues tagged roadmap](https://github.com/tjboldt/Apple2-IO-RPi/issues?q=is%3Aissue+is%3Aopen+label%3Aroadmap+author%3Atjboldt)
## Setup ## Setup on classic hardware
[Setup card from scratch](https://github.com/tjboldt/Apple2-IO-RPi/discussions/63) [Setup card from scratch](https://github.com/tjboldt/Apple2-IO-RPi/discussions/63)
[Setup if you received a complete board from me](https://github.com/tjboldt/Apple2-IO-RPi/discussions/64) [Setup if you received a complete board from me](https://github.com/tjboldt/Apple2-IO-RPi/discussions/64)
[Update to latest](https://github.com/tjboldt/Apple2-IO-RPi/discussions/65) [Update to latest](https://github.com/tjboldt/Apple2-IO-RPi/discussions/65)
## Setup on Pico based hardware
[Setup card with Pico hardware](https://github.com/tjboldt/Apple2-IO-RPi/discussions/162)
## Contributions/Thanks ## Contributions/Thanks
- Hans Hübner ([@hanshuebner](https://github.com/hanshuebner)) for help cleaning up schematics - Hans Hübner ([@hanshuebner](https://github.com/hanshuebner)) for help cleaning up schematics
- Scott ([@figital](https://github.com/figital)) for assembling early prototypes and recommending the AT28C64B chip - Scott ([@figital](https://github.com/figital)) for assembling early prototypes and recommending the AT28C64B chip
@ -41,6 +49,8 @@ See [List of issues tagged roadmap](https://github.com/tjboldt/Apple2-IO-RPi/iss
- ([@Abysmal](https://github.com/Abysmal)) for shell and rpi.command testing - ([@Abysmal](https://github.com/Abysmal)) for shell and rpi.command testing
- ([@bfranske](https://github.com/bfranske)) for suggesting adding the 5V jumper - ([@bfranske](https://github.com/bfranske)) for suggesting adding the 5V jumper
- Tim Boldt ([@timboldt](https://github.com/timboldt)) for recommending removing sysfs based GPIO code - Tim Boldt ([@timboldt](https://github.com/timboldt)) for recommending removing sysfs based GPIO code
- Oliver Schmidt ([@oliverschmidt](https://github.com/oliverschmidt/apple2-io-rpi/)) for writing the Pico PIO and firmware
- Ralle Palaveev ([@rallepalaveev](https://github.com/rallepalaveev/a2pico)) for Pico hardware design
## Similar Project ## Similar Project
If you prefer having Apple II peripherals control a Raspberry Pi rather than simply using the Raspberry Pi to provide storage, network access and processing to the Apple II, have a look at David Schmenk's excellent [Apple2Pi](https://github.com/dschmenk/apple2pi) project. I am often asked about differences between these two projects. They are similar in some ways but essentially opposite. The Apple2Pi is meant for the primary machine to be the RPi, using the Apple II for it's peripherals. The Apple2-IO-RPi is meant to have the Apple II as the primary machine and just use the RPi for its processing, storage and network. If you prefer having Apple II peripherals control a Raspberry Pi rather than simply using the Raspberry Pi to provide storage, network access and processing to the Apple II, have a look at David Schmenk's excellent [Apple2Pi](https://github.com/dschmenk/apple2pi) project. I am often asked about differences between these two projects. They are similar in some ways but essentially opposite. The Apple2Pi is meant for the primary machine to be the RPi, using the Apple II for it's peripherals. The Apple2-IO-RPi is meant to have the Apple II as the primary machine and just use the RPi for its processing, storage and network.

View File

@ -0,0 +1,151 @@
// Copyright Terence J. Boldt (c)2020-2022
// Use of this source code is governed by an MIT
// license that can be found in the LICENSE file.
// This file is used for communicating with the Apple II data bus via the
// GPIO ports on the Raspberry Pi
package a2io
import (
"bytes"
"errors"
"fmt"
"strings"
"time"
"go.bug.st/serial"
"go.bug.st/serial/enumerator"
)
var port serial.Port
// CDCio is a live implementation of A2Io interface
type CDCio struct {
}
// Init initializes the CDC driver on the Raspberry Pi
func (a2 CDCio) Init() {
name := ""
for {
portInfos, err := enumerator.GetDetailedPortsList()
if err == nil {
for _, portInfo := range portInfos {
if portInfo.IsUSB &&
strings.ToUpper(portInfo.VID) == "2E8A" &&
strings.ToUpper(portInfo.PID) == "000A" {
name = portInfo.Name
fmt.Printf("Found CDC port %s\n", name)
break
}
}
if name != "" {
break
}
}
time.Sleep(time.Millisecond)
}
for {
var err error
port, err = serial.Open(name, &serial.Mode{})
if err == nil {
break
}
var portErr *serial.PortError
if !errors.As(err, &portErr) ||
portErr.Code() != serial.PortNotFound &&
portErr.Code() != serial.PermissionDenied {
panic(err)
}
time.Sleep(time.Millisecond)
}
err := port.SetReadTimeout(time.Second)
if err != nil {
panic(err)
}
}
// ReadByte reads a byte from the Apple II via Raspberry Pi's CDC driver
func (a2 CDCio) ReadByte(noDelay ...bool) (byte, error) {
var data [1]byte
n, err := port.Read(data[:])
if err != nil {
return 0, err
}
if n == 0 {
return 0, errors.New("timed out reading byte")
}
return data[0], nil
}
// WriteByte writes a byte to the Apple II via Raspberry Pi's CDC driver
func (a2 CDCio) WriteByte(data byte) error {
_, err := port.Write([]byte{data})
return err
}
// ReadString reads a string from the Apple II via Raspberry Pi's CDC driver
func (a2 CDCio) ReadString() (string, error) {
var inBytes bytes.Buffer
for {
inByte, err := a2.ReadByte()
if err != nil {
return "", err
}
if inByte == 0 {
break
}
inBytes.WriteByte(inByte)
}
return inBytes.String(), nil
}
// WriteString writes a string to the Apple II via Raspberry Pi's CDC driver
func (a2 CDCio) WriteString(outString string) error {
for _, character := range outString {
err := a2.WriteByte(byte(character) | 128)
if err != nil {
fmt.Printf("Failed to write string\n")
return err
}
}
a2.WriteByte(0)
return nil
}
// WriteBlock writes 512 bytes to the Apple II via Raspberry Pi's CDC driver
func (a2 CDCio) WriteBlock(buffer []byte) error {
_, err := port.Write(buffer)
return err
}
// ReadBlock reads 512 bytes from the Apple II via Raspberry Pi's CDC driver
func (a2 CDCio) ReadBlock(buffer []byte) error {
var err error
for i := 0; i < 512; i++ {
buffer[i], err = a2.ReadByte()
if err != nil {
return err
}
}
return nil
}
// WriteBuffer writes a buffer of bytes to the Apple II via Raspberry Pi's CDC driver
func (a2 CDCio) WriteBuffer(buffer []byte) error {
_, err := port.Write(buffer)
return err
}
// SendCharacter is a pass-through to vt100 implementation
func (a2 CDCio) SendCharacter(character byte) {
sendCharacter(a2, character)
}
// ReadCharacter is a pass-through to vt100 implementation
func (a2 CDCio) ReadCharacter() (string, error) {
return readCharacter(a2)
}

View File

@ -9,12 +9,15 @@
package main package main
import ( import (
"errors"
"flag" "flag"
"fmt" "fmt"
"os" "os"
"path/filepath" "path/filepath"
"time" "time"
"go.bug.st/serial"
"github.com/tjboldt/Apple2-IO-RPi/RaspberryPi/apple2driver/a2io" "github.com/tjboldt/Apple2-IO-RPi/RaspberryPi/apple2driver/a2io"
"github.com/tjboldt/Apple2-IO-RPi/RaspberryPi/apple2driver/drive" "github.com/tjboldt/Apple2-IO-RPi/RaspberryPi/apple2driver/drive"
"github.com/tjboldt/Apple2-IO-RPi/RaspberryPi/apple2driver/handlers" "github.com/tjboldt/Apple2-IO-RPi/RaspberryPi/apple2driver/handlers"
@ -34,7 +37,7 @@ const menuCommand = 8
const shellCommand = 9 const shellCommand = 9
func main() { func main() {
drive1Name, drive2Name := getFlags() drive1Name, drive2Name, cdc := getFlags()
drive1, drive2 := getDriveFiles(drive1Name, drive2Name) drive1, drive2 := getDriveFiles(drive1Name, drive2Name)
driveImageDir, err := drive.GetDriveImageDirectory() driveImageDir, err := drive.GetDriveImageDirectory()
@ -44,7 +47,12 @@ func main() {
fmt.Printf("Starting Apple II RPi v%s...\n", info.Version) fmt.Printf("Starting Apple II RPi v%s...\n", info.Version)
comm := a2io.A2Gpio{} var comm a2io.A2Io
if cdc {
comm = a2io.CDCio{}
} else {
comm = a2io.A2Gpio{}
}
handlers.SetCommunication(comm) handlers.SetCommunication(comm)
comm.Init() comm.Init()
@ -73,6 +81,13 @@ func main() {
case shellCommand: case shellCommand:
handlers.ShellCommand() handlers.ShellCommand()
} }
// the A2Io interface should be extended in one way or another
// to encapsulate this, e.g. by a ReadByte variant / parameter
} else if cdc {
var portErr *serial.PortError
if errors.As(err, &portErr) && portErr.Code() == serial.PortClosed {
comm.Init()
}
// temporary workaround for busy wait loop heating up the RPi // temporary workaround for busy wait loop heating up the RPi
} else { } else {
time.Sleep(time.Millisecond * 200) time.Sleep(time.Millisecond * 200)
@ -80,9 +95,10 @@ func main() {
} }
} }
func getFlags() (string, string) { func getFlags() (string, string, bool) {
var drive1Name string var drive1Name string
var drive2Name string var drive2Name string
var cdc bool
execName, _ := os.Executable() execName, _ := os.Executable()
path := filepath.Dir(execName) path := filepath.Dir(execName)
@ -91,9 +107,10 @@ func getFlags() (string, string) {
flag.StringVar(&drive1Name, "d1", "", "A ProDOS format drive image for drive 1") flag.StringVar(&drive1Name, "d1", "", "A ProDOS format drive image for drive 1")
flag.StringVar(&drive2Name, "d2", "", "A ProDOS format drive image for drive 2 and will be used for drive 1 if drive 1 empty") flag.StringVar(&drive2Name, "d2", "", "A ProDOS format drive image for drive 2 and will be used for drive 1 if drive 1 empty")
flag.BoolVar(&cdc, "cdc", false, "Use ACM CDC serial device")
flag.Parse() flag.Parse()
return drive1Name, drive2Name return drive1Name, drive2Name, cdc
} }
func getDriveFiles(drive1Name string, drive2Name string) (prodos.ReaderWriterAt, prodos.ReaderWriterAt) { func getDriveFiles(drive1Name string, drive2Name string) (prodos.ReaderWriterAt, prodos.ReaderWriterAt) {

View File

@ -5,6 +5,7 @@ go 1.16
require ( require (
github.com/creack/pty v1.1.21 github.com/creack/pty v1.1.21
github.com/stianeikeland/go-rpio/v4 v4.6.0 github.com/stianeikeland/go-rpio/v4 v4.6.0
github.com/tjboldt/ProDOS-Utilities v0.4.8 github.com/tjboldt/ProDOS-Utilities v0.4.9
golang.org/x/image v0.14.0 // indirect go.bug.st/serial v1.6.1
golang.org/x/sys v0.16.0 // indirect
) )

View File

@ -1,15 +1,25 @@
github.com/creack/goselect v0.1.2 h1:2DNy14+JPjRBgPzAd1thbQp4BSIihxcBf0IXhQXDRa0=
github.com/creack/goselect v0.1.2/go.mod h1:a/NhLweNvqIYMuxcMOuWY516Cimucms3DglDzQP3hKY=
github.com/creack/pty v1.1.21 h1:1/QdRyBaHHJP61QkWMXlOIBfsgdDeeKfK8SYVUWJKf0= github.com/creack/pty v1.1.21 h1:1/QdRyBaHHJP61QkWMXlOIBfsgdDeeKfK8SYVUWJKf0=
github.com/creack/pty v1.1.21/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= github.com/creack/pty v1.1.21/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stianeikeland/go-rpio/v4 v4.6.0 h1:eAJgtw3jTtvn/CqwbC82ntcS+dtzUTgo5qlZKe677EY= github.com/stianeikeland/go-rpio/v4 v4.6.0 h1:eAJgtw3jTtvn/CqwbC82ntcS+dtzUTgo5qlZKe677EY=
github.com/stianeikeland/go-rpio/v4 v4.6.0/go.mod h1:A3GvHxC1Om5zaId+HqB3HKqx4K/AqeckxB7qRjxMK7o= github.com/stianeikeland/go-rpio/v4 v4.6.0/go.mod h1:A3GvHxC1Om5zaId+HqB3HKqx4K/AqeckxB7qRjxMK7o=
github.com/tjboldt/ProDOS-Utilities v0.4.8 h1:hW4gHliqTjKCep6jXX4Z59pkVhB+OyVJPWM5X3N+ybs= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/tjboldt/ProDOS-Utilities v0.4.8/go.mod h1:tk5Cd5WSoogNF+XRMjEPuWeU1vVuqdJexn23s5ev/fU= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/tjboldt/ProDOS-Utilities v0.4.9 h1:TkrXrm6EMcB9GDHoBtfpr0/h5G6xUQf4NVX6d1YLYvg=
github.com/tjboldt/ProDOS-Utilities v0.4.9/go.mod h1:TS0/NXtEofuAaDOhRzlrHrbGAzrJXlk9IltkLswShsc=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.bug.st/serial v1.6.1 h1:VSSWmUxlj1T/YlRo2J104Zv3wJFrjHIl/T3NeruWAHY=
go.bug.st/serial v1.6.1/go.mod h1:UABfsluHAiaNI+La2iESysd9Vetq7VRdpxvjx7CmmOE=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/image v0.13.0/go.mod h1:6mmbMOeV28HuMTgA6OSRkdXKYw/t5W9Uwn2Yv1r3Yxk= golang.org/x/image v0.15.0 h1:kOELfmgrmJlw4Cdb7g/QGuB3CvDrXbqEIww/pNtNBm8=
golang.org/x/image v0.14.0 h1:tNgSxAFe3jC4uYqvZdTr84SZoM1KfwdC9SKIFrLjFn4= golang.org/x/image v0.15.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE=
golang.org/x/image v0.14.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
@ -24,7 +34,10 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
@ -32,10 +45,12 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@ -49,12 +49,13 @@ func ShellCommand() {
ptmx.Close() ptmx.Close()
cmd.Wait() cmd.Wait()
comm.WriteByte(0) comm.WriteByte(0)
return // return
break
case <-userCancelled: case <-userCancelled:
fmt.Printf("User cancelled, killing process\n") fmt.Printf("User cancelled, killing process\n")
ptmx.Close() ptmx.Close()
cmd.Process.Kill() cmd.Process.Kill()
comm.WriteByte(0) // comm.WriteByte(0)
return return
case <-inputComplete: case <-inputComplete:
fmt.Printf("Shell input complete\n") fmt.Printf("Shell input complete\n")

View File

@ -8,4 +8,4 @@ package info
// Version is the hexadecimal version number that // Version is the hexadecimal version number that
// should be incremented with each driver update // should be incremented with each driver update
const Version = "002C" const Version = "002D"

Binary file not shown.

Binary file not shown.

View File

@ -21,16 +21,18 @@ if [ ! -d "ProDOS-Utilities" ]; then
git clone https://github.com/tjboldt/ProDOS-Utilities.git git clone https://github.com/tjboldt/ProDOS-Utilities.git
fi fi
cd ProDOS-Utilities || exit cd ProDOS-Utilities || exit
go mod tidy
go build go build
cd ~ || exit cd ~ || exit
if [ -L "/usr/bin/ProDOS-Utilities" ]; then if [ -L "/usr/bin/ProDOS-Utilities" ]; then
sudo rm /usr/bin/ProDOS-Utilities sudo rm /usr/bin/ProDOS-Utilities
fi fi
sudo ln -s /home/pi/ProDOS-Utilities/ProDOS-Utilities /usr/bin/ProDOS-Utilities sudo ln -s $HOME/ProDOS-Utilities/ProDOS-Utilities /usr/bin/ProDOS-Utilities
if [ ! -d "Apple2-IO-RPi" ]; then if [ ! -d "Apple2-IO-RPi" ]; then
git clone https://github.com/tjboldt/Apple2-IO-RPi.git git clone https://github.com/tjboldt/Apple2-IO-RPi.git
fi fi
cd Apple2-IO-RPi/RaspberryPi/apple2driver || exit cd Apple2-IO-RPi/RaspberryPi/apple2driver || exit
go mod tidy
go build go build
sudo apt install cc65 vim -y sudo apt install cc65 vim -y
cd ~ || exit cd ~ || exit
@ -41,18 +43,18 @@ dtoverlay=disable-bt
boot_delay=0 boot_delay=0
EOF' EOF'
sudo bash -c 'echo " quiet" >> /boot/cmdline.txt' sudo bash -c 'echo " quiet" >> /boot/cmdline.txt'
bash -c 'cat > apple2driver.service << EOF sudo --preserve-env=HOME --preserve-env=USER bash -c 'cat > apple2driver.service << EOF
[Unit] [Unit]
Description=Apple2-IO-RPi Driver Description=Apple2-IO-RPi Driver
[Service] [Service]
ExecStart=/home/$USER/Apple2-IO-RPi/RaspberryPi/apple2driver/apple2driver ExecStart=$HOME/Apple2-IO-RPi/RaspberryPi/apple2driver/apple2driver
StandardOutput=syslog StandardOutput=syslog
StandardError=syslog StandardError=syslog
SyslogIdentifier=apple2driver SyslogIdentifier=apple2driver
User=$USER User=$USER
Group=$USER Group=$USER
WorkingDirectory=/home/$USER/Apple2-IO-RPi/RaspberryPi/apple2driver WorkingDirectory=$HOME/Apple2-IO-RPi/RaspberryPi/apple2driver
[Install] [Install]
WantedBy=basic.target WantedBy=basic.target

View File

@ -0,0 +1,39 @@
set(PROJECT_NAME Apple2-IO-RPi)
cmake_minimum_required(VERSION 3.12)
include(pico_sdk_import.cmake)
project(${PROJECT_NAME} C CXX ASM)
pico_sdk_init()
add_executable(${PROJECT_NAME})
pico_add_extra_outputs(${PROJECT_NAME})
pico_enable_stdio_uart(${PROJECT_NAME} 0)
pico_enable_stdio_usb(${PROJECT_NAME} 1)
include(FetchContent)
FetchContent_Declare(a2pico
GIT_REPOSITORY https://github.com/oliverschmidt/a2pico.git
GIT_TAG main
)
FetchContent_MakeAvailable(a2pico)
set_source_files_properties(incbin.S OBJECT_DEPENDS ../../Apple2/AT28C64B.bin)
add_custom_command(
WORKING_DIRECTORY ../../Apple2
COMMAND ./assemble.sh 1
OUTPUT ../../Apple2/AT28C64B.bin
VERBATIM
)
target_sources(${PROJECT_NAME} PRIVATE
main.c
board.c
incbin.S
)
target_link_libraries(${PROJECT_NAME} PRIVATE
pico_stdlib
pico_multicore
a2pico
)

21
RaspberryPiPico/LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Oliver Schmidt (https://a2retro.de/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

78
RaspberryPiPico/board.c Normal file
View File

@ -0,0 +1,78 @@
/*
MIT License
Copyright (c) 2022 Oliver Schmidt (https://a2retro.de/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include <pico/multicore.h>
#include <a2pico.h>
#include "board.h"
extern const __attribute__((aligned(4))) uint8_t firmware[];
static uint32_t page;
void __time_critical_func(board)(void) {
a2pico_init(pio0);
while (true) {
uint32_t pico = a2pico_getaddr(pio0);
uint32_t addr = pico & 0x0FFF;
uint32_t io = pico & 0x0F00; // IOSTRB or IOSEL
uint32_t strb = pico & 0x0800; // IOSTRB
uint32_t read = pico & 0x1000; // R/W
if (read) {
if (!io) { // DEVSEL
switch (addr & 0x7) {
case 0x3:
a2pico_putdata(pio0, !multicore_fifo_rvalid() << 7 |
!multicore_fifo_wready() << 6);
break;
case 0x6:
a2pico_putdata(pio0, sio_hw->fifo_rd);
break;
}
} else {
if (!strb) {
a2pico_putdata(pio0, firmware[page | addr]);
}
}
} else {
uint32_t data = a2pico_getdata(pio0);
if (!io) { // DEVSEL
switch (addr & 0x7) {
case 0x5:
sio_hw->fifo_wr = data;
break;
case 0x7:
page = (data & 0x30) << 7;
break;
}
}
}
}
}

32
RaspberryPiPico/board.h Normal file
View File

@ -0,0 +1,32 @@
/*
MIT License
Copyright (c) 2022 Oliver Schmidt (https://a2retro.de/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef _BOARD_H
#define _BOARD_H
void board(void);
#endif

6
RaspberryPiPico/incbin.S Normal file
View File

@ -0,0 +1,6 @@
.section .time_critical.firmware
.global firmware
.type firmware, %object
.balign 4
firmware:
.incbin "../../Apple2/AT28C64B.bin"

92
RaspberryPiPico/main.c Normal file
View File

@ -0,0 +1,92 @@
/*
MIT License
Copyright (c) 2022 Oliver Schmidt (https://a2retro.de/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include <stdio.h>
#include <pico/printf.h>
#include <pico/stdlib.h>
#include <pico/multicore.h>
#include "board.h"
#ifdef TRACE
void uart_printf(uart_inst_t *uart, const char *format, ...) {
static char buffer[0x100];
va_list va;
va_start(va, format);
vsnprintf(buffer, sizeof(buffer), format, va);
va_end(va);
buffer[0xFF] = '\0';
uart_puts(uart, buffer);
}
#endif
void main(void) {
multicore_launch_core1(board);
stdio_init_all();
stdio_set_translate_crlf(&stdio_usb, false);
#ifdef PICO_DEFAULT_LED_PIN
gpio_init(PICO_DEFAULT_LED_PIN);
gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT);
#endif
#ifdef TRACE
uart_init(uart0, 115200);
uart_set_translate_crlf(uart0, true);
gpio_set_function(PICO_DEFAULT_UART_TX_PIN, GPIO_FUNC_UART);
gpio_set_function(PICO_DEFAULT_UART_RX_PIN, GPIO_FUNC_UART);
#endif
while (true) {
bool conn = stdio_usb_connected();
if (conn) {
if (multicore_fifo_rvalid()) {
uint32_t data = multicore_fifo_pop_blocking();
putchar(data);
#ifdef TRACE
uart_printf(uart0, "> %02X\n", data);
#endif
}
}
if (multicore_fifo_wready()) {
int data = getchar_timeout_us(0);
if (data != PICO_ERROR_TIMEOUT) {
multicore_fifo_push_blocking(data);
#ifdef TRACE
uart_printf(uart0, "< %02X\n", data);
#endif
}
}
#ifdef PICO_DEFAULT_LED_PIN
gpio_put(PICO_DEFAULT_LED_PIN, conn);
#endif
}
}

View File

@ -0,0 +1,73 @@
# This is a copy of <PICO_SDK_PATH>/external/pico_sdk_import.cmake
# This can be dropped into an external project to help locate this SDK
# It should be include()ed prior to project()
if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH))
set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')")
endif ()
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT))
set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT})
message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')")
endif ()
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH))
set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH})
message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
endif ()
set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable")
set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK")
if (NOT PICO_SDK_PATH)
if (PICO_SDK_FETCH_FROM_GIT)
include(FetchContent)
set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR})
if (PICO_SDK_FETCH_FROM_GIT_PATH)
get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
endif ()
# GIT_SUBMODULES_RECURSE was added in 3.17
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0")
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG master
GIT_SUBMODULES_RECURSE FALSE
)
else ()
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG master
)
endif ()
if (NOT pico_sdk)
message("Downloading Raspberry Pi Pico SDK")
FetchContent_Populate(pico_sdk)
set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR})
endif ()
set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE})
else ()
message(FATAL_ERROR
"SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git."
)
endif ()
endif ()
get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
if (NOT EXISTS ${PICO_SDK_PATH})
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found")
endif ()
set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake)
if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE})
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK")
endif ()
set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE)
include(${PICO_SDK_INIT_CMAKE_FILE})