diff options
| author | not_a_robot06 <temporarythrowaway@tutamail.com> | 2025-02-15 19:09:28 +0000 |
|---|---|---|
| committer | not_a_robot06 <temporarythrowaway@tutamail.com> | 2025-02-15 19:09:28 +0000 |
| commit | 424240eb2f9f78d8ea648feab4a32cc0fdbea194 (patch) | |
| tree | a9d8850b19526522a9f706f93a9c8be535cf8a29 /life.asm | |
| parent | c01b622893dcedcf7175599376b706267d3ebc60 (diff) | |
| download | c64-life-424240eb2f9f78d8ea648feab4a32cc0fdbea194.tar.gz c64-life-424240eb2f9f78d8ea648feab4a32cc0fdbea194.tar.bz2 c64-life-424240eb2f9f78d8ea648feab4a32cc0fdbea194.zip | |
add basic cell modifying
Diffstat (limited to 'life.asm')
| -rw-r--r-- | life.asm | 45 |
1 files changed, 27 insertions, 18 deletions
@@ -23,39 +23,49 @@ loop: cmp #$1d ; right arrow beq if_right - cmp #$9d ; left arrow beq if_left - jmp else_left -if_left: - jsr dec_num - jmp loop -else_left: + cmp #$2d ; reset if - pressed + beq if_reset + cmp #$20 ; fill cell if space pressed + beq if_space + cmp #$30 ; end program if 0 pressed + bne loop + jmp end - jsr print_byte if_right: jsr inc_num + jmp loop + +if_left: + jsr dec_num + jmp loop - cmp #$2d ; reset if - pressed - beq if_reset - jmp else_reset if_reset: - pha lda #$04 sta numH lda #$00 sta numL - pla jmp loop -else_reset: - cmp #$30 ; end program if 0 pressed - bne loop - jmp end +if_space: + ldx #$00 + lda (numL,x) + cmp #$a0 + beq if_cell_filled + jmp if_cell_empty +if_cell_filled: + lda #$20 + jsr print_byte + jmp loop +if_cell_empty: + lda #$a0 + jsr print_byte + jmp loop + ; loops until keyboard buffer has any number of characters in it key_wait: - ; init: pha to retrieve before rts, to keep A intact pha key_wait_loop: lda key_buf_len ; shows how many keys are in key buffer @@ -105,7 +115,6 @@ print_byte: txa ldy #$00 - sbc #$3f ; convert (very vaguely) to c64 screen codes sta (numL),y ; deinit: pull Y from stack and transfer original A from X to A |
