mirror of
https://codeberg.org/cryu/micro-sci-a2-controller
synced 2024-11-25 05:34:42 +00:00
157 lines
3.4 KiB
ArmAsm
157 lines
3.4 KiB
ArmAsm
; da65 V2.11.0 - (C) Copyright 2000-2005, Ullrich von Bassewitz
|
|
; Created: 2022-01-26 21:00:18
|
|
; Input file: xaa
|
|
; Page: 1
|
|
|
|
|
|
.setcpu "6502"
|
|
.org $c600
|
|
|
|
A2L := $3e
|
|
MON_WAIT := $FCA8
|
|
GETLNZ := $FD67
|
|
BELL := $FF3A
|
|
IORTS := $FF58
|
|
GETNUM := $FFA7
|
|
|
|
|
|
lda #$A3 ; '#'
|
|
sta $33 ; set input-prompt character to '#'
|
|
LC604: jsr BELL
|
|
LC607: jsr GETLNZ ; start new line and take input
|
|
lda #$00
|
|
sta $F2
|
|
LC60E: sta $C010 ; clear keyboard strobe
|
|
sta $F3
|
|
ldy $F2
|
|
jsr GETNUM ; parse hex into A2, A has last char xor $b0
|
|
; plus $89
|
|
sty $F2
|
|
cmp #$C6 ; $C6 from $8D (return)
|
|
beq LC607 ; no more input, go prompt for new input
|
|
cmp #$EC ; 'S'
|
|
beq CMD_S
|
|
cmp #$F0 ; 'W'
|
|
beq CMD_W
|
|
cmp #$F3 ; 'Z'
|
|
beq CMD_Z
|
|
ldy #$7F
|
|
cmp #$06 ; 'M'
|
|
beq CMD_MX
|
|
cmp #$EB ; 'R'
|
|
beq CMD_R
|
|
ldx #$06
|
|
stx $F3
|
|
cmp #$F1 ; 'X'
|
|
beq CMD_MX
|
|
cmp #$EA ; 'Q'
|
|
bne LC604 ; BEEP and prompt for new input
|
|
brk ; 'Q' exits out
|
|
|
|
; 'R'
|
|
CMD_R: lda #$50
|
|
sta $FC
|
|
txa
|
|
adc #$00
|
|
sta $F3
|
|
lda #$00
|
|
beq LC651
|
|
|
|
; 'S': seek logical-track index in A2L ('22S' seeks logical track $22)
|
|
CMD_S: lda A2L
|
|
asl a
|
|
LC651: sta $F0
|
|
ldy #$FF
|
|
bne CMD_MX
|
|
|
|
; 'Z'
|
|
CMD_Z: lda A2L
|
|
asl a
|
|
sta $F1
|
|
ldy #$00
|
|
beq CMD_MX
|
|
LC660: lda #$50
|
|
jsr MON_WAIT
|
|
sta $C088,x
|
|
ldy A2L
|
|
LC66A: jsr MON_WAIT
|
|
dey
|
|
bpl LC66A
|
|
bmi LC68E
|
|
LC672: lda #$00
|
|
beq LC60E
|
|
|
|
; 'W'
|
|
CMD_W: lda A2L
|
|
sta $FF
|
|
ldy #$0F
|
|
CMD_MX: sty $09
|
|
jsr IORTS
|
|
tsx
|
|
lda $0100,x
|
|
asl a
|
|
asl a
|
|
asl a
|
|
asl a
|
|
sta $FD
|
|
adc $F3
|
|
tax
|
|
LC68E: sta $C089,x
|
|
lda $09
|
|
beq LC6BA
|
|
bmi LC6BA
|
|
asl a
|
|
bmi LC6AC
|
|
sta $C08F,x
|
|
LC69D: lda $09
|
|
asl a
|
|
bmi LC660
|
|
nop
|
|
nop
|
|
lda $FF
|
|
sta $C08D,x
|
|
cmp $C08C,x
|
|
LC6AC: lda $C000
|
|
eor #$9B
|
|
bne LC69D
|
|
ldx $FD
|
|
sta $C08E,x
|
|
LC6B8: beq LC672
|
|
LC6BA: ldx $FD
|
|
sta $C089,x
|
|
LC6BF: ldy $FC
|
|
LC6C1: cpy $F0
|
|
bne LC6E3
|
|
lda $F0
|
|
sta $FC
|
|
lda $09
|
|
bne LC672
|
|
lda $F0
|
|
ldy $F1
|
|
sta $F1
|
|
sty $F0
|
|
lda $C000
|
|
eor #$9B
|
|
beq LC6B8
|
|
lda #$73
|
|
jsr MON_WAIT
|
|
bcs LC6BF
|
|
LC6E3: bcs LC6E7
|
|
iny
|
|
iny
|
|
LC6E7: dey
|
|
tya
|
|
and #$03
|
|
asl a
|
|
ora $FD
|
|
tax
|
|
lsr a
|
|
lsr a
|
|
sta $C081,x
|
|
nop
|
|
nop
|
|
lda #$56
|
|
jsr MON_WAIT
|
|
sta $C080,x
|
|
bcs LC6C1
|