mirror of
https://github.com/dschmenk/apple2pi.git
synced 2024-11-24 12:31:30 +00:00
173 lines
2.1 KiB
ArmAsm
Executable File
173 lines
2.1 KiB
ArmAsm
Executable File
.DEFINE EQU =
|
|
.CODE
|
|
PISLOT EQU $05
|
|
;*
|
|
;* ACIA REGISTERS
|
|
;*
|
|
ACIADR EQU $C088+PISLOT*16
|
|
ACIASR EQU $C089+PISLOT*16
|
|
ACIACR EQU $C08A+PISLOT*16
|
|
ACIAMR EQU $C08B+PISLOT*16
|
|
;*
|
|
;* APPLE I/O LOCATIONS
|
|
;*
|
|
KEYBD EQU $C000
|
|
STROBE EQU $C010
|
|
;*
|
|
;* UTIL ROUTINES
|
|
;*
|
|
WAIT EQU $FCA8
|
|
COUT EQU $FDED
|
|
CROUT EQU $FD8E
|
|
PRBYTE EQU $FDDA
|
|
PRHEX EQU $FDE3
|
|
PRNTAX EQU $F941
|
|
RDKEY EQU $FD0C
|
|
RDCHAR EQU $FD35
|
|
GETLN EQU $FD6A
|
|
;*
|
|
;* ZERO PAGE PARAMETERS
|
|
;*
|
|
PDCMD EQU $42
|
|
PDUNIT EQU $43
|
|
PDBUFF EQU $44
|
|
PDBUFL EQU $44
|
|
PDBUFH EQU $45
|
|
PDBLKL EQU $46
|
|
PDBLKH EQU $47
|
|
;*
|
|
;* PRODOS COMMANDS
|
|
;*
|
|
PDSTAT EQU 0
|
|
PDREAD EQU 1
|
|
PDWRITE EQU 2
|
|
PDFORMT EQU 3
|
|
;*
|
|
;* PRODOS ERRORS
|
|
;*
|
|
PDNOERR EQU $00
|
|
PDIOERR EQU $27
|
|
PDNODEV EQU $28
|
|
PDWRPRT EQU $2B
|
|
;*
|
|
;* AUTOSTART BOOT SIGNATURE
|
|
;*
|
|
LDX #$20
|
|
LDY #$00
|
|
LDX #$03
|
|
STX $3C
|
|
;*
|
|
;* INIT ACIA
|
|
;*
|
|
STY ACIASR ; RESET STATUS REGISTER
|
|
LDY #$0B
|
|
STY ACIACR ; SET CONTROL REGISTER
|
|
LDY #$10
|
|
STY ACIAMR ; SET COMMAND REGISTER (115K BAUD)
|
|
;*
|
|
;* SYNC WITH HOST
|
|
;*
|
|
SYNC: LDA #$80
|
|
STA ACIADR
|
|
LDA #$FF
|
|
JSR WAIT
|
|
LDA KEYBD
|
|
BMI SKIPBOOT
|
|
LDA ACIASR
|
|
AND #$08
|
|
BEQ SYNC
|
|
LDA ACIADR
|
|
CMP #$81
|
|
BNE SYNC
|
|
BEQ BOOT
|
|
SKIPBOOT: STA STROBE
|
|
JMP $FABA ; JUMP BACK TO BOOT SCANNER ROM ROUTINE
|
|
;*
|
|
;* CREATE COMMAND BUFFER FOR BOOT BLOCK
|
|
;*
|
|
BOOT: LDA #PDREAD
|
|
STA PDCMD
|
|
LDA #$00
|
|
STA PDUNIT
|
|
STA PDBUFL
|
|
STA PDBLKL
|
|
STA PDBLKH
|
|
PHA
|
|
LDA #$08
|
|
STA PDBUFH
|
|
PHA
|
|
;*
|
|
;* PRODOS INTELLIGENT DEVICE ENTRYPOINT
|
|
;*
|
|
DOCMD: PHP
|
|
SEI
|
|
LDA PDUNIT
|
|
ASL
|
|
LDA PDCMD
|
|
ROL
|
|
ASL
|
|
JSR SENDACC
|
|
LDA PDBLKL
|
|
JSR SENDACC
|
|
LDA PDBLKH
|
|
JSR SENDACC
|
|
CHKACK: JSR RECVACC
|
|
TAX
|
|
DEX
|
|
CPX PDCMD
|
|
BNE CHKACK
|
|
LDY #$00
|
|
CPX #PDREAD
|
|
BEQ RDBLK
|
|
CPX #PDWRITE
|
|
BEQ WRBLK
|
|
CPX #PDSTAT
|
|
BEQ STATDEV
|
|
LDA #PDIOERR
|
|
CMDERR: PLP
|
|
SEC
|
|
RTS
|
|
STATDEV:
|
|
LDX #$FF
|
|
LDY #$FF
|
|
CMDEX: JSR RECVACC
|
|
BNE CMDERR
|
|
PLP
|
|
CLC
|
|
RTS
|
|
RDBLK:
|
|
RD1BLK: JSR RECVACC
|
|
STA (PDBUFF),Y
|
|
INY
|
|
BNE RD1BLK
|
|
INC PDBUFH
|
|
RD2BLK: JSR RECVACC
|
|
STA (PDBUFF),Y
|
|
INY
|
|
BNE RD2BLK
|
|
BEQ CMDEX
|
|
WRBLK:
|
|
WR1BLK: LDA (PDBUFF),Y
|
|
JSR SENDACC
|
|
INY
|
|
BNE WR1BLK
|
|
INC PDBUFH
|
|
WR2BLK: LDA (PDBUFF),Y
|
|
JSR SENDACC
|
|
INY
|
|
BNE WR1BLK
|
|
BEQ CMDEX
|
|
SENDACC:
|
|
PHA
|
|
SENDWT: LDA ACIASR
|
|
AND #$10
|
|
BEQ SENDWT
|
|
PLA
|
|
STA ACIADR
|
|
RTS
|
|
RECVACC:
|
|
RECVWT: LDA ACIASR
|
|
AND #$08
|
|
BEQ RECVWT
|
|
LDA ACIADR
|
|
RTS |