commanderx16 / x16-emulator

Emulator for the Commander X16 8-bit computer
384 stars 60 forks source link

Missing control over TILEW and TILEH in text modes #179

Closed Serentty closed 5 years ago

Serentty commented 5 years ago

The official specifications list for the Commander X16 mentions that “the 1 bpp tile modes in combination with 8x16 tile size will also allow for a standard VGA font to be used.” By “1 bpp tile modes” I'm assuming that it's referring to modes zero and one, the text modes. However, currently the emulator ignores TILEW and TILEH in these two modes, as can be seen in the code below.

if (props->tile_mode) {
    props->tilew = 1 << (((reg_layer[layer][1] >> 4) & 1) + 3);
    props->tileh = 1 << (((reg_layer[layer][1] >> 5) & 1) + 3);
} else {
    props->tilew = 8;
    props->tileh = 8;
}

I discovered this when I went to use this feature in order to display Japanese text at a reasonable size and resolution, yet nothing happened.

mist64 commented 5 years ago

I don't see this claim in the specification (Facebook is ^*&$^#%&!), and it's not in the VERA spec:

https://github.com/commanderx16/x16-docs/blob/master/VERA%20Programmer's%20Reference.md

@fvdhoef Can you comment?

fvdhoef commented 5 years ago

It is correct that tile mode 0 and 1 also support all combinations of tile width and height 8x8, 8x16, 16x8, 16x16. If the emulator doesn't emulate this now, that is an error. Also in the documentation there is some confusing text below the mode 0 and mode 1 info that is only valid when 8x8 mode is selected.

mist64 commented 5 years ago

A pull request would be gladly accepted. :)

Serentty commented 5 years ago

Alright, if this is supposed to be emulated, I'll take a look and see if I can figure out how to implement it.

Kroc commented 5 years ago

Can't access Facebook at all; can anybody perhaps mirror that doc please?

indigodarkwolf commented 5 years ago

Hopefully the fix is straightforward, just remove the if() and use the tile size logic from tiles modes for text as well:

props->tilew = 1 << (((reg_layer[layer][1] >> 4) & 1) + 3);
props->tileh = 1 << (((reg_layer[layer][1] >> 5) & 1) + 3);

But even if it's harder than that, I expect the worst case would be looking at wherever checks props->tile_mode and props->text_mode, which shouldn't be too bad.

Serentty commented 5 years ago

I created a branch where I removed the check on tile size. First tests seem promising. Understandably the text on the screen is all corrupted when switching the tile size, so I'll have to check more carefully to ensure that it's behaving properly.

Serentty commented 5 years ago

It seems that when the checks are removed, it does indeed work properly, as per my understanding of how it is supposed to work. For example, when characters are set to be double height, it continues on to load 100% more font data, which is easy to see from how whenever a letter is typed, you see two consecutive letters from the character set.

image

I'll go and open a pull request for these changes.

Serentty commented 5 years ago

Done.

https://github.com/commanderx16/x16-emulator/pull/184

Serentty commented 5 years ago

I'm closing this because my pull request has been merged.