Welcome, Guest. Please login or register.


Author Topic: Use of character modes for games? (Read 2803 times)

Offline ssr86

  • EP user
  • *
  • Posts: 359
  • Country: pl
  • OS:
  • Windows NT 6.2 Windows NT 6.2
  • Browser:
  • Firefox 40.0 Firefox 40.0
    • View Profile
Re: Use of character modes for games?
« Reply #15 on: 2015.September.29. 22:21:30 »
Either I'm doing something wrong or the VRES doesn't work in char modes as in pixel modes... I can't get the char lines to repeat. For line_height = x I get x different lines...

Well... I must have completely misunderstood everything...:
"VRES should always be clear for character modes."
So I guess it's just how it should normally be... Then it seems you can't get the lines to repeat without doing a seperate modeline for each line of display... That makes the already big lpt even bigger...
Or am I missing something?

"The first 128 bytes of the font are the display bytes for the top scanline of each of the 128 characters. The next 128 bytes are the display bytes for the second scanline and so on. " (about ch128 from nick doc)
This is why I thought that 1char=1byte (two pixels in c16)... So I guess it's an error in the doc...
« Last Edit: 2015.September.29. 22:45:24 by ssr86 »

Offline lgb

  • EP addict
  • *
  • Posts: 3496
  • Country: hu
  • æðsta yfirmaður
  • OS:
  • Linux (Ubuntu) Linux (Ubuntu)
  • Browser:
  • Firefox 41.0 Firefox 41.0
    • View Profile
    • http://lgb.hu/
Re: Use of character modes for games?
« Reply #16 on: 2015.September.29. 23:59:00 »
Either I'm doing something wrong or the VRES doesn't work in char modes as in pixel modes... I can't get the char lines to repeat. For line_height = x I get x different lines...

Well... I must have completely misunderstood everything...:
"VRES should always be clear for character modes."

I think this is because: according the specification, "if VRES is set then the next scanline of this modeline continues at the next byte in video RAM, if VRES is clear then the LD1 pointer is reloaded so the same data will be displayed on each scanline." This is written for PIXEL mode, but I think this sentence is true for every video modes (what VRES actually does with LD1 is the same in every modes) just in some cases it simply does not make any sense in a given video mode, because the nature of that mode (like in ch modes?)! So actually effect of VRES bit set/reset - I think, again! - works the very same way in every modes, just the "visible result" is different because different modes uses LD1/LD2 in different ways then to "show" pixels then on your screen ...

So VRES bit seems to set the behaviour of LD1 in the mentioned way. I guess it does something similar in character mode as well (or generally in every modes), just it does not make sense there to use "VRES is set" state. In ch mode, LD1 defines the character codes to be displayed (and LD2 points to the font data). Now that explains very well, why specification says, that "VRES should be clear" for character modes: one LPB describes one character line, the number of scanlines for the LPB defines the height of the used ch pixels (this is also a strength of Nick, that the height of a char is not defined at all just only by user, eg in Commodore 64 is strictly 8 pixels unless some very complex raster interrupt timed tricks are used or so, by burning significant amount of your CPU time just for this, by also exploiting some VIC-II "bugs" maybe). Since for every new scanlines of a given character involves the next line of font data of the character, LD2 can change and will at the same column of next line. However since line by line Nick should show the newer and newer line of the font data of the SAME CHARACTER CODE, it means, LD1 should be the same during this process, that is, LD1 should be re-loaded at every scanline, that is, VRES should be clear for this ... Of course you can actually set VRES in ch mode, just the result will be ... well ... interesting :) You can guess what it does with VRES set, if you know how exactly LD1 and LD2 is used in ch modes ...

Code: [Select]
Either I'm doing something wrong or the VRES doesn't work in char modes as in pixel modes... I can't get the char lines to repeat. For line_height = x I get x different lines...
Of course not. What is "repeating" _already_ in character mode is using the same character code multiple times for its all scanlines. You can't repeat the character line itself then (it would be repeating the repeated stuff) ... In pixel mode the situation is different, as Nick "directly" reads/displays pixels, while in ch modes, there is an indirect mode: character code indexed font data is transferred to pixels (how? depending in colour mode of course) ... And here "character code" is same for the given column of the given character line, but font data is not (of course).

Well, it's my best understanding of the topic, at least!

Offline ssr86

  • EP user
  • *
  • Posts: 359
  • Country: pl
  • OS:
  • Windows NT 6.2 Windows NT 6.2
  • Browser:
  • Firefox 46.0 Firefox 46.0
    • View Profile
Re: Use of character modes for games?
« Reply #17 on: 2016.May.22. 22:14:33 »
It is actually possible to use ALTIND0/ALTIND1 in all video modes, including even PIXEL modes. Unlike LSBALT and MSBALT, these do not clear the bits they use, so it is possible to have 4 pairs of colors in 2-color CH256 mode:
- characters 0 to 63 will use colors 0 and 1
- characters 64 to 127 will use colors 4 and 5 (ALTIND0)
- characters 128 to 191 will use colors 2 and 3 (ALTIND1)
- characters 192 to 255 will use colors 6 and 7 (ALTIND0+ALTIND1)
And in 4-color character modes this becomes:
- colors 0,1,2,3 for characters 0-63
- colors 4,5,6,7 for characters 64-127
- colors 2,3,2,3 for characters 128-191
- colors 6,7,6,7 for characters 192-255
?
Or is there a "magic" trick to make the last two fours more useful...?
I would really hope there was a way to have all the fours different, but that's just impossible...
« Last Edit: 2016.May.22. 22:20:07 by ssr86 »

Online endi

  • EP addict
  • *
  • Posts: 7218
  • Country: hu
  • grafikus, játékfejlesztõ, programozás, scifi, tudományok, vallás
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 50.0.2661.94 Chrome 50.0.2661.94
    • View Profile
    • Honlapom
Re: Use of character modes for games?
« Reply #18 on: 2016.May.22. 22:17:59 »
And in 4-color character modes this becomes:
- colors 0,1,2,3 for characters 0-63
- colors 4,5,6,7 for characters 64-127
- colors 2,3,2,3 for characters 128-191
- colors 6,7,6,7 for characters 192-255
?
Or is there a "magic" trick to make the last two fours more useful...?
I would really hope there is a way to have all fours different, but I guess that's impossible...

in the Gracha Editor I use 2*4 color char mode. sad, there are no other useable mode (masked bits...)
Vigyázat! Szektás vagyok! :)

Offline ssr86

  • EP user
  • *
  • Posts: 359
  • Country: pl
  • OS:
  • Windows NT 6.2 Windows NT 6.2
  • Browser:
  • Firefox 46.0 Firefox 46.0
    • View Profile
Re: Use of character modes for games?
« Reply #19 on: 2016.May.22. 22:25:27 »
So I guess the only way to get four sets (well...somewhat) would be to use char128 mode and have an alternative set of blocks with either color inversion/swap or dither...and use ALTIND0...

Online endi

  • EP addict
  • *
  • Posts: 7218
  • Country: hu
  • grafikus, játékfejlesztõ, programozás, scifi, tudományok, vallás
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 50.0.2661.94 Chrome 50.0.2661.94
    • View Profile
    • Honlapom
Re: Use of character modes for games?
« Reply #20 on: 2016.May.22. 22:31:31 »
So I guess the only way to get four sets (well...somewhat) would be to use char128 mode and have an alternative set of blocks with either color inversion/swap or dither...and use ALTIND0...

maybe useable for some graph styles... strongly dithered artistic styles maybe
or make an intellingent gfx converter that can convert the graphics to these bit-masked modes
Vigyázat! Szektás vagyok! :)

Offline IstvanV

  • EP addict
  • *
  • Posts: 4806
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 46.0 Firefox 46.0
    • View Profile
Re: Use of character modes for games?
« Reply #21 on: 2016.May.23. 06:02:00 »
And in 4-color character modes this becomes:
- colors 0,1,2,3 for characters 0-63
- colors 4,5,6,7 for characters 64-127
- colors 2,3,2,3 for characters 128-191
- colors 6,7,6,7 for characters 192-255
?

Yes, and without ALTIND1, the second half of the character set is again 0,1,2,3 and then 4,5,6,7. It is not possible to use more colors than that with ALTIND0 and ALTIND1, these just perform OR 4 and OR 2 operation on the color.