mirror of
https://github.com/tjboldt/Apple2-IO-RPi.git
synced 2024-06-10 01:29:31 +00:00
WIP - clock driver
This commit is contained in:
parent
4fd6b7b91e
commit
92aa732c92
|
@ -1,48 +1,141 @@
|
|||
enableWriteLang = $C088
|
||||
disableWriteLang = $C082
|
||||
EnableWriteLang = $C088
|
||||
DisableWriteLang = $C082
|
||||
|
||||
prodosJump = $BF06
|
||||
prodosClockCode = $BF07
|
||||
prodosMachineId = $BF98
|
||||
ProdosJump = $BF06
|
||||
ProdosClockCode = $BF07
|
||||
ProdosMachineId = $BF98
|
||||
|
||||
PrintChar = $FDED
|
||||
PrintHex = $FDE3
|
||||
PrintByte = $FDDA
|
||||
|
||||
GetTimeCommand = $03
|
||||
|
||||
.org $2000
|
||||
; Find Apple2-IO-RPi card
|
||||
ldx #$06
|
||||
ldy #$09
|
||||
CheckIdBytes:
|
||||
lda $C700,y ; !! Self modifying code
|
||||
cmp IdBytes,y
|
||||
bne NextCard
|
||||
dey
|
||||
bne CheckIdBytes
|
||||
jmp FoundCard
|
||||
NextCard:
|
||||
dec CheckIdBytes+2
|
||||
ldy #$09
|
||||
dex
|
||||
bne CheckIdBytes
|
||||
CardNotFound:
|
||||
ldy #$00
|
||||
PrintCardNotFound:
|
||||
lda TextCardNotFound,y
|
||||
beq Failed
|
||||
ora #$80
|
||||
jsr PrintChar
|
||||
iny
|
||||
bne PrintCardNotFound
|
||||
Failed:
|
||||
rts
|
||||
FoundCard:
|
||||
ldy #$00
|
||||
PrintCardFound:
|
||||
lda TextCardFound,y
|
||||
beq PrintCardNumber
|
||||
ora #$80
|
||||
jsr PrintChar
|
||||
iny
|
||||
bne PrintCardFound
|
||||
PrintCardNumber:
|
||||
inx
|
||||
txa
|
||||
jsr PrintHex
|
||||
lda #$8D
|
||||
jsr PrintChar
|
||||
|
||||
|
||||
; Change driver code to point to the card
|
||||
txa
|
||||
ora #$C0
|
||||
sta GetByte+2
|
||||
sta SendByte+2
|
||||
jsr PrintByte
|
||||
|
||||
|
||||
; Change destination to be ProDOS clock code location
|
||||
lda prodosClockCode
|
||||
lda ProdosClockCode
|
||||
sta DriverDestination+1
|
||||
lda prodosClockCode+1
|
||||
jsr PrintByte
|
||||
lda ProdosClockCode+1
|
||||
sta DriverDestination+2
|
||||
jsr PrintByte
|
||||
|
||||
; Changing RTS to JMP enables clock driver
|
||||
lda #$4C ; jump instruction
|
||||
sta prodosJump
|
||||
sta ProdosJump
|
||||
|
||||
; Enable writing to language card RAM
|
||||
; by triggering switch twice
|
||||
lda enableWriteLang
|
||||
lda enableWriteLang
|
||||
lda EnableWriteLang
|
||||
lda EnableWriteLang
|
||||
|
||||
; write driver code to language card RAM
|
||||
WriteDriver:
|
||||
ldy #EndDriver-Driver+1
|
||||
WriteDriver:
|
||||
lda Driver,y
|
||||
DriverDestination:
|
||||
sta $D000,y ; this address gets modified above
|
||||
sta $D000,y ; !! this address gets modified above
|
||||
dey
|
||||
bne WriteDriver
|
||||
|
||||
; Disable writing to language card RAM
|
||||
lda disableWriteLang
|
||||
lda DisableWriteLang
|
||||
|
||||
; Update ProDOS Machine ID to mark clock as enabled
|
||||
lda prodosMachineId
|
||||
lda ProdosMachineId
|
||||
ora #$01
|
||||
sta prodosMachineId
|
||||
sta ProdosMachineId
|
||||
|
||||
ldy #$00
|
||||
PrintFinished:
|
||||
lda TextDriverInstalled,y
|
||||
beq Finished
|
||||
ora #$80
|
||||
jsr PrintChar
|
||||
iny
|
||||
bne PrintFinished
|
||||
Finished:
|
||||
rts
|
||||
|
||||
IdBytes:
|
||||
.byte $E0,$20,$E0,$00,$E0,$03,$E0,$3C,$A9,$3F
|
||||
|
||||
TextCardFound:
|
||||
.byte "Found Apple2-IO-RPi in slot ",$00
|
||||
|
||||
TextCardNotFound:
|
||||
.byte "Apple2-IO-RPi not found",$8D,$00
|
||||
|
||||
TextDriverInstalled:
|
||||
.byte "Clock driver installed",$8D,$00
|
||||
|
||||
Driver:
|
||||
rts
|
||||
php
|
||||
pha
|
||||
lda #GetTimeCommand
|
||||
SendByte:
|
||||
jsr $C749 ; !! address gets modified on installation
|
||||
ldy #$00
|
||||
getTimeByte:
|
||||
GetByte:
|
||||
jsr $C743 ; !! address gets modified on installation
|
||||
sta $bf90,y
|
||||
iny
|
||||
cpy #$04
|
||||
bne getTimeByte
|
||||
pla
|
||||
plp
|
||||
EndDriver:
|
||||
rts
|
||||
|
|
|
@ -69,7 +69,7 @@ DetectSlot:
|
|||
bne nextSlot
|
||||
iny
|
||||
lda (SlotL),y
|
||||
cmp #$14
|
||||
cmp #$1F
|
||||
bne nextSlot
|
||||
txa
|
||||
asl
|
||||
|
|
|
@ -78,7 +78,7 @@ DetectSlot:
|
|||
bne nextSlot
|
||||
iny
|
||||
lda (SlotL),y
|
||||
cmp #$14
|
||||
cmp #$1F
|
||||
bne nextSlot
|
||||
txa
|
||||
asl
|
||||
|
|
Loading…
Reference in New Issue
Block a user