editor project: need the opcodes etc for NESASM

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

Post Reply
User avatar
Laserbeak43
Posts: 188
Joined: Fri Sep 21, 2007 4:31 pm
Contact:

editor project: need the opcodes etc for NESASM

Post by Laserbeak43 »

hi there,
i have an editor project i think the noobs will apreciate but i'll need some community help.
i'll need:
1.the Opcodes- i think i have all of them here - please correct me if i'm wrong.

2.i'll need the NES asm keywords, functions etc. does anyone know of an online list of these?

3. and the assembler execution flags. again, does anyone know of an online list of these?

any help would be greatly appreciated.
Noob sticky!!
Please document this part of the NESdevWiki!! XD
YOU NEED A RETROMACHINESHOP!!
atari2600a
Posts: 324
Joined: Fri Jun 29, 2007 10:25 pm
Location: Earth, Milkyway Galaxy, The Universe, M-Theory
Contact:

Post by atari2600a »

I'm curious whether illegal opcodes are the same on the 2A03 as they are on the 6502...If they are you can have them turn a blood red color I guess...

Code: Select all

          *=$0000
loop      JMP loop
          .eof
User avatar
Laserbeak43
Posts: 188
Joined: Fri Sep 21, 2007 4:31 pm
Contact:

Post by Laserbeak43 »

atari2600a wrote:I'm curious whether illegal opcodes are the same on the 2A03 as they are on the 6502...If they are you can have them turn a blood red color I guess...
:lol: what do you mean by illegal opcodes?
Noob sticky!!
Please document this part of the NESdevWiki!! XD
YOU NEED A RETROMACHINESHOP!!
atari2600a
Posts: 324
Joined: Fri Jun 29, 2007 10:25 pm
Location: Earth, Milkyway Galaxy, The Universe, M-Theory
Contact:

Post by atari2600a »

Um...opcodes that are illegal?

http://en.wikipedia.org/wiki/Illegal_opcode

Code: Select all

          *=$0000
loop      JMP loop
          .eof
User avatar
Laserbeak43
Posts: 188
Joined: Fri Sep 21, 2007 4:31 pm
Contact:

Post by Laserbeak43 »

atari2600a wrote:Um...opcodes that are illegal?

http://en.wikipedia.org/wiki/Illegal_opcode
wow, i couldn't have guessed that, but thanks for the link :)

hmm very interesting article :)
Noob sticky!!
Please document this part of the NESdevWiki!! XD
YOU NEED A RETROMACHINESHOP!!
atari2600a
Posts: 324
Joined: Fri Jun 29, 2007 10:25 pm
Location: Earth, Milkyway Galaxy, The Universe, M-Theory
Contact:

Post by atari2600a »

Wait crap I just remembered something! This is limited to NESasm, & I doubt NESasm would support illegal opcodes of any kind. (I never looked into NESasm at all)

This would render the whole idea useless...UNLESS you added a little more dynamic-y-ism to the program by adding support for pseudo opcodes from multiple assemblers...

Code: Select all

          *=$0000
loop      JMP loop
          .eof
User avatar
Laserbeak43
Posts: 188
Joined: Fri Sep 21, 2007 4:31 pm
Contact:

Post by Laserbeak43 »

atari2600a wrote:Wait crap I just remembered something! This is limited to NESasm, & I doubt NESasm would support illegal opcodes of any kind. (I never looked into NESasm at all)

This would render the whole idea useless...UNLESS you added a little more dynamic-y-ism to the program by adding support for pseudo opcodes from multiple assemblers...
well i was thinking, after i do NESASM i'd start with a WLADX version. but there are so many ways to use WLA-DX, so i'm not really concentrating on that yet.
Noob sticky!!
Please document this part of the NESdevWiki!! XD
YOU NEED A RETROMACHINESHOP!!
User avatar
Laserbeak43
Posts: 188
Joined: Fri Sep 21, 2007 4:31 pm
Contact:

6502 opcodes, ASM syntax and NESASM syntax questions

Post by Laserbeak43 »

is there some kind of list of NESASM and 6502 commands and syntax? as far as labels and all that other stuff that i don't know about? :D

just got this from here: http://e-tradition.net/bytes/6502/assembler.html
and wanted to know if this is true for nesasm?

Code: Select all

Syntax
The assembler supports the following syntax:

Opcodes and Addressing 
   Instructions are always 3 letter mnemonics followed by an (optional) operand/address: 
   OPC .... implied 
  OPC A .... Accumulator 
  OPC #BB .... immediate 
  OPC HHLL .... absolute 
  OPC HHLL,X .... absolute, X-indexed 
  OPC HHLL,Y .... absolute, Y-indexed 
  OPC *LL .... zeropage 
  OPC *LL,X .... zeropage, X-indexed 
  OPC *LL,Y .... zeropage, Y-indexed 
  OPC (BB,X) .... X-indexed, indirect 
  OPC (LL),Y .... indirect, Y-indexed 
  OPC (HHLL) .... indirect 
  OPC BB .... relative 
   
Where HHLL is a 16 bit word and LL or BB a 8 bit byte, and A is literal "A".
There must not be any white space in any part of an instruction's address.
  
Number Formats
  
   $[0-9A-Zaz] .... hex 
  %[01] .... binary 
  0[0-7] .... octal 
  [0-9] .... decimal 
  < .... LO-byte portion 
  > .... HI-byte portion 
 
Labels and Identifiers 
   Identifiers must begin with a letter [A-Z] and contain letters, digits, and the underscore [A-Z0-9_]. Only the first 6 characters are significant.
All identifiers, numbers, opcodes, and pragmas are case insensitive and translated to upper case. Identifiers must not be the same as valid opcodes.
The special identifier "*" refers to the program counter (PC).  
   Exampels:  
  * = $C000 .... Set start address (PC) to C000. 
  LABEL1 LDA #4 .... Define LABEL1 with the address of instruction LDA. 
         BNE LABEL2 .... Jump to address of label LABEL2. 
  STORE = $0800 .... Define STORE with value 0800. 
  HERE = * .... Define HERE with current address (PC). 
  HERE2 .... Define HERE2 with current address (PC). 
         LDA #<VAL1 .... Load LO-byte of VAL1. 
 
Pragmas 
   Pragmas start with a dot (.) and must be the only expression in a line: 
   .BYTE BB .... Insert 8 bit byte at current address into code. 
   .WORD HHLL .... Insert 16 bit word at current address into code. 
   .END .... End of source, stop assembly. (optional) 
 
Comments 
   ; comment .... Any sequence of characters starting with a semicolon till the end of the line are ignored. 
 
White Space 
   The assembler does not rely on any special formatting with the following exclusion:
There must be white space between a label and a opcode and the opcode and any operands. Only one instruction per line is permitted. 
 
Code Example
  
   Src:      Listing: 
   *=$c000
       LDX #0
Label1 TXA
       STA $0400,X
       LDA #1
       STA $D800,X
       INX
       BNE Label1
       RTS
.END
    * = $C000
C000        LDX #$00        A2 00
C002 LABEL1 TXA             8A
C003        STA $0400,X     9D 00 04
C006        LDA #$01        A9 01
C008        STA $D800,X     9D 00 D8
C00B        INX             E8
C00C        BNE LABEL1      D0 F4
C00E        RTS             60
C00F .END
 
    
Object Code: 
   A2 00 8A 9D 00 04 A9 01
9D 00 D8 E8 D0 F4 60
 
Noob sticky!!
Please document this part of the NESdevWiki!! XD
YOU NEED A RETROMACHINESHOP!!
Post Reply