Video: Lesson P8 - Tilemap graphics on the Sega Master System & Game Gear

The Master System & GameGear are virtually the same hardware!
User avatar
akuyou
Posts: 563
Joined: Mon Apr 22, 2019 3:19 am
Contact:

Re: Video: Lesson P8 - Tilemap graphics on the Sega Master System & Game Gear

Post by akuyou » Thu Jul 21, 2022 1:14 pm

Happened across this on my travels in the SMS official docs:
Seems the SMS needs up to 30 ticks to process a write.
The GG docs uses a combination of "PUSH IX POP IX" as a delay for that purpose - may be worth a try.
15.gif
15.gif (109.2 KiB) Viewed 2649 times
you can get the docs here:
https://www.smspower.org/Development/Of ... umentation
Chibi Akuma(s) Comedy-Horror 8-bit Bullet Hell shooter! // 「チビ悪魔」可笑しいゴシックSTG ! // Work in Progress: ChibiAliens

Interested in CPU's :Z80,6502,68000,6809,ARM,8086,RISC-V
Learning: 65816,ARM,8086,6809

Lee
Posts: 23
Joined: Sun Oct 10, 2021 1:26 am

Re: Video: Lesson P8 - Tilemap graphics on the Sega Master System & Game Gear

Post by Lee » Thu Jul 21, 2022 9:15 pm

As it means from the above so it takes a wait of 29 t-states for writing in between OUT commands. Symmetric PUSH and POP will create delays as you mention. PUSH IX is 15 t-states POP Ix is 14 T-states so the
PUSH IX, POP IX pair should work as it will take 29 t-states and it only takes 2 bytes of memory.Definitely can give this a try on real hardware.

I also have another question. What is the code to make magnified double size background tiles on the master system using the .RAW file system? So if I have a color 8 by 8 pixel tile how do display it as a 16 by 16 pixel tile
(so it takes 4 tiles on screen). I do not want to store the 4 tiles they will be computed from a single tile.

User avatar
akuyou
Posts: 563
Joined: Mon Apr 22, 2019 3:19 am
Contact:

Re: Video: Lesson P8 - Tilemap graphics on the Sega Master System & Game Gear

Post by akuyou » Thu Jul 21, 2022 9:28 pm

If you mean storing a 4x4 bitmap and scaling it to 8x8 then I have no code to do that, though it would not be hard to do using bitshifting to double up the bitmap data, and writing each line of the source to the vram twice.

I'm surprised this is something you would want to do. The SMS can store upto 512k on a cartridge, so space would not typically be a problem unless you're streaming video or something.

If you're really looking to reduce the space used by tile patterns, it may be worth considering using 4 color tiles, by defining only 2 of the bitplanes from a source bitmap, and 2 bitplanes from a fixed value. This would give you the 'full resolution' of the patern, and just limit each 8x8 tile to 1 of 4 sets of colors.

Please let me know if the PUSH POP delay solves the previous problem on your hardware.
Chibi Akuma(s) Comedy-Horror 8-bit Bullet Hell shooter! // 「チビ悪魔」可笑しいゴシックSTG ! // Work in Progress: ChibiAliens

Interested in CPU's :Z80,6502,68000,6809,ARM,8086,RISC-V
Learning: 65816,ARM,8086,6809

Lee
Posts: 23
Joined: Sun Oct 10, 2021 1:26 am

Re: Video: Lesson P8 - Tilemap graphics on the Sega Master System & Game Gear

Post by Lee » Fri Jul 22, 2022 2:01 am

Eventually after I finish my game I want to make it available for download and the smallest commercial flash cartridge you can buy for the master system is 32K. A 32KB game will run on any real hardware cartridge it does not exclude gamers depending on their flash cartridge size so I was surprised when you mentioned up to512KB in size master system cartridges.
The double magnification already exists for sprites but not background tiles and there is a hardware bug implementing double sprite magnification is the master system 1 but was fixed in the master system two as discussed

https://www.smspower.org/forums/19069-Z ... itesOnSMS1

So double zooming is not easy for everyone to implement. Sprites can use tile data as their graphics in master system 2 so this is another way to implement zoomed sprites on the master system 1. But zoomed tiles have more than one use such as saving memory. I will use your suggestion for zoomed doubler sized and give it a go.

Also follow up later with how the PUSH POP delay test goes.

User avatar
akuyou
Posts: 563
Joined: Mon Apr 22, 2019 3:19 am
Contact:

Re: Video: Lesson P8 - Tilemap graphics on the Sega Master System & Game Gear

Post by akuyou » Fri Jul 22, 2022 3:09 am

If you're real tight on data space, you may want to take a look at the RLE routine I covered here,
https://www.chibiakumas.com/z80/multipl ... #LessonM11

(The website says MSX, but this is a typo, the example is SMS - I'll get it fixed)

This was borrowed from the SMS game here:
https://www.chibiakumas.com/forum/viewtopic.php?t=281

You may want to combine this with reduced resolution / bitplanes to get your data down in size.
Chibi Akuma(s) Comedy-Horror 8-bit Bullet Hell shooter! // 「チビ悪魔」可笑しいゴシックSTG ! // Work in Progress: ChibiAliens

Interested in CPU's :Z80,6502,68000,6809,ARM,8086,RISC-V
Learning: 65816,ARM,8086,6809

Lee
Posts: 23
Joined: Sun Oct 10, 2021 1:26 am

Re: Video: Lesson P8 - Tilemap graphics on the Sega Master System & Game Gear

Post by Lee » Sat Jul 23, 2022 8:27 pm

I added in the PUSH IX POP IX code into your code. So the patterns display as expected so the delay
using the stack works. So all it took was a few bytes to solve theproblem and you found the bug in your own code.


RLE compression probably works best when the graphics have large patches of the same color as shown in the phantasy star tunnel maze that tunnel effect in phantasy star can be done with any compression algorithm that decompresses in real time but there will be a trade of between smoothness of graphics and speed of decompression for a compression algorithm but that is the core idea.However I do not think it would be as simple as the core idea of decompressing all the tiles for a frame and then drawing them all to the screen for each frame though I could be wrong as a a web search shows there are lots of compression algorithms.

It is interesting and this is the first time I have known about these tunnels I will have see of the video to find out more.

Post Reply

Return to “Master System & GameGear Assembly Programming”