This page is a mirror of Tepples' nesdev forum mirror (URL TBD).

# X816 Question...

I'm trying to do some NES development on an old machine running DOS 6.22 (for fun...I have newer computers running Windows and Linux, but I want to try to see if I could do this on an old computer), and I've chosen X816 as my assembler. I'm having trouble assembling .NES files from some sample code I have, and can't seem to find any decent documentation on using X816 for NES development...I run it and get a .BIN, and I have no clue what I'm supposed to do from there. Can anybody shed some light on what I'm supposed to do?
You're probably not going to get anywhere decent because x816 has no NES header support (meaning the 16 byte header you have to prepend yourself using something like copy /b header.bin+yourrom.bin result.nes).

I would suggest not bothering with DOS at all and get yourself asm6 and use that. There is absolutely no legitimacy in limiting yourself like that. If you want example code for that (for a mapper 1 game with a single 32KByte PRG section and a single 8KByte CHR page (you'll need to make your own CHR data)):

Code:
;
; =====================
.db "NES", $1a ; Offset 0 = ID string + 0x1a .db 2 ; Offset 4 = 16KB PRG bank count .db 1 ; Offset 5 = 8KB CHR bank count .db 1 ; Offset 6 = Mapper # .db$00         ; Offset 7 = Mapper # (extended)
.fillvalue 00 ; XXX - use fillvalue to work around an asm6 v1.05 bug .align 16 ; Pad remaining header with zeros ; RESET point ; ===================== .fillvalueff      ; XXX - use fillvalue to work around an asm6 v1.05 bug
.org $8000 reset: sei ldx #$ff
txs
lda #$00 ; ; MAIN code ; =========== - jmp - ; ; NMI vector ; =========== nmi: rti ; IRQ vector ; ============ irq: rti ; NMI/RESET/IRQ Vectors ; ======================= .fillvalue$ff      ; XXX - use fillvalue to work around an asm6 v1.05 bug
.org $fffa .dw nmi ; NMI vector .dw reset ; RESET vector .dw irq ; IRQ vector Assembling is easy: \path\to\asm6.exe -l myprog.asm followed by copy /b myprog.bin+myprog.chr myprog.nes. Despite this warning if you still want to use x816, you can create a 16-byte NES header yourself (call it header.bin) based on the above header data, then use some code like this for x816: Code: .opt off .dasm off .detect off .index 8 .mem 8 .hirom off .base$008000
.org $008000 .par {} ; RESET point ; ===================== reset: sei ldx #$ff
txs
lda #$00 ; ; MAIN code ; =========== - jmp - ; ; NMI vector ; =========== nmi: rti ; IRQ vector ; ============ irq: rti ; NMI/RESET/IRQ Vectors ; ======================= .org$00fffa
.dw nmi         ; NMI vector
.dw reset      ; RESET vector
.dw irq         ; IRQ vector

Assembling is easy: \path\to\x816.exe -l myprog.asm followed by copy /b header.bin+myprog.bin+myprog.chr myprog.nes.

You will also need to be absolutely 100% sure to write pure 6502 instructions -- this will be entirely your responsibility. The assembler has no way to limit its instruction set to 6502 only, so instructions like INC or INC A will assemble into their 65c02/65816 opcodes without any errors and you'll be wondering why your code just locks up or behaves oddly (6502 does not offer that opcode; you have to use CLC ADC #1). So again: please stick to a real 6502 assembler and stop with this limit-myself-to-DOS nonsense. :-)

Sorry for the screwed up formatting; the board software appears to make a beautiful mess of tabs vs. spaces.
I guess you talked some sense into me since it sounds like more trouble than it's worth...I'll save that computer for DOS 13h programming...I already have ASM6 and everything else I need on this (my main) computer, anyway.

 Nevermind...I'm working through the Nerdy Nights tutorial and going through and converting the code to work with ASM6, and now I understand exactly why I had problems with displaying graphics.