From 1dfc78b8bf5b708cb1118a9d6646397772a1b894 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Tue, 24 Dec 2019 22:18:32 -0500 Subject: Added support for Indirect addressing modes, and allow for use of the B register as an operand, for ALU based instructions. This allows for both low code size, and high performance. This means we can save upto 9 bytes, by just using the B register for ALU operations, rather than using a memory address. The indirect addressing modes, give Sux the abillity to now use pointers. Hope you guys have a Merry Christmas! From mr b0nk 500 --- test/input.s | 45 ++++++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 13 deletions(-) (limited to 'test') 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 -- cgit v1.2.3-13-gbd6f