mirror of
https://github.com/mach-kernel/mrbuffer.git
synced 2024-09-27 04:55:01 +00:00
refactored with working char index!
This commit is contained in:
parent
f1b1cb084d
commit
4a4a86082d
206
src/main.S
206
src/main.S
@ -29,18 +29,21 @@
|
|||||||
; show the current char on screen
|
; show the current char on screen
|
||||||
; read keyboard then hit strobe to reset
|
; read keyboard then hit strobe to reset
|
||||||
ldx #0
|
ldx #0
|
||||||
|
ldy #0
|
||||||
ldal $00C010
|
ldal $00C010
|
||||||
|
|
||||||
|
; core key event loop
|
||||||
|
|
||||||
:kloop clc
|
:kloop clc
|
||||||
ldal $00C000
|
ldal $00C000
|
||||||
bit #%1
|
bit #%1 ; check strobe bit to make sure a key was pressed
|
||||||
bmi :kjump
|
bmi :kjump
|
||||||
jmp :kloop
|
jmp :kloop
|
||||||
:kjump jsr keydown
|
:kjump jsr keydown
|
||||||
|
jsr drawpos
|
||||||
jmp :kloop
|
jmp :kloop
|
||||||
|
|
||||||
keydown nop
|
keydown cmp #$8B ; up
|
||||||
cmp #$8B ; up
|
|
||||||
beq up
|
beq up
|
||||||
cmp #$8A ; down
|
cmp #$8A ; down
|
||||||
beq down
|
beq down
|
||||||
@ -52,68 +55,74 @@ keydown nop
|
|||||||
beq backspace
|
beq backspace
|
||||||
cmp #$8D ; return
|
cmp #$8D ; return
|
||||||
beq down
|
beq down
|
||||||
jmp dispchar
|
|
||||||
|
|
||||||
backspace clc
|
|
||||||
cpx #0
|
|
||||||
bne :drop
|
|
||||||
jmp :out
|
|
||||||
:drop dex
|
|
||||||
:out lda #$A0
|
|
||||||
stal $000400,X
|
|
||||||
jmp rtsout
|
|
||||||
|
|
||||||
up clc
|
|
||||||
phy
|
|
||||||
ldy #0
|
|
||||||
jsr updown
|
|
||||||
ply
|
|
||||||
jmp rtsout
|
|
||||||
|
|
||||||
down clc
|
|
||||||
phy
|
|
||||||
ldy #1
|
|
||||||
jsr updown
|
|
||||||
ply
|
|
||||||
jmp rtsout
|
|
||||||
|
|
||||||
updown clc
|
|
||||||
cpx #1488
|
|
||||||
beq rtsout
|
|
||||||
rep #$30
|
|
||||||
pha
|
|
||||||
txa
|
|
||||||
cpy #0
|
|
||||||
beq :ldown
|
|
||||||
bne :lup
|
|
||||||
:lup adc #128
|
|
||||||
jmp :lcont
|
|
||||||
:ldown sbc #128
|
|
||||||
:lcont tax
|
|
||||||
pla
|
|
||||||
sep #$20
|
|
||||||
jmp rtsout
|
|
||||||
|
|
||||||
left clc
|
|
||||||
cpx #0
|
|
||||||
beq rtsout
|
|
||||||
dex
|
|
||||||
jmp rtsout
|
|
||||||
|
|
||||||
right clc
|
|
||||||
cpx #39
|
|
||||||
beq rtsout
|
|
||||||
inx
|
inx
|
||||||
jmp rtsout
|
jsr drawchar
|
||||||
|
finkey ldal $00C010 ; clear strobe bit
|
||||||
dispchar stal $000400,X
|
|
||||||
inx
|
|
||||||
jmp rtsout
|
|
||||||
|
|
||||||
rtsout ldal $00C010
|
|
||||||
lda #0
|
lda #0
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
up cpy #0
|
||||||
|
beq finkey
|
||||||
|
dey
|
||||||
|
jmp finkey
|
||||||
|
down cpy #22
|
||||||
|
beq finkey
|
||||||
|
iny
|
||||||
|
jmp finkey
|
||||||
|
left cpx #0
|
||||||
|
beq finkey
|
||||||
|
dex
|
||||||
|
jmp finkey
|
||||||
|
right cpx #39
|
||||||
|
beq finkey
|
||||||
|
inx
|
||||||
|
jmp finkey
|
||||||
|
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
|
||||||
|
|
||||||
|
drawchar stal $000400,X ; display the character
|
||||||
|
rts
|
||||||
|
|
||||||
|
tencount ldx #0
|
||||||
|
:substart clc
|
||||||
|
cmp #10
|
||||||
|
bcc :subout
|
||||||
|
sbc #10
|
||||||
|
inx
|
||||||
|
jmp :substart
|
||||||
|
:subout rts
|
||||||
|
|
||||||
; working text blit
|
; working text blit
|
||||||
* ldx #hithere+2 ; strl, first two bytes are strlen, # denotes immediate addr val
|
* ldx #hithere+2 ; strl, first two bytes are strlen, # denotes immediate addr val
|
||||||
* ldy #$0400 ; start of text buffer on 00
|
* ldy #$0400 ; start of text buffer on 00
|
||||||
@ -127,7 +136,6 @@ rtsout ldal $00C010
|
|||||||
SPEAKER equ $E0C030
|
SPEAKER equ $E0C030
|
||||||
PRODOS16 equ $E100A8
|
PRODOS16 equ $E100A8
|
||||||
|
|
||||||
|
|
||||||
jsl PRODOS16
|
jsl PRODOS16
|
||||||
|
|
||||||
; This exit code is "device busy", why is it the only one
|
; This exit code is "device busy", why is it the only one
|
||||||
@ -145,6 +153,80 @@ QP adrl $0000
|
|||||||
hithere strl "this was excruciating"
|
hithere strl "this was excruciating"
|
||||||
brkboi brk
|
brkboi brk
|
||||||
|
|
||||||
|
bufbase da #40
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user