Equivalents to 6502 instructions
From GbdevWiki
					
										
					
					Many new Game Boy programmers have experience on a platform with a 6502 family (6502, 6507, 6510, 65C02, 65816, or HuC6280) processor. These include Apple II, Atari 8-bit (2600 VCS, 800, 5200, 7800 ProSystem, Lynx), Nintendo (NES/Famicom, Super NES/Super Famicom), and TurboGrafx-16/PC Engine. To help these programmers adapt, this table lists the closest opcode in the Game Boy CPU to each instruction in a WDC/Rockwell 65C02 CPU.
| 65C02 instruction | SM83 instruction | Notes | 
|---|---|---|
| adc | adc | See also add | 
| and | and | Clears carry | 
| asl | sla,add a | It always stood for Add to SeLf | 
| bbr | bitthenjr z | |
| bbs | bitthenjr nz | |
| bcc | jr nc | |
| bcs | jr c | |
| beq | jr z | |
| bit | bit | Tests the argument against a given bit, not the bits set in A | 
| bmi | bit 7thenjr nz | |
| bne | jr nz | |
| bpl | bit 7thenjr z | If using to test a counter for wrapping from $00 to $FF, dec bthenjr nzis more commonly used. | 
| bra | jr | |
| brk | rst | |
| bvc | No direct equivalent | Replacement uses xorandbit 7 | 
| bvs | No direct equivalent | |
| clc | scfthenccf | or aalso clears Z. Less needed in general becauseaddexists. | 
| cld | No direct equivalent | Skip daaafteraddorsub | 
| cli | ei | Also enables vblank if set in LCDC, as Game Boy does not use NMI | 
| clv | No direct equivalent | No SO pin. If using with bvcto simulatebra, usejrwithout a condition. | 
| cmp | cp | Carry sense is inverted | 
| cpx | No direct equivalent | Load a value into A and compare it to B, C, etc. | 
| cpy | No direct equivalent | |
| dec | dec | |
| dex | dec b | |
| dey | dec c | |
| eor | xor | Clears carry | 
| inc | inc | |
| inx | inc b | |
| iny | inc c | |
| jmp | jp | Can be made conditional | 
| jsr | call | |
| lda | ld a | Does not change Z | 
| ldx | ld b | Does not change Z; accessing arrays is very different | 
| ldy | ld c | |
| lsr | srl | See also srawhich copies bit 7 to carry first | 
| nop | nop | |
| ora | or | Clears carry | 
| pha | push af | Only pairs of registers can be pushed or popped. BC, DE, and HL are more commonly pushed or popped. | 
| php | push af | |
| phx | push bc | |
| phy | push bc | |
| pla | pop af | |
| plp | pop af | |
| plx | pop bc | |
| ply | pop bc | |
| rol | rla,rl,adc a | See also rlcwhich copies bit 7 to carry first | 
| rmb | res | |
| ror | rra,rr | See also rrcwhich copies bit 0 to carry first | 
| rti | pop afthenreti | Interrupt handlers do not automatically push flags. | 
| rts | ret | Can be made conditional. See also jp hl | 
| sbc | sbc | Carry sense is inverted; see also sub | 
| sec | scf | |
| sed | No direct equivalent | Use daaafteraddorsub | 
| sei | di | Disables vblank, as Game Boy does not use NMI | 
| smb | set | |
| sta | ld [destination],a | |
| stx | ld [hl], b | There are two main ways for data to get in and out of registers: through A or through [HL]. | 
| sty | ld [hl], c | |
| stz | xor athenld [destination],a | Sets Z, clears carry and A | 
| tax | ld b, a | Does not change Z | 
| tay | ld c, a | Does not change Z | 
| trb | res place, [hl] | |
| tsb | set place, [hl] | |
| tsx | ld hl, sp+0 | Does not change Z | 
| txa | ld a, b | Does not change Z | 
| txs | ld sp, hl | |
| tya | ld a, c | Does not change Z | 
| wai | halt | 
