Understanding OAM1 and OAM2
Moderator: Moderators
Forum rules
- For making cartridges of your Super NES games, see Reproduction.
- jeffythedragonslayer
- Posts: 344
- Joined: Thu Dec 09, 2021 12:29 pm
Understanding OAM1 and OAM2
I am trying to figure out what exactly OAM1 and OAM2 are.
Mesen-S, in the Tile Viewer, has buttons called OAM1 and OAM2. bsnes-plus, also in the Tile Viewer, has labels called OAM1 and OAM2 - they appear next to text boxes which contain hex addresses and also next to goto buttons.
Looking at this documentation,
https://www.mesen.ca/snes/docs/debuggin ... ile-viewer
they are preset buttons, but the explanation on what they do is a bit sparse. When I try pressing these buttons with the Final Fantasy Mystic Quest title screen loaded, pressing OAM1 seems to give focus to the first tile in the row which contains the first tile used by a sprite, specifically the jewels, which are 32x32 pixels. It is probably supposed to give focus to the first tile used by a sprite.
Pressing OAM2 gives focus to the row above the letters "F I N A L T S Y" (which is a letter de-duplication of "FINAL FANTASY"). These are 16x16 pixels.
Is my understanding correct, that the "1" and "2" in OAM1 and OAM2 are referring to the little and big sprites? (Controlled by the size select bits in the OAM high table?)
Mesen-S, in the Tile Viewer, has buttons called OAM1 and OAM2. bsnes-plus, also in the Tile Viewer, has labels called OAM1 and OAM2 - they appear next to text boxes which contain hex addresses and also next to goto buttons.
Looking at this documentation,
https://www.mesen.ca/snes/docs/debuggin ... ile-viewer
they are preset buttons, but the explanation on what they do is a bit sparse. When I try pressing these buttons with the Final Fantasy Mystic Quest title screen loaded, pressing OAM1 seems to give focus to the first tile in the row which contains the first tile used by a sprite, specifically the jewels, which are 32x32 pixels. It is probably supposed to give focus to the first tile used by a sprite.
Pressing OAM2 gives focus to the row above the letters "F I N A L T S Y" (which is a letter de-duplication of "FINAL FANTASY"). These are 16x16 pixels.
Is my understanding correct, that the "1" and "2" in OAM1 and OAM2 are referring to the little and big sprites? (Controlled by the size select bits in the OAM high table?)
Last edited by jeffythedragonslayer on Sun Jul 03, 2022 6:31 pm, edited 1 time in total.
- rainwarrior
- Posts: 8735
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: Understanding OAM1 and OAM2
No, OAM1 and OAM2 are the two tile pages selected via OBJSEL. (The "name base" page, and the "name select" page that is offset from the base.)
Similarly 1, 2, 3, 4 above them correspond to the tile address via BG12/34NBA, or just address 0 for a mode 7 layer.
The also seem to automatically jump to an appropriate palette line, since layer/obj determines which of those can be used too.
Similarly 1, 2, 3, 4 above them correspond to the tile address via BG12/34NBA, or just address 0 for a mode 7 layer.
The also seem to automatically jump to an appropriate palette line, since layer/obj determines which of those can be used too.
- jeffythedragonslayer
- Posts: 344
- Joined: Thu Dec 09, 2021 12:29 pm
Re: Understanding OAM1 and OAM2
Ah, so the WOBJSEL register has a totally different function than OBSEL/OBJSEL despite the similar names. The "W" stands for window, not "wide" as in std::wstring. That's where I wound up in fullsnes when trying to figure out if OBJSEL has something to do with this! I'd argue that those window registers should really be called W12SET, W34SET, and WOBJSET. There'd be less potential for confusion because the only other similarly named register with "SET" in the name is SETINI, whose description on the wiki ironically has "Select" in the name though I think the name comes from ScrEen INterlacIng.
ditto for M7SEL -> M7SET.
ditto for M7SEL -> M7SET.
-
- Posts: 611
- Joined: Mon Jan 23, 2006 7:47 am
- Location: Germany
- Contact:
Re: Understanding OAM1 and OAM2
You don't have to use these names, you can just create your own or use the register values.
My current setup:
Super Famicom ("2/1/3" SNS-CPU-GPM-02) → SCART → OSSC → StarTech USB3HDCAP → AmaRecTV 3.10
Super Famicom ("2/1/3" SNS-CPU-GPM-02) → SCART → OSSC → StarTech USB3HDCAP → AmaRecTV 3.10
- jeffythedragonslayer
- Posts: 344
- Joined: Thu Dec 09, 2021 12:29 pm
Re: Understanding OAM1 and OAM2
Sure, I'm thinking of putting together a list of long versions of those register names sometime.
Re: Understanding OAM1 and OAM2
Set and select are pretty much synonymous in this case. I think most abbreviations like these are too confusing to just try to figure out on my own and I always need to have a reference on hand. You eventually learn most of them by heart just by working with them though.
- jeffythedragonslayer
- Posts: 344
- Joined: Thu Dec 09, 2021 12:29 pm
Re: Understanding OAM1 and OAM2
I started the long register name .include file here: https://github.com/jeffythedragonslayer ... nes_regs.s
-
- Posts: 611
- Joined: Mon Jan 23, 2006 7:47 am
- Location: Germany
- Contact:
Re: Understanding OAM1 and OAM2
You can use shorter names by using the Shift key
Code: Select all
; ----------------------------------------------
; SNES PPU Control
; PPU Picture Processing Unit (write-only ports)
; ----------------------------------------------
DisplayCtrl1 = $2100 ; INIDISP
DisplayCtrl2 = $2133 ; SETINI
MainscreenLayers = $212C ; TM
SubscreenLayers = $212D ; TS
; -------------------
; SNES PPU BG Control
; -------------------
BG_ModeAndTileSize = $2105 ; BGMODE
Mosaic_SizeAndEnable = $2106 ; MOSAIC
BG1_TilemapBaseAndSize = $2107 ; BG1SC
BG2_TilemapBaseAndSize = $2108 ; BG2SC
BG3_TilemapBaseAndSize = $2109 ; BG3SC
BG4_TilemapBaseAndSize = $210A ; BG3SC
BG12_TileBase = $210B ; BG12NBA
BG34_TileBase = $210C ; BG34NBA
BG1_PosX = $210D ; BG1HOFS
BG1_PosY = $210E ; BG1VOFS
BG2_PosX = $210F ; BG2HOFS
BG2_PosY = $2110 ; BG2VOFS
BG3_PosX = $2111 ; BG3HOFS
BG3_PosY = $2112 ; BG3VOFS
BG4_PosX = $2113 ; BG4HOFS
BG4_PosY = $2114 ; BG4VOFS
; -------------------------
; SNES PPU Rotation/Scaling
; -------------------------
Mode7_Settings = $211A ; M7SEL
Mode7_A = $211B ; M7A
Mode7_B = $211C ; M7B
Mode7_C = $211D ; M7C
Mode7_D = $211E ; M7D
Mode7_CenterX = $211F ; M7X
Mode7_CenterY = $2120 ; M7Y
; -----------------------
; SNES PPU Sprites (OBJs)
; -----------------------
Sprites_SizeAndBases = $2101 ; OBSEL / OBJSEL
; ---------------
; SNES PPU Window
; ---------------
WndMask_BG12 = $2123 ; W12SEL
WndMask_BG34 = $2124 ; W12SEL
WndMask_ColorMathAndSprites = $2125 ; WOBJSEL
Wnd1_Left = $2126 ; WH0
Wnd1_Right = $2127 ; WH1
Wnd2_Left = $2128 ; WH2
Wnd2_Right = $2129 ; WH3
WndLogic_BG = $212A ; WBGLOG
WndLogic_ColorMathAndSprites = $212B ; WOBJLOG
Mainscreen_WndOnLayers = $212E ; TMW
Subscreen_WndOnLayers = $212F ; TSW
; -------------------
; SNES PPU Color-Math
; -------------------
ColorMath_Ctrl1 = $2130 ; CGWSEL
ColorMath_Ctrl2 = $2132 ; CGADSUB
ColorMath_ColorConstant = $2132 ; COLDATA
; ---------------------------------------------
; PPU Picture Processing Unit (read-only ports)
; ---------------------------------------------
PPU1_MultiplyProduct_Low = $2134 ; MPYL
PPU1_MultiplyProduct_Middle = $2135 ; MPYM
PPU1_MultiplyProduct_High = $2136 ; MPYH
; --------------------------
; SNES PPU Timers and Status
; --------------------------
PPU1_Latch_HVCounter = $2137 ; SLHV
PPU1_OAM_Read = $2138 ; RDOAM
PPU1_VRAM_Read_Low = $2139 ; RDVRAML
PPU1_VRAM_Read_High = $213A ; RDVRAMH
PPU2_CGRAM_Read = $213B ; RDCGRAM
PPU2_Latch_X = $213C ; OPHCT
PPU2_Latch_Y = $213D ; OPVCT
PPU1_StatusAndVersion = $213E ; STAT77
PPU2_StatusAndVersion = $213F ; STAT78
; -------------------
; SNES PPU Interrupts
; -------------------
InterruptEnableAndControllerRequest = $4200 ; NMITIMEN
HCount_TimerSetting_Low = $4207 ; HTIMEL
HCount_TimerSetting_High = $4208 ; HTIMEH
VCount_TimerSetting_Low = $4209 ; VTIMEL
VCount_TimerSetting_High = $420A ; VTIMEH
VBLANK_NMI_Flag = $4210 ; RDNMI
HVTimer_IRQ_Flag = $4211 ; TIMEUP
HVBlankAndControllerBusyFlag = $4212 ; HVBJOY
; etc.
My current setup:
Super Famicom ("2/1/3" SNS-CPU-GPM-02) → SCART → OSSC → StarTech USB3HDCAP → AmaRecTV 3.10
Super Famicom ("2/1/3" SNS-CPU-GPM-02) → SCART → OSSC → StarTech USB3HDCAP → AmaRecTV 3.10
- jeffythedragonslayer
- Posts: 344
- Joined: Thu Dec 09, 2021 12:29 pm
Re: Understanding OAM1 and OAM2
Sure. But I generally find snake case easier to read than camel case.