Sega MegaDrive
Contents
SEGA MegaDrive / Genesis
The SEGA MegaDrive / Genesis is a 16-bit videogame console released by SEGA in 1989.
It features: - 320x240 resolution (PAL) - 4x 16 color palettes - Tile based display chip with 2 scrolling tilemaps - 64 Sprites (up to 4x4tiles in size each) - 64K of dedicated Video Memory (VRAM) - YM2612 Sound Chip
Setting up
- Assembler: VASM
- Emulator(s): BlastEm ( https://www.retrodev.com/blastem/ )
- Tool(s): MDTools ( https://github.com/sikthehedgehog/mdtools )
- Hardware: Sega MegaDrive / Genesis console with a way to access ROM files.
The real hardware and BlastEm emulator don't require exact ROM headers, but you might want to distribute an emulator friendly version of your production as well for broader emulator compatibility.
CPU Vector table
This must be the very first thing in the ROM, since the CPU reads it from 0x0000 on bootup. The Vector table is a table of addresses that the CPU needs to know about - things like stack address, "main()" function address, vertical/horizontal interrupt addresses, etc. For any interrupts we don't want to handle, we specify INT_Null (an interrupt at the bottom of the file that doesn't do anything).
dc.l 0x00FFE000 ; Initial stack pointer value
dc.l CPU_EntryPoint ; Start of program
dc.l CPU_Exception ; Bus error
dc.l CPU_Exception ; Address error
dc.l CPU_Exception ; Illegal instruction
dc.l CPU_Exception ; Division by zero
dc.l CPU_Exception ; CHK CPU_Exception
dc.l CPU_Exception ; TRAPV CPU_Exception
dc.l CPU_Exception ; Privilege violation
dc.l INT_Null ; TRACE exception
dc.l INT_Null ; Line-A emulator
dc.l INT_Null ; Line-F emulator
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Spurious exception
dc.l INT_Null ; IRQ level 1
dc.l INT_Null ; IRQ level 2
dc.l INT_Null ; IRQ level 3
dc.l INT_HInterrupt ; IRQ level 4 (horizontal retrace interrupt)
dc.l INT_Null ; IRQ level 5
dc.l INT_VInterrupt ; IRQ level 6 (vertical retrace interrupt)
dc.l INT_Null ; IRQ level 7
dc.l INT_Null ; TRAP #00 exception
dc.l INT_Null ; TRAP #01 exception
dc.l INT_Null ; TRAP #02 exception
dc.l INT_Null ; TRAP #03 exception
dc.l INT_Null ; TRAP #04 exception
dc.l INT_Null ; TRAP #05 exception
dc.l INT_Null ; TRAP #06 exception
dc.l INT_Null ; TRAP #07 exception
dc.l INT_Null ; TRAP #08 exception
dc.l INT_Null ; TRAP #09 exception
dc.l INT_Null ; TRAP #10 exception
dc.l INT_Null ; TRAP #11 exception
dc.l INT_Null ; TRAP #12 exception
dc.l INT_Null ; TRAP #13 exception
dc.l INT_Null ; TRAP #14 exception
dc.l INT_Null ; TRAP #15 exception
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)
dc.l INT_Null ; Unused (reserved)This vector table is then followed by the ROM header at 0x100
ROM Header
The ROM Header is a structure located at 0x100 that specifies some metadata about the ROM, like its name, author, version number, release date, region, and any special peripherals used.
Note that the Mega Drive console itself doesn't read any of this, it's more a convenience for the programmer, but most emulators will read the title and region. Further header information at: https://plutiedev.com/rom-header
Memory map
Video display
To be added.
VDP
To be added.
to be addedFor more information, check out https://plutiedev.com/vdp-setup
Sprites
To be added
; to be addedSound
To be added.
; to be added