Replace .fills with consts wherever possible

Reduces filesize from 8kB to 5kB
This commit is contained in:
Sijmen 2020-12-09 17:51:37 +01:00
parent 4959a34dcb
commit 6ba6c568df
Signed by: vijfhoek
GPG key ID: DAF7821E067D9C48
3 changed files with 25 additions and 23 deletions

View file

@ -1,8 +1,21 @@
// vim: filetype=kickass // vim: filetype=kickass
tree_clear:
lda #0
tay
!loop:
sta tree_values_lo, y
sta tree_values_hi, y
sta tree_left, y
sta tree_right, y
iny
bne !loop-
rts
.const next_index = $02 .const next_index = $02
.const input = $03 .const input = $03
// NOTE Assumes the tree is zeroed
tree_insert: tree_insert:
ldx #0 ldx #0
@ -93,14 +106,3 @@ tree_contains:
rts rts
brk brk
.align $100
tree_values_lo:
.fill 256, 0
tree_values_hi:
.fill 256, 0
tree_left:
.fill 256, 0
tree_right:
.fill 256, 0

View file

@ -126,6 +126,7 @@ main:
sta $01 sta $01
jsr generate_multiplication_tables jsr generate_multiplication_tables
jsr tree_clear
//jsr test_tree //jsr test_tree
@ -145,14 +146,3 @@ day01_input:
.import text "../rust/inputs/day01" .import text "../rust/inputs/day01"
.byte 0 .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

@ -1,4 +1,14 @@
// vim: filetype=kickass // vim: filetype=kickass
.const square1_lo = $c000
.const square1_hi = $c200
.const square2_lo = $c400
.const square2_hi = $c600
.const tree_values_lo = $c900
.const tree_values_hi = $ca00
.const tree_left = $cb00
.const tree_right = $cc00
.const udivmod32_dividend = $10 // 11,12,13 .const udivmod32_dividend = $10 // 11,12,13
.const udivmod32_divisor = $14 // 15,16,17 .const udivmod32_divisor = $14 // 15,16,17
.const udivmod32_result = $18 // 19,1a,1b .const udivmod32_result = $18 // 19,1a,1b