![]() |
how to use a standard character set - Printable Version +- Forum (https://www.boriel.com/forum) +-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12) +--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11) +---- Forum: How-To & Tutorials (https://www.boriel.com/forum/forumdisplay.php?fid=13) +---- Thread: how to use a standard character set (/showthread.php?tid=211) |
how to use a standard character set - programandala.net - 04-20-2010 Sometimes, in order to use the Spanish characters (áéíóúüñÁÉÍÓÚÜÑ¿¡) in my Spectrum programs, I put them in the place of less used Spectrum chars (#, ', @...). In the source code of my current project there's a lot of Spanish texts to be printed by the Spectrum. It would be uncomfortable to use those fake chars all over the source. Then I had a quite brilliant ![]() First, I wrote a trivial asm sub to change the character set address. Then I added the character graphics, with the Spanish chars in the right position (in the ISO-8859-1 standard). The only needed trick is to fill the gaps of the unused chars. Happily, I already had all the character definitions is assembler DEFBs, in another project of mine. This is the first part of the sub: Code: sub fastcall changeCharacterSet() And so on... This is the end: Code: defs (243-241-1)*8 ; unused chars Easy, isn't it? The next task is to hack the print.asm library in order to print all characters from 32 to 255. I show the removed or added lines (they are clearly marked): First: Code: ; 1 LINE REMOVED: And then the rest: Code: ; 8 LINES REMOVED: That's all. Now all characters from 32 to 255 are in the same set: no block graphics, no UDGs, no Basic tokens. Any desired graphic can be defined in any character code. Any standard 8-bit character set can be used. Now I can write the Spanish texts in the source and they show perfectly on the Spectrum's screen. I'd like my hacked version to be an independent library, to be #included, and used with a new command (print224, printplus or whatever). But rigth now that task is beyond my current skill with ZX Basic. Any help? Another issue is to use the gaps of the unused chars for variables, but I'm still not sure how to use asm labels in ZX Basic. I have to explore it. Any help? Now I will tinker with the second part of the system: I have to modify my own input routine, to let it accept some key combinations (e.g. Symbol Shift (+Shift)+letter) to get the Spanish characters... Re: how to use a standard character set - boriel - 04-20-2010 Having "page codes" is a nice idea. I implemented UDG just for compatibility, but there is a simple way to specify a different PRINT routine, by using #ifdef directives, and invoking them at the command line. It could be something like this: zxb.py --DUSE_PRINT_SPANISH ... Code: # FILE: print.asm Re: how to use a standard character set - programandala.net - 04-20-2010 boriel Wrote:zxb.py --DUSE_PRINT_SPANISH Quote:error: no such option -D Is it a planned option for a future release? Re: how to use a standard character set - boriel - 04-20-2010 programandala.net Wrote:It was just an idea!boriel Wrote:zxb.py --DUSE_PRINT_SPANISH ![]() Note: use -D option or --define (see -h for help). Single dash is for short options, whilst double-dash (--) is for long ones. Try your command again. |