Author Topic: How to redefine characters in C/Assembly  (Read 888 times)

0 Members and 1 Guest are viewing this topic.

Offline Fabrizio

  • CPC464
  • **
  • Posts: 34
  • Country: fr
  • Liked: 16
  • Likes Given: 1
How to redefine characters in C/Assembly
« on: 13:05, 20 September 17 »

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


Online rpalmer

  • 6128 Plus
  • ******
  • Posts: 569
  • Country: au
  • Liked: 398
  • Likes Given: 19
Re: How to redefine characters in C/Assembly
« Reply #1 on: 13:25, 20 September 17 »

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.


Offline pelrun

  • Supporter
  • 6128 Plus
  • *
  • Posts: 762
  • Country: au
    • index.php?action=treasury
  • Liked: 443
  • Likes Given: 272
Re: How to redefine characters in C/Assembly
« Reply #2 on: 13:55, 20 September 17 »
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):

Code: [Select]

      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

      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
« Last Edit: 13:58, 20 September 17 by pelrun »