Discussion

Character Source ?

0

G-9 2021-02-23 06:31

There is SOUND SOURCE *rom(15)* and BG SOURCE *rom(3)* ... but I didn't found something like CHAR SOURCE *rom(2)* ... but actually I think chars are the most important in disks but :P Can someone help me ?

It's for Among Us NX...


Timo 2021-02-23 06:53 (Edited)

Music can be played from anywhere in the RAM or ROM, so SOUND SOURCE can set the memory address directly.

BG data has to be in video RAM, this is why you have to use BG COPY. With BG SOURCE you just say where it should be copied from.

Characters have to be in video RAM. Use the COPY command to switch between different character sets. For example this copies all characters from ROM 10:

COPY ROM(10),4096 TO $8000


G-9 2021-02-23 09:48

Oki thanks ill try it :D


was8bit 2021-02-23 11:58 (Edited)

You can have multiple files for background source, you can have multiple files for sound source, you can have multiple files for character source.. but the one thing to remember is that NX copies data from these files (stored memory) into active memory ...

So, the data at the bottom of your code is stored data and called FILES... however, when NX is running, it runs using data put into ACTIVE data... which you can directly access with PEEK POKE,etc...

$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

NX automatically loads data from specific files into active data, AND OR you may also manually load different data from different files into active data with specific commands..

BUT, the thing to remember, you are ABSOLUTELY restricted to only using 256 charcters at one time, 2x32x32 sized backgrounds at one time, one set of 8 palettes of colors at one time, one set of sounds and music data at one time, etc..

You may CHANGE any of these things in real time, but youn cannot EXCEED these limites simutaneously during the game...

So you cannot use, say, over 500 characters at once.. you MAY use a set of 256 characters for part of the game, and ANOTHER set of 256 characters at another TIME during the game... you can SWAP out these 2 sets throughout the whole game, but you may never use ALL characters from BOTH sets at the same time...

Theroectically, with PEEK POKE COPY etc, and using fancy math, you could pick and choose different character data from different files, copying what you wanted into memory $8000, and dynamically change that file in real time during the game... and yet even then you are still restricted to 256 characters #(0-255) at one time...


was8bit 2021-02-24 04:52 (Edited)

Here is the fancy math to copy ANY one existing character in ANY one character file into ANY one active character memory....


COPY ROM(ROMNUM)+RCHARNUM*16,16 TO $8000+ACHARNUM*16

ROMNUM is the actual file number that has the character you want.. (#2 is the default file)

RCHARNUM is the # of the character (0-255) in the source file # ROMNUM

ACHARNUM is the # of the character in active memory (0-255) you are replacing with the # ROMNUM character...


was8bit 2021-02-24 04:59

Check this out, you might find it interesting :)

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


Anywhere Games 2022-06-16 06:47

Is there a way to do it without using the character addresses?


was8bit 2022-06-16 16:31

COPY is a powerful command, but remember that lowresNX mimicks the experience of programming a handheld gaming system.... and copying blocks of memory from one location to another is common thing to do... parts of memory is useful by the machine for specific uses (video, audio, etc) and the rest of memory is for storing whatever data you want...

COPY then lets you move data into the spaces the gaming system is using, letting your change the data for graphics, or music, or colors, etc....


was8bit 2022-06-16 16:36

If you didn't need any graphics, but all you needed was 4 sets of fonts, you COULD use the FONT command to point to different places in character memory to use as your fonts... so if you used all 4 pages of character memory as fonts, FONT command could easily switch the font sets.. but that would eliminate any room for other graphics in your game...

I only use FONT command if i only have a few graphics, but I want to design my own fonts set, or just a portion of it, like i only need numbers... with careful planning i then can save a lot of needed memory space in my characters file....


Log in to reply.