Dunk Shot — MSX2 patch

HAL Laboratory's basketball flickers because every player is four sprites and the MSX1 draws four per line. An MSX2 draws eight: this 164-byte patch takes the game to SCREEN 4 and turns the sharing off, and on an MSX1 it still plays as the original.

HAL Laboratory - (c) 1986 HAL Laboratory - A 292-byte IPS patch, unofficial - MSX2 (and MSX1 as it was) - Original a1891e03...

Tested in openMSX, not yet on real hardware. The screenshots are of the patched ROM running in openMSX (an MSX1 and a Philips NMS 8250), and the numbers come from a probe that counts, frame by frame, the sprites the VDP does not draw. No ROM is distributed: only the IPS. It comes from the commented disassembly, where every address can be looked up.

The patch in numbers

66.7sprites not drawn per frame, original on MSX1
1.7sprites not drawn per frame, patched on MSX2
166 → 22in the worst frame
164bytes changed in 24 stretches
292bytes of IPS
0patterns moved

What it does, and what had to be known

The game manages the flicker

Every frame 0x5E1B sorts the seven groups by depth, 0x5C0B builds their attributes in that order, 0x5BAB copies them reversed as well and the interrupt (0x5B77) shows one table or the other: one frame the near players are in front, the next the far ones. On an MSX2 the patch always leaves the sorted one: the nearest in front, and no change from frame to frame.

In mode 2, colours first and attributes at +0x200

Register 5 points at a 1 KB block: the sprite colour table, 16 bytes per sprite, takes the first half, and the attributes sit 0x200 further on. Put them the other way round and the screen has not a single sprite, which is the first thing that came out.

The only free room was 0x3C00

Below the 16 KB of the MSX1 the game uses nothing from 0x3C00 to 0x3FFF: colours at 0x3C00, attributes at 0x3E00 and the MSX1's second table at 0x3F00. Not one pattern moves, and the same file works on both MSXs.

The new code, in the cartridge's orphans

The filler at 0xBFD4 and three routines nobody calls (0x6EA0, 0x6F30, 0x7AAE), found when the disassembly was traced. And the sample figure of the team menus keeps its colours: mode 2 does not read the attribute's colour, so the patch copies them into the colour table.

In openMSX

openMSX screenshots of the ROM each caption names; the commands that take them are in In the emulator.

The original on an MSX1 (C-BIOS_MSX1_JP): in this frame players are missing, and the one in the middle has no hair or shirt. 66.7 sprites not drawn per frame over thirty seconds of a match.
The original on an MSX1 (C-BIOS_MSX1_JP): in this frame players are missing, and the one in the middle has no hair or shirt. 66.7 sprites not drawn per frame over thirty seconds of a match.
The patched cartridge on the Philips NMS 8250: SCREEN 4, eight sprites per line, every player in the window whole, with the ball and the net. 1.7 sprites not drawn per frame.
The patched cartridge on the Philips NMS 8250: SCREEN 4, eight sprites per line, every player in the window whole, with the ball and the net. 1.7 sprites not drawn per frame.
The patched cartridge on an MSX1: the two tables still alternate, now at 0x3E00 and 0x3F00, and it flickers as the original.
The patched cartridge on an MSX1: the two tables still alternate, now at 0x3E00 and 0x3F00, and it flickers as the original.
TRADE on the MSX2: the sample figure with its skin, hair and shirt, copied into the sprite colour table by 0x6F30.
TRADE on the MSX2: the sample figure with its skin, hair and shirt, copied into the sprite colour table by 0x6F30.