News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

How to redefine characters in C/Assembly

Started by Fabrizio, 11:05, 20 September 17

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Fabrizio

Hi!

I am developing in ANSI C the "universal" multi-system 8-bit game CROSS CHASE for (nearly) all 8 computers including the CPC series.
I am NOT using BASIC. I may use some Assembly but I would prefer to do everything in C.

I am using Z88DK and CC65. Z88DK is my choice for Z80 because it supports all other Z80 targets.

I need to understand how to redefine characters in 320x200 mode (which is the mode I am using for the game).


You find binaries and source code at
https://github.com/Fabrizio-Caruso/CROSS-CHASE/releases

  Fabrizio

rpalmer

Fabrizio,

You cannot use C on its own.

You would need to write a wrapper in C which calls the required OS routine to re-define characters.

rpalmer

pelrun

#2
The firmware routines you want are below (the table is sized to fit all the chars from the provided start char through to 255, and it copies over the ROM definitions, so don't just call it on a predefined table):



&BBA8   TXT SET MATRIX
      Action: Installs a matrix for a user-defined character
      Entry:  A contains the character which  is being defined and HL
              contains the address of the matrix to be used
      Exit:   If the character is user-definable  then Carry is true;
              otherwise Carry is false,  and  no  action is taken; in
              both cases AF, BC, DE and HL are corrupt, and all other
              registers are preserved


&BBAB   TXT SET M TABLE
      Action: Sets the address of a user-defined matrix table
      Entry:  DE is the first character  in  the  table and HL is the
              table's address (in the central 32K of RAM)
      Exit:   If there are no  existing  tables  then Carry is false,
              and A and HL are both corrupt; otherwise Carry is true,
              A is the first character and HL is the table's address;
              in both cases BC, DE and the other flags are corrupt

Powered by SMFPacks Menu Editor Mod