Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- testloop:
- jsr get_char
- ldx #0
- @loop:
- lda buf,x
- jsr put_char
- inx
- cpx data_length
- bne @loop
- jmp testloop
- ;==================
- get_char:
- sei
- lda #$40
- sta $4017
- lda #$80
- sta $4010
- lda #$3f
- sta $4013
- lda #0
- sta $4015
- lda #$1F
- sta $4015
- ldx #0
- @loop:
- lda #SERIAL_MASK
- cli ; enable DMC long timeout
- @wait:
- bit $4017
- beq @wait
- ; 14 cycles
- sei
- lda #0
- sta $4010 ; disable DMC timeout, then enable frame IRQ short timeout with LSR $4017
- nop
- nop
- nop
- .repeat 3
- lsr $4017
- ror a
- pha
- pla
- lsr $4017
- ror a
- nop
- nop
- nop
- nop
- .endrepeat
- lsr $4017
- ror a
- pha
- pla
- lsr $4017
- ror a
- eor #$FF
- cmp #'Z'
- beq @exit
- sta buf,x
- ; lda #0
- ; sta $4010
- ; sta $4017
- inx
- bne @loop
- @exit:
- stx data_length
- sei
- rts
- ;==================
- IRQ:
- beep
- lda #'I'
- jsr put_char
- lda #'R'
- jsr put_char
- lda #'Q'
- jsr put_char
- lda $4015
- pla
- pla
- pla
- jmp testloop
- rti
- ;==================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement