More than 32 sprites on a TMS9128!


Really? The TMS9900 : TMS9918A / TMS9928A / TMS9929A Video Display Processors – Data Manual (Nov 1982) tells:

The video display can have up to 32 sprites on the highest priority video planes.

But I’ve accidentally figured out that due a bug on sprite rendering you can have much more than 32 sprites on screen. And I’ve made tests on Sharp HB-8000 v1.2 (TMS9128) and Frael Bruc 100 (TMS9129) and got the same result in both¹.

(¹) By the way, not only MSX computers but ColecoVision, Sord M5, TI-99/4A etc might be affected too!

Showing the bug

How to reproduce it? Type this on a real MSX1 computer…

10 COLOR 15,0,0:SCREEN 2,2,0
15 SPRITE$(0)=STRING$(32,&HAA):Y%=15:X%=192
20 PUT SPRITE 0,(128,95),15,0
25 VDP(4)=0 ' Try with 1 or 2 too!
30 PUT SPRITE 8,(X%,Y%),7,0
35 J%=STICK(0)
45 Y%=Y%(J%=5)+(J%=1)
50 X%=X%(J%=3)+(J%=7)
55 GOTO 30

view raw


hosted with ❤ by GitHub

On a emulated MSX1 you get:


But there is something weird on a real MSX1


Use arrows to move the light blue box (boxes?) over the screen and see bug’s behaviour, the screen will blink when a sprite collision is detected.

I’ve figured out that the old trick² to resize the Pattern Table by change register #4 affects sprites too. So, all sprites beyond the 7th layer and at the first third of screen will appear on the second (current line+64) and the third (current line+128) thirds as well. And they are real sprites, not “ghosts”, because collision detection still working for each one!

Of course, nothing is perfect, and just remember that Pattern Table has 2048 bytes by now and is replicated on all thirds of screen!

(²) Trick that doesn’t work on T6950.

More than 32 sprites

And how it affects the limit of 32 sprites on screen? Now, try this…

100 COLOR 15,14,0:SCREEN 2,2
105 RESTORE 105:FOR J%=0 TO 7:READ K%:LINE (0,J%*8)STEP(255,7),K%,BF:NEXT J%:DATA 8,9,10,11,3,7,5,13
110 RESTORE 160:FOR J%=0 TO 15:K$="":FOR I%=0 TO 31:READ L$
115 K$=K$+CHR$(VAL("&H"+L$)):NEXT I%:SPRITE$(J%)=K$:NEXT J%
120 K%=8:FOR J%=0 TO 3:FOR I%=0 TO 3
125 PUT SPRITE K%,(96+16*I%,1+16*J%),1,J%*4+I%
130 K%=K%+1:NEXT I%,J%
135 VDP(0)=VDP(0) OR 2
140 VDP(1)=VDP(1) AND &HE7
145 VDP(3)=&H9F
150 VDP(4)=0
155 GOTO 155
160 DATA 07,1f,3f,7f,70,f1,f1,f1,f1,f1,70,7f,3f,1f,07,00,c0,f0,f8,fc,1c,1e,1e,1e,1e,1e,1c,fc,f8,f0,c0,00
165 DATA 07,1f,3f,7f,78,fc,fc,fc,fc,fc,78,7f,3f,1f,07,00,c0,f0,f8,fc,7c,7e,7e,7e,7e,7e,3c,fc,f8,f0,c0,00
170 DATA 07,1f,3f,7f,70,ff,f0,f1,f1,f1,70,7f,3f,1f,07,00,c0,f0,f8,fc,1c,1e,1e,fe,1e,1e,1c,fc,f8,f0,c0,00
175 DATA 07,1f,3f,7f,78,ff,fc,ff,f1,f1,70,7f,3f,1f,07,00,c0,f0,f8,fc,1c,1e,3e,1e,1e,1e,1c,fc,f8,f0,c0,00
180 DATA 07,1f,3f,7f,71,f1,f1,f1,f0,ff,7f,7f,3f,1f,07,00,c0,f0,f8,fc,fc,1e,1e,1e,1e,1e,1c,fc,f8,f0,c0,00
185 DATA 07,1f,3f,7f,70,f1,f0,ff,f1,f1,70,7f,3f,1f,07,00,c0,f0,f8,fc,7c,fe,1e,1e,1e,1e,1c,fc,f8,f0,c0,00
190 DATA 07,1f,3f,7f,70,f1,f0,f1,f1,f1,70,7f,3f,1f,07,00,c0,f0,f8,fc,7c,fe,1e,1e,1e,1e,1c,fc,f8,f0,c0,00
195 DATA 07,1f,3f,7f,70,f1,ff,fe,fc,fc,7c,7f,3f,1f,07,00,c0,f0,f8,fc,1c,1e,1e,3e,7e,7e,7c,fc,f8,f0,c0,00
200 DATA 07,1f,3f,7f,70,f1,f8,f1,f1,f1,70,7f,3f,1f,07,00,c0,f0,f8,fc,1c,1e,3e,1e,1e,1e,1c,fc,f8,f0,c0,00
205 DATA 07,1f,3f,7f,70,f1,f0,ff,f1,f1,70,7f,3f,1f,07,00,c0,f0,f8,fc,1c,1e,1e,1e,1e,1e,1c,fc,f8,f0,c0,00
210 DATA 07,1f,3f,7f,7c,ff,f0,f1,f1,f1,70,7f,3f,1f,07,00,c0,f0,f8,fc,1c,1e,1e,1e,1e,1e,1c,fc,f8,f0,c0,00
215 DATA 07,1f,3f,7f,71,f1,f0,f1,f1,f1,70,7f,3f,1f,07,00,c0,f0,f8,fc,fc,fe,1e,1e,1e,1e,1c,fc,f8,f0,c0,00
220 DATA 07,1f,3f,7f,70,f1,f1,f1,f1,f1,70,7f,3f,1f,07,00,c0,f0,f8,fc,1c,1e,1e,fe,1e,1e,1c,fc,f8,f0,c0,00
225 DATA 07,1f,3f,7f,7f,ff,f0,f1,f1,f1,70,7f,3f,1f,07,00,c0,f0,f8,fc,1c,1e,1e,1e,1e,1e,1c,fc,f8,f0,c0,00
230 DATA 07,1f,3f,7f,70,f1,f0,f1,f1,f1,70,7f,3f,1f,07,00,c0,f0,f8,fc,1c,1e,1e,fe,1e,1e,1c,fc,f8,f0,c0,00
235 DATA 07,1f,3f,7f,7c,fc,fc,f0,fc,fc,7c,7f,3f,1f,07,00,c0,f0,f8,fc,1c,7e,7e,1e,7e,7e,7c,fc,f8,f0,c0,00

view raw


hosted with ❤ by GitHub

By the way, I’ve resized Attribute Table changing register #3, but it doesn’t affect bug’s behaviour.

On a emulated MSX1 you see only 16 sprites on top of screen…


But on a real MSX1


You see 48 simultaneous sprites! 😮


I already know that it doesn’t work on V9938 (tested, SVI-738) and V9958 (tested, FS A1-ST); and shouldn’t work on T6950 (untested). About emulators, it doesn’t work on fMSX (tested, version 4.5), openMSX (tested, version 0.15.0), WebMSX (tested, version 5.4.0) and may not work on FPGA based MSX.

Well, I don’t have how to test all TMS9918 family and its variants (FPGA, Sega, Toshiba, Yamaha etc) to let know in which of them this “feature” is present.

So any help would be appreciated!


2 comentários sobre “More than 32 sprites on a TMS9128!

  1. Pingback: Mais de 32 sprites em um TMS9128 | Retrocomputaria

Os comentários estão desativados.