Plotting a single dot on screen

Page 3/4
1 | 2 | | 4

By PingPong

Prophet (3770)

PingPong's picture

09-02-2021, 14:13

ToriHino wrote:

To be more precise, the C64 does not have vram connected to a Z80 bus but I get your point :P. Indeed when programming the MSX1 VDP like this it becomes slow and certainly is not making optimal use of it. If performance indeed is not an issue I would say solve it in the correct MSX way and use the BIOS

the c64 HAVE VRAM connected to CPU BUS. It is this the reason that justify the fact that the VIC-II Steal CPU Cycles when needed. To be more precise the 16K of vram used from the VIC-II controller could be mapped in some physical positions around the 64K space.

By geijoenr

Champion (275)

geijoenr's picture

09-02-2021, 14:15

Quote:

most of spectrum users complain about slow vram access on msx. i think is not so slow on typical operations, unless you try to do this kind of things. What you are trying to do IS EXACTLY the kind of thing where the MSX suffers a lot in performances compared to systems where vram is electrically connected to z80 bus (ZX for example, but also CPC, or C64).

Besides, in the ZX Spectrum the video memory is organized in a way that plotting a pixel (or anything that is not a tile, for that matter) is a bit faster because of the way bytes are arranged.

Still, I think having hardware sprites allows to compensate the slowdown in certain ways that I think were generally not exploited when doing conversions.

By PingPong

Prophet (3770)

PingPong's picture

09-02-2021, 14:21

It does depend on what you want to achieve: for plotting a sw sprite on screen you do not need to do a vram ptr setup, so the impact is more lighter. If you want to plot a pixel at random positions then you got the slowdown.

Hw sprites are another thing, they help to speed up things but are not related to the task of plotting pixels around the screen
Unfortunately TMS has a very weak sprites, the most heavy limit is the scanline limit. Without this in place MSX sprites would not be so bad.

By santiontanon

Paragon (1488)

santiontanon's picture

09-02-2021, 16:23

Metalion wrote:
Chilly Willy wrote:

Being tactful by saying that I asked how to plot a single point. I will expand on that formula and program later but to ask "why would I want to do that" instead of an answer like come on dude....

You totally misunderstood the reply ... He was trying to help you. As other have said, plotting just a single pixel on screen is not an easy job (see PingPong explanation). So maybe trying to see past that initial request and ask you exactly what your need was, was a good idea because it would probably lead to a different solution, maybe a simpler one, depending on your need.

OK, now, we know that you're writing a drawing program.

Exactly, I was just trying to help. Apologies if you took offense on my question! But please take it easy, no need to be so defensive. I just wanted to make sure I understood what you wanted to draw pixels for before I pointed you to some example or another.

Now that I know what you want, I know how to help. If you want concrete examples of putpixel routines in asm (with the exact formula in the comment describing the function), you can look at the "draw_white_pixel" and "draw_black_pixel" routines in this code: https://github.com/santiontanon/triton/blob/master/src/state...

The function that calculates the address to modify is "draw_pixel_get_ptr". The routines assume the attribute tables are all set to #f0, and the name tables are all reset to 0, 1, 2, 3, 4, ..., etc. so that drawing pixels is easy. The "set_bitmap_mode_a_color" sets the name and attribute tables like this.

These are the routines used to draw the lines in the "Brain Games" logo in the intro of The Menace from Triton, which is drawn pixel by pixel.

By pgimeno

Champion (301)

pgimeno's picture

09-02-2021, 16:23

The problem in Chilly Willy's question is that the answer depends on the video mode and VDP target model, and he didn't mention either.

By santiontanon

Paragon (1488)

santiontanon's picture

09-02-2021, 17:38

oh, yeah, that's right. In my answer above I assumed MSX1 and Screen 2 (and btw, the file I linked also has routines for line drawing, in case they are useful "draw_line_start" and "draw_line_next_pixel")

By Chilly Willy

Expert (66)

Chilly Willy's picture

09-02-2021, 18:01

sjoerd wrote:

The BIOS has routines to do this, so you could track one of those with a debugger. Or just use the BIOS, because it's there and probably not much worse than something you could come up with yourself. It doesn't sound very difficult, but I doubt many people have laying such a routine around, because it's something you want to avoid if possible, just like divisions.

Thank you...
I am not using BIOS routines.

By Chilly Willy

Expert (66)

Chilly Willy's picture

09-02-2021, 18:02

gdx wrote:
Chilly Willy wrote:

Technically whether it is 768 8x8 blocks it still adds up to 256x192

In fact, it's 3x256 blocks of 8x8 in SCREEN2.

To trace a single dot on the screen, you can use the SETC routine (0120h) of the BIOS of the Main-ROM.

See here:
https://www.msx.org/wiki/Main-ROM_BIOS#Graphic_Draw

If IU start using BIOS routines the code will not be portable to any other Z80 based system.

By Chilly Willy

Expert (66)

Chilly Willy's picture

09-02-2021, 18:04

PingPong wrote:

most of spectrum users complain about slow vram access on msx. i think is not so slow on typical operations, unless you try to do this kind of things. What you are trying to do IS EXACTLY the kind of thing where the MSX suffers a lot in performances compared to systems where vram is electrically connected to z80 bus (ZX for example, but also CPC, or C64).

Thanks PP.

I will let you know how it worked out.

By Chilly Willy

Expert (66)

Chilly Willy's picture

09-02-2021, 18:06

santiontanon wrote:

oh, yeah, that's right. In my answer above I assumed MSX1 and Screen 2 (and btw, the file I linked also has routines for line drawing, in case they are useful "draw_line_start" and "draw_line_next_pixel")

Totally my fault for not specifying.

MSX Mode 2

Page 3/4
1 | 2 | | 4