summaryrefslogtreecommitdiff
path: root/test/input.s
diff options
context:
space:
mode:
Diffstat (limited to 'test/input.s')
-rw-r--r--test/input.s45
1 files changed, 32 insertions, 13 deletions
diff --git a/test/input.s b/test/input.s
index 169372f..20ab3d1 100644
--- a/test/input.s
+++ b/test/input.s
@@ -18,6 +18,8 @@ c:
.word $0
d:
.word $0
+e:
+ .word $0
string:
.byte "Please, type something.\n"
string2:
@@ -93,19 +95,20 @@ getchar:
echo:
sta a
ldx scr_col
- cpx #$79
+ cpx #$4F
bne echo_print
linewrap:
inc scr_row
ldx #$0
stx scr_col
+ lda scr_row
jsr update_pos
echo_print:
lda a
sta $C001 ; Echo typed character.
inc scr_col ; Increment the cursor's x coordinate.
sta buffer, y ; Store typed character into the input buffer.
- iny ; Increment the buffer offset.
+ iny
jmp rset_a ; Start getting user input.
esc:
@@ -173,22 +176,30 @@ isleft_done:
up:
dec scr_row
+ lda #$0
+ sta e
jsr update_pos
lda #$1
sta d
jmp isup_done
down:
inc scr_row
+ lda #$1
+ sta e
jsr update_pos
lda #$1
sta d
jmp isdown_done
right:
inc scr_col
+ lda #$2
+ sta e
jsr update_pos
jmp isright_end
left:
dec scr_col
+ lda #$3
+ sta e
jsr update_pos
lda #$1
sta d
@@ -260,9 +271,9 @@ bs:
result:
ldx scr_col
- cpx #$79
+ cpx #$4F
bne result_print
-linewrap:
+linewrap2:
inc scr_row
ldx #$0
stx scr_col
@@ -277,14 +288,14 @@ result_print:
rset_y:
- ldy.w #$0
+ ldy.w #$0 ; Reset y.
jmp print_buf ; Print the input buffer.
print_buf:
ldx scr_col
- cpx #$79
+ cpx #$4F
bne buf_print
-linewrap:
+linewrap3:
inc scr_row
ldx #$0
stx scr_col
@@ -297,6 +308,14 @@ buf_print:
iny
jmp print_buf ; Keep printing the buffer.
+scr_to_buf:
+ tax
+ mul #$50
+ adc scr_col
+ tay
+ txa
+ rts
+
spin:
nop
nop
@@ -317,12 +336,12 @@ spin:
.org $FFA0
.qword irq_routine
-.org $8000
-viewmem
-.org $8100
-viewmem
-.org $8200
-viewmem
+;.org $8000
+;viewmem
+;.org $8100
+;viewmem
+;.org $8200
+;viewmem
;q
done