How To

Is there a way to use more than 256 characters?

0

SP4CEBAR 2021-02-26 17:49 (Edited)

Each cell of a background, in LowRes Coder NX, occupies two bytes of memory, one of which points to a character. So a cell can only point to 256 different characters, so there can only be 256 different characters inside a background, 52 of which are symbols.
This is unfortunate, because it means that I can't fill the whole screen with different characters (I need to do this for a paint program I'm making).

There's plenty of memory in ROM to store more characters.
Is there a way to display character data which did not come from ROM entry 3?


was8bit 2021-02-26 17:55 (Edited)

The info you want is here :)

https://lowresnx.inutilis.com/topic.php?id=1745

Check out the one link to my example which uses 5 font sets..


was8bit 2021-02-26 18:06 (Edited)

For your paint program, there is a trick to use all 256 characters for painting.. see attatched...

Now, with this you can use debug TRACE to see variable values, but you cannot use PRINT as PRINT assumes the default text from secret file#0 has been secretly uploaded to the last page of the character set.. i say "secretly" as NX doesnt actually show the secret font set is there, but it is even though you cant see it...

Adding #0: file with bogus data (i actually just renamed the PALETTE file as #0:) prevents the secret font set from auto uploading, freeing up the character set for your paint program

BUT you still cannot use the top left corner, char#0, as by default ALL bacgkgrounds are set to char#0 as a blank space, so anytime you draw into char#0 it will show up everywhere

Empty Canvas.nx | Open in app
2021-02-26 18:11

was8bit 2021-02-26 18:10 (Edited)

I used your idea already for the title screen of this game...

https://lowresnx.inutilis.com/topic.php?id=1696

I had to create the title screen by directly drawing it using CHARACTER EDITOR... (see the attached file i added in the last post)

then i changed the character file into my title file, which saved the image data and freed up my character space again for making game images...

Then i had to use code to manually display my title image...

If you notice very carefully, the top left space has been left empty ;)

If you open file#4 with character editor, you can see how easy it was to create the whole image :)


SP4CEBAR 2021-02-26 18:19

Thanks a lot


was8bit 2021-02-26 18:19

The manual manipulation code for the battlestar game is this..

COPY $8000,$1000 TO $A000

This saves my game character file

COPY ROM(4),$1000 TO $8000

This copies the title image from file#4

FOR Y=0 TO 15
FOR X=0 TO 15
CELL X+2,Y,Y*16+X
NEXT X
NEXT Y

This lets the title image be seen

COPY $A000,$1000 TO $8000

This restores my game character set

a CLS command clears all backgrounds if needed...


was8bit 2021-02-26 18:20

This is a very key reference to use when diving into the inner workings of NX ;)

Hardware Reference

Memory Map

$0000 - Cartridge ROM (32 KB)

$8000 - Character Data (4 KB)
$9000 - BG0 Data (2 KB)
$9800 - BG1 Data (2 KB)

$A000 - Working RAM (16 KB)

$E000 - Persistent RAM (4 KB)

$FE00 - Sprite Registers (256 B)
$FF00 - Color Registers (32 B)
$FF20 - Video Registers
$FF40 - Audio Registers
$FF70 - I/O Registers


was8bit 2021-02-26 18:23

.. glad to be helpful :)


SP4CEBAR 2021-02-26 18:26 (Edited)

In the paint program I'm making, characters are loaded, decoded, encoded, and saved. In the current stadium I can plot pixels, and draw boxes. Next I'll work on line drawing, and I'll try if I can implement a flood filling algorithm.


was8bit 2021-02-26 18:30

It is fun, isn't it :)

Doing one color (color#1) is easy... all 3 colors is harder...

I have never had the patience to do lines and such... i have created a simple pixel editor that uses a trick of using both backgrounds at the same time to simulate having 7 colors at once.. but it drastically reduces the size of the final image..

https://lowresnx.inutilis.com/topic.php?id=854


was8bit 2021-02-26 18:40

Ultimately, i have concluded, for myself, especially since i a NO artist, that the simple trick i used in my battlestar game is easy and sufficient for me... it uses the existing char editor (doesnt require a tool program being loaded) and works just fine for my limited artistic abilities... also the code needed to display it is very small, and easy to use..

... people with more artistic skills could make good use of a good drawing program :)


SP4CEBAR 2021-02-26 18:47 (Edited)

@was8bit Is it possible to load a set of characters, display them all on BG 0, load another set of characters, and display those on BG 1? (To have 512 characters displayed at once)


was8bit 2021-02-26 20:07 (Edited)

That sounds like it should work... but one key thing to remember is that the actual character raw data is NOT get stored into background memory, merely the character# only... the raw graphic data is stored in $8000, and NX compiles the graphic in real time pulling the actual raw data from $8000 by referencing the memory address from $9000... CELL X,Y CHAR# only stores the char# (0-255) in the background memory, that is all ...

The storage amount available for characters is $1000, and it takes 16 bytes to store one 8x8 pixels of a single character, so if you do PRINT $1000/16 you get 256... so NX is absolutely restricted to using 256 characters, referenced as 0-255, at any one single time....


was8bit 2021-02-26 20:10 (Edited)

Check this out...

https://lowresnx.inutilis.com/topic.php?id=428

You can CHANGE part or all of the character set during the game... but can never exceed 255 characters simultaneously...


BGelais 2021-05-20 23:26

I recently uses the Epaint as tool, it save to rom(4), also used the was8bit code routine to display the title

paint title demo.nx | Open in app
2021-05-20 23:26

was8bit 2021-05-21 04:30

Cool :D


SP4CEBAR 2021-05-21 16:55

Nice


Log in to reply.