nes/main.s
2025-03-20 20:11:06 -06:00

80 lines
1.0 KiB
ArmAsm

.segment "HEADER"
.byte $4E, $45, $53, $1A ;Nes header identifier
.byte 2 ;2x 16KB PRG code
.byte 1 ; 1x 8KB CHR Data
.byte $01, $00 ; mapper 0, vertical mirroring
.segment "VECTORS"
.addr nmi ; nmi interrupt
.addr reset ; reset interrupt
.addr 0 ; external interrupt
.segment "STARTUP"
.segment "CHARS"
.incbin "./CHR-ROM.bin"
.segment "CODE"
check:
cmp #5
bcc skip
clc
adc #3
skip:
rts
reset:
lda #173
sta $00
lda #0
sta $01
sta $02
dabble:
; check first digit
lda $01
and #$F
jsr check
sta $03
lda #$F0
and $01
ora $03
sta $01
; check second digit
lda $01
and #$F0
lsr
lsr
lsr
lsr
jsr check
asl
asl
asl
asl
sta $03
lda #$F
and $01
ora $03
sta $01
; check third digit
lda $02
and #$F
jsr check
sta $03
lda #$F0
and $02
ora $03
sta $02
; Shift
clc
rol $00
rol $01
rol $02
lda $00
cmp #0
bne dabble
rts
nmi:
rti