How are fonts mapped to memory?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How are fonts mapped to memory?

Henoktes722
The Hack screen has 256 rows and 512 columns. Since each pixel is mapped with a bit in memory, 512 columns needs (512/16), 32, bytes of memory. So for all pixels, rows we need 32 * 256 = 8192 words of memory, which is exactly our screen memory mapped size.

My questions is how does fonts are represented in memory? I mean like the font for 'a' won't be in a consecutive memory location? And also a byte in Hack is 16 bit, but the font needs only 8 bits for the column, so how does actually the word divided into different characters, 8 bit for 'a' 8 bit for 'b'?
Reply | Threaded
Open this post in threaded view
|

Re: How are fonts mapped to memory?

WBahn
Administrator
The basic answer is that it can be represented however you choose to do so -- you just need to make the functions that access the bitmaps compatible with how you store them. The authors describe the generic basis in Section 12.1.5.

Having said that, unless you want to make your own bitmaps for each character, you need to be compatible with how the authors elected to represent the bitmaps in the code they made available to you, which is discussed in Section 12.3.4.

So spend some time studying how the authors elected to represent the bitmaps in the code they made available to you.
Reply | Threaded
Open this post in threaded view
|

Re: How are fonts mapped to memory?

Henoktes722
Okay, what makes me vague was, I was doing the storing of bits in RAM in Output module. But I can first do drawPixel(int x, int y), which knows about storing the color value at the specified memory location. So I can use this method inside the output module, instead of worrying about how to map to physical memory address.