an ooo so basic question

Posts about Z80 programming that do not relate to a particular computer
Post Reply
User avatar
Gee-k
Posts: 22
Joined: Sat May 04, 2019 9:35 am
Location: Scotland
Contact:

an ooo so basic question

Post by Gee-k » Fri Oct 18, 2019 11:24 am

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?
You don't fail, You learn how it's not done.
https://www.gee-k.net : Where I blog about my random geeky goings on.

User avatar
akuyou
Posts: 398
Joined: Mon Apr 22, 2019 3:19 am
Contact:

Re: an ooo so basic question

Post by akuyou » Sat Oct 19, 2019 9:51 pm

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
Chibi Akuma(s) Comedy-Horror 8-bit Bullet Hell shooter! // 「チビ悪魔」可笑しいゴシックSTG ! // Work in Progress: ChibiAliens

Interested in CPU's :Z80,6502,68000,6809,ARM,8086,RISC-V
Learning: 65816,ARM,8086,6809

User avatar
Gee-k
Posts: 22
Joined: Sat May 04, 2019 9:35 am
Location: Scotland
Contact:

Re: an ooo so basic question

Post by Gee-k » Mon Oct 21, 2019 8:50 am

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.
You don't fail, You learn how it's not done.
https://www.gee-k.net : Where I blog about my random geeky goings on.

Post Reply

Return to “General Z80 Programming”