Page 1 of 1

an ooo so basic question

Posted: Fri Oct 18, 2019 11:24 am
by Gee-k
Slightly ashamed to be asking this, but i've been searching the internet for a while and through all the lessons etc.
I'm looking at the firmware routines and have managed to make sure the screen is mode 1 and change the border colour of my cpc by using:

Code: Select all

org &5000
Printchar equ &bb5a

ld a,1
call &bc0e ;clear screen to mode 1

;change border and screen colour
ld bc,&0b0b ;
call &bc38

ret
I'm trying to now change the text (pen) background (ink 0) to the colour I want but I can't seem to find out how to do it in assembly. It's so simple in BASIC. My program that I made in BASIC and now converting to asm uses the following:

Code: Select all

30 BORDER 11:INK 0,11:INK 1,0
I've tried firmware routine &bc32 to try set the pen after setting bc, but it doesn't appear to be doing anything. If I call it using BASIC on the system with a parimiter (any it seems) it changes the text to light green.

How would you set about doing this in z80asm?

Re: an ooo so basic question

Posted: Sat Oct 19, 2019 9:51 pm
by akuyou
Don't worry about asking questions like this, it's perfectly normal for someone learning.
BC32 is the one you want... you need to set the Pen number in A, an the two inks in BC...

Here's some code to set the background blue, and text red:

Code: Select all

ld a,0	    ;Pen
ld bc,&0b0b ;Color (twice) blue
call &bc32

ld a,1	    ;Pen
ld bc,&0707 ;Color (twice) red
call &bc32
I wonder, do you have the firmware guide, this is what I use for these kinds of problem:
http://www.cpcwiki.eu/imgs/0/02/CPC_firmware.pdf

Re: an ooo so basic question

Posted: Mon Oct 21, 2019 8:50 am
by Gee-k
Many thanks Keith.

I was hoping by tagging you on twitter with my query that more of your followers would see it and maybe give you a break from always coming to my rescue.
I really appreciate that you've set yourself up here to help others learn assembly. It's a great thing that you do.

After you answered my question, I had another look over the firmware guide and notice that it is missing the 'A', Instead it just says 'Containts the pen number'. Any decent detective would realise that this should have said 'A' and acted acordingly haha!
Especially seeing as the next item is similar and has the A in there.

Thanks again for your help! I'll now power on and try see if I can re-code the rest of my BASIC program in ASM.
I might take your advice and have some of it running in BASIC and the calculations running in ASM.