HCOLOR pokes

Post your SmartBASIC questions here
Post Reply
User avatar
joltguy
Posts: 91
Joined: Wed Aug 21, 2019 5:17 am
Location: Toronto, Canada
Contact:

HCOLOR pokes

Post by joltguy » Sun May 17, 2020 9:49 am

Hi all

I've been having fun going through Guy Cousineau's "Exploring SmartBASIC" document and in the High Resolution Graphics section it says:
In HGR it is highly recommended to disable the check and translation; see HPLOT for applications. The value check is disabled with a POKE of 255 at 11127 (2B76). The translation check is disabled by POKE 18747, 201.
The POKE for disabling the value check works as expected. With it in place I am able to supply values above 15 to HCOLOR. However the second POKE for disabling the translation check doesn't seem to work. Once I POKE it, none of the colours work at all. No matter what colour I specify, all my HPLOTs are rendered as black (or maybe transparent). I've also tried POKE 18747 with other values and had no success.

Can anyone provide some insight into what's happening or what I should do differently? I am using SmartBASIC 1.0.

User avatar
pearsoe
Posts: 11
Joined: Sun Jul 21, 2019 3:28 pm

Re: HCOLOR pokes

Post by pearsoe » Mon May 18, 2020 4:04 pm

It looks like the poke 18747,201 is trying to bypass the routine at 18747 by inserting a RET (opcode C9 = 201). But that routine seems to need to return with a valid value in register A. Try this:

poke 11127,255: poke 18747,121:poke 18748,201

This disables the value check with the poke 11127,255

Then inserts a LD A,C and then the RET with poke 18747,121: poke 18748,201

So this:

4936 215d49 ld hl,495dh
4939 1803 jr 493eh
493b 214d49 ld hl,494dh
493e 0600 ld b,00h
4940 09 add hl,bc
4941 7e ld a,(hl)
4942 c9 ret

Becomes this:
4936 215d49 ld hl,495dh
4939 1803 jr 493eh
493b 79 ld a,c
493c c9 ret
493d 49 ld c,c ; this is never called
493e 0600 ld b,00h
4940 09 add hl,bc
4941 7e ld a,(hl)
4942 c9 ret

User avatar
joltguy
Posts: 91
Joined: Wed Aug 21, 2019 5:17 am
Location: Toronto, Canada
Contact:

Re: HCOLOR pokes

Post by joltguy » Mon May 18, 2020 9:30 pm

:!: Pure genius... that works perfectly. Thank you very much for the solution and the technical explanation!

Post Reply