Bit Mapped MSX 1?

Page 1/2
| 2

Par Chilly Willy

Expert (103)

Portrait de Chilly Willy

17-11-2022, 17:48

I know it would be slow but I would like to recreate the Tron light cycle game for the MSX 1.

I understand that the easiest way to do this would be to give each individual tile it's own address as in
Tile 0, would be 0
Tile 1, would be 1
Ect...
That way no tile would be repeated.

At that point everything should be able to plot a dot anywhere.

Has anyone tried this approach? Code? Examples? Thoughts?

!login ou Inscrivez-vous pour poster

Par santiontanon

Paragon (1810)

Portrait de santiontanon

17-11-2022, 18:33

Yeah, setting the VDP name table like this is commonly called "bitmap mode". This is what is used for most ZX Spectrum ports.

I used this mode in most of the menu screens in my "Menace from Triton" game. For example, the "BRAIN GAMES" intro effect when the game start uses this. You can find the code for the "draw_white_pixel", draw line, etc. functions I used here: https://github.com/santiontanon/triton/blob/master/src/state...

And the code to initialize the VDP like that here: https://github.com/santiontanon/triton/blob/master/src/gfx-b...

Note that none of my code needed fast execution, as it was not used in-game, so all of those routines are optimized for space rather than for speed.

Par aoineko

Paladin (1011)

Portrait de aoineko

17-11-2022, 18:48

With this approach, you are limited to 2 colors per 8x1 pixel block. So if you have a color for the background and a color for one of the bikes, you cannot have a third color on the same 8x1 block.

If you make a monochrome game, no problem.

Par theNestruo

Champion (423)

Portrait de theNestruo

17-11-2022, 19:23

Chilly Willy wrote:

Has anyone tried this approach? Code? Examples? Thoughts?

That's MSX-BASIC approach to SCREEN 2 (with PSET, LINE, CIRCLE...)

Par Chilly Willy

Expert (103)

Portrait de Chilly Willy

18-11-2022, 00:55

aoineko wrote:

With this approach, you are limited to 2 colors per 8x1 pixel block. So if you have a color for the background and a color for one of the bikes, you cannot have a third color on the same 8x1 block.

If you make a monochrome game, no problem.

I thought in mode 2 it was two colors per each line on an 8x8 tile.

Mode 0 it is 2 colors per every 8 tiles in a row.

Par Chilly Willy

Expert (103)

Portrait de Chilly Willy

18-11-2022, 00:57

theNestruo wrote:
Chilly Willy wrote:

Has anyone tried this approach? Code? Examples? Thoughts?

That's MSX-BASIC approach to SCREEN 2 (with PSET, LINE, CIRCLE...)

Thank you.
I think for maximum speed I will have to stick with assembly.
Decoding somewhere in a 256x192 grid inside 8x8 tiles would probably be slow as Christmas.

Par aoineko

Paladin (1011)

Portrait de aoineko

18-11-2022, 01:35

Chilly Willy wrote:

I thought in mode 2 it was two colors per each line on an 8x8 tile.

It is the same thing. Tiles have 8 lines so if you look the screen as a bitmap, the limitation occur on every 8x1 pixels chunk.

Chilly Willy wrote:

Decoding somewhere in a 256x192 grid inside 8x8 tiles would probably be slow as Christmas.

If you make a classic Tron game, you only need to update each frame with the location of each Light cycle.
If you have 2 cycles, the time to draw in the tiles corresponding to their position will be minimal.

Finding the tile corresponding to the pixel to be drawn is very simple.
From the X/Y screen position, you can find the (16-bits) index of the tile with the formula : (Y / 8) * 32 + (X / 8).
(Division by 8 can be achieved by right-shifting 3 times and multiply by 32 by left-shifting 5 times).
The corresponding line in the tile is Y % 8 (or faster, Y & 7).

To get this tile's line data, you just have to VPeek at : PatternBaseAddress + Index * 8 + Line.
Modifiy the X % 8th bit, and VPoke back to the same address.

For example, for position X=100, Y=150 :
The index is 588 (18*32+12).
The line number is 6 (150 & 7).
The bit to modify is number 4 (100 & 7).

Par santiontanon

Paragon (1810)

Portrait de santiontanon

18-11-2022, 02:26

Yep, that is exactly the logic that the "draw_pixel_get_ptr" function in the code I linked above uses Smile ( https://github.com/santiontanon/triton/blob/master/src/state... )

As for monochrome/color game, another option is to have the lines always be the same color, but use sprites for the motorcycles (even if it's just a few pixels). So, it's clear which lines belong to which player.

Par Chilly Willy

Expert (103)

Portrait de Chilly Willy

18-11-2022, 06:28

great information guys.
I am blown away at how much you know and have figured out.

I am trying to figure out multiple colored cycles that left the same colored lines behind so on each horizontal line there would be the same colored lines as the cycle. more like every 2 lines for thickness

Then plot a multicolored explosion in pixels

I guess I am setting the idea in my brain too high for the technology. Smile

Par Uninteresting

Champion (352)

Portrait de Uninteresting

18-11-2022, 06:48

My MSXdev'22 game, MIX, played in "bitmap mode" where the player was drawing a line in a grid. I don't remember the details and I need to hurry to work, but in this file, check PsetVram. This assumes the VRAM is organized in a certain way (the drawing window in each third of the screen is a consecutive sequence of characters starting from 0 to 22*8 (middle part) or 22*7 (top and bottom parts), so you'd have to change something there, at least 787 to 792 (multiply Y character by 22, and in a full-screen version it should be 32).

Par Manuel

Ascended (19471)

Portrait de Manuel

18-11-2022, 07:43

Page 1/2
| 2