Update firmware to send ddrive unit

This commit is contained in:
Terence Boldt 2021-10-06 19:30:20 -04:00
parent 068c907f45
commit ccab3e801f
12 changed files with 155 additions and 171 deletions

Binary file not shown.

View File

@ -145,15 +145,10 @@ finishRead:
end:
rts
.repeat 247-<end
.repeat 251-<end
.byte 0
.endrepeat
.byte <GetByte ;all firmware pages have pointer to GetByte routine here
.byte >GetByte
.byte <SendByte ;all firmware pages have pointer to SendByte routine here
.byte >SendByte
.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 DriverEntry&$00FF ;low byte of entry

View File

@ -150,7 +150,7 @@ Current file: CommandFirmware.asm
00C7B6 1 end:
00C7B6 1 60 rts
00C7B7 1
00C7B7 1 00 00 00 00 .repeat 247-<end
00C7B7 1 00 00 00 00 .repeat 251-<end
00C7BB 1 00 00 00 00
00C7BF 1 00 00 00 00
00C7C3 1 00 00 00 00
@ -166,14 +166,10 @@ Current file: CommandFirmware.asm
00C7EB 1 00 00 00 00
00C7EF 1 00 00 00 00
00C7F3 1 00 00 00 00
00C7F7 1 00
00C7F8 1 .byte 0
00C7F8 1 .endrepeat
00C7F8 1
00C7F8 1 9B .byte <GetByte ;all firmware pages have pointer to GetByte routine here
00C7F9 1 C7 .byte >GetByte
00C7FA 1 7D .byte <SendByte ;all firmware pages have pointer to SendByte routine here
00C7FB 1 C7 .byte >SendByte
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

@ -107,6 +107,8 @@ readBlock:
jsr SendByte
lda BlockHi
jsr SendByte
txa
jsr SendByte
ldy #$0
jsr read256
inc BufferHi
@ -131,6 +133,8 @@ WriteBlock:
jsr SendByte
lda BlockHi
jsr SendByte
txa
jsr SendByte
ldy #$0
jsr write256
inc BufferHi
@ -186,15 +190,10 @@ finishRead:
end:
rts
.repeat 247-<end
.repeat 251-<end
.byte 0
.endrepeat
.byte <GetByte ;all firmware pages have pointer to GetByte routine here
.byte >GetByte
.byte <SendByte ;all firmware pages have pointer to SendByte routine here
.byte >SendByte
.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 DriverEntry&$00FF ;low byte of entry

View File

@ -75,7 +75,7 @@ Current file: DriveFirmware.asm
00C738 1 C9 01 cmp #ReadBlockCommand
00C73A 1 F0 10 beq ReadBlockAndSetTime
00C73C 1 C9 02 cmp #WriteBlockCommand
00C73E 1 F0 50 beq WriteBlock
00C73E 1 F0 54 beq WriteBlock
00C740 1 38 sec ;set carry as we don't support any other commands
00C741 1 A9 53 lda #$53 ;Invalid parameter error
00C743 1 60 rts
@ -97,108 +97,106 @@ Current file: DriveFirmware.asm
00C754 1 D0 12 bne readBlock
00C756 1 A0 00 ldy #$00 ;Get the current time on each block read for now
00C758 1 A9 03 lda #GetTimeCommand
00C75A 1 20 B8 C7 jsr SendByte
00C75A 1 20 C0 C7 jsr SendByte
00C75D 1 getTimeByte:
00C75D 1 20 D6 C7 jsr GetByte
00C75D 1 20 DE C7 jsr GetByte
00C760 1 99 90 BF sta $bf90,y
00C763 1 C8 iny
00C764 1 C0 04 cpy #$04
00C766 1 D0 F5 bne getTimeByte
00C768 1 readBlock:
00C768 1 A9 01 lda #ReadBlockCommand ;read the block after setting the clock
00C76A 1 20 B8 C7 jsr SendByte
00C76A 1 20 C0 C7 jsr SendByte
00C76D 1 A5 46 lda BlockLo
00C76F 1 20 B8 C7 jsr SendByte
00C76F 1 20 C0 C7 jsr SendByte
00C772 1 A5 47 lda BlockHi
00C774 1 20 B8 C7 jsr SendByte
00C777 1 A0 00 ldy #$0
00C779 1 20 87 C7 jsr read256
00C77C 1 E6 45 inc BufferHi
00C77E 1 20 87 C7 jsr read256
00C781 1 C6 45 dec BufferHi
00C783 1 A9 00 lda #$0 ;zero accumulator and clear carry for success
00C785 1 18 clc
00C786 1 60 rts
00C787 1
00C787 1 read256:
00C787 1 20 D6 C7 jsr GetByte
00C78A 1 91 44 sta (BufferLo),y
00C78C 1 C8 iny
00C78D 1 D0 F8 bne read256
00C78F 1 60 rts
00C790 1
00C790 1 ; ProDOS Write Block Command
00C790 1 WriteBlock:
00C790 1 A9 02 lda #WriteBlockCommand
00C792 1 20 B8 C7 jsr SendByte
00C795 1 A5 46 lda BlockLo
00C797 1 20 B8 C7 jsr SendByte
00C79A 1 A5 47 lda BlockHi
00C79C 1 20 B8 C7 jsr SendByte
00C79F 1 A0 00 ldy #$0
00C7A1 1 20 AF C7 jsr write256
00C7A4 1 E6 45 inc BufferHi
00C7A6 1 20 AF C7 jsr write256
00C7A9 1 C6 45 dec BufferHi
00C7AB 1 A9 00 lda #$0 ;zero accumulator and clear carry for success
00C7AD 1 18 clc
00C7AE 1 60 rts
00C7AF 1
00C7AF 1 write256:
00C7AF 1 B1 44 lda (BufferLo),y
00C7B1 1 20 B8 C7 jsr SendByte
00C7B4 1 C8 iny
00C7B5 1 D0 F8 bne write256
00C7B7 1 60 rts
00C7B8 1
00C7B8 1 SendByte:
00C7B8 1 48 pha
00C7B9 1 waitWrite:
00C7B9 1 AD FB C0 lda InputFlags
00C7BC 1 2A rol
00C7BD 1 2A rol
00C7BE 1 B0 F9 bcs waitWrite
00C7C0 1 68 pla
00C7C1 1 8D FD C0 sta OutputByte
00C7C4 1 A9 0E lda #$0e ; set bit 0 low to indicate write started
00C7C6 1 8D F7 C0 sta OutputFlags
00C7C9 1 finishWrite:
00C7C9 1 AD FB C0 lda InputFlags
00C7CC 1 2A rol
00C7CD 1 2A rol
00C7CE 1 90 F9 bcc finishWrite
00C7D0 1 A9 0F lda #$0f
00C7D2 1 8D F7 C0 sta OutputFlags
00C7D5 1 60 rts
00C7D6 1
00C7D6 1 GetByte:
00C7D6 1 A9 0D lda #$0d ;set read flag low
00C7D8 1 8D F7 C0 sta OutputFlags
00C7DB 1 waitRead:
00C7DB 1 AD FB C0 lda InputFlags
00C7DE 1 2A rol
00C7DF 1 B0 FA bcs waitRead
00C7E1 1 AD FE C0 lda InputByte
00C7E4 1 48 pha
00C7E5 1 A9 0F lda #$0f ;set all flags high
00C7E7 1 8D F7 C0 sta OutputFlags
00C7EA 1 finishRead:
00C7EA 1 AD FB C0 lda InputFlags
00C7ED 1 2A rol
00C7EE 1 90 FA bcc finishRead
00C7F0 1 68 pla
00C7F1 1 end:
00C7F1 1 60 rts
00C7F2 1
00C7F2 1 00 00 00 00 .repeat 247-<end
00C7F6 1 00 00
00C7F8 1 .byte 0
00C7F8 1 .endrepeat
00C7F8 1
00C7F8 1 D6 .byte <GetByte ;all firmware pages have pointer to GetByte routine here
00C7F9 1 C7 .byte >GetByte
00C7FA 1 B8 .byte <SendByte ;all firmware pages have pointer to SendByte routine here
00C7FB 1 C7 .byte >SendByte
00C774 1 20 C0 C7 jsr SendByte
00C777 1 8A txa
00C778 1 20 C0 C7 jsr SendByte
00C77B 1 A0 00 ldy #$0
00C77D 1 20 8B C7 jsr read256
00C780 1 E6 45 inc BufferHi
00C782 1 20 8B C7 jsr read256
00C785 1 C6 45 dec BufferHi
00C787 1 A9 00 lda #$0 ;zero accumulator and clear carry for success
00C789 1 18 clc
00C78A 1 60 rts
00C78B 1
00C78B 1 read256:
00C78B 1 20 DE C7 jsr GetByte
00C78E 1 91 44 sta (BufferLo),y
00C790 1 C8 iny
00C791 1 D0 F8 bne read256
00C793 1 60 rts
00C794 1
00C794 1 ; ProDOS Write Block Command
00C794 1 WriteBlock:
00C794 1 A9 02 lda #WriteBlockCommand
00C796 1 20 C0 C7 jsr SendByte
00C799 1 A5 46 lda BlockLo
00C79B 1 20 C0 C7 jsr SendByte
00C79E 1 A5 47 lda BlockHi
00C7A0 1 20 C0 C7 jsr SendByte
00C7A3 1 8A txa
00C7A4 1 20 C0 C7 jsr SendByte
00C7A7 1 A0 00 ldy #$0
00C7A9 1 20 B7 C7 jsr write256
00C7AC 1 E6 45 inc BufferHi
00C7AE 1 20 B7 C7 jsr write256
00C7B1 1 C6 45 dec BufferHi
00C7B3 1 A9 00 lda #$0 ;zero accumulator and clear carry for success
00C7B5 1 18 clc
00C7B6 1 60 rts
00C7B7 1
00C7B7 1 write256:
00C7B7 1 B1 44 lda (BufferLo),y
00C7B9 1 20 C0 C7 jsr SendByte
00C7BC 1 C8 iny
00C7BD 1 D0 F8 bne write256
00C7BF 1 60 rts
00C7C0 1
00C7C0 1 SendByte:
00C7C0 1 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
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
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

@ -144,15 +144,10 @@ finishRead:
end:
rts
.repeat 247-<end
.repeat 251-<end
.byte 0
.endrepeat
.byte <GetByte ;all firmware pages have pointer to GetByte routine here
.byte >GetByte
.byte <SendByte ;all firmware pages have pointer to SendByte routine here
.byte >SendByte
.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 DriverEntry&$00FF ;low byte of entry

View File

@ -148,7 +148,7 @@ Current file: FileAccessFirmware.asm
00C7AD 1 end:
00C7AD 1 60 rts
00C7AE 1
00C7AE 1 00 00 00 00 .repeat 247-<end
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
@ -166,14 +166,10 @@ Current file: FileAccessFirmware.asm
00C7EA 1 00 00 00 00
00C7EE 1 00 00 00 00
00C7F2 1 00 00 00 00
00C7F6 1 00 00
00C7F8 1 .byte 0
00C7F8 1 .endrepeat
00C7F8 1
00C7F8 1 92 .byte <GetByte ;all firmware pages have pointer to GetByte routine here
00C7F9 1 C7 .byte >GetByte
00C7FA 1 74 .byte <SendByte ;all firmware pages have pointer to SendByte routine here
00C7FB 1 C7 .byte >SendByte
00C7F6 1 00 00 00 00
00C7FA 1 00 00
00C7FC 1 .byte 0
00C7FC 1 .endrepeat
00C7FC 1
00C7FC 1 00 00 .byte 0,0 ;0000 blocks = check status
00C7FE 1 07 .byte 7 ;bit set(0=status 1=read 2=write) unset(3=format, 4/5=number of volumes, 6=interruptable, 7=removable)

View File

@ -141,7 +141,7 @@ finishRead:
end:
rts
.repeat 183-<end
.repeat 187-<end
.byte 0
.endrepeat
@ -151,11 +151,6 @@ Text:
.byte $8d
.byte "Waiting for RPi...",$00
.byte <GetByte ;all firmware pages have pointer to GetByte routine here
.byte >GetByte
.byte <SendByte ;all firmware pages have pointer to SendByte routine here
.byte >SendByte
.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 DriverEntry&$00FF ;low byte of entry

View File

@ -64,7 +64,7 @@ Current file: MenuFirmware.asm
00C721 1 20 58 FC jsr Home ;clear screen and show menu options
00C724 1 A0 00 ldy #$00
00C726 1 PrintString:
00C726 1 B9 B8 C7 lda Text,y
00C726 1 B9 BC C7 lda Text,y
00C729 1 F0 08 beq WaitForRPi
00C72B 1 09 80 ora #$80
00C72D 1 20 ED FD jsr PrintChar
@ -145,38 +145,34 @@ Current file: MenuFirmware.asm
00C7A3 1 end:
00C7A3 1 60 rts
00C7A4 1
00C7A4 1 00 00 00 00 .repeat 183-<end
00C7A4 1 00 00 00 00 .repeat 187-<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 .byte 0
00C7B8 1 .endrepeat
00C7B8 1
00C7B8 1 Text:
00C7B8 1 41 70 70 6C .byte "Apple2-IO-RPi",$8d
00C7BC 1 65 32 2D 49
00C7C0 1 4F 2D 52 50
00C7C4 1 69 8D
00C7C6 1 28 63 29 32 .byte "(c)2020-2021 Terence J. Boldt",$8d
00C7CA 1 30 32 30 2D
00C7CE 1 32 30 32 31
00C7D2 1 20 54 65 72
00C7D6 1 65 6E 63 65
00C7DA 1 20 4A 2E 20
00C7DE 1 42 6F 6C 64
00C7E2 1 74 8D
00C7E4 1 8D .byte $8d
00C7E5 1 57 61 69 74 .byte "Waiting for RPi...",$00
00C7E9 1 69 6E 67 20
00C7ED 1 66 6F 72 20
00C7F1 1 52 50 69 2E
00C7F5 1 2E 2E 00
00C7F8 1
00C7F8 1 88 .byte <GetByte ;all firmware pages have pointer to GetByte routine here
00C7F9 1 C7 .byte >GetByte
00C7FA 1 6A .byte <SendByte ;all firmware pages have pointer to SendByte routine here
00C7FB 1 C7 .byte >SendByte
00C7B8 1 00 00 00 00
00C7BC 1 .byte 0
00C7BC 1 .endrepeat
00C7BC 1
00C7BC 1 Text:
00C7BC 1 41 70 70 6C .byte "Apple2-IO-RPi",$8d
00C7C0 1 65 32 2D 49
00C7C4 1 4F 2D 52 50
00C7C8 1 69 8D
00C7CA 1 28 63 29 32 .byte "(c)2020-2021 Terence J. Boldt",$8d
00C7CE 1 30 32 30 2D
00C7D2 1 32 30 32 31
00C7D6 1 20 54 65 72
00C7DA 1 65 6E 63 65
00C7DE 1 20 4A 2E 20
00C7E2 1 42 6F 6C 64
00C7E6 1 74 8D
00C7E8 1 8D .byte $8d
00C7E9 1 57 61 69 74 .byte "Waiting for RPi...",$00
00C7ED 1 69 6E 67 20
00C7F1 1 66 6F 72 20
00C7F5 1 52 50 69 2E
00C7F9 1 2E 2E 00
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)

Binary file not shown.

View File

@ -7,13 +7,21 @@ import (
"github.com/tjboldt/Apple2-IO-RPi/RaspberryPi/apple2driver/a2io"
)
var oldFirmware = false
func ReadBlockCommand(drive1 *os.File, drive2 *os.File) {
blockLow, _ := a2io.ReadByte()
blockHigh, _ := a2io.ReadByte()
driveUnit, err := a2io.ReadByte()
var driveUnit byte = 0
var err error
if err != nil {
fmt.Printf("Drive unit not sent, assuming older firmware")
if !oldFirmware {
driveUnit, err = a2io.ReadByte()
if err != nil {
fmt.Printf("Drive unit not sent, assuming older firmware")
oldFirmware = true
}
}
file := drive1

View File

@ -10,10 +10,16 @@ import (
func WriteBlockCommand(drive1 *os.File, drive2 *os.File) {
blockLow, _ := a2io.ReadByte()
blockHigh, _ := a2io.ReadByte()
driveUnit, err := a2io.ReadByte()
if err != nil {
fmt.Printf("Drive unit not sent, assuming older firmware")
var driveUnit byte = 0
var err error
if !oldFirmware {
driveUnit, err = a2io.ReadByte()
if err != nil {
fmt.Printf("Drive unit not sent, assuming older firmware")
oldFirmware = true
}
}
file := drive1