Shuffle memory locations around a bit
This commit is contained in:
parent
5c6cefa355
commit
e001280dc2
4 changed files with 34 additions and 42 deletions
|
@ -18,7 +18,7 @@
|
|||
.const remainder = $24
|
||||
|
||||
// Need to be $03 and $fd due to multiply_16bit_unsigned
|
||||
.const outer_value = $03
|
||||
.const outer_value = $26
|
||||
.const inner_value = $fd
|
||||
|
||||
day01:
|
||||
|
@ -112,7 +112,6 @@ day01:
|
|||
iny
|
||||
lda (outer_pointer), y
|
||||
bne !not_zero+
|
||||
.break
|
||||
jmp !error+
|
||||
!not_zero:
|
||||
|
||||
|
|
41
c64/main.asm
41
c64/main.asm
|
@ -4,29 +4,7 @@
|
|||
|
||||
BasicUpstart2(main)
|
||||
|
||||
* = $8000
|
||||
.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"
|
||||
* = $0900 "Main program"
|
||||
.const SCREEN_RAM = $0400
|
||||
.const COLOR_RAM = $d800
|
||||
|
||||
|
@ -72,3 +50,20 @@ buffer:
|
|||
#import "day01.asm"
|
||||
#import "screen.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
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// Multiplication routines found on
|
||||
// https://codebase64.org/doku.php?id=base:seriously_fast_multiplication
|
||||
.const T1=$03
|
||||
.const T1=$26
|
||||
.const T2=$fd
|
||||
.const PRODUCT=$22
|
||||
|
||||
|
|
|
@ -107,39 +107,37 @@ write_string:
|
|||
ldx #0
|
||||
ldy #0
|
||||
|
||||
!loop:
|
||||
lda ($03), y
|
||||
beq !done+
|
||||
!loop:
|
||||
lda ($03), y
|
||||
beq !done+
|
||||
|
||||
cmp #'\r'
|
||||
beq !carriage_return+
|
||||
cmp #'\n'
|
||||
beq !newline+
|
||||
iny
|
||||
|
||||
sta (cursor_pointer_lo, x)
|
||||
cmp #'\r'
|
||||
beq !carriage_return+
|
||||
cmp #'\n'
|
||||
beq !newline+
|
||||
|
||||
i16_inc(cursor_pointer_lo)
|
||||
|
||||
iny
|
||||
sta (cursor_pointer_lo, x)
|
||||
i16_inc(cursor_pointer_lo)
|
||||
jmp !loop-
|
||||
|
||||
!newline:
|
||||
jsr print_newline
|
||||
jmp !loop-
|
||||
|
||||
!carriage_return:
|
||||
jsr print_carriage_return
|
||||
|
||||
iny
|
||||
jmp !loop-
|
||||
|
||||
!done:
|
||||
rts
|
||||
|
||||
|
||||
.macro i16_print_hex_0x(lo, hi) {
|
||||
lda hi
|
||||
.macro i16_print_hex_0x(addr) {
|
||||
lda addr + 1
|
||||
jsr print_hex_0x
|
||||
lda lo
|
||||
lda addr
|
||||
jsr print_hex
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue