which assembler to use?

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Celius
Posts: 2159
Joined: Sun Jun 05, 2005 2:04 pm
Location: Minneapolis, Minnesota, United States
Contact:

Post by Celius »

I really think Wla-Dx is a great thing to use. It takes a while to get used to (Or at least it did for me), but once you really know how to use it, it's SO much better than NESASM. I at first didn't understand why everyone hated NESASM so much, but as soon as I actually started making something that wasn't just displaying a sprite on screen, I noticed TONS of things that really sucked. I recall not being able to do nameless lables and things like that, but I also couldn't figure out its banking system. I couldn't really make a game that wasn't NROM. I found the little features that Wla-Dx offered to be quite handy.
User avatar
nineTENdo
Posts: 223
Joined: Sun Mar 19, 2006 12:37 am
Location: San ANto, TX
Contact:

Post by nineTENdo »

Does anyone know how to output a .nes on the ASM6. It says that can only output a .bin file. very simlar to the x816.

Code: Select all

Usage:

        asm6 [-options] sourcefile[.asm|.s] [outputfile] [listfile]

Options:

        -?         Show some help
        -l         Create listing
        -L         Create verbose listing (expand REPT, MACRO)
        -d<name>:  Define a symbol and make it equal to 1

        Default output is <sourcefile>.bin
        Default listing is <sourcefile>.lst
" If I have seen further it is by standing on the shoulders of giants" - Issac Newton, in a letter to Robert Hooke.
User avatar
Disch
Posts: 1848
Joined: Wed Nov 10, 2004 6:47 pm

Post by Disch »

A .bin file is all you need. Just slap on a header and the chr and give it an .nes extension. You can do that in a batch file. Put this in a text file and rename it to whatever.bat:

Code: Select all

asm6 yoursourcefile.asm output.bin

copy /B header.bin+output.bin+yourchr.chr  yourrom.nes

pause
(you can remove that pause if you want -- but i usually leave it so I can see any assembler errors).

Of course you'll need to make header.bin and yourchr.chr by hand (chr can be made with a tile editor like YY-CHR or something -- header.bin is just the $10 byte header which you can throw together with a hex editor pretty easily)
User avatar
nineTENdo
Posts: 223
Joined: Sun Mar 19, 2006 12:37 am
Location: San ANto, TX
Contact:

Post by nineTENdo »

do i define the .chr file in the .asm file like in NESASM
ie:

Code: Select all

 .bank 2   		; switch to bank 2
	.org $0000  		; start at $0000
	.incbin "demo.chr" 	; empty background first
or do i just include it? thanks for the fast reply
" If I have seen further it is by standing on the shoulders of giants" - Issac Newton, in a letter to Robert Hooke.
User avatar
Disch
Posts: 1848
Joined: Wed Nov 10, 2004 6:47 pm

Post by Disch »

no

the CHR will be appended to the end of the ROM by the batch file -- it should not run through the assembler.

do not include/incbin the CHR anywhere in your code.
User avatar
loopy
Posts: 403
Joined: Sun Sep 19, 2004 10:52 pm
Location: UT

Post by loopy »

Last edited by loopy on Wed Aug 20, 2008 11:27 am, edited 1 time in total.
User avatar
nineTENdo
Posts: 223
Joined: Sun Mar 19, 2006 12:37 am
Location: San ANto, TX
Contact:

Post by nineTENdo »

its complies with no flaws it just dosent open in FCEUXD. i figure its my header. im putting all 00 in a 16 bit notepad edited in a hex editor. either that or its my .asm file.

Code: Select all


it starts with:
.org $8000
::
::
::
::
ends with:
.pad $FFFA

.dw nmi,reset,reset

.end
" If I have seen further it is by standing on the shoulders of giants" - Issac Newton, in a letter to Robert Hooke.
User avatar
loopy
Posts: 403
Joined: Sun Sep 19, 2004 10:52 pm
Location: UT

Post by loopy »

Last edited by loopy on Wed Aug 20, 2008 11:30 am, edited 1 time in total.
User avatar
nineTENdo
Posts: 223
Joined: Sun Mar 19, 2006 12:37 am
Location: San ANto, TX
Contact:

Post by nineTENdo »

yeah those docs do explain alot.

so if i use:
.db "NES",$1a
.db 2 ;prgsize
.db 1 ;chrsize
.db 0 ;mapper#, etc
.db 0,0,0,0,0,0,0,0,0 ;filler

then i dont have to combine the header with the output.bin? or do i just put this in a seperate file and then combine them.
" If I have seen further it is by standing on the shoulders of giants" - Issac Newton, in a letter to Robert Hooke.
User avatar
loopy
Posts: 403
Joined: Sun Sep 19, 2004 10:52 pm
Location: UT

Post by loopy »

Last edited by loopy on Wed Aug 20, 2008 11:30 am, edited 1 time in total.
User avatar
nineTENdo
Posts: 223
Joined: Sun Mar 19, 2006 12:37 am
Location: San ANto, TX
Contact:

Post by nineTENdo »

thanks again everyone:)
" If I have seen further it is by standing on the shoulders of giants" - Issac Newton, in a letter to Robert Hooke.
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

In ASM6, I start like this:

Code: Select all

	.org $7ff0

	.db "NES", $1a	;ID
	.db $10			;16 PRG-ROM pages
	.db $00			;No CHR-ROM present
	.db $21			;Mapper 2 with vertical mirroring
	.dsb $09, $00	;Clear the rest
Then follow all the ROM banks that get mapped to $8000. Each of them looks like this:

Code: Select all

	.base $8000
	;WHATEVER GOES IN THE BANK
	.org $c000
Then comes the last bank, the one that gets mapped to $c000:

Code: Select all

	.org $c000
	;WHATEVER GOES IN THE BANK
	.org $fffa
	.dw NMI
	.dw Reset
	.dw IRQ
This is a CHR-RAM project, so I do not have any CHR banks, but i'm sure there would be no problems in including the binary data at the end.

I also have all my variables defined before the header, like this:

Code: Select all

	.enum $0000
Character ;Index of the character being used
	.dsb 1
LevelIndex ;Index of the level being played
	.dsb 1
	(...)
	.ende
When you assemble the code, you can even specify the name of the output file, which can have a .nes extension, resulting in a ROM ready to be used in emulators.
User avatar
nineTENdo
Posts: 223
Joined: Sun Mar 19, 2006 12:37 am
Location: San ANto, TX
Contact:

Post by nineTENdo »

i can seem to output my demo normally. at first i couldnt even open it in FCEUXD when i tried to merge a header, output.bin and .chr file. so then i just pasted the header into the .asm file and it all compiled without any errors but i just get a grey screen. if figured it was the .incbin(ed) .pal file. but still nothing i used db statements. i wondering if maybe it has to do with the fact that used this demo on NESASM. what kind of things do i look out for when switching compilers?

heres the code that complied without errors but just show up grey:

Code: Select all

.db "NES",$1a
.db 1   ;prgsize
.db 1  ;chrsize
.db 0  ;mapper#, etc
.db 0,0,0,0,0,0,0,0,0  ;filler 
	
.org $8000  	

vbtrip = $01

SP_yp  = $0300
SP_tn  = $0301
SP_at  = $0302
SP_xp  = $0303

Start:
   	sei
	cld

vb1:	lda $2002
	bne vb1
vb2:	lda $2002
	bne vb2

	lda #$00
	sta $2000
	sta $2001

	jsr ldpal
	jsr ldnmt


	lda #%10000000
	sta $2000
	lda #%00011110
	sta $2001


loop
	jmp loop


ldpal
   	ldx #$00

   	lda #$3F
   	sta $2006
   	lda #$00
   	sta $2006

loadpal:
   	lda tilepal, x
   	sta $2007
   	inx
   	cpx #32
   	bne loadpal
   	rts

ldnmt
      	lda #$20
     	sta $2006
	lda #$20
      	sta $2006
      	ldx #$00


loadNames1:
      	lda ourMap, X
      	sta $2007
      	inx
      	bne loadNames1

loadNames2:
      	lda ourMap+$100, X
      	sta $2007
      	inx
      	bne loadNames2

loadNames3:
      	lda ourMap+$200, X
      	sta $2007
      	inx
      	bne loadNames3

loadNames4:
      	lda ourMap+$300, X
      	sta $2007
      	inx
      	cpx #$80
      	bne loadNames4

	lda #$2c
   	sta $2006
   	lda #$20
   	sta $2006
   	ldx #$00
loadNames5:
   	lda ourMap2, X
   	sta $2007
   	inx
   	bne loadNames5
loadNames6:
   	lda ourMap2+$100, X
   	sta $2007
   	inx
   	bne loadNames6
loadNames7:
   	lda ourMap2+$200, X
   	sta $2007
   	inx
   	bne loadNames7
loadNames8:
   	lda ourMap2+$300, X
   	sta $2007
   	inx
   	cpx #$80
   	bne loadNames8


  	rts

 	lda #$80
	sta vbtrip



nmi
   	pha
   	txa
   	pha
   	tya
   	pha

   	dec vbtrip


	lda #$03
   	sta $0301


	lda #$20
	sta $0300

	LDA $0303
   	ADC #$01
   	sta $0303

	lda #$03
	sta $4014


	lda #$00
   	Sta $2005
   	Sta $2005

	pla
   	tay
   	pla
   	tax
   	pla

        RTI


irq:
	rti

tilepal: 
	.incbin "basictst.nam"


ourMap: 
	.incbin "basictst.nam"

ourMap2: 	
	.incbin "basictst2.nam"

.org $FFFA  		
	.dw nmi			

	.dw Start		
	.dw irq
" If I have seen further it is by standing on the shoulders of giants" - Issac Newton, in a letter to Robert Hooke.
atari2600a
Posts: 324
Joined: Fri Jun 29, 2007 10:25 pm
Location: Earth, Milkyway Galaxy, The Universe, M-Theory
Contact:

Post by atari2600a »

I had the grey screen for a while once...turns out I was just starting at the wrong address, lol! (PRG set to 1 on N-ROM at $7000 by mistake)

Code: Select all

          *=$0000
loop      JMP loop
          .eof
User avatar
loopy
Posts: 403
Joined: Sun Sep 19, 2004 10:52 pm
Location: UT

Post by loopy »

Last edited by loopy on Wed Aug 20, 2008 11:30 am, edited 1 time in total.
Post Reply