Hey, so I made a post ages ago concerning NES programming never really got off the ground because I didn't know anything about computer architecture, haha. But recently I've been thinking about getting back at it as a hobby. Anyway I tried a intro tutorial to but I can't get this code to work on NESASM3
;iNES header
.inesprg 1 ; 1x 16KB bank of PRG code
.ineschr 1 ; 1x 8KB bank of CHR data
.inesmap 0 ; mapper 0 = NROM, no bank swapping
.inesmir 1 ; background mirroring
; code and graphics banks mapped out according to memory map specified in .inesmap (in this case no memory map is used)
; this is the lower program bank and .org directive sets the program counter
; together bank 0 and bank 1 fill the upper PRG-ROM
.bank 0
.org $C000
RESET:
SEI ; disable IRQs
CLD ; disable decimal mode
LDX #$40 ; #$ literal hex value
STX $4017 ; disable APU frame IRQ
LDX #$FF
TXS ; Set up stack, this sets the stack pointer to what's in X
INX ; now X = 0
STX $2000 ; disable NMI
STX $2001 ; disable rendering
STX $4010 ; disable DMC IRQs
BIT $2002 ; clear VBL flag if it was set at reset time
vblankwait1: ; First wait for vblank to make sure PPU is ready
BIT $2002
BPL vblankwait1
clrmem:
LDA #$00
STA $0000, X ; Indexed absolute addressing, address is effectively $0000 + X
STA $0100, X
STA $0200, X
STA $0400, X
STA $0500, X
STA $0600, X
STA $0700, X
LDA #$FE ; load A with 1111 1110
STA $0300, X
INX
BNE clrmem ; branches if Z flag is 0 (i.e. not set) effectively X will continue to increment until it loops back to 0 again (thus clearing all memory)
vblankwait2: ; Second wait for vblank, PPU is ready after this
BIT $2002 ; set Z flag based on ANDing A (accumulator) and the value in $2002, which is the PPU status register
; information is so difficult to find sometimes u_u: anyway bit 7 of the memory address will set N in this case
BPL vblankwait2 ; branch if N flag is 0
LDA %10000000 ; bitmask for PPUMASK, increases intensity of blues
STA $2001
mainLoop:
JMP mainLoop ; typical game loop
.bank 1
.org $E000
; remember the vector table is located in $FFFA-$FFFF
.dw NMI ; when an NMI happens (once per frame if enabled) the
; processor will jump to the label NMI:
.dw RESET ; when the processor first turns on or is reset, it will
; to the label RESET:
.dw 0 ; external interrupt IRQ is not used in this tutorial
; this is the pattern table in the PPU
.bank 2
.org $0000
.incbin "mario.chr"
Oh and if any of those comments are wrong just tell me that's just my understanding of the situation. Now for the error NESASM3 gave me...
Not even sure what some of the errors mean. What's the word pros?
Code:
;iNES header
.inesprg 1 ; 1x 16KB bank of PRG code
.ineschr 1 ; 1x 8KB bank of CHR data
.inesmap 0 ; mapper 0 = NROM, no bank swapping
.inesmir 1 ; background mirroring
; code and graphics banks mapped out according to memory map specified in .inesmap (in this case no memory map is used)
; this is the lower program bank and .org directive sets the program counter
; together bank 0 and bank 1 fill the upper PRG-ROM
.bank 0
.org $C000
RESET:
SEI ; disable IRQs
CLD ; disable decimal mode
LDX #$40 ; #$ literal hex value
STX $4017 ; disable APU frame IRQ
LDX #$FF
TXS ; Set up stack, this sets the stack pointer to what's in X
INX ; now X = 0
STX $2000 ; disable NMI
STX $2001 ; disable rendering
STX $4010 ; disable DMC IRQs
BIT $2002 ; clear VBL flag if it was set at reset time
vblankwait1: ; First wait for vblank to make sure PPU is ready
BIT $2002
BPL vblankwait1
clrmem:
LDA #$00
STA $0000, X ; Indexed absolute addressing, address is effectively $0000 + X
STA $0100, X
STA $0200, X
STA $0400, X
STA $0500, X
STA $0600, X
STA $0700, X
LDA #$FE ; load A with 1111 1110
STA $0300, X
INX
BNE clrmem ; branches if Z flag is 0 (i.e. not set) effectively X will continue to increment until it loops back to 0 again (thus clearing all memory)
vblankwait2: ; Second wait for vblank, PPU is ready after this
BIT $2002 ; set Z flag based on ANDing A (accumulator) and the value in $2002, which is the PPU status register
; information is so difficult to find sometimes u_u: anyway bit 7 of the memory address will set N in this case
BPL vblankwait2 ; branch if N flag is 0
LDA %10000000 ; bitmask for PPUMASK, increases intensity of blues
STA $2001
mainLoop:
JMP mainLoop ; typical game loop
.bank 1
.org $E000
; remember the vector table is located in $FFFA-$FFFF
.dw NMI ; when an NMI happens (once per frame if enabled) the
; processor will jump to the label NMI:
.dw RESET ; when the processor first turns on or is reset, it will
; to the label RESET:
.dw 0 ; external interrupt IRQ is not used in this tutorial
; this is the pattern table in the PPU
.bank 2
.org $0000
.incbin "mario.chr"
Oh and if any of those comments are wrong just tell me that's just my understanding of the situation. Now for the error NESASM3 gave me...
Code:
C:\nes>nesasm3 demo
NES Assembler (v3.01)
pass 1
#[1] demo.asm
2 00:E000 .inesprg 1 ; 1x 16KB bank of PRG code
Local symbol not allowed here!
3 00:E000 .ineschr 1 ; 1x 8KB bank of CHR data
Local symbol not allowed here!
4 00:E000 .inesmap 0 ; mapper 0 = NROM, no bank swapping
Local symbol not allowed here!
5 00:E000 .inesmir 1 ; background mirroring
Local symbol not allowed here!
10 00:E000 .bank 0
Local symbol not allowed here!
11 00:E000 .org $C000
Local symbol not allowed here!
14 00:E000 SEI   ; disable IRQs
Syntax error!
15 00:E001 CLD   ; disable decimal mode
Syntax error!
17 00:E004 STX $4017   ; disable APU frame IR
Q
Syntax error!
19 00:E006 TXS   ; Set up stack, this s
ets the stack pointer to what's in X
Syntax error!
20 00:E007 INX   ; now X = 0
Syntax error!
21 00:E008 STX $2000   ; disable NMI
Syntax error!
22 00:E008 STX $2001   ; disable rendering
Syntax error!
23 00:E008 STX $4010   ; disable DMC IRQs
Syntax error!
50 00:E034 LDA %10000000 ; bitmask for PPUMASK, increases i
ntensity of blues
Unknown instruction!
51 00:E034 STA $2001
Unknown instruction!
56 00:E037 .bank 1
Unknown instruction!
57 00:E037 .org $E000
Unknown instruction!
67 00:E03D .bank 2
Label multiply defined!
67 00:E03D .bank 2
Unknown instruction!
68 00:E03D .org $0000
Label multiply defined!
68 00:E03D .org $0000
Unknown instruction!
69 00:E03D .incbin "mario.chr"
Unknown instruction!
# 23 error(s)
NES Assembler (v3.01)
pass 1
#[1] demo.asm
2 00:E000 .inesprg 1 ; 1x 16KB bank of PRG code
Local symbol not allowed here!
3 00:E000 .ineschr 1 ; 1x 8KB bank of CHR data
Local symbol not allowed here!
4 00:E000 .inesmap 0 ; mapper 0 = NROM, no bank swapping
Local symbol not allowed here!
5 00:E000 .inesmir 1 ; background mirroring
Local symbol not allowed here!
10 00:E000 .bank 0
Local symbol not allowed here!
11 00:E000 .org $C000
Local symbol not allowed here!
14 00:E000 SEI   ; disable IRQs
Syntax error!
15 00:E001 CLD   ; disable decimal mode
Syntax error!
17 00:E004 STX $4017   ; disable APU frame IR
Q
Syntax error!
19 00:E006 TXS   ; Set up stack, this s
ets the stack pointer to what's in X
Syntax error!
20 00:E007 INX   ; now X = 0
Syntax error!
21 00:E008 STX $2000   ; disable NMI
Syntax error!
22 00:E008 STX $2001   ; disable rendering
Syntax error!
23 00:E008 STX $4010   ; disable DMC IRQs
Syntax error!
50 00:E034 LDA %10000000 ; bitmask for PPUMASK, increases i
ntensity of blues
Unknown instruction!
51 00:E034 STA $2001
Unknown instruction!
56 00:E037 .bank 1
Unknown instruction!
57 00:E037 .org $E000
Unknown instruction!
67 00:E03D .bank 2
Label multiply defined!
67 00:E03D .bank 2
Unknown instruction!
68 00:E03D .org $0000
Label multiply defined!
68 00:E03D .org $0000
Unknown instruction!
69 00:E03D .incbin "mario.chr"
Unknown instruction!
# 23 error(s)
Not even sure what some of the errors mean. What's the word pros?