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
|
||||
|
||||
SendByte:
|
||||
pha
|
||||
waitWrite:
|
||||
lda InputFlags
|
||||
rol
|
||||
rol
|
||||
bcs waitWrite
|
||||
pla
|
||||
bit InputFlags
|
||||
bvs SendByte
|
||||
sta OutputByte
|
||||
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
|
||||
rts
|
||||
|
@ -150,9 +143,8 @@ GetByte:
|
|||
lda #$1d ;set read flag low
|
||||
sta OutputFlags
|
||||
waitRead:
|
||||
lda InputFlags
|
||||
rol
|
||||
bcc readByte
|
||||
bit InputFlags
|
||||
bpl readByte
|
||||
bit Keyboard ;keypress will abort waiting to read
|
||||
bpl waitRead
|
||||
lda #$1f ;set all flags high and exit
|
||||
|
@ -165,9 +157,8 @@ readByte:
|
|||
lda #$1f ;set all flags high
|
||||
sta OutputFlags
|
||||
finishRead:
|
||||
lda InputFlags
|
||||
rol
|
||||
bcc finishRead
|
||||
bit InputFlags
|
||||
bpl finishRead
|
||||
pla
|
||||
clc ;success
|
||||
end:
|
||||
|
|
|
@ -161,21 +161,14 @@ write256:
|
|||
rts
|
||||
|
||||
SendByte:
|
||||
pha
|
||||
waitWrite:
|
||||
lda InputFlags
|
||||
rol
|
||||
rol
|
||||
bcs waitWrite
|
||||
pla
|
||||
bit InputFlags
|
||||
bvs SendByte
|
||||
sta OutputByte
|
||||
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
|
||||
rts
|
||||
|
@ -184,17 +177,15 @@ GetByte:
|
|||
lda #$0d ;set read flag low
|
||||
sta OutputFlags
|
||||
waitRead:
|
||||
lda InputFlags
|
||||
rol
|
||||
bcs waitRead
|
||||
bit InputFlags
|
||||
bmi waitRead
|
||||
lda InputByte
|
||||
pha
|
||||
lda #$0f ;set all flags high
|
||||
sta OutputFlags
|
||||
finishRead:
|
||||
lda InputFlags
|
||||
rol
|
||||
bcc finishRead
|
||||
bit InputFlags
|
||||
bpl finishRead
|
||||
pla
|
||||
end:
|
||||
rts
|
||||
|
|
|
@ -114,21 +114,14 @@ ExitToMonitor:
|
|||
jsr Monitor
|
||||
|
||||
SendByte:
|
||||
pha
|
||||
waitWrite:
|
||||
lda InputFlags
|
||||
rol
|
||||
rol
|
||||
bcs waitWrite
|
||||
pla
|
||||
bit InputFlags
|
||||
bvs SendByte
|
||||
sta OutputByte
|
||||
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
|
||||
rts
|
||||
|
@ -137,17 +130,15 @@ GetByte:
|
|||
lda #$2d ;set read flag low
|
||||
sta OutputFlags
|
||||
waitRead:
|
||||
lda InputFlags
|
||||
rol
|
||||
bcs waitRead
|
||||
bit InputFlags
|
||||
bmi waitRead
|
||||
lda InputByte
|
||||
pha
|
||||
lda #$2f ;set all flags high
|
||||
sta OutputFlags
|
||||
finishRead:
|
||||
lda InputFlags
|
||||
rol
|
||||
bcc finishRead
|
||||
bit InputFlags
|
||||
bpl finishRead
|
||||
pla
|
||||
end:
|
||||
rts
|
||||
|
|
|
@ -121,21 +121,14 @@ Boot:
|
|||
jmp PageJump
|
||||
|
||||
SendByte:
|
||||
pha
|
||||
waitWrite:
|
||||
lda InputFlags
|
||||
rol
|
||||
rol
|
||||
bcs waitWrite
|
||||
pla
|
||||
bit InputFlags
|
||||
bvs SendByte
|
||||
sta OutputByte
|
||||
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
|
||||
rts
|
||||
|
@ -144,17 +137,15 @@ GetByte:
|
|||
lda #$3d ;set read flag low
|
||||
sta OutputFlags
|
||||
waitRead:
|
||||
lda InputFlags
|
||||
rol
|
||||
bcs waitRead
|
||||
bit InputFlags
|
||||
bmi waitRead
|
||||
lda InputByte
|
||||
pha
|
||||
lda #$3f ;set all flags high
|
||||
sta OutputFlags
|
||||
finishRead:
|
||||
lda InputFlags
|
||||
rol
|
||||
bcc finishRead
|
||||
bit InputFlags
|
||||
bpl finishRead
|
||||
pla
|
||||
rts
|
||||
|
||||
|
|
Loading…
Reference in New Issue