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

1
.gitignore vendored
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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