micro-sci-a2-controller/firmware/util.s

157 lines
3.4 KiB
ArmAsm
Raw Normal View History

2023-07-09 20:59:05 +00:00
; 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"
2023-07-16 02:28:35 +00:00
.org $c600
2023-07-09 20:59:05 +00:00
2023-07-16 02:28:35 +00:00
A2L := $3e
MON_WAIT := $FCA8
GETLNZ := $FD67
BELL := $FF3A
IORTS := $FF58
GETNUM := $FFA7
2023-07-09 20:59:05 +00:00
2023-07-16 02:28:35 +00:00
lda #$A3 ; '#'
sta $33 ; set input-prompt character to '#'
2023-07-09 20:59:05 +00:00
LC604: jsr BELL
2023-07-16 02:28:35 +00:00
LC607: jsr GETLNZ ; start new line and take input
2023-07-09 20:59:05 +00:00
lda #$00
sta $F2
2023-07-16 02:28:35 +00:00
LC60E: sta $C010 ; clear keyboard strobe
2023-07-09 20:59:05 +00:00
sta $F3
ldy $F2
2023-07-16 02:28:35 +00:00
jsr GETNUM ; parse hex into A2, A has last char xor $b0
; plus $89
2023-07-09 20:59:05 +00:00
sty $F2
2023-07-16 02:28:35 +00:00
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
2023-07-09 20:59:05 +00:00
ldy #$7F
2023-07-16 02:28:35 +00:00
cmp #$06 ; 'M'
beq CMD_MX
cmp #$EB ; 'R'
beq CMD_R
2023-07-09 20:59:05 +00:00
ldx #$06
stx $F3
2023-07-16 02:28:35 +00:00
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
2023-07-09 20:59:05 +00:00
sta $FC
txa
adc #$00
sta $F3
lda #$00
beq LC651
2023-07-16 02:28:35 +00:00
; 'S': seek logical-track index in A2L ('22S' seeks logical track $22)
CMD_S: lda A2L
2023-07-09 20:59:05 +00:00
asl a
LC651: sta $F0
ldy #$FF
2023-07-16 02:28:35 +00:00
bne CMD_MX
; 'Z'
CMD_Z: lda A2L
2023-07-09 20:59:05 +00:00
asl a
sta $F1
ldy #$00
2023-07-16 02:28:35 +00:00
beq CMD_MX
2023-07-09 20:59:05 +00:00
LC660: lda #$50
jsr MON_WAIT
sta $C088,x
2023-07-16 02:28:35 +00:00
ldy A2L
2023-07-09 20:59:05 +00:00
LC66A: jsr MON_WAIT
dey
bpl LC66A
bmi LC68E
LC672: lda #$00
beq LC60E
2023-07-16 02:28:35 +00:00
; 'W'
CMD_W: lda A2L
2023-07-09 20:59:05 +00:00
sta $FF
ldy #$0F
2023-07-16 02:28:35 +00:00
CMD_MX: sty $09
2023-07-09 20:59:05 +00:00
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