c64: Day 9, some small cleanups
This commit is contained in:
parent
a7902f66e3
commit
01ab067797
6 changed files with 65 additions and 46 deletions
|
@ -1,8 +1,11 @@
|
|||
// vim: filetype=kickass
|
||||
|
||||
* = * "Day 01"
|
||||
|
||||
* = * "Day 01 Input"
|
||||
day01_input:
|
||||
.import text "../rust/inputs/day01"
|
||||
.byte 0
|
||||
|
||||
* = * "Day 01 Code"
|
||||
//
|
||||
// day01
|
||||
//
|
||||
|
@ -18,7 +21,6 @@
|
|||
// Need to be $26 and $fd due to multiply_16bit_unsigned
|
||||
.const outer_value = $26
|
||||
.const inner_value = $fd
|
||||
|
||||
day01:
|
||||
jsr tree_clear
|
||||
|
||||
|
@ -212,12 +214,3 @@ str_title:
|
|||
.text "Part 1: "
|
||||
.byte 0
|
||||
|
||||
str_part2:
|
||||
.byte '\n'
|
||||
.text "Part 2: "
|
||||
.byte 0
|
||||
|
||||
str_done:
|
||||
.byte '\n', '\n'
|
||||
.text "* Done"
|
||||
.byte '\n', 0
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
// vim: filetype=kickass
|
||||
|
||||
* = * "Day 05"
|
||||
|
||||
* = * "Day 05 Input"
|
||||
!input:
|
||||
.import text "../inputs/05"
|
||||
.byte 0
|
||||
|
||||
* = * "Day 05 Code"
|
||||
//
|
||||
// day05
|
||||
//
|
||||
|
@ -31,7 +34,7 @@ day05:
|
|||
iny
|
||||
bne !loop-
|
||||
|
||||
move_16_imm(input_ptr, day05_input)
|
||||
move_16_imm(input_ptr, !input-)
|
||||
move_16_imm(max_value, 0)
|
||||
move_16_imm(min_value, $ffff)
|
||||
|
||||
|
|
11
c64/main.asm
11
c64/main.asm
|
@ -133,17 +133,8 @@ main:
|
|||
|
||||
#import "day01.asm"
|
||||
#import "day05.asm"
|
||||
#import "day09.asm"
|
||||
#import "screen.asm"
|
||||
#import "math.asm"
|
||||
#import "btree.asm"
|
||||
#import "menu.asm"
|
||||
|
||||
* = * "Day 01 Input"
|
||||
day01_input:
|
||||
.import text "../rust/inputs/day01"
|
||||
.byte 0
|
||||
|
||||
* = * "Day 05 input"
|
||||
day05_input:
|
||||
.import text "../inputs/05"
|
||||
.byte 0
|
||||
|
|
22
c64/math.inc
22
c64/math.inc
|
@ -179,6 +179,21 @@
|
|||
!cc:
|
||||
}
|
||||
|
||||
.macro i32_add_a(dst) {
|
||||
clc
|
||||
adc dst
|
||||
sta dst
|
||||
bcc done
|
||||
inc dst + 1
|
||||
bne done
|
||||
inc dst + 2
|
||||
bne done
|
||||
inc dst + 3
|
||||
bne done
|
||||
done:
|
||||
// Everyday I'm rippling
|
||||
}
|
||||
|
||||
// Destroys: a
|
||||
.macro i16_i16_add(dst, src) {
|
||||
clc
|
||||
|
@ -259,6 +274,13 @@
|
|||
bne target
|
||||
}
|
||||
|
||||
.macro i32_i32_move(dst, src) {
|
||||
lda dst + 0; sta dst + 0
|
||||
lda dst + 1; sta dst + 1
|
||||
lda dst + 2; sta dst + 2
|
||||
lda dst + 3; sta dst + 3
|
||||
}
|
||||
|
||||
.macro pearson_hash(dst, buffer) {
|
||||
lda #0
|
||||
sta dst
|
||||
|
|
42
c64/menu.asm
42
c64/menu.asm
|
@ -117,7 +117,7 @@ menu_update:
|
|||
.word 0 // 7
|
||||
.word 0 // 8
|
||||
.word 0
|
||||
.word 0 // 9
|
||||
.word day09 // 9
|
||||
.word 0
|
||||
.word 0
|
||||
.word 0 // 15
|
||||
|
@ -240,27 +240,27 @@ stabilized_irq:
|
|||
.align $0100
|
||||
* = * "Menu Data"
|
||||
menu_characters:
|
||||
.byte ' ',' ',' ',' ',$6f,$6f,$6f,$52,$52,$52,$46,$46,$46,$46,$42,$46,$46,$46,$46,$52,$52,$52,$6f,$6f,$6f,' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',$31,$2a,$2a
|
||||
.byte $45,$45,$77,$77,' ',$2e,$27,' ',' ',$2d,' ',' ',$2d,' ',' ',$4d,$2d,' ',$2e,$27,$27,$68,' ',$68,' ',$77,$77,$45,$45,$44,$43,$40,$46,$52,$6f,' ',' ',$32,' ',' '
|
||||
.byte $68,' ',' ',$68,' ',$27,$2e,$27,$2e,' ',$2d,' ',' ',' ',$2d,' ',$4d,' ',$2d,$27,$27,$3a,' ',' ',$68,' ',$68,' ',' ',' ',$68,' ',' ',$68,' ',' ',' ',$33,' ',' '
|
||||
.byte ' ',' ',$68,' ',$68,' ',' ',$68,' ',$27,$27,$2e,$2e,$27,$27,$27,$64,$1b,$1d,$2e,$27,' ',' ',$68,' ',' ',' ',' ',$68,' ',' ',' ',$68,' ',$68,' ',' ',$34,' ',' '
|
||||
.byte $27,$2e,' ',$68,' ',' ',$68,' ',' ',$68,' ',' ',$64,$64,$6f,$4e,$63,$27,$27,' ',' ',$68,' ',' ',$68,' ',' ',$68,' ',' ',' ',' ',' ',$68,' ',' ',' ',$35,$2a,$2a
|
||||
.byte $27,' ',' ',$2e,$2e,$6f,$6f,$6f,$6f,$6f,$4e,$77,$63,$63,' ',' ',$68,' ',' ',$68,' ',' ',$68,' ',' ',' ',' ',' ',' ',$68,' ',' ',' ',' ',' ',' ',' ',$36,' ',' '
|
||||
.byte $68,' ',$3a,$1b,$1d,$27,$2e,' ',' ',' ',$68,' ',$68,' ',' ',' ',' ',' ',' ',' ',' ',$68,' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',$37,' ',' '
|
||||
.byte ' ',' ',' ',$27,$2e,$4d,' ',$68,' ',' ',' ',' ',' ',' ',' ',' ',$68,' ',' ',$68,' ',' ',' ',' ',' ',' ',$68,' ',' ',' ',' ',' ',' ',$68,' ',' ',' ',$38,' ',' '
|
||||
.byte ' ',' ',$68,' ',' ',' ',$4d,' ',' ',$68,' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',$68,' ',' ',' ',' ',' ',' ',$68,' ',' ',' ',' ',' ',' ',' ',' ',' ',' '
|
||||
.byte ' ',' ',' ',' ',' ',$68,' ',$4d,' ',' ',' ',' ',' ',' ',' ',' ',' ',$27,$27,'.','.',' ',' ',' ',' ',$68,' ',' ',' ',' ',' ',' ',' ',$68,' ',' ',' ',$39,' ',' '
|
||||
.byte ' ',' ',' ',' ',' ',' ',' ',' ',$4d,' ',$68,' ',' ',' ',' ',' ',$27,' ','[',']','.',' ',' ',' ',' ',' ',' ',' ',$68,' ',' ',$68,' ',' ',$2e,' ',$31,$36,' ',' '
|
||||
.byte ' ',' ',' ',' ',$6f,$6f,$6f,$52,$52,$52,$46,$46,$46,$46,$42,$46,$46,$46,$46,$52,$52,$52,$6f,$6f,$6f,' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','1','*','*'
|
||||
.byte $45,$45,$77,$77,' ',$2e,$27,' ',' ',$2d,' ',' ',$2d,' ',' ',$4d,$2d,' ',$2e,$27,$27,$68,' ',$68,' ',$77,$77,$45,$45,$44,$43,$40,$46,$52,$6f,' ',' ','2',' ',' '
|
||||
.byte $68,' ',' ',$68,' ',$27,$2e,$27,$2e,' ',$2d,' ',' ',' ',$2d,' ',$4d,' ',$2d,$27,$27,$3a,' ',' ',$68,' ',$68,' ',' ',' ',$68,' ',' ',$68,' ',' ',' ','3',' ',' '
|
||||
.byte ' ',' ',$68,' ',$68,' ',' ',$68,' ',$27,$27,$2e,$2e,$27,$27,$27,$64,$1b,$1d,$2e,$27,' ',' ',$68,' ',' ',' ',' ',$68,' ',' ',' ',$68,' ',$68,' ',' ','4',' ',' '
|
||||
.byte $27,$2e,' ',$68,' ',' ',$68,' ',' ',$68,' ',' ',$64,$64,$6f,$4e,$63,$27,$27,' ',' ',$68,' ',' ',$68,' ',' ',$68,' ',' ',' ',' ',' ',$68,' ',' ',' ','5','*','*'
|
||||
.byte $27,' ',' ',$2e,$2e,$6f,$6f,$6f,$6f,$6f,$4e,$77,$63,$63,' ',' ',$68,' ',' ',$68,' ',' ',$68,' ',' ',' ',' ',' ',' ',$68,' ',' ',' ',' ',' ',' ',' ','6',' ',' '
|
||||
.byte $68,' ',$3a,$1b,$1d,$27,$2e,' ',' ',' ',$68,' ',$68,' ',' ',' ',' ',' ',' ',' ',' ',$68,' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','7',' ',' '
|
||||
.byte ' ',' ',' ',$27,$2e,$4d,' ',$68,' ',' ',' ',' ',' ',' ',' ',' ',$68,' ',' ',$68,' ',' ',' ',' ',' ',' ',$68,' ',' ',' ',' ',' ',' ',$68,' ',' ',' ','8',' ',' '
|
||||
.byte ' ',' ',$68,' ',' ',' ',$4d,' ',' ',$68,' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',$68,' ',' ',' ',' ',' ',' ',$68,' ',' ',' ',' ',' ',' ','1','7',' ',' '
|
||||
.byte ' ',' ',' ',' ',' ',$68,' ',$4d,' ',' ',' ',' ',' ',' ',' ',' ',' ',$27,$27,'.','.',' ',' ',' ',' ',$68,' ',' ',' ',' ',' ',' ',' ',$68,' ',' ',' ','9','*','*'
|
||||
.byte ' ',' ',' ',' ',' ',' ',' ',' ',$4d,' ',$68,' ',' ',' ',' ',' ',$27,' ','[',']','.',' ',' ',' ',' ',' ',' ',' ',$68,' ',' ',$68,' ',' ',$2e,' ','1','6',' ',' '
|
||||
.byte ' ',' ',' ',' ',' ',' ',' ',' ',' ',$4d,' ',' ',' ',' ',' ',$27,' ',',',' ',':',$4d,' ',' ',$68,' ',' ',' ',' ',' ',' ',' ',$3a,$27,$27,' ',' ',' ',' ',' ',' '
|
||||
.byte ' ',' ',' ',' ',' ',' ',' ',' ',' ',$68,$4d,' ',' ',' ',' ',$27,'.','.',$27,' ',' ',$4d,$6f,$6f,$64,$64,$64,' ',' ',$68,' ',$27,$2e,' ',$2c,' ',$31,$35,' ',' '
|
||||
.byte ' ',' ',' ',' ',' ',' ',' ',' ',' ',$68,$4d,' ',' ',' ',' ',$27,'.','.',$27,' ',' ',$4d,$6f,$6f,$64,$64,$64,' ',' ',$68,' ',$27,$2e,' ',$2c,' ','1','5',' ',' '
|
||||
.byte ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',$4d,' ',$68,' ',' ',' ',' ',' ',' ',' ',$68,' ',' ',$63,$63,$63,$77,$77,$4d,' ',' ',$3a,' ',' ',' ',' ',' ',' ',' '
|
||||
.byte ' ',' ',' ',' ',' ',' ',' ',' ',' ',$68,' ',' ',$4d,' ',' ',' ',$68,' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',$2e,$4d,$27,' ',$2c,' ',' ',$31,$30,' ',' '
|
||||
.byte ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',$4d,' ',' ',' ',$2e,' ',' ',' ',' ',' ',' ',' ',$68,' ',' ',' ',$27,$2e,$1b,$1d,' ',$2c,' ',$31,$34,' ',' '
|
||||
.byte ' ',' ',' ',' ',' ',' ',' ',' ',' ',$68,' ',' ',$4d,' ',' ',' ',$68,' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',$2e,$4d,$27,' ',$2c,' ',' ','1','0',' ',' '
|
||||
.byte ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',$4d,' ',' ',' ',$2e,' ',' ',' ',' ',' ',' ',' ',$68,' ',' ',' ',$27,$2e,$1b,$1d,' ',$2c,' ','1','4',' ',' '
|
||||
.byte ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',$68,' ',' ',$4d,$27,$27,$2c,$3a,' ',' ',$68,' ',' ',' ',' ',' ',' ',' ',$64,$4e,$27,$2e,$2e,' ',' ',' ',' ',' ',' '
|
||||
.byte ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',$3a,$1b,$1d,$2e,$2e,$27,' ',' ',' ',' ',' ',' ',' ',' ',' ',$4e,$63,$68,' ',' ',' ',$27,' ',$31,$31,' ',' '
|
||||
.byte ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',$27,$27,$4d,$64,$64,' ',' ',$68,' ',' ',' ',' ',' ',$4e,' ',' ',' ',' ',' ',' ',' ',' ',$31,$33,' ',' '
|
||||
.byte ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',$3a,$1b,$1d,$2e,$2e,$27,' ',' ',' ',' ',' ',' ',' ',' ',' ',$4e,$63,$68,' ',' ',' ',$27,' ','1','1',' ',' '
|
||||
.byte ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',$27,$27,$4d,$64,$64,' ',' ',$68,' ',' ',' ',' ',' ',$4e,' ',' ',' ',' ',' ',' ',' ',' ','1','3',' ',' '
|
||||
.byte ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',$68,$63,$63,$4d,$64,$64,' ',' ',' ',' ',$4e,$68,' ',' ',' ',' ',' ',' ',$68,' ',' ',' ',' ',' '
|
||||
.byte ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',$63,$63,$4d,$64,$64,$4e,' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',$31,$32,' ',' '
|
||||
.byte ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',$63,$63,$4d,$64,$64,$4e,' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','1','2',' ',' '
|
||||
.byte ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',$68,$63,$63,' ',' ',' ',' ',' ',' ',' ',$68,' ',' ',' ',' ',' ',' ',' '
|
||||
.byte ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',$68,' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '
|
||||
.byte ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '
|
||||
|
@ -272,11 +272,11 @@ menu_colors:
|
|||
.byte $0e, $0e, $0e, $0e, $0e, $01, $61, $0e, $0e, $61, $00, $00, $01, $00, $01, $01, $61, $0e, $01, $01 // 1;00 - 1;20 | 7;10 - 7;30
|
||||
.byte $01, $06, $00, $66, $0e, $0e, $0e, $fe, $0e, $0e, $0e, $0e, $6e, $0e, $0e, $00, $10, $0f, $00, $60 // 1;20 - 2;00 | 7;30 - 8;10
|
||||
.byte $06, $0e, $0e, $06, $0e, $01, $01, $01, $01, $0e, $01, $00, $b0, $00, $01, $0e, $01, $0e, $01, $61 // 2;00 - 2;20 | 8;10 - 8;30
|
||||
.byte $01, $01, $00, $00, $06, $00, $06, $00, $00, $00, $06, $03, $03, $06, $03, $60, $00, $1f, $00, $00 // 2;20 - 3;00 | 8;30 - 9;10
|
||||
.byte $01, $01, $00, $00, $06, $00, $b6, $b0, $00, $00, $06, $03, $03, $06, $03, $60, $00, $1f, $00, $00 // 2;20 - 3;00 | 8;30 - 9;10
|
||||
.byte $0e, $0e, $06, $0e, $06, $0e, $0e, $c6, $ce, $c1, $c1, $01, $01, $01, $01, $61, $01, $01, $01, $01 // 3;00 - 3;20 | 9;10 - 9;30
|
||||
.byte $01, $00, $00, $66, $00, $00, $00, $f0, $06, $00, $00, $00, $06, $0e, $06, $00, $00, $0f, $10, $00 // 3;20 - 4;00 | 9;30 - 10;10
|
||||
.byte $01, $00, $00, $66, $00, $00, $00, $f0, $76, $70, $00, $00, $06, $0e, $06, $00, $00, $0f, $10, $00 // 3;20 - 4;00 | 9;30 - 10;10
|
||||
.byte $65, $05, $00, $06, $0e, $0e, $b6, $0e, $1e, $16, $51, $01, $01, $01, $01, $01, $01, $01, $61, $00 // 4;00 - 4;20 | 10;10 - 10;30
|
||||
.byte $00, $66, $00, $00, $56, $00, $b0, $b6, $00, $00, $00, $00, $00, $06, $00, $00, $00, $0f, $07, $17 // 4;20 - 5;00 | 10;30 - 11;10
|
||||
.byte $00, $66, $00, $00, $56, $00, $f0, $f6, $00, $00, $00, $00, $00, $06, $00, $00, $00, $0f, $07, $17 // 4;20 - 5;00 | 10;30 - 11;10
|
||||
.byte $05, $00, $00, $05, $05, $b1, $01, $b1, $01, $b1, $11, $01, $01, $61, $01, $00, $06, $00, $00, $06 // 5;00 - 5;20 | 11;10 - 11;30
|
||||
.byte $00, $50, $56, $50, $00, $00, $00, $00, $00, $06, $00, $00, $00, $00, $00, $00, $00, $0f, $00, $60 // 5;20 - 6;00 | 11;30 - 12;10
|
||||
.byte $16, $00, $05, $01, $01, $c5, $55, $c5, $50, $00 // 6;00 - 6;10 | 12;10 - 12;20
|
||||
|
|
|
@ -337,3 +337,13 @@ wait_space_then_reset:
|
|||
.byte '\n'
|
||||
.text "Resetting..."
|
||||
.byte 0
|
||||
|
||||
str_part2:
|
||||
.byte '\n'
|
||||
.text "Part 2: "
|
||||
.byte 0
|
||||
|
||||
str_done:
|
||||
.byte '\n', '\n'
|
||||
.text "* Done"
|
||||
.byte '\n', 0
|
||||
|
|
Loading…
Reference in a new issue