summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2019-12-19 01:02:09 -0500
committermrb0nk500 <b0nk@b0nk.xyz>2019-12-19 01:07:44 -0500
commit3029d54edf8baabb2841f9a6f3d88bfc993ae3e8 (patch)
treea6d13de021ef642eeefcc3d0804764d86f72365d /test
parentca5f89b8f043b180c26ef2494cab52121ba97328 (diff)
Added the B register, which is used for storing the
remainder during a DIV instruction. I also added the TAB, and TBA instructions, for transfering between the Accumulator, and the B register.
Diffstat (limited to 'test')
-rw-r--r--test/input.s47
1 files changed, 45 insertions, 2 deletions
diff --git a/test/input.s b/test/input.s
index a2725f6..95b4077 100644
--- a/test/input.s
+++ b/test/input.s
@@ -12,10 +12,15 @@ string2:
.byte "You typed, "
end:
.byte $0
-x:
+scr_row:
.word $0
-tmp:
+scr_col:
.word $0
+a:
+ .word $0
+b:
+ .word $0
+
; Input buffer.
.org $2000
buffer:
@@ -93,6 +98,10 @@ esc:
cmp #$44 ; Did the user press the left arrow?
beq left ; Yes, so move the cursor left.
up:
+ lda scr_row
+ beq rset_a
+ dec scr_row
+ jsr update_pos
lda #$1B
sta $C001
lda #$5B
@@ -101,6 +110,8 @@ up:
sta $C001
jmp rset_a
down:
+ inc scr_row
+ jsr update_pos
lda #$1B
sta $C001
lda #$5B
@@ -109,6 +120,11 @@ down:
sta $C001
jmp rset_a
right:
+ lda scr_col
+ cmp #$50
+ beq rset_a
+ inc scr_col
+ jsr update_pos
lda #$1B
sta $C001
lda #$5B
@@ -117,6 +133,10 @@ right:
sta $C001
jmp rset_a
left:
+ lda scr_col
+ beq rset_a
+ dec scr_col
+ jsr update_pos
lda #$1B
sta $C001
lda #$5B
@@ -125,8 +145,30 @@ left:
sta $C001
jmp rset_a
+update_pos:
+ lda #$1B
+ sta $C001
+ lda #$5B
+ sta $C001
+ lda scr_row
+ jsr uint_to_bcd
+ jmp spin
+
+uint_to_bcd:
+ div #$A
+ lsl #$4
+ sta a
+ tba
+ sta b
+ lda a
+ ora b
+ rts
+
nl:
+ lda #$A
sta $C001
+ inc scr_row
+ jsr update_pos
lda #$0 ; Replace newline with a null terminator.
sta buffer, y ; Store said terminator into the input buffer.
ldy.w #$0 ; Reset y, to print the result.
@@ -189,3 +231,4 @@ viewmem
viewmem
;q
done
+