diff --git a/.gitignore b/.gitignore index 50bd2ea..114e326 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ c64/*.prg c64/tests/ inputs/ + +.vim/ diff --git a/c64/day01.asm b/c64/day01.asm index 284a63b..36eda7c 100644 --- a/c64/day01.asm +++ b/c64/day01.asm @@ -20,6 +20,8 @@ .const inner_value = $fd day01: + jsr tree_clear + move_16_imm($03, str_title) jsr write_string diff --git a/c64/day05.asm b/c64/day05.asm new file mode 100644 index 0000000..e6c22db --- /dev/null +++ b/c64/day05.asm @@ -0,0 +1,193 @@ +// vim: filetype=kickass + +* = * "Day 05" + + +// +// day05 +// +// Destroys: $03..04, $08..09, $0a..0d +// +.const column_min = $0a +.const column_max = $0b +.const row_min = $0c +.const row_max = $0d + +.const input_ptr = $08 +.const max_value = $0e +.const min_value = $2c + +// Conflicts with tree_values_lo and _hi +.const buffer = $c800 // $c800..cfff +day05: + move_16_imm($03, !str_title+) + jsr write_string + + lda #0 + tay +!loop: + .for (var i = $0000; i < $0800; i += $0100) + sta buffer + i, y + iny + bne !loop- + + move_16_imm(input_ptr, day05_input) + move_16_imm(max_value, 0) + move_16_imm(min_value, $ffff) + + ldy #0 +!init_vars: + lda #128 + sta row_max + lda #8 + sta column_max + + lda #0 + sta row_min + sta column_min + + !loop: + lda ($08), y + + // TODO could be optimized easily + cmp #'F' + bne !else+ + // lower half + lda row_min + adc row_max + lsr + sta row_max + jmp !next+ + !else: + cmp #'B' + bne !else+ + // upper half + lda row_min + adc row_max + lsr + sta row_min + jmp !next+ + !else: + cmp #'L' + bne !else+ + // lower half column + lda column_min + adc column_max + lsr + sta column_max + jmp !next+ + !else: + cmp #'R' + bne !else+ + // upper half column + lda column_min + adc column_max + lsr + sta column_min + jmp !next+ + !else: + cmp #'\n' + bne !else+ + lda #0; sta row_min + 1 + + // row_min *= 8 + lda row_min + asl; rol row_min + 1 + asl; rol row_min + 1 + asl; rol row_min + 1 + + // row_min |= column_min + ora column_min + sta row_min + + lda row_min + 1 + cmp max_value + 1 + bcc !not_max+ + bne !max+ + lda row_min + cmp max_value + bcc !not_max+ + !max: + u16_u16_move(max_value, row_min) + !not_max: + + lda min_value + 1 + cmp row_min + 1 + bcc !not_max+ + bne !max+ + lda min_value + cmp row_min + bcc !not_max+ + !max: + u16_u16_move(min_value, row_min) + !not_max: + + lda row_min + 1 + clc + adc #>buffer + sta row_min + 1 + + ldx #0 + lda #1 + sta (row_min, x) + + iny + bne !+ + //.break + inc $09 + !: + jmp !init_vars- + !else: + jmp !done+ + + !next: + iny + bne !+ + //.break + inc $09 + !: + jmp !loop- + + !done: + + u16_u16_move(udivmod32_dividend, max_value) + move_16_imm(udivmod32_dividend + 2, 0) + jsr print_decimal_u32 + move_16_imm($03, str_part2) + jsr write_string + + lda #>buffer + clc + adc min_value + 1 + sta column_min + 1 + + // Find the first free seat + ldy min_value + !loop: + y_buf_inc(column_min) + lda (column_min), y + bne !loop- + + sty udivmod32_dividend + + lda column_min + 1 + sec + sbc #>buffer + sta udivmod32_dividend + 1 + + move_16_imm(udivmod32_dividend + 2, 0) + jsr print_decimal_u32 + + rts + + +!newline: + rts + + +!str_title: + .text "# Day 05" + .byte '\n', '\n' + .text "Part 1: " + .byte 0 + diff --git a/c64/main.asm b/c64/main.asm index f97c9db..511c597 100644 --- a/c64/main.asm +++ b/c64/main.asm @@ -8,10 +8,6 @@ .const SCREEN_RAM = $0400 .const COLOR_RAM = $d800 -.const kernal_scinit = $ff81 -.const kernal_chrout = $ffd2 -.const kernal_write_byte = $e716 - .const zp_temp = $02 .const cursor_pointer_lo = $05 .const cursor_pointer_hi = $06 @@ -59,7 +55,6 @@ test_tree: move_16_imm($03, $1337) jsr tree_insert - move_16_imm($03, $08) jsr tree_contains bne !fail+ @@ -118,31 +113,37 @@ test_tree: // main // main: - jsr clear_screen - - // Swap out BASIC and kernal sei - lda %00110000 + lda #$35 sta $01 + lda #49 + sta $07 + jsr setup_interrupt + + jsr clear_screen + jsr draw_menu + jsr generate_multiplication_tables - jsr tree_clear - //jsr test_tree - - jsr day01 - -!loop: - jmp !loop- + !: + jsr menu_update + jmp !- #import "day01.asm" +#import "day05.asm" #import "screen.asm" #import "math.asm" #import "btree.asm" +#import "menu.asm" -* = * "Day 01 Input" + * = * "Day 01 Input" day01_input: .import text "../rust/inputs/day01" .byte 0 + * = * "Day 05 input" +day05_input: + .import text "../inputs/05" + .byte 0 diff --git a/c64/math.asm b/c64/math.asm index 2a54d66..42c6e15 100644 --- a/c64/math.asm +++ b/c64/math.asm @@ -352,12 +352,12 @@ generate_multiplication_tables: // TODO could probably be optimized further // // Input: -// - udivmod32_dividend: LSB of the dividend. -// - udivmod32_divisor: LSB of the divisor. +// - udivmod32_dividend ($10..$13): LSB of the dividend. +// - udivmod32_divisor ($14..$17): LSB of the divisor. // // Output: -// - udivmod32_result: LSB of the division result. -// - udivmod32_remainder: LSB of the modulo result. +// - udivmod32_result ($18..1b): LSB of the division result. +// - udivmod32_remainder ($1c..$1f): LSB of the modulo result. // // Destroys: a, $20..$2b // @@ -515,4 +515,3 @@ udivmod32: bne !do_start- rts - diff --git a/c64/math.inc b/c64/math.inc index 05e2890..1436efc 100644 --- a/c64/math.inc +++ b/c64/math.inc @@ -3,6 +3,7 @@ .const square1_hi = $c200 .const square2_lo = $c400 .const square2_hi = $c600 +.const pearson_table = $c800 .const tree_values_lo = $c900 .const tree_values_hi = $ca00 @@ -58,7 +59,7 @@ // Output: // - $24..$25 - 16-bit unsigned result // -// Destroys: a, x, $22..$25, $fd, $fe +// Destroys: a, x, $22, $23, $fd, $fe // .macro u16_div10() { lda #$19 @@ -70,6 +71,7 @@ jsr multiply_16bit_unsigned } +// Destroys: zp_temp .macro i8_mul5_a() { sta zp_temp asl @@ -109,6 +111,7 @@ i16_i16_add(dst, $fd) } +// Destroys: - .macro u32_mul2(lsb) { asl lsb + 0 rol lsb + 1 @@ -116,6 +119,7 @@ rol lsb + 3 } +// Destroys: a .macro u32_mul10(lsb) { u32_mul2(lsb) @@ -134,6 +138,7 @@ i32_i32_add(lsb, $2c) } +// Destroys: a .macro i32_i16_add(dst, src) { clc lda dst + 0 @@ -147,6 +152,7 @@ !: } +// Destroys: a .macro i32_i32_add(dst, src) { clc lda dst + 0 @@ -184,12 +190,29 @@ sta dst + 1 } -// Destroys: a, dst_lo, dst_hi +// Destroys: a .macro i16_inc(dst) { lda #1 i16_i8_add_a(dst) } +.macro y_buf_inc(buffer) { + iny + bne !+ + inc buffer + 1 + !: +} + +// Destroys: a +.macro y_buf_dec(buffer) { + tya + bne !+ + dec buffer + 1 + !: + dey +} + +// Destroys: a .macro i16_i16_sub_imm(dst_lo, dst_hi, src_lo, src_hi, imm) { sec @@ -235,3 +258,17 @@ cmp b + 1 bne target } + +.macro pearson_hash(dst, buffer) { + lda #0 + sta dst +loop: + lda buffer, y + beq end + eor dst + tax + lda pearson_table, x + sta dst + jmp loop +end: +} diff --git a/c64/menu.asm b/c64/menu.asm new file mode 100644 index 0000000..6ff284d --- /dev/null +++ b/c64/menu.asm @@ -0,0 +1,296 @@ +// vim: filetype=kickass + +.const PA = $dc00 +.const PB = $dc01 +.const DDRA = $dc02 +.const DDRB = $dc03 + +* = * "Menu Routines" +// +// draw_menu +// +draw_menu: + lda $d018 + and #%11110001 + ora #%00000100 + sta $d018 + + ldy #$fa + 1 + sty $d020 + sty $d021 +!: + // TODO Compression for the characters + lda menu_characters + $0000 - 1, y + sta SCREEN_RAM + $0000 - 1, y + lda menu_characters + $00fa - 1, y + sta SCREEN_RAM + $00fa - 1, y + lda menu_characters + $01f4 - 1, y + sta SCREEN_RAM + $01f4 - 1, y + lda menu_characters + $02ee - 1, y + sta SCREEN_RAM + $02ee - 1, y + + lda menu_colors + $0000 - 1, y + sta COLOR_RAM + $0000 - 1, y + lsr; lsr; lsr; lsr + sta COLOR_RAM + $00fa - 1, y + + lda menu_colors + $00fa - 1, y + sta COLOR_RAM + $01f4 - 1, y + lsr; lsr; lsr; lsr + sta COLOR_RAM + $02ee - 1, y + + dey + bne !- + + rts + +// +// menu_update +// +menu_update: + lda PA + lsr + bcs !not_up+ + lda $07 + sec + sbc #8 + cmp #49 + bcc !wait+ + sta $07 + jmp !wait+ + !not_up: + + lsr + bcs !not_down+ + lda $07 + clc + adc #08 + cmp #242 + bcs !wait+ + sta $07 + jmp !wait+ + !not_down: + + lsr + lsr + lsr + bcs !done+ + sei + jsr clear_screen + + lda $07 + lsr; lsr; lsr + sec + sbc #6 + asl + tay + + // Modify JSR instruction to jump to the right day + lda !days+, y + sta !jump+ + 1 + lda !days+ + 1, y + sta !jump+ + 2 + + !jump: + jsr !done+ + +!wait: + ldy #80 + ldx #0 + !: + !: + dex + bne !- + dey + bne !-- + +!done: + rts + +!days: + .word day01 // 1 + .word 0 // 2 + .word 0 // 3 + .word 0 // 4 + .word day05 // 5 + .word 0 // 6 + .word 0 // 7 + .word 0 // 8 + .word 0 + .word 0 // 9 + .word 0 + .word 0 + .word 0 // 15 + .word 0 + .word 0 // 10 + .word 0 // 14 + .word 0 + .word 0 // 11 + .word 0 // 13 + .word 0 + .word 0 // 12 + .word 0 + .word 0 + .word 0 + .word 0 + +// +// setup_interrupt +// +setup_interrupt: + sei + + SetRasterInterrupt(menu_irq) + move_16_imm($fffa, nmi_nop) + + lda #$7f + sta $dc0d + sta $dd0d + + lda #$01 + sta $d019 + sta $d01a + + lda #$35 + sta $01 + + cli + rts + +menu_irq: + pha + txa + pha + tya + pha + + StabilizeRaster() + ldy #11 + sty $d020 + sty $d021 + + ldy #90 +!: + dey + bne !- + + ldy #0 + sty $d021 + sty $d020 + + SetRasterInterrupt(menu_irq) + + asl $d019 + + pla + tay + pla + tax + pla + rti + +nmi_nop: + rti + +.macro SetRasterInterrupt(address) { + move_16_imm($fffe, address) + + lda $d011 + and #$7f + sta $d011 + + lda $07 + sta $d012 +} + +.macro StabilizeRaster() { + move_16_imm($fffe, stabilized_irq) + inc $d012 + + asl $d019 + + tsx + + cli + nop + nop + nop + nop + nop + nop + nop + nop + nop + +stabilized_irq: + txs + sei + + ldx #6 +!: + dex + bne !- + bit $00 + + lda $d012 + cmp $d012 + beq *+2 +} + + .align $0100 + * = * "Menu Data" +menu_characters: + .byte $20,$20,$20,$20,$6f,$6f,$6f,$52,$52,$52,$46,$46,$46,$46,$42,$46,$46,$46,$46,$52,$52,$52,$6f,$6f,$6f,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$31,$2a,$2a + .byte $45,$45,$77,$77,$20,$2e,$27,$20,$20,$2d,$20,$20,$2d,$20,$20,$4d,$2d,$20,$2e,$27,$27,$68,$20,$68,$20,$77,$77,$45,$45,$44,$43,$40,$46,$52,$6f,$20,$20,$32,$20,$20 + .byte $68,$20,$20,$68,$20,$27,$2e,$27,$2e,$20,$2d,$20,$20,$20,$2d,$20,$4d,$20,$2d,$27,$27,$3a,$20,$20,$68,$20,$68,$20,$20,$20,$68,$20,$20,$68,$20,$20,$20,$33,$20,$20 + .byte $20,$20,$68,$20,$68,$20,$20,$68,$20,$27,$27,$2e,$2e,$27,$27,$27,$64,$1b,$1d,$2e,$27,$20,$20,$68,$20,$20,$20,$20,$68,$20,$20,$20,$68,$20,$68,$20,$20,$34,$20,$20 + .byte $27,$2e,$20,$68,$20,$20,$68,$20,$20,$68,$20,$20,$64,$64,$6f,$4e,$63,$27,$27,$20,$20,$68,$20,$20,$68,$20,$20,$68,$20,$20,$20,$20,$20,$68,$20,$20,$20,$35,$2a,$2a + .byte $27,$20,$20,$2e,$2e,$6f,$6f,$6f,$6f,$6f,$4e,$77,$63,$63,$20,$20,$68,$20,$20,$68,$20,$20,$68,$20,$20,$20,$20,$20,$20,$68,$20,$20,$20,$20,$20,$20,$20,$36,$20,$20 + .byte $68,$20,$3a,$1b,$1d,$27,$2e,$20,$20,$20,$68,$20,$68,$20,$20,$20,$20,$20,$20,$20,$20,$68,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$37,$20,$20 + .byte $20,$20,$20,$27,$2e,$4d,$20,$68,$20,$20,$20,$20,$20,$20,$20,$20,$68,$20,$20,$68,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$38,$20,$20 + .byte $20,$20,$68,$20,$20,$20,$4d,$20,$20,$68,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20 + .byte $20,$20,$20,$20,$20,$68,$20,$4d,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$39,$20,$20 + .byte $20,$20,$20,$20,$20,$20,$20,$20,$4d,$20,$68,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$2e,$20,$20,$20,$20,$20 + .byte $20,$20,$20,$20,$20,$20,$20,$20,$20,$4d,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$3a,$27,$27,$20,$20,$20,$20,$20,$20 + .byte $20,$20,$20,$20,$20,$20,$20,$20,$20,$68,$4d,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$64,$64,$64,$64,$20,$20,$27,$2e,$20,$2c,$20,$31,$35,$20,$20 + .byte $20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$4d,$20,$68,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$63,$63,$63,$63,$4d,$20,$20,$3a,$20,$20,$20,$20,$20,$20,$20 + .byte $20,$20,$20,$20,$20,$20,$20,$20,$20,$68,$20,$20,$4d,$20,$20,$20,$68,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$2e,$4d,$27,$20,$2c,$20,$20,$31,$30,$20,$20 + .byte $20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$4d,$20,$20,$20,$2e,$20,$20,$20,$20,$20,$20,$20,$68,$20,$20,$20,$27,$2e,$1b,$1d,$20,$2c,$20,$31,$34,$20,$20 + .byte $20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$68,$20,$20,$4d,$27,$27,$2c,$3a,$20,$20,$68,$20,$20,$20,$20,$20,$20,$20,$64,$4e,$27,$2e,$2e,$20,$20,$20,$20,$20,$20 + .byte $20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$3a,$1b,$1d,$2e,$2e,$27,$20,$20,$20,$20,$20,$20,$20,$20,$20,$4e,$63,$68,$20,$20,$20,$27,$20,$31,$31,$20,$20 + .byte $20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$27,$27,$4d,$64,$64,$20,$20,$68,$20,$20,$20,$20,$20,$4e,$20,$20,$20,$20,$20,$20,$20,$20,$31,$33,$20,$20 + .byte $20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$68,$63,$63,$4d,$64,$64,$20,$20,$20,$20,$4e,$68,$20,$20,$20,$20,$20,$20,$68,$20,$20,$20,$20,$20 + .byte $20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$63,$63,$4d,$64,$64,$4e,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$31,$32,$20,$20 + .byte $20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$68,$63,$63,$20,$20,$20,$20,$20,$20,$20,$68,$20,$20,$20,$20,$20,$20,$20 + .byte $20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$68,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20 + .byte $20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20 + .byte $20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$2e,$20,$2e,$2e,$20,$20,$20,$2e,$27,$20,$2e,$2e,$20,$20,$20,$20,$20,$20,$20,$20,$20 + +menu_colors: + .byte $6f, $0e, $6e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $6e, $0e, $0e, $02, $0e, $0e, $0e, $0e, $0e // 0;00 - 0;20 | 6;10 - 6;30 + .byte $0e, $0e, $0e, $0e, $0e, $00, $00, $f0, $00, $00, $00, $00, $00, $50, $50, $10, $e0, $6f, $07, $07 // 0;20 - 1;00 | 6;30 - 7;10 + .byte $0e, $0e, $0e, $0e, $0e, $01, $61, $0e, $0e, $61, $00, $00, $01, $00, $01, $01, $01, $0e, $01, $01 // 1;00 - 1;20 | 7;10 - 7;30 + .byte $01, $06, $00, $06, $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, $00, $00, $01, $0e, $01, $0e, $01, $01 // 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 $0e, $0e, $06, $0e, $06, $0e, $0e, $06, $0e, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01 // 3;00 - 3;20 | 9;10 - 9;30 + .byte $01, $00, $00, $06, $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 $65, $05, $00, $06, $0e, $0e, $06, $0e, $0e, $06, $01, $01, $01, $01, $01, $01, $01, $01, $01, $00 // 4;00 - 4;20 | 10;10 - 10;30 + .byte $00, $06, $00, $00, $56, $00, $00, $06, $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, $01, $01, $01, $01, $01, $01, $01, $01, $01, $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, $05, $05, $05, $00, $00 // 6;00 - 6;10 | 12;10 - 12;20 + + .byte $00, $00, $00, $00, $00, $01, $f1, $f1, $01, $00, $00, $05, $05, $0e, $05, $00, $0f, $0f, $00, $00 // 12;20 - 13;00 | 18;30 - 19;10 + .byte $00, $00, $00, $00, $00, $00, $60, $10, $10, $10, $10, $11, $00, $06, $00, $00, $10, $60, $00, $00 // 13;00 - 13;20 | 19;10 - 19;30 + .byte $00, $00, $00, $00, $60, $01, $01, $01, $01, $01, $00, $00, $05, $0e, $0b, $00, $00, $00, $00, $00 // 13;20 - 14;00 | 19;30 - 20;10 + .byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $06, $10, $10, $11, $10, $10, $10, $06, $00, $00, $00 // 14;00 - 14;20 | 20;10 - 20;30 + .byte $00, $00, $00, $01, $00, $00, $f0, $f0, $00, $05, $01, $05, $0e, $05, $00, $00, $0f, $0f, $00, $00 // 14;20 - 15;00 | 20;30 - 21;10 + .byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $60, $11, $10, $00, $00, $05, $00, $00 // 15;00 - 15;20 | 21;10 - 21;30 + .byte $00, $00, $60, $00, $00, $06, $00, $00, $00, $05, $05, $01, $01, $0e, $05, $00, $0f, $0f, $00, $00 // 15;20 - 16;00 | 21;30 - 22;10 + .byte $00, $00, $00, $00, $00, $00, $00, $60, $00, $10, $00, $06, $00, $00, $01, $05, $05, $05, $05, $00 // 16;00 - 16;20 | 22;10 - 22;30 + .byte $00, $06, $00, $00, $00, $00, $00, $00, $00, $01, $01, $05, $05, $05, $00, $00, $00, $00, $00, $00 // 16;20 - 17;00 | 22;30 - 23;10 + .byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $10, $10, $10, $00, $05, $01, $01, $05, $05, $05, $00 // 17;00 - 17;20 | 23;10 - 23;30 + .byte $00, $00, $00, $00, $00, $00, $00, $00, $01, $01, $06, $00, $00, $00, $05, $00, $0f, $0f, $00, $00 // 17;20 - 18;00 | 23;30 - 24;10 + .byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $50, $e0, $50, $50, $00, $05, $05, $51, $51, $01, $50 // 18;00 - 18;20 | 24;10 - 24;30 + .byte $50, $06, $00, $00, $00, $00, $00, $01, $00, $00 // 18;20 - 18;30 | 24;30 - 25;00 diff --git a/c64/menu.pe b/c64/menu.pe new file mode 100644 index 0000000..53deb08 --- /dev/null +++ b/c64/menu.pe @@ -0,0 +1 @@ +{"app":"PETSCII Editor","version":"3.0","data":"{\"app\":\"PETSCII Editor\",\"urlą\"http://petscii.krissz.hu/Ė\"mĦaąĀnaĹĜNew projectķauthĔNĿeĜķeđērVersionĜ3.0ķfileFĔmatŜŞŠŢĆŤŦėcreůeTiŀ:1607892427734ėlastSavŽſŕƁƃ794ƃ36971}ėoptųsļ\"paŪğƙ\"colodĔŕŸrtFũtŝĜnšƺ\"ŨŪœƀ\"nŃ-ņňŊŌėsƕeCounǀĕ:5ŸšcůƔƖǗǙǛĜyeƫėŎēǔƖǨǪōŏoǯeIǚŝvƯą10ėkeyboardLayǘŌĆuǫdžiŞtKȂƸwŴ\"drawŧȒƒClickĜțȝķēƵƩpƫĆǩȐcęsĔŬlƶȞȰDzƥƳȣpȄȆdȯĀĨźenĐĒĔą[]ŸhȆsĦɊŚąfƯɓǓņĒeɕɌ:ɘlɓȽcɑŞĦȯ[ĽŔĜC64 uăŝǡɓķmƷƲşngŪķbgǗƶǜ6ɐȆʃɠ1ƎĸulƩʉr1ǽėmʎʐƵĔ2ą2ėbĒŮȮɍ[ƃ,Ǿʝ1Ǿʦʪ9ʆ98,ʥ0ɏ[ƈʱǿʧʦ2ʆʹʽ0ʝʳ,[1ʶʾʨ˅ʿʦˉ˄Ǝˁʤʸˉʭ,˒˒ʹʲʴ˄ːʰˆˊʨ0˛2ǿˎ˄ʮ˥ʺǿ˔ʼʻ,ˣ˫˩˧˓˦˒ˎʥʹ˕ʪ˜˗˂˜ʽ˫˼ˉ˴ǿʶ̃Ǝ̄ʷˬʴ3ʸˇʺ̍Ǿʰ5ʆˣˋ˟˰ʩˇ˚˝̈˂˯̝˦ˤ̛[99ʫ̤˄7ˊ̨̣˓̤̫̓ʨ1ˠ˪ʼ˸̔ˀʴ˵̶̚˹ˢ˘ˈ˞ˇƎ̡̞̹̻̀ˉ˵ˍ̾Ǝ˼˅ˡˊ˛̸̀ːʝ˒ʥʼ͈̽˻˫̆̅͊͝˻̺˿͆˺˃ͧ͢ʝʥʶˎ̫̦ͭƄʺ̨ʩ̭̤̯ͪ̚Ǝ̚ͅͶ̼,̡̠͞˪;Ǝ4ʰ˕˫́,΅Ίʰ΋Ύʰͥ˄ʦ΍ˠ΄Άʰ25̷˂˵̌ΒΟ͚ͩ[̂͹̋ʆͿƈʴʸʆ΋̧ͱΌʦ̒Ϊˬδˢε̡Ψˍδͫ˘ͨηζͼˉΙǞʹσ͇Λʵ͹͕ʆ͗ʺ̡͟ʯ̻ʝʶέˉ7΢ͺʥ̑ˊ3ͷϝ˴̍ͫο΀ϓΖΰ΋̡͎Ϩ͌Ξϥΰˎ͔̇φͺ΢Τ΃ʺΧϏϵϣ϶ϔ8γζ̠π̡Ѓζ̆ϰ,ϝ΂Ͼ˱̈́ϱʩʸ̱χ̇ˎ̆ϛͿЂ͓ͷ̍΋·βΜϱΧΐͷϘʦƎ̊ϒ̨όϤ̟ʶЫ˖Ϙϱ·̺͌Α˾ˋϮͿΉͽͽлеͩФЄλκ϶ϻхуϷ΅˘ϏНάΘ͌͠ΣδЂϸο˘ΒϩЋ͌Βорјκμ˂ЃφφπʴΘΐˇͲƊ;ѩθϏιϷΩѢηѤ5ǞѦѴ̂ѷ;ѼЅγѶѸϼЀѵѼѥϪΔϧ҉ΏΌ̾̎ϭҏʺ҄̂̄ǿЗ͟ʴ͝˛Ą̈̄ѹωϷҗҔф΀Ƈʦҥ1ҧҩʨҥҁ˘Ҭ˅ΒЗ˛Ǝ̨3̉,Ͳ̴̅̐ϓ˅Ƈҙ҆ѼҨҫӄҦӅӃӀǞφϝӌЉӎҶѴΝ̳ѕ΁цϣҁ̡5ϬѫӜʱϓʰʰͬ˲ӣЍ˩ғҸʦӊя΃Үӊ31ѕ͗Φ;ӯҦ5γӒГӕѯϷ˜̆ͥЫԁʱԃ6ѧѭӞί6ӟ,ӡҙѰ̅ӁӊԏҮӅҌӃӆҊԎѲԏԛӬѺӎԊʫ̐ƎӚθӂѬ6ӌӰ1Ҝӎ1ӧЅѯΤԳ΃ԴƈԶ4ЈѣԑѽӊѷӉϼіԟԱѻӷ˻ҪԘԗՊՈӈ˂ˡ̅0ԤӰ5ӰՏ;Ց,Քՙԯ˂Ӎ՞ӏЉ԰՗ՐՒ՛ՀΙԐϥяҢՉ2Ͽ՝ՠ՟ӌԚ̆ӵӵ͞բԬөջԬմϏնӰҞѣϫӫ̄բІԑӧրԝѳҟ͝Լւ҅ԾԒԛվԛяօҘՇӇՌ֝ӄҙ֢̃֡̅;֤2֍̨֩Ө֪֩էѾՁЕԼ҇ѿՃ֒ԽԽҷղӎҭֵԸ־˘τׁջִ֎ԏ֘Ղω־Ե҃ՎԹ׋Է׋պגׁӭөϝʋτ4ׁ̦5ח9֓ҙӵҨׁח2לחםזָ˻עשԬח׭רװՕԿՇפөל׹תף׫˃3יͲ׮؂ח4Ͳ׿׽˄׺Ԭ̦؇؋׸ʺ̤σ̾؊5،כ؏؎ؒ׶׻ؕЦ׷ׯӶ؈؃׻צ؜ײ؈ןӴՕշجثԫةؚʵΙ΃ϝƈص4ط؄Ͳ̫رؠʋ؆יװ؀תؽ؝؎هنى̦إمʼƠʺҳқʼϛԬΧ׵˃׮3ѫً̦ךئب؟أؾ׮ذٗ1ױ׻׭ؔؑ٦ة٣اؾذ4״Ն׾ԫ٢ע؍؅ل٭١̦ٲקءؽٌحتچ2څمٰ٢٢٥ٵٯٟٱӮٴ׀ٓږЦˠ˛ُٕآٰذעٮأڊڑڟخڇ٦ٌ4ؑظڇͰهٌٽ՗̨ˡڳͰڴڲڂٗضӴڵ؆Օڮ5ҵ٠شۄڻۆڬ׼رѤڠτڄڦڈخէ3ؑڮծِڸڈ٬ٵӘֲۜ։Վډډֲշ٦ڌص۞֓ڝתʸש۬اۊڠרٿԒ،ۏۥ؁عڭ۸Γנ؛ڒҦלʨ٤ϓںڪۅۤ۩۝ۛڬېۘڶڶշ܌ںܐՕ܌ܖصշڶںӂ٤҂׼ؠּʵ҆څ؉ڇ܈׽܊ַۋۏƄ֮۩ܥܩۊۨܪܣ۶ۛӁϥګܘڿ؁ۚוؾٞ٧ۻۿ۰ڦҨؑۡԫڰڏڡطܺڸگܾ۾שƈؑѬݕ׻ڎԎګՕسؾۖݘݡڨ؊ܑګځۉڱ٣۵ڤ۽˃إܠ܌݉ڧ݌١מݵڹݴڤݎݙݭۜܧܫܴܷ܉ݿܵۺԎܬܑܽۘڔՎԼܰԧۚށыܻۅ܆ۆעܒݹݰݏ܍ހܲ܉֯Յޒ׍ڳѬҨץڙ֥ػۧۛݲޝޮӯܮַֈޠނ޳λܳޟֶܱܛ޵޷ޢۊ܏ڽ܎߃ڷڴԎ۹ۇ߉ܗش޲Ӌٷ܀ܦ՜ʵډݗ׎ƈΘۨס݆̫պބݭԩʱЊߣߢߥϘԪЦמݖڳٳ΃ߙ2Ӏժ΃ݝػٝߨԩ҄ߡߺߤ߻҄Ι܄ࠀѽࠁ߿Հܟݯࠇٜݸߎܳ޴ҙ0݊ީ˄˛9صߖڳۥ٫ؘيࠚ9ࠋԒիުߒК͎۳ءܰΥࠅٮݯ٢ݯݚ݆۠ڢܤ࠮ωݦ΃࠵ݡޖ࠹ࠝޤࠡާۗ࠾֧߬ࠗޭۏӵІ̸݉ߤ߆Ͱ߻߄ߛߒࡐޯۑލޠҫװڵڿތђࠒԘ֧͟Τ߯ѽ4ࠞށࡥمռׂדࡨࡤֳεҀ޹ࡰ޶޼޾˴߼ࡶߥ߽˂՚՚ՖՖࡻڿդ߱ࠂࢃ߿ࢄΚࢆ߰ࡔࡦѼࡿգգγӰϝ؁ЉӰߡ̧ࢂࢅ࢙ࢇ࢚ࠃΚࡏࡒ֥֣̅ࡈࢊܱߗࢧԳ࢟ߕࢢࢋࡲԼ֪ࢠې࡬ࠌԦ޾࡞ࢡࡑޱ࠯ࡐ޴ޣܢࡴλࢤߔࡅӰࢰࣂࡍࣈࡷ߸՝࢑࣍࢔࣏֋ࢺωׇߘ߮ࣖࣕࣘъԟࡳࢾԻࢶ۟ࢿࢭ޿Ԧ࢝ࣥࢃ΢ࣜࡪדԎ׊אࡳࢪڦࢰߚ˻ࡩׂ࣯ࣴࡨջ࣮ࢨԵ]]ƥɬNJɯɱȹɵƑDžɹdɻiɽɿʞʂʙʅʇrʑǽʌʖʏiʑʓƁʕʗचऑʛ:ʝ\"ʟtʡɪˏ̻˸ʬʮΐӖύԡ˖ψ˨Эд͆ˌтǿʥ̓ͥऻԄस͈ऴδͺ̠͖ϻʋϷԡк߹ुͩў֍वЍहͣтϢҗॊϻ̒Ԅड़ƃγ˯̖̏̕ʹЈक़ͿाѓиӝǾ̪͵҄॔ξ।߹ЏеӖ॰सʶӦԟलпԄ९̿ӥ˦ԺԈेԃहЈ͎ϹԝॉঃॕळऺӺ͙ϷঃߝەЪʝԥ঍঒ЮϱচॎԈΠ঍˾ϮέΈКҌনयϤΓΰहНࡡлҐΠДҀΥѕι࢐юίήέПђՄ࡮׍֌ңѡͦটՄν͆φυӂ̺ЕϊЍύह৅ϑ˽щ͑ʝϗЎсٔ0ח͈ϟ̸ϡңҞџҊΰϩˎϫґ০΋ЈаַϴॖϏ̠Їঐփৗӧє֑ԱЇγЊৣΰ˳Кʽब৘с৏Ҡঊ̆ЙРЛΒэѕѝԃۖ͘Ρ̈́ЦЉЏԨԃ˭शड़ৰਓгГжਖਁौ਎мॵ৛˹ў঒ঃϢчਰৄьկ˃ਵЍ৫ঌॿज़৻΀০ΒњʫψϙਁхӧӘҞজϒਦ˜˭षϒ੐˽ёͺ̓ਡ̙̾঎ॣ͏ਞঁ˰ॠদ͛Ӥ˙ਫ਼ਃ਩ˑ̴ॴਗρॸ੍ৎࠣԜӿ΢Ш঳ੵ̕ϛρˠБ̘͐ͻʴ̓੖੡̢̦Ҩ঻Ͱ̬ͮ΀ˋВ̠ઍ̵͆ਓਗ਼੫͋ӺॹӤઑξ͉Ϥ੒иϬਖ਼͒੧ϋ̇ਦਥৃદ੬঑ͤ΢઒с৔ʹઉ६঻અ̮৉ભশ੎વͽਨݮЯতΆӓਉ֏܉ԓ֛ԘԖՈΏ֖ѱֆࡺՓࢀࢎࢍࡽՑʴ՚ܠ՘ʹ૕ݔ૗ʿև׈࣭ࣻࣼ૟բࣷ࣡ীӖীؽ֞Չ૪Սʵ՘ࡾ૎ࢎ૰զհֺ՞ૣ૯՘ࡿࠎ͌ש૕ς૗૾ԫ૜૵ձձ૊Ч࣎ոֽࣹ࣫ূյ࣎ৼуࣔૄিՁܡЃ֋ଋׅѲ֐ুଖ߀҆କιଔ֕ૅՋ֜଩ӆ֠ࢬࢷମ֦֢ʴ֬֫଴7޲૦ࡤৈଌଡݭ࢑আਜ਼੻ЍঃІૡࢨ׀଍҂੊ੱք૞୅Դׄ૟׏׎࣪הݓ؄י݄ؗ޽ַۉ܆࠾ٱެࠅࠛ٧ٷٰ܈޲ܟୣن࠳Ѥ࠺Ҧڋמୡࢥӂݍؘؐ୬ଢߜޔࢱ୛োࠔݺ࠶ʦ࣒োୣ٨ڐ޺ޝ୴݈ߜݽଢޑ࠸࠷୞ןୢ؊ٻ٧كܠ୛݇ࢹ஌ܨގ׮ۖ࡜ʋْஞܯஆۦ஥ଡ଼୵ڐݨࢮτ஧׳ࠜ୨୿஬୿ஐ୨஧࠙ஈ୴۲ڂ୞୧ࢥעێࡑ߭஻ݷவ୲࣡஄୰ڂீொܜʼথࠓصࠏனோ்د׷ெڑ٤۹஗୨ک୻ەݒ˃ذ߂߄ݐ୬ݱ߃୤ݐہֻڱߊޕ௞୸ړࠦ௃ࢱஃܣ۔ѫީ߆ۓ௖ࡱࢭࣰࡑۣ࡚஬ݔంڣؠۮѓڢں۱୷۴ஂܶ׀ۻޗܼ׻8ଽ஫ٮߝࢇٱ܄܋ޜߟః׍௢߅ܔۅܓڳܑߋనனۿʸ୵ܡޞூ஋ݳఁࣟ௶ޝܭ୳ܯ݋ద௏఻అࢮܹ܇ఙؙݩ׮݁ٚݬܨ࠲సࢠޏޚݔ࠹௔މ౔ౖܿ߫஁୚ణ֥߳؟ݠ୮ڃݤܕ࠵౟౛஽௭வଽࠫ߉ްఇ஫ܝ౏૩ேஶ୞౵௛உރٴ఺హశܼއۺ؏௿ܕ࡚Ә౔୶܊ޓڇܖతԫޙ౫஁ఘܪ௎ܩࢽవیؤݧఏڏரఔڑ௎୩౬୪ݶ؈ٺ݃٢஖؇౦ࠜஂ୙ن݋ؓರ஗ಶ؝౷؜ٝ౸ଽநܥఈ௉ۉ౲چ஭֠ԒయۄؿߑఋಭفಱЦగ࠘ಸ࠙ౚَࣴ˪ّөڗڜఋ౎ೀݯ݁ಟಔುݼ಩୥٩ٷ஺ోௌ݄௅٦ಡ౭ಪټౕ౬ڀ೦ಯ௹ࣄݳ׀೭ಿ࠳೥౮೼೗೛അண࠿ڛЗۥڞ௶ಥ೴೽౶ޮݣಕݱ౉ಳ௤೺ѵࣇࡊ௧ࡍࡋଶࢻങഢஃૹեࡼഥ՛૴૮੐૙௔ബ୥ࢳౄࡧ୔ୈөറ׌ђࣜ಍ి࣢੉ࡉࡸ࣊ࡶ૔૱૒ദ૏Տ࢛࢘ൊࣦ࢜ഷ૑ഥൃ̚Ֆؠ૿ϓଁӐܢൌോ࢈ࠂఄޝ֦ࣂഺ୎ࣽഡࢫࢸ഻ృַࣆࣄഷ੉ࢵࡦൠ൬൥ڦಚ࣠ಙࣁ൲ࣃࡐ൫ࠢΜുീീ࣑̉࣎ඃ࣍Ԏଔඈࣗք߾ఊ࣠ࣞഽ୽ం੊ԥ࢙୞೎ߩಆඑ޾ഴս׍ૠ଼ࢾങࣲ޵େഴ૤ගԒඟࣾ}ɏ\"ɆeɈɪँƲłńSŹධŢʕɺĜɼɾDžşzeXą׎ථiෂYʜǞƳऑBĔऊǜǿ෍ʄBgąීƴʄCɧෘञङछʔʍ෠डʜėextූ෡झ\"෨෪ऐʄढत෯෫ऑ3ąϝථɜǀMट෬तs෼e෾෤ෲąʆ෻ĮǀsǸාȇǁĆhidऊයชɝsVįibɿ:trueओaŋŝSĦෞƳɧDůĻ:[[3ʝิЉี̰ԫʩʫӰ8ʝ฾Ԍ৙ǿ৚ไऻʆๅҸใǿเ์ู฼๏ึ๑ุื๔๒๕๓ึ܆ƉΊࢉʤ̤ơ̥๡๙ʆఀ๖ٞ๦Ǟ๖ƋΊ๩ʝƞЉ̤ఀǾЧ˞๴๡ͳʱ๟๟ΐЪҴ๋๎๖5ǿ๒ν๶ึ๳๕̤๯ఀ຋๮๭๗๬๔๫๙๩๱̤5ʰ๖ຈງ՘๖ຜຆ๵ຐึ՚ຄ՝๓ປມບຝีຖΊά๤ອ๲0̂ڳຊະຐຨຢຩ๘ົˊຠՙຼ̉ຶ๔ູຟຸຫໄຳˊБࣅΆັ๱ວ່ໆສ຿ພຽກӌุໂຐ๯๯ʩฺ໠๏ໟҸ˛ળય໔໇຿໅ຼ໩຺໮ຣຠ຅๔ຘ;ີ๰ຮ໮ູ໫໯໬໻໖໼ༀກຏิ̉໬ຌ็ҵ໗༆་຾໭໿༏༌༐໮ϛລำ໑໕৙༉້༘༁༑༞༝༠༐༅ༀູຓ༟༒༨༧༪༠௯༕༩໮༦།༯༳༫༴๔ຍ໼༣༶๪༚༻༵༿໳ນັ༪༺ཀໆ༱༾༡ཆໃ๙༜༮ཆ༌༱໾ཐཊຐ໴༾ཅཕ໓๓཈༗ཚ༫຋གྷΊ຿๚ນ໚຦ཟ༠ཝ༷๤ཀན໷๯ݗ໐ལ༷ທແཨཉ໿໻ຓອ4Ԥས༛ཀྵǾใག໸༸༩ཙཹ༌໴ི྆ືྊຒ໎༲༆ཱི๚ཱི༄ླྀཔ༳ອ๫໋ྃ༎༟ƅཀྵ๙ທ࢑ཧ༖ྣཔຈઈྜྷ໊ྞ༒ྡྷ཯ེ໒་ྉྚྷ๔ྫྷͲྮ໊ྡྷྐ๦ທ຃ྦྷ྿ྸ༯ྫ໧཮ྴ༝ྶྩཕྲ࿅࿐࿌࿄࿍࿓࿕࿃࿐࿔๮཭ྎ໮ཡཬ໸࿄ࣾǟʄฮtะาॉ࿩ѐਙ࿪࿬࿫࿭࿭ʨ࿯࿳࿮࿵ঌְ࿸۬֫ы࿶࿯ʦ࿶ηց࿿ԫ࿬ဃਝআ࿴࿰ဉ࿴Ё୉ৢ࿭௑ဆင࿩ϣಒဃ͌ဒηज़ज़ζ๤Ԡӎဍଟတਙထॉဥမဓဨ࿿ဝՁလॄဤခဎࡺՙုဣံဪဩဂिာြိပဲ[୉ဴτးဪျုွীီীպХҖဆǞၑယ၈࿹ၔ૦ၕအ૧၃ဗဇၗ၇ၟၘၡ࿺रပၓၞၢၨၞ૝਽ၩၭၧԱ၍৷࿸ဂ။ၮၶ฻଺ଠၕ်ၶၯѓฺဴସ଻ှၼၾႆၿဴ࿩ႅଟႇЁၖၽ࿸יʫְ૝ԱီႋၵЃႋζၒ႒ќఎ׃ၲႍါη၂၊ϣၒဓԤႈၸႢၡ႗ၛၒ၉ၳ࿿ႝ࿹႕ၡ၄ՓၛႇငၵܞׂၚႣ၏ႺႤၠႚၨࡪჂ႐ि္჆ခၝှၹჃၭ჎ငႣ჊Ⴎეၧʼ჏Ⴇၪႃმဇႛ჌സტၧဩყ႔სქ၏ॉႲႥႁႼၢ࿢ธฌɍතǙƸS࿦ȥჸėź჻ჽȦัࣿතขซeษħɍඳŁŃ ᄈɝᄑสɛᄉ඲ĘดţP2csSɸ඼Ć඾ऎුĔූหේĔSฃ෢घʘʄजतᄯठง:ฉ෨Ʈndහɡəฤ෮xᄺd්ᄾɣᅀदʡ࿥࿧˃၅ԫ˘ᅎʦႸફᅑߓზဒᅓ΀ဆდՁဓᅙˣᅛღᅝဃᅟᅐთᅢၰᅤწᅔᅧׄ၌ᅪၺၹჩᅨၥᅏᅫᅚᅗᅶᅍᅹᅒᅷୃძᅱᅴႂᆁᅮၘᅥᅾᆇᆄ׈ၯᆉᆌᆈᆏᆊ଒ᆃᆎᆑႌᆆᆐᆔᆙᆗᆕ჋ᆅრᆜლᆋᆛᆚᆟᆤႷᆘᆣᆩᆥᆪႷᄆėჺoჼฦᄄɎᄀŘᆱᄃჸඬ}"} \ No newline at end of file diff --git a/c64/screen.asm b/c64/screen.asm index a6f7b01..a418ca7 100644 --- a/c64/screen.asm +++ b/c64/screen.asm @@ -8,6 +8,11 @@ // Destroys: a, y // clear_screen: + lda #$06 + sta $d021 + lda #$0e + sta $d020 + ldy #0 !loop: @@ -49,12 +54,13 @@ clear_screen: // print_newline: sec - lda $05 + lda cursor_pointer_lo adc #40 sta cursor_pointer_lo bcc !done+ - inc cursor_pointer_hi -!done: + inc cursor_pointer_hi + !done: + // fallthrough // @@ -141,7 +147,7 @@ write_string: jsr print_hex } -// Destroys: a, x, y, $03 +// Destroys: a, x, y, zp_temp ($02) print_hex_0x: sta zp_temp @@ -187,6 +193,10 @@ print_hex: .text "0123456789ABCDEF" +// Input: +// - $03..$04: The number to print +// +// Destroys: a, y, $24..$25 print_decimal_u16: ldy #6 @@ -196,21 +206,12 @@ print_decimal_u16: !loop: u16_div10() - - lda $24 - sta $22 - - lda $25 - sta $23 - + u16_u16_move($22, $24) i16_mul10($22) i16_i16_sub($22, $23, $03, $04, $22, $23) - lda $24 - sta $03 - lda $25 - sta $04 + u16_u16_move($03, $24) lda $22 clc @@ -246,6 +247,9 @@ print_decimal_u16: // // Input: // - udivmod32_dividend - Number to print +// +// Destroys: a, y, $02..$04, $10..$2b +// print_decimal_u32: ldy #11 @@ -305,3 +309,31 @@ print_decimal_u32: !buffer: .fill 12, 0 + +wait_space_then_reset: + ldx #$ff + stx $dc02 + ldy #$00 + sty $dc03 + +!: + lda #$7f + sta $dc00 + lda $dc01 + and #$10 + bne !- + + move_16_imm($03, !str_resetting+) + jsr write_string + + // Reset + lda #%00110111 + sta $01 + jmp $fce2 + + rts + +!str_resetting: + .byte '\n' + .text "Resetting..." + .byte 0 diff --git a/c64/zp.org b/c64/zp.org new file mode 100644 index 0000000..10de637 --- /dev/null +++ b/c64/zp.org @@ -0,0 +1,70 @@ +| Address | i8_div5_a | u16_div10 | i8_mul5_a | i16_mul10 | multiply_8bit_* | multiply_16bit_* | multiply_32bit_* | udivmod32 | print_newline | write_string | print_decimal_u16 | print_decimal_u32 | draw_menu | day05 | +| | | | | | | | | | print_carriage_return | | | | | | +| | | | | | | | | | print_hex_0x | | | | | | +| | | | | | | | | | print_hex | | | | | | +|---------+-----------+-----------+-----------+-----------+-----------------+------------------+------------------+-----------+-----------------------+--------------+-------------------+-------------------+-----------+-----------| +| | | | | | | | | | | | | | | | +| $02 | temporary | | temporary | | | | | | temporary | temporary | temporary | temporary | | | +| $03 | | input | | | | | | | | input | input (destroyed) | temporary | temporary | temporary | +| $04 | | input | | | | | | | | input | input (destroyed) | temporary | temporary | temporary | +| $05 | | | | | | | | | state | state | state | state | state | state | +| $06 | | | | | | | | | state | state | state | state | state | state | +| $07 | | | | | | | | | | | | | state | | +| $08 | | | | | | | | | | | | | | temporary | +| $09 | | | | | | | | | | | | | | temporary | +| $0a | | | | | | | | | | | | | | temporary | +| $0b | | | | | | | | | | | | | | temporary | +| $0c | | | | | | | | | | | | | | temporary | +| $0d | | | | | | | | | | | | | | temporary | +| $0e | | | | | | | | | | | | | | temporary | +| $0f | | | | | | | | | | | | | | | +| $10 | | | | | | | | input | | | | input (destroyed) | | | +| $11 | | | | | | | | input | | | | input (destroyed) | | | +| $12 | | | | | | | | input | | | | input (destroyed) | | | +| $13 | | | | | | | | input | | | | input (destroyed) | | | +| $14 | | | | | | | | input | | | | temporary | | | +| $15 | | | | | | | | input | | | | temporary | | | +| $16 | | | | | | | | input | | | | temporary | | | +| $17 | | | | | | | | input | | | | temporary | | | +| $18 | | | | | | | | output | | | | temporary | | | +| $19 | | | | | | | | output | | | | temporary | | | +| $1a | | | | | | | | output | | | | temporary | | | +| $1b | | | | | | | | output | | | | temporary | | | +| $1c | | | | | | | | output | | | | temporary | | | +| $1d | | | | | | | | output | | | | temporary | | | +| $1e | | | | | | | | output | | | | temporary | | | +| $1f | | | | | | | | output | | | | temporary | | | +| $20 | | | | | | | | temporary | | | | temporary | | | +| $21 | | | | | | | | temporary | | | | temporary | | | +| $22 | | temporary | | | output | output | temporary | temporary | | | temporary | temporary | | | +| $23 | | temporary | | | output | output | temporary | temporary | | | temporary | temporary | | | +| $24 | | output | | | | output | temporary | temporary | | | temporary | temporary | | | +| $25 | | output | | | | output | temporary | temporary | | | temporary | temporary | | | +| $26 | | | | | input | input | temporary | temporary | | | | temporary | | | +| $27 | | | | | | input | temporary | temporary | | | | temporary | | | +| $28 | | | | | | | | temporary | | | | temporary | | | +| $29 | | | | | | | | temporary | | | | temporary | | | +| $2a | | | | | | | | temporary | | | | temporary | | | +| $2b | | | | | | | | temporary | | | | temporary | | | +| $2c | | | | | | | | | | | | | | | +| $2d | | | | | | | | | | | | | | | +| $2e | | | | | | | | | | | | | | | +| $2f | | | | | | | | | | | | | | | +| $30 | | | | | | | input | | | | | | | | +| $31 | | | | | | | input | | | | | | | | +| $32 | | | | | | | input | | | | | | | | +| $33 | | | | | | | input | | | | | | | | +| $34 | | | | | | | input | | | | | | | | +| $35 | | | | | | | input | | | | | | | | +| $36 | | | | | | | input | | | | | | | | +| $37 | | | | | | | input | | | | | | | | +| $38 | | | | | | | output | | | | | | | | +| $39 | | | | | | | output | | | | | | | | +| $3a | | | | | | | output | | | | | | | | +| $3b | | | | | | | output | | | | | | | | +| $3c | | | | | | | output | | | | | | | | +| $3d | | | | | | | output | | | | | | | | +| $3e | | | | | | | output | | | | | | | | +| $3f | | | | | | | output | | | | | | | | +| $fd | | | | temporary | input | input | temporary | | | | temporary | | | | +| $fe | | | | temporary | | input | temporary | | | | temporary | | | |