Hello,I am not that well-versed in CPC BASIC programming so apologies in advance :)I have a script that displays a picture then starts a program with |cpm. That program doesn't display accented characters well, and I need to change the font.I have written a bunch of SYMBOL statements that give me what I want... in theory. In practice, I ran into problems:
- Putting it at the beginning of my script didn't do anything; putting it between the picture display and the "|cpm" call gave me an "improper argument error". I eventually found this post (https://www.cpcwiki.eu/forum/programming/basic-programming-tips/) that indicated it was probably because the picture display had a "MEMORY" statement. I inserted a "SYMBOL AFTER 256" as my first statement and the error went away... but the font still didn't change inside the CPM program.
- I found this page (https://www.seasip.info/Cpm/xbiosint.html) that seemed to indicate where CPM looks for the font on the CPC. I thus wrote "SYMBOL AFTER 256" then "MEMORY &87FF" then my SYMBOL statements, then the rest of the code (which includes another MEMORY statement). Predictably (because I'm not sure I understand what I'm doing) this didn't work. I then tried to put my "MEMORY &87FF" & SYMBOL after the image is displayed, but this didn't work either (no changes to the font).
Would anyone know what I am doing wrong?I can send the code to someone as a PM but I don't want to post it publicly (I'm not the one who wrote the original script).Thank you :)
Maybe this article may be giving the hint you need ?
https://cpcrulez.fr/applications_util-sonderzeichen_fur_cpm.htm (https://cpcrulez.fr/applications_util-sonderzeichen_fur_cpm.htm)
It's using the soundbuffer (so no sound for cp/m)
Oh, thank you very much for this link! This looks very promising. (And much more complicated than I thought... But it's good to know that SYMBOL doesn't work with CPM).No sound is fine for my application, so that could work!
Google Translate is not very clear on some aspects though... What is "DIN"? And I am also not sure I would be able to adapt this to my purposes; I have 20 characters I need to redefine, and they're not in a sequence, so I'm not sure how this DATA command can be adapted. Maybe I'll experiment... but if someone has an idea, I have attached my symbol commands to this post.
Thank you for your help, I appreciate it!
I think DIN here refers to the standard German keyboard layout. DIN is the German standards association, like BS for British standards, ANSI for American standards and ISO for international standards.
SYMBOL can be used from CP/M Plus, using the USERF Bios function to invoke the firmware TXT_SET_MATRIX call. Any symbol can be redefined, just like after using SYMBOL AFTER 0 in Locomotive Basic.
This program will do it:
SYMBOL.ASM
; Symbol
; The Basic SYMBOL command in Amstrad CPC CP/M PLus
; CP/M page 0 address
bios_jumps equ 1
argline equ 00080h
; CPC firmware address
txt_set_matrix equ 0BBA8h
start:
org 100h
call init_data
ld hl, argline + 1
call skip_spaces
call get_num
ld a, b
ld [charcode], a
ld de, chartable
nextvalue:
call skip_spaces
or a
jr z, doit
cp 0Dh
jr z, doit
call get_num
ld a, b
ld [de], a
inc de
jr nextvalue
doit:
ld a, [charcode]
ld hl, chartable
call do_userf
dw txt_set_matrix
call 0
skip_spaces:
ld a, [hl]
cp ' '
ret nz
inc hl
jr skip_spaces
get_num:
ld b, 0
digit:
; Multipliy by 10
ld a, b
add a, a
ld b, a
add a, a
add a, a
add a, b
ld b, a
; Add current digit
ld a, [hl]
sub '0'
add a, b
ld b, a
inc hl
ld a, [hl]
cp ' '
ret z
cp 0Dh
ret z
cp 0
ret z
jr digit
init_data:
; Fill the character data with 0
ld hl, chartable
xor a
ld b, 8
init_more:
ld [hl], a
inc hl
djnz init_more
ret
;---------------------------------------
do_userf:
push hl
push de
ld hl, [bios_jumps]
ld de, 057h ; Offset to USERF
add hl, de
pop de
ex [sp], hl
ret
;---------------------------------------
charcode db 0
; Must be in the high 16K
chartable equ 0C000h
end start
;---------------------------------------
If you don't have a Z80 assembler:
SYMBOL.HEX:10010000CD5501218100CD3301CD3A0178326C010A
:100110001100C0CD3301B7280CFE0D2808CD3A01DF
:1001200078121318EE3A6C012100C0CD6001A8BB13
:10013000CD00007EFE20C02318F90600788747878F
:100140008780477ED6308047237EFE20C8FE0DC8BC
:10015000FE00C818E72100C0AF0608772310FCC9CD
:0D016000E5D52A010011570019D1E3C900AF
:00000001FF
Use HEXCOM SYMBOL.HEX to create SYMBOL.COM
Example use:
SYMBOL 97 255 127 63 31 15 7 3 1
Redefine 'a' to a triangle.