diff options
Diffstat (limited to 'roms/7seg_print_one.asm')
-rw-r--r-- | roms/7seg_print_one.asm | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/roms/7seg_print_one.asm b/roms/7seg_print_one.asm new file mode 100644 index 0000000..00725ef --- /dev/null +++ b/roms/7seg_print_one.asm @@ -0,0 +1,62 @@ +PORTA = $6001 +DDRA = $6003 + +SER = %00000001 +RCLK = %00000010 +SRCLK = %00000100 + + .org #$f800 + +reset: + ldx #$FF ; initialize call stack to $1FF + txs + + ldx #%00000111 ; set output on 7seg control pins of PORTA + stx DDRA + + lda #$a5 ; 10100101, data to show + ldy #$8 ; 8 bits to shift +loop: + rol a + bcc zerobit ; C=0, bang a zero to SER +onebit: + ldx #(SER) ; C=1, bang a one to SER + stx PORTA + ldx #(SER | SRCLK) + stx PORTA + ldx #(SER) + stx PORTA + jmp next +zerobit: + ldx #$0 ; C=0, bang a zero to SER + stx PORTA + ldx #SRCLK + stx PORTA + ldx #$0 + stx PORTA + jmp next +next: + dey + bne loop + +output: + ldx #0 ; bang RCLK to store output in latch + stx PORTA + ldx #RCLK + stx PORTA + ldx #0 + stx PORTA + +term: + jmp term + +nmi: + rti + +irq: + rti + + .org #$fffa + .word nmi + .word reset + .word irq |