Jump to content
NHL'94 Forums

RESOURCE: SNES assembly code tutorial


smozoma

Recommended Posts

Pretty impressive tutorial from a Super Mario World editing forum:

http://www.smwcentral.net/?p=thread&id=16714

Here is the table of contents:

-------------------------

1. BASIC WORKSHOP

1.1 - HEX AND BINARY

1.2 - A X Y REGISTERS

1.3 - LDA, STA, RTS, INC, DEC, INX, INY, STZ, ADC, SBC.

1.4 - DIRECT PAGE, TCD, TDC, XBA.

1.5 - BANKS

1.6 - EMULATION MODE, PROCESSOR FLAGS, REP, SEP, CLC, SEC, CLV, SED, SEI, CLI, CLD, CONDITIONAL OPERATIONS.

1.7 - JUMPS.

1.8 - INDEXING

1.9 - STACK, STACK POINTER, TSC, TCS, TXS, TSX.

1.10 - TRANSFERRING

--------------------------

2. SEMI-ADVANCED WORKSHOP

2.1 - VECTORS, H/V-BLANKING, INTERRUPTS

2.2 - BITWISE OPERATIONS

2.3 - VARIOUS PPU REGS

2.4 - DMA AND HDMA

2.5 - BLOCK MOVES -> MVN, MVP

2.6 - MORE ADDRESSING MODES

2.7 - USELESS OPCODES

--------------------------

I found it when I was trying to figure out the difference between DMA mode 0 and mode 1.

mode 0 is 4 layers + 4 colours per palette

mode 1 is 3 layers + 16 colours per palette.

mode 1 would be used when loading a player portrait, since they're 16 colours.

i suspect mode 0 is used to show team banners (upper half of banner = 4 colours, lower half = 4, text = 4..), but that's a guess. EDIT: reading the document made me realize that banner idea is wrong.. the mode 0 stuff i was seeing was actually changing palettes..

Edited by smozoma
Link to comment
Share on other sites

Apparently Anomie's documents are good:

http://www.romhacking.net/?category=&P...itle=&desc=

Register Map:

http://www.romhacking.net/docs/%5B196%5Dregs.txt (Anomie's)

http://fh.digitalmenagerie.org/coding/Snesmap.txt (someone else's)

Found this stuff when looking for info about register 4202:

4202  wb++++ WRMPYA - Multiplicand A
4203  wb++++ WRMPYB - Multiplicand B
	mmmmmmmm

	Write $4202, then $4203. 8 "machine cycles" (probably 48 master cycles)
	after $4203 is set, the product may be read from $4216/7. $4202 will
	not be altered by this process, thus a new value may be written to
	$4203 to perform another multiplication without resetting $4202.

	The multiplication is unsigned.

That bit about cycles is important: after setting 4202 and 4203 (to say 2 and 3), you need to wait a while (run some other instructions) before the result is ready. Once the result is ready, you can actually set a new value into 4202 (say 10), then immediately pull the old result from 4216 (2x3=6) before it changes to the new result a few cycles later (10x33=30).

Edited by smozoma
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Who's Online   0 Members, 0 Anonymous, 110 Guests (See full list)

    • There are no registered users currently online
×
×
  • Create New...