mirror of
https://github.com/dschmenk/apple2pi.git
synced 2024-11-24 12:31:30 +00:00
148 lines
2.0 KiB
ArmAsm
148 lines
2.0 KiB
ArmAsm
|
;****************************************
|
||
|
;*
|
||
|
;* SLOT INDEPENDENT ROM CODE @ $Cn00
|
||
|
;*
|
||
|
;****************************************
|
||
|
CXSLOT EQU *
|
||
|
;*
|
||
|
;* AUTOSTART BOOT SIGNATURE
|
||
|
;*
|
||
|
LDX #$20
|
||
|
LDY #$00
|
||
|
LDX #$03
|
||
|
STX $3C
|
||
|
;*
|
||
|
;* AUTOSTART/PR# ENTRYPOINT
|
||
|
;*
|
||
|
.IFDEF DEBUG
|
||
|
LDA #'*'
|
||
|
STA INDCTR+7
|
||
|
.ENDIF
|
||
|
PHP
|
||
|
SEI
|
||
|
STA XROMOFF
|
||
|
.IFDEF PIROM
|
||
|
LDA #$01
|
||
|
STA BANKSEL
|
||
|
.ENDIF
|
||
|
JSR GETSLOT
|
||
|
LDA #$00
|
||
|
STA SYNCED,Y ; CLEAR SYNCED FLAG
|
||
|
JSR SYNC
|
||
|
BNE NOBOOT
|
||
|
;*
|
||
|
;* CREATE COMMAND BUFFER FOR BOOT BLOCK
|
||
|
;*
|
||
|
STX PDUNIT ; SLOT * 16, DEV 0
|
||
|
LDX #$00
|
||
|
STX PDBLKL
|
||
|
STX PDBLKH
|
||
|
STX PDBUFL
|
||
|
INX ; LDX #PDREAD
|
||
|
STX PDCMD
|
||
|
LDX #$08
|
||
|
STX PDBUFH
|
||
|
.IFDEF ALTBOOT
|
||
|
STA STROBE
|
||
|
JSR PUTMSG
|
||
|
LDX #$10
|
||
|
BOOTMSG:
|
||
|
LDA #$FF
|
||
|
JSR WAIT
|
||
|
LDA KEYBD
|
||
|
BPL BOOTDELAY
|
||
|
STA STROBE
|
||
|
LDX #$01
|
||
|
CMP #'M'+$80
|
||
|
BEQ :+
|
||
|
CMP #'m'+$80
|
||
|
BNE BOOTDELAY
|
||
|
: LDA #SIBOOT ; LOAD SI BOOT PROGRAM
|
||
|
STA PDCMD
|
||
|
BOOTDELAY:
|
||
|
DEX
|
||
|
BNE BOOTMSG
|
||
|
JSR CLRMSG
|
||
|
LDA IOSLOT
|
||
|
AND #$0F
|
||
|
TAY
|
||
|
.ENDIF
|
||
|
BOOT: LDX SLOT16
|
||
|
JSR DOCMD ; READ BOOT BLOCK
|
||
|
PLP
|
||
|
PHA
|
||
|
LDA IOSLOT
|
||
|
AND #$0F
|
||
|
TAY
|
||
|
LDA SAVE16,Y ; SAVED ORIGINAL SLOT16 VALUE
|
||
|
STA SLOT16
|
||
|
PLA
|
||
|
BNE NOBOOT
|
||
|
JMP $801 ; JUMP TO BOOT BLOCK
|
||
|
NOBOOT: LDA $00
|
||
|
BEQ AUTOSTART
|
||
|
RTS
|
||
|
AUTOSTART:
|
||
|
JMP $FABA ; JUMP BACK TO AUTOSTART BOOT SCANNER ROM
|
||
|
;*
|
||
|
;* PRODOS INTELLIGENT DEVICE ENTRYPOINT
|
||
|
;*
|
||
|
CMDENTRY:
|
||
|
PHP
|
||
|
SEI
|
||
|
STA XROMOFF
|
||
|
.IFDEF PIROM
|
||
|
LDA #$01
|
||
|
STA BANKSEL
|
||
|
.ENDIF
|
||
|
JSR GETSLOT
|
||
|
.IFDEF DEBUG
|
||
|
LDA PDCMD
|
||
|
ORA #'0'
|
||
|
STA INDCTR+1
|
||
|
.ENDIF
|
||
|
JSR DOCMD
|
||
|
PLP
|
||
|
PHA ; RESTORE ORIGINAL SLOT16 VALUE
|
||
|
TYA
|
||
|
PHA
|
||
|
LDA IOSLOT
|
||
|
AND #$0F
|
||
|
TAY
|
||
|
LDA SAVE16,Y ; SAVED ORIGINAL SLOT16 VALUE
|
||
|
STA SLOT16
|
||
|
PLA
|
||
|
TAY
|
||
|
PLA
|
||
|
;*
|
||
|
;* CHECK FOR ERROR
|
||
|
;*
|
||
|
BNE CMDERR
|
||
|
CLC ; ALL GOOD, CLEAR ERROR FLAG
|
||
|
RTS
|
||
|
CMDERR:
|
||
|
.IFDEF DEBUG
|
||
|
PHA
|
||
|
STA $2FF
|
||
|
LDA #'E'-$40
|
||
|
STA INDCTR+2
|
||
|
: LDA KEYBD
|
||
|
BPL :-
|
||
|
STA STROBE
|
||
|
CMP #'M'+$80
|
||
|
BNE :+
|
||
|
LDA ROMEN
|
||
|
JMP MONITOR
|
||
|
: PLA
|
||
|
.ENDIF
|
||
|
SEC ; SET ERROR FLAG
|
||
|
RTS
|
||
|
ENDCMD:
|
||
|
.REPEAT CXSLOT+250-*
|
||
|
DB $00
|
||
|
.ENDREP
|
||
|
DB SIG ; SIGNATURE
|
||
|
DW 0 ; USE STATUS TO GET SIZE
|
||
|
DB $97 ; REMOVEABLE, 2 DEVICES, R/W
|
||
|
DB <CMDENTRY
|