Ok, I've got to a stage with my starscrl program in Small-C where I'm trying to redefine characters 254 & 255, so it looks like a starship, but for some reason my redefine characters are not being redefined and I cannot find what is wrong with my code, because it's coming up error free in the compilation. :'(
The problem is I'm not sure if it's the matrix routine I made from the modified CPCIOLIB.C which is at fault, or my setup routine from my starscrl.c program (obviously I've got the data in arrays p1 & p2, which I haven't included here). I've added the oscall routine (which works fine) just as a reference.
What I've tried to do is setup pointers and have paddr1 & paddr2, the routine I'm using from the Firmware is TXT SET MATRIX (&BBA8 or 48040), which has the character in A and the Address of the Matrix is in HL, so what I've tried to do is use paddr1 to point to the address of p1[0] for example and likewise for paddr2, but the program is simply displaying the original graphic symbols for 254 & 255. :'(
Unfortunately I'm limited in what I should be doing here and I guess if I cannot do it this way, I could try using control codes through putchar to hopefully redefine it that way.
matrix(ch,table) int ch,*table;
{
regs[0]=ch<<8;
regs[1]=table;
oscall(48040,regs);
}
setup()
{
int p1[8],p2[8],paddr1,paddr2;
paddr1=&p1[0];
paddr2=&p2[0];
/* Set p1 & p2 with data for the object */
matrix(254,paddr1);
matrix(255,paddr2);
}
oscall(adr,regpack)
int adr;
int *regpack; /* af,hl,de,bc */
{
#asm
pop bc ; ret
pop de ; regs
pop hl ; adr
push hl
push de
push bc
ld (031h),hl ; rst 30h: user
ld a,0c3h
ld (030h),a
push de
ex (sp),ix
ld l,(ix+0)
ld h,(ix+1)
push hl
pop af
ld l,(ix+2)
ld h,(ix+3)
ld e,(ix+4)
ld d,(ix+5)
ld c,(ix+6)
ld b,(ix+7)
ex (sp),ix
rst 30h ; execute os-call
ex (sp),ix
ld (ix+2),l
ld (ix+3),h
push af
pop hl
ld (ix+0),l
ld (ix+1),h
ld (ix+4),e
ld (ix+5),d
ld (ix+6),c
ld (ix+7),b
pop de
JP CCSXT ;move A to HL & sign extend
#endasm
}