NASM Forum > Other Discussion

Am I using the Graphics Buffer correctly?

<< < (2/2)

Johnpaul Humphrey:
I see what interlacing is. that would explain why my pixels were rectangular. They were double stacked. That means the behavior I observed was normal.
Eventually, I want to map a font on the screen. interlaced means more code, I think.
If I had a sprite stored at say 0xA000 That was 8 rows tall the fastest way I could think of mapping it would be, (assuming a BIT a character and an 8x8)

--- Code: ---mov ebx, 0b8000h ;RBIL says B800, but B8000 seems to be correct.
mov si, 0xA000
mov cx, 4
halfA:
lodsb
mov byte [ebx], al
lodsb   ;skip row for interlacing
add ebx, 1
loop halfA
mov si, 0xA001
mov ebx, 0bcb00h ;half way if my calcs are correct.

halfB:
lodsb
mov byte [ebx], al
lodsb   ;skip row for interlacing
add ebx, 1
loop halfB

--- End code ---

mode 13h comes recommended. If I just want/need monochrome, does a monochrome mode have any advantages, or are they primarily historical?

ShaiHulud:

--- Quote from: Johnpaul Humphrey on July 07, 2020, 06:23:54 PM ---mode 13h comes recommended. If I just want/need monochrome, does a monochrome mode have any advantages, or are they primarily historical?

--- End quote ---

the first machine I played with was an IBM model PS2 (think Macintosh, monitor/motherboard/drives molded into one case, but with an 8086 and a hard drive, definitely not as pretty ;) ) which came with MCGA, that supported the monochrome and CGA modes (320x200 4 color), and the 320x200 256 color mode. Most other video chips of the time were EGA, which also supported the mono, cga and 16 color hires modes, but not the 256 color modes. Soon vga chips came after supporting the 256 color modes, then VESA kicked in and supervga cards started appearing. A lot of the machines of the time used the hires monochrome modes for word processing (google WordPerfect), CAD, paint software. It was rare for games to use the monochrome modes. I can think of only one I ever played that used it, the first SimCity. When 286 started hitting the market, a version of Geos (like the commodore 64 one!) was made, and truly used the protected mode on that chip, almost a proper multitasking system (i say almost...its hard to multitask anything decently at 25mhz). It ran in hires monochrome as well, and did a windowed gui much like macintosh or c64 geos. I only remember it because it had one of the best printing apps of the time, it made spectacular printouts with just a dot matrix printer ;)

A common trick that was used a lot for video routines: lookup tables. make an array of offsets into video memory, one entry per scanline for each row. Use the lookup to speed things up some in your loop, and you wont have to split your code up for the interlacing. if you're clever enough, you could make a macro that preinitializes it for you at compile time. And if i remember correctly, at 640x200, thats only 16k of memory...you should have enough video ram to do page flipping, aka double buffers. If you can manage to tweak the video regs, you could do some realtime stuff

Johnpaul Humphrey:
Thanks for the help so far!
I will try to implement that, and if I come up with some cool macro, I will post it.
I think this solves my problem.
I

Johnpaul Humphrey:
I think I am going to switch to mode 11h. It does not appear to be interlaced and appears to be a conventional size of 640x480.
640x200 seems a bit odd.

My question has been answered. The behavior I was experiencing was a mixture of the wrong size and interlacing.

I am marking the thread as solved.
EDIT:
There does not appear to be a way to mark a thread as solved. If I can't figure out how maybe I shouldn't be programming.  :D

Navigation

[0] Message Index

[*] Previous page

Go to full version