# HELLO WORLD - Mega Drive/Genesis homebrew example

Minimal Mega Drive/Genesis cartridge built with the WLA DX toolchain. The 68000 program clears VRAM, loads a tiny embedded tile font, prints `HELLO WORLD` centered on plane A in white on a black background, then uploads a Z80 sound driver that plays two beeps with the PSG.

## Sources

| File | What it contains |
| --- | --- |
| [main68k.s](main68k.s) | 68000 program, Mega Drive vectors/header, VDP setup, text tiles, and Z80 driver upload. |
| [soundz80.s](soundz80.s) | Z80 sound driver. It drives the PSG for two short beeps, silences the PSG, and idles. |
| [linkfile.68k](linkfile.68k) | WLA DX linker object list. |
| [linkfile.z80](linkfile.z80) | WLA DX linker object list for the Z80 sound driver. |
| [makefile](makefile) | Builds `hello-z80.bin`, embeds it into `hello.bin`, checks output sizes, and provides `make run` for MAME. |

The example uses [../../../memorymaps/md68k.i](../../../memorymaps/md68k.i) and the shared [../../../include/megadrive](../../../include/megadrive) support files.

## Build

From this directory:

```sh
make
```

The build produces:

* `hello.bin` - 128 KiB raw Mega Drive ROM image.
* `hello-z80.bin` - 8 KiB Z80 sound driver copied into Z80 RAM by the 68000 program.
* `hello.sym` - symbol file from WLALINK.
* `hello-z80.sym` - Z80 symbol file from WLALINK.

## Running in MAME

```sh
make run
```

The `run` target launches MAME's Genesis/Mega Drive driver with the freshly linked ROM:

```sh
mame genesis -cart hello.bin -window
```

On this workspace's Cygwin/Windows setup, the makefile also tries to auto-detect `C:/Users/ville/Downloads/Mame/mame.exe` and converts the ROM path with `cygpath` before launching a Windows MAME binary.

For a short noninteractive smoke run:

```sh
make run MAME_FLAGS="-seconds_to_run 3 -nothrottle"
```

## Expected Behavior

MAME should show a black screen with white `HELLO WORLD` centered on the screen, followed by two short beeps generated by the Z80 sound driver. The ROM then idles forever.