2018-01-17 00:52:31 +00:00
|
|
|
rel
|
|
|
|
typ $B3
|
|
|
|
dsk main.l
|
2018-01-15 15:58:58 +00:00
|
|
|
|
2018-01-29 00:57:31 +00:00
|
|
|
; ensure 16-bit mode (unnecessary?)
|
2018-01-18 22:01:26 +00:00
|
|
|
clc
|
|
|
|
xce
|
2018-02-05 02:25:37 +00:00
|
|
|
rep #$30
|
2018-01-18 22:01:26 +00:00
|
|
|
|
2018-01-17 00:52:31 +00:00
|
|
|
phk
|
|
|
|
plb
|
2018-01-15 15:58:58 +00:00
|
|
|
|
2018-01-28 03:41:56 +00:00
|
|
|
; half bank for accumulator, you don't want to toggle them on then back off, right?
|
|
|
|
sep #$30
|
2018-01-18 22:01:26 +00:00
|
|
|
|
2018-01-27 02:25:23 +00:00
|
|
|
; toggle the softswitches; they don't take any values. some are only triggered
|
|
|
|
; by writes, $C054 can be triggered by a read
|
2018-01-28 03:41:56 +00:00
|
|
|
stal $00C000 ; disable 80 column store?
|
2018-01-18 22:01:26 +00:00
|
|
|
|
2018-01-28 03:41:56 +00:00
|
|
|
stal $00C00C ; disable 80 column hardware?!
|
|
|
|
stal $00C050 ; set standard apple ii gfx mode
|
|
|
|
stal $00C051 ; select text mode only. "only"?
|
|
|
|
ldal $00C054 ; select text page 1 (there are 2)
|
|
|
|
ldal $00C056 ; select "low res" graphics
|
2018-01-29 04:13:32 +00:00
|
|
|
|
2018-02-05 02:25:37 +00:00
|
|
|
rep #$30
|
|
|
|
sep #$20
|
2018-01-17 06:07:57 +00:00
|
|
|
|
2018-01-29 00:57:31 +00:00
|
|
|
; show the current char on screen
|
2018-02-01 04:47:06 +00:00
|
|
|
; read keyboard then hit strobe to reset
|
2018-01-29 04:13:32 +00:00
|
|
|
ldx #0
|
2018-02-08 04:30:43 +00:00
|
|
|
ldy #0
|
2018-02-01 04:47:06 +00:00
|
|
|
ldal $00C010
|
2018-01-29 00:57:31 +00:00
|
|
|
|
2018-02-08 04:30:43 +00:00
|
|
|
; core key event loop
|
|
|
|
|
2018-02-07 01:04:16 +00:00
|
|
|
:kloop clc
|
2018-02-04 22:00:31 +00:00
|
|
|
ldal $00C000
|
2018-02-08 04:30:43 +00:00
|
|
|
bit #%1 ; check strobe bit to make sure a key was pressed
|
2018-02-07 01:04:16 +00:00
|
|
|
bmi :kjump
|
|
|
|
jmp :kloop
|
|
|
|
:kjump jsr keydown
|
2018-02-08 04:30:43 +00:00
|
|
|
jsr drawpos
|
2018-02-07 01:04:16 +00:00
|
|
|
jmp :kloop
|
2018-02-04 22:00:31 +00:00
|
|
|
|
2018-02-08 04:30:43 +00:00
|
|
|
keydown cmp #$8B ; up
|
2018-02-05 00:21:35 +00:00
|
|
|
beq up
|
|
|
|
cmp #$8A ; down
|
|
|
|
beq down
|
|
|
|
cmp #$88 ; left
|
|
|
|
beq left
|
|
|
|
cmp #$95 ; right
|
2018-02-08 05:15:46 +00:00
|
|
|
beq colinc
|
2018-02-07 01:04:16 +00:00
|
|
|
cmp #$FF ; backspace
|
|
|
|
beq backspace
|
|
|
|
cmp #$8D ; return
|
|
|
|
beq down
|
2018-02-08 04:30:43 +00:00
|
|
|
jsr drawchar
|
2018-02-08 05:15:46 +00:00
|
|
|
jmp colinc
|
2018-02-08 04:30:43 +00:00
|
|
|
finkey ldal $00C010 ; clear strobe bit
|
|
|
|
lda #0
|
|
|
|
rts
|
2018-02-05 00:21:35 +00:00
|
|
|
|
2018-02-08 04:30:43 +00:00
|
|
|
up cpy #0
|
|
|
|
beq finkey
|
|
|
|
dey
|
|
|
|
jmp finkey
|
|
|
|
down cpy #22
|
|
|
|
beq finkey
|
|
|
|
iny
|
|
|
|
jmp finkey
|
|
|
|
left cpx #0
|
|
|
|
beq finkey
|
|
|
|
dex
|
|
|
|
jmp finkey
|
2018-02-08 05:15:46 +00:00
|
|
|
colinc cpx #39
|
|
|
|
beq :rolcol
|
2018-02-05 01:06:37 +00:00
|
|
|
inx
|
2018-02-08 04:30:43 +00:00
|
|
|
jmp finkey
|
2018-02-08 05:15:46 +00:00
|
|
|
:rolcol ldx #0
|
|
|
|
jmp down
|
|
|
|
|
2018-02-08 04:30:43 +00:00
|
|
|
backspace lda #$A0
|
|
|
|
jsr drawchar
|
|
|
|
jmp left
|
|
|
|
|
|
|
|
; $B0 is the start of the char table for numbers
|
|
|
|
; we start by preserving our registers
|
|
|
|
drawpos pha
|
|
|
|
phx
|
|
|
|
; draw the parens and comma
|
|
|
|
lda #"("
|
|
|
|
stal $0007F1
|
|
|
|
lda #$AC
|
|
|
|
stal $0007F4
|
|
|
|
lda #")"
|
|
|
|
stal $0007F7
|
|
|
|
txa
|
|
|
|
jsr tencount
|
|
|
|
adc #$B0
|
|
|
|
stal $0007F3
|
|
|
|
txa
|
|
|
|
adc #$B0
|
|
|
|
stal $0007F2
|
|
|
|
tya
|
|
|
|
jsr tencount
|
|
|
|
adc #$B0
|
|
|
|
stal $0007F6
|
|
|
|
txa
|
|
|
|
adc #$B0
|
|
|
|
stal $0007F5
|
|
|
|
; restore x and original keydown char
|
|
|
|
plx
|
|
|
|
pla
|
|
|
|
rts
|
2018-02-05 00:21:35 +00:00
|
|
|
|
2018-02-08 04:30:43 +00:00
|
|
|
drawchar stal $000400,X ; display the character
|
2018-02-01 04:47:06 +00:00
|
|
|
rts
|
2018-01-30 04:20:16 +00:00
|
|
|
|
2018-02-08 04:30:43 +00:00
|
|
|
tencount ldx #0
|
|
|
|
:substart clc
|
|
|
|
cmp #10
|
|
|
|
bcc :subout
|
|
|
|
sbc #10
|
|
|
|
inx
|
|
|
|
jmp :substart
|
|
|
|
:subout rts
|
|
|
|
|
2018-01-29 00:57:31 +00:00
|
|
|
; working text blit
|
|
|
|
* ldx #hithere+2 ; strl, first two bytes are strlen, # denotes immediate addr val
|
|
|
|
* ldy #$0400 ; start of text buffer on 00
|
|
|
|
* ldal hithere
|
|
|
|
* dec
|
2018-01-27 02:25:23 +00:00
|
|
|
|
2018-01-29 00:57:31 +00:00
|
|
|
* mvn $02, $00
|
|
|
|
* brk
|
2018-01-27 02:25:23 +00:00
|
|
|
|
2018-01-17 00:52:31 +00:00
|
|
|
; Important locations
|
|
|
|
SPEAKER equ $E0C030
|
|
|
|
PRODOS16 equ $E100A8
|
2018-01-15 15:58:58 +00:00
|
|
|
|
2018-01-17 00:52:31 +00:00
|
|
|
jsl PRODOS16
|
2018-01-28 22:29:30 +00:00
|
|
|
|
|
|
|
; This exit code is "device busy", why is it the only one
|
|
|
|
; that works?!
|
|
|
|
|
2018-01-17 00:52:31 +00:00
|
|
|
da $29
|
|
|
|
adrl QP
|
2018-01-15 15:58:58 +00:00
|
|
|
bcs ERROR
|
|
|
|
|
2018-01-17 00:52:31 +00:00
|
|
|
ERROR brk
|
2018-01-15 15:58:58 +00:00
|
|
|
|
|
|
|
QP adrl $0000
|
2018-01-17 00:52:31 +00:00
|
|
|
da $00
|
|
|
|
|
2018-01-28 16:40:43 +00:00
|
|
|
hithere strl "this was excruciating"
|
2018-01-30 04:20:16 +00:00
|
|
|
brkboi brk
|
|
|
|
|
2018-02-08 04:30:43 +00:00
|
|
|
bufbase da #40
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-02-07 01:04:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-02-08 05:15:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2018-02-07 01:04:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2018-01-30 04:20:16 +00:00
|
|
|
|