News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

taking chars out of fonts and entering text in "encoded" form.

Started by arnoldemu, 09:47, 28 May 10

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

arnoldemu

I need to reclaim some bytes in blue angel, so I need to remove some chars from the font.
No problem here.

However now, the ascii char codes do not relate directly to the same chars in the font, the chars in the font will be in a different position.

Is there an assembler or C trick where I can enter the text as ASCII in my program and it remaps it to the actual char positions in my font?

e.g.
(example clearly doesn't work, but you get the idea)

"PLAYER SCORE" -> "EFRTGD@SCRYE"

I think I will have to hardcode it but that is a pain.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

gerald

Hi Kevin

A simple indirection using a table that you use in your putchar() equivalent should do.
The table should contain in entry 80 (P), the 69(E) value etc ...
You also can reduce table size by only translating char between 32 and 127 (or less).
According to the translation rules you might have multiple tables as well
You just need to build the table by hand.
But this will cost you the table size and code around it.

An better way would be to have all your stings in a header file and pre-process this header file before compilation with an external script (perl or whatever).
You will have your source in a human readable state and save the bytes in compiled the code.

Gerald

arnoldemu

Quote from: gerald on 10:28, 28 May 10
Hi Kevin

A simple indirection using a table that you use in your putchar() equivalent should do.
The table should contain in entry 80 (P), the 69(E) value etc ...
You also can reduce table size by only translating char between 32 and 127 (or less).
According to the translation rules you might have multiple tables as well
You just need to build the table by hand.
But this will cost you the table size and code around it.

An better way would be to have all your stings in a header file and pre-process this header file before compilation with an external script (perl or whatever).
You will have your source in a human readable state and save the bytes in compiled the code.

Gerald
Hi Gerald,

Yes I was after some pre-process trickery that could do the work for me, either using the assembler or c-preprocessor to do it.
Well it seems I may have to write a program to read some strings and then generate the appropiate code for compiling/assembling.

No problem.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Executioner

Quote from: arnoldemu on 09:47, 28 May 10
Is there an assembler or C trick where I can enter the text as ASCII in my program and it remaps it to the actual char positions in my font?

Yes, WinAPE assembler has a character re-mapping instruction (looks like I forgot to document it!). The following code is from the CPC Plus frogger source code:


charset '0',#80
charset '1','9',1
charset ' ',10
charset 'A','Z',11
charset '-',37
charset 'c',38    ; Copyright


It maps the character '0' to #80, '1'..'9' to #01..#09, space as 10, 'A' as 11 etc, and to Copyright symbol as 'c'. You can then use

db 'ABC 10c'

would produce #0B #0C #0D #0A #01 #80 #26

Powered by SMFPacks Menu Editor Mod