Shuffle memory locations around a bit

This commit is contained in:
Sijmen 2020-12-09 09:01:02 +01:00
parent 5c6cefa355
commit e001280dc2
Signed by: vijfhoek
GPG key ID: DAF7821E067D9C48
4 changed files with 34 additions and 42 deletions

View file

@ -18,7 +18,7 @@
.const remainder = $24 .const remainder = $24
// Need to be $03 and $fd due to multiply_16bit_unsigned // Need to be $03 and $fd due to multiply_16bit_unsigned
.const outer_value = $03 .const outer_value = $26
.const inner_value = $fd .const inner_value = $fd
day01: day01:
@ -112,7 +112,6 @@ day01:
iny iny
lda (outer_pointer), y lda (outer_pointer), y
bne !not_zero+ bne !not_zero+
.break
jmp !error+ jmp !error+
!not_zero: !not_zero:

View file

@ -4,29 +4,7 @@
BasicUpstart2(main) BasicUpstart2(main)
* = $8000 * = $0900 "Main program"
.align $100
* = * "Square table"
square1_lo:
.fill 512, 0
square1_hi:
.fill 512, 0
square2_lo:
.fill 512, 0
square2_hi:
.fill 512, 0
* = * "Day 01 Input"
day01_input:
.import text "../rust/inputs/day01"
.byte 0
* = * "Day 01 Input End"
//* = $8000 "Cartridge ROM"
//* = $a000 "Basic ROM"
* = $c000 "Main program"
.const SCREEN_RAM = $0400 .const SCREEN_RAM = $0400
.const COLOR_RAM = $d800 .const COLOR_RAM = $d800
@ -72,3 +50,20 @@ buffer:
#import "day01.asm" #import "day01.asm"
#import "screen.asm" #import "screen.asm"
#import "math.asm" #import "math.asm"
* = * "Day 01 Input"
day01_input:
.import text "../rust/inputs/day01"
.byte 0
.align $100
* = * "Square table"
square1_lo:
.fill 512, 0
square1_hi:
.fill 512, 0
square2_lo:
.fill 512, 0
square2_hi:
.fill 512, 0

View file

@ -4,7 +4,7 @@
// Multiplication routines found on // Multiplication routines found on
// https://codebase64.org/doku.php?id=base:seriously_fast_multiplication // https://codebase64.org/doku.php?id=base:seriously_fast_multiplication
.const T1=$03 .const T1=$26
.const T2=$fd .const T2=$fd
.const PRODUCT=$22 .const PRODUCT=$22

View file

@ -107,39 +107,37 @@ write_string:
ldx #0 ldx #0
ldy #0 ldy #0
!loop: !loop:
lda ($03), y lda ($03), y
beq !done+ beq !done+
iny
cmp #'\r' cmp #'\r'
beq !carriage_return+ beq !carriage_return+
cmp #'\n' cmp #'\n'
beq !newline+ beq !newline+
sta (cursor_pointer_lo, x) sta (cursor_pointer_lo, x)
i16_inc(cursor_pointer_lo) i16_inc(cursor_pointer_lo)
iny
jmp !loop- jmp !loop-
!newline: !newline:
jsr print_newline jsr print_newline
jmp !loop-
!carriage_return: !carriage_return:
jsr print_carriage_return jsr print_carriage_return
iny
jmp !loop- jmp !loop-
!done: !done:
rts rts
.macro i16_print_hex_0x(lo, hi) { .macro i16_print_hex_0x(addr) {
lda hi lda addr + 1
jsr print_hex_0x jsr print_hex_0x
lda lo lda addr
jsr print_hex jsr print_hex
} }