11 March 2016 - Forum Rules
Started by DelilahTw, March 30, 2021, 02:02:53 AM
Quote from: DelilahTw on March 30, 2021, 02:02:53 AMThe main problem that i have when it comes to code for the snes is to find a proper documentation with examples and all the available instructions when it comes to code.
Quote from: Raeven0 on March 30, 2021, 11:34:38 PMIndeed. You'd think after 30 years we'd have a solid base of lucid pedagogical material for SNES development, but, alas, no.You might get value out of Ersanio's ASM Tutorial. It only has a couple of mistakes.PinoBatch's LoROM "minimal working program" is all right. It uses the ca65 assembler and some Python scripts, and is nicely documented. The most interesting file is probably src/init.s, wherein a lot of thought goes into initializing the SNES hardware registers to a sane state.The SNES development wiki is a treasure trove of technical detail, but also quite difficult to follow at times, on account of broken links and references to other material that no longer exists.The 65C816 opcodes page is essentially a mandatory reference work, and good general reading too.I'm aware of at least one complete disassembly of Super Mario World, which can provide some insight as to how code is written in practice.
Quote from: Raeven0 on April 02, 2021, 07:14:13 PMAlso possibly useful: the SNESdev forum, some 15 years and counting of discussion about development of original games and such for the SNES. romhacking.net is more about hacking existing games.
Quote from: Lusofonia on April 02, 2021, 08:33:04 PMAnother thing: how does the assembler "write" the opcodes to the ROM? Can't you simply open the ROM and edit the opcodes from there? As far as I know you can only view/edit opcodes in a debugger from the memory, but I could be wrong because I'm just a beginner.
org $80FD00tyxlda [$0a] : sta $1000inc $0a : inc $0alda [$0a] : sta $1002inc $0astz $1008lda $0a : sta $02,srti
Quote from: Lusofonia on April 03, 2021, 09:15:19 AMAlso, why so many assemblers? xkas, asar... Can't there be simply one and only assembler?
Quote from: Raeven0 on April 03, 2021, 01:52:52 PMAsar itself is a derivative of xkas and a product of the SMW community. It fixes bugs and adds syntax features to make programming faster and easier. A couple of interesting notes:direct,y is not a valid 65816 addressing mode, so what should happen if the programmer writes say lda $14,y? xkas throws an error, but Asar parses this as lda $0014,y -- consistent with what a SMW hacker would expect, since in SMW the direct page is at $0000.For MVN (and MVP), the CPU developer prescribed the assembler syntax MVN src,dest but the machine code order $54 dest src. The xkas developer (incorrectly) interpreted dest src as a 2-byte (little-endian) word, so programmed xkas with the syntax MVN SrcDest (no comma). Later developers, thinking this looked strange, allowed the word to be written as two bytes instead, giving the syntax MVN dest,src -- precisely the opposite of what the CPU developer intended. This will never be fixed in Asar, because doing so would break all SMW patches that use MVN/MVP.
Page created in 0.089 seconds with 19 queries.