Character Source ?


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....


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 :)


Log in to reply.