Changing border colour on Plus to visualize routine time

Started by redbox, 16:33, 05 October 10

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

redbox

I can't seem to get the border colour to change on the Plus when using the ASIC so I can visualize the time a routine takes. 

On a normal CPC this works:


;WAIT FOR FRAME FLYBACK

; change border colour to blue
ld bc,&7F10
out (c),c
ld c,&55
out (c),c

; ROUTINE CODE

; change border colour to black
ld bc,&7F10
out (c),c
ld c,&54
out (c),c

;LOOP BACK


But it doesn't work on when using the ASIC.  So I tried the following instead:


        ld bc,&7fb8        ;page in ASIC ram
        out (c),c

        ld a,(border_toggle)
        xor 1
        ld (border_toggle),a

        jr z,border_white

border_black:    ld hl,&0FFF
        ld de,&6420
        ld bc,1*2
        ldir

border_white:    ld hl,&0111
        ld de,&6420
        ld bc,1*2
        ldir

        ld bc,&7fa0        ;page out ASIC ram
        out (c),c

        ret

border_toggle:    defb 0


...but it also doesn't work.  Any ideas?

arnoldemu

Quote from: redbox on 16:33, 05 October 10
I can't seem to get the border colour to change on the Plus when using the ASIC so I can visualize the time a routine takes. 

On a normal CPC this works:


;WAIT FOR FRAME FLYBACK

; change border colour to blue
ld bc,&7F10
out (c),c
ld c,&55
out (c),c

; ROUTINE CODE

; change border colour to black
ld bc,&7F10
out (c),c
ld c,&54
out (c),c

;LOOP BACK


But it doesn't work on when using the ASIC.  So I tried the following instead:


        ld bc,&7fb8        ;page in ASIC ram
        out (c),c

        ld a,(border_toggle)
        xor 1
        ld (border_toggle),a

        jr z,border_white

border_black:    ld hl,&0FFF
        ld de,&6420
        ld bc,1*2
        ldir

border_white:    ld hl,&0111
        ld de,&6420
        ld bc,1*2
        ldir

        ld bc,&7fa0        ;page out ASIC ram
        out (c),c

        ret

border_toggle:    defb 0


...but it also doesn't work.  Any ideas?


2nd should be:


       ld bc,&7fb8        ;page in ASIC ram
        out (c),c

          ld a,(border_toggle)
        xor 1
        ld   (border_toggle),a

        jr z,border_white

border_black:      ld hl,&0FFF
ld (&6420),hl
jr border_done
border_white:    ld hl,&0111
ld (&6420),hl
border_done:
        ld   bc,&7fa0        ;page out ASIC ram
        out (c),c

          ret

border_toggle:    defb 0


Your code wants to copy from &111 to the colour register, not actually put &111 into it.
Also setting border black then immediately overrides with border white.

Your code for setting border the other way is fine.
Except you need to put code between ;)
and no need to wait for flyback ;)


EDIT:

My personal choice is this:


LD BC,&7F10
OUT (C),C
LD BC,&7F54
OUT (C),C

;; code

LD BC,&7F10
OUT (C),C
LD BC,&7F4B
out (c),c


I don't have any border toggle as you have here.
I then remove the outs when I'm done timing.


My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

redbox

Sorry, yes I got the second code wrong (too much Z80 today!).

But neither still work and I think the problem is because features of the ASIC are being used...?

I am trying this on WinAPE btw, but if you choose a normal CPC then the border changing routine using the OUTs works, if you're using the Plus and ASIC it doesn't  :(

arnoldemu

Quote from: redbox on 17:04, 05 October 10
Sorry, yes I got the second code wrong (too much Z80 today!).

But neither still work and I think the problem is because features of the ASIC are being used...?

I am trying this on WinAPE btw, but if you choose a normal CPC then the border changing routine using the OUTs works, if you're using the Plus and ASIC it doesn't  :(
It should work even with ASIC enabled. I tested it on a real plus a few years ago. So maybe you found a bug in Winape?
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Grim

I also use the regular OUT &7F10 to do that all the time (because this way I don't have to bother paging in/out the ASIC RAM) and it works (at least on my Plus, I don't remember about WinAPE).

redbox

The OUT does work in WinAPE, I'm was just being a complete noob as my routines were just much faster than I realised, yay!  8)

Thanks guys.

Executioner

WinAPE has a way of changing palette colours from a breakpoint condition, so you don't have to do it in code, and it also has an option to display interrupt timing in the border, so if you put your routine in an interrupt you can time it that way. Just in case it's useful :)

Powered by SMFPacks Menu Editor Mod