mirror of
https://github.com/tjboldt/Apple2-IO-RPi.git
synced 2024-05-29 00:41:45 +00:00
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.
This commit is contained in:
parent
9fc6f5f74a
commit
b0a105606a
|
@ -127,21 +127,14 @@ 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
|
||||||
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
|
||||||
rts
|
rts
|
||||||
|
@ -150,9 +143,8 @@ GetByte:
|
||||||
lda #$1d ;set read flag low
|
lda #$1d ;set read flag low
|
||||||
sta OutputFlags
|
sta OutputFlags
|
||||||
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
|
||||||
lda #$1f ;set all flags high and exit
|
lda #$1f ;set all flags high and exit
|
||||||
|
@ -165,9 +157,8 @@ readByte:
|
||||||
lda #$1f ;set all flags high
|
lda #$1f ;set all flags high
|
||||||
sta OutputFlags
|
sta OutputFlags
|
||||||
finishRead:
|
finishRead:
|
||||||
lda InputFlags
|
bit InputFlags
|
||||||
rol
|
bpl finishRead
|
||||||
bcc finishRead
|
|
||||||
pla
|
pla
|
||||||
clc ;success
|
clc ;success
|
||||||
end:
|
end:
|
||||||
|
|
|
@ -161,21 +161,14 @@ write256:
|
||||||
rts
|
rts
|
||||||
|
|
||||||
SendByte:
|
SendByte:
|
||||||
pha
|
bit InputFlags
|
||||||
waitWrite:
|
bvs SendByte
|
||||||
lda InputFlags
|
|
||||||
rol
|
|
||||||
rol
|
|
||||||
bcs waitWrite
|
|
||||||
pla
|
|
||||||
sta OutputByte
|
sta OutputByte
|
||||||
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
|
||||||
rts
|
rts
|
||||||
|
@ -184,17 +177,15 @@ GetByte:
|
||||||
lda #$0d ;set read flag low
|
lda #$0d ;set read flag low
|
||||||
sta OutputFlags
|
sta OutputFlags
|
||||||
waitRead:
|
waitRead:
|
||||||
lda InputFlags
|
bit InputFlags
|
||||||
rol
|
bmi waitRead
|
||||||
bcs waitRead
|
|
||||||
lda InputByte
|
lda InputByte
|
||||||
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
|
||||||
end:
|
end:
|
||||||
rts
|
rts
|
||||||
|
|
|
@ -114,21 +114,14 @@ ExitToMonitor:
|
||||||
jsr Monitor
|
jsr Monitor
|
||||||
|
|
||||||
SendByte:
|
SendByte:
|
||||||
pha
|
bit InputFlags
|
||||||
waitWrite:
|
bvs SendByte
|
||||||
lda InputFlags
|
|
||||||
rol
|
|
||||||
rol
|
|
||||||
bcs waitWrite
|
|
||||||
pla
|
|
||||||
sta OutputByte
|
sta OutputByte
|
||||||
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
|
||||||
rts
|
rts
|
||||||
|
@ -137,17 +130,15 @@ GetByte:
|
||||||
lda #$2d ;set read flag low
|
lda #$2d ;set read flag low
|
||||||
sta OutputFlags
|
sta OutputFlags
|
||||||
waitRead:
|
waitRead:
|
||||||
lda InputFlags
|
bit InputFlags
|
||||||
rol
|
bmi waitRead
|
||||||
bcs waitRead
|
|
||||||
lda InputByte
|
lda InputByte
|
||||||
pha
|
pha
|
||||||
lda #$2f ;set all flags high
|
lda #$2f ;set all flags high
|
||||||
sta OutputFlags
|
sta OutputFlags
|
||||||
finishRead:
|
finishRead:
|
||||||
lda InputFlags
|
bit InputFlags
|
||||||
rol
|
bpl finishRead
|
||||||
bcc finishRead
|
|
||||||
pla
|
pla
|
||||||
end:
|
end:
|
||||||
rts
|
rts
|
||||||
|
|
|
@ -121,21 +121,14 @@ Boot:
|
||||||
jmp PageJump
|
jmp PageJump
|
||||||
|
|
||||||
SendByte:
|
SendByte:
|
||||||
pha
|
bit InputFlags
|
||||||
waitWrite:
|
bvs SendByte
|
||||||
lda InputFlags
|
|
||||||
rol
|
|
||||||
rol
|
|
||||||
bcs waitWrite
|
|
||||||
pla
|
|
||||||
sta OutputByte
|
sta OutputByte
|
||||||
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
|
||||||
rts
|
rts
|
||||||
|
@ -144,17 +137,15 @@ GetByte:
|
||||||
lda #$3d ;set read flag low
|
lda #$3d ;set read flag low
|
||||||
sta OutputFlags
|
sta OutputFlags
|
||||||
waitRead:
|
waitRead:
|
||||||
lda InputFlags
|
bit InputFlags
|
||||||
rol
|
bmi waitRead
|
||||||
bcs waitRead
|
|
||||||
lda InputByte
|
lda InputByte
|
||||||
pha
|
pha
|
||||||
lda #$3f ;set all flags high
|
lda #$3f ;set all flags high
|
||||||
sta OutputFlags
|
sta OutputFlags
|
||||||
finishRead:
|
finishRead:
|
||||||
lda InputFlags
|
bit InputFlags
|
||||||
rol
|
bpl finishRead
|
||||||
bcc finishRead
|
|
||||||
pla
|
pla
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user