[A83] Re: LCD update freq and working with 16bit numbers on the Z80
[Prev][Next][Index][Thread]
[A83] Re: LCD update freq and working with 16bit numbers on the Z80
> Van: Andreas Gustafsson <and_gu@hotmail.com>
>
> Adding by 12 is easy, since there is a 16 bit add, but subtracting by 12
> seems to be very complicated, the only solution I could have come up
> with this far is this (which looks like it's waisting many clock cycles)
:
>
> ld a,l
> sub 12
> ld l,a
> ld a,h
> sbc a,0
> ld h,a
what about:
;push bc ; BC can also be DE
ld bc,-12
add hl,bc
;pop bc
What happens, BC (or DE) gets loaded with $FFFF - $C (12d) = $FFF3
Let's say HL was $1234 (4660d)
$1234
$FFF3
----- +
$xxx7
$x12x
$11xx
$0xxx (plus an overflow...)
===>
$1227 (4647d = 4660d - 12d)
> My second question - does anyone know how many times per second you can
> update the LCD using the _GRBUFCPY_V call? I mean, what 'FPS' is the
> theoretical max, assuming that nothing else but the buffer copy is done?
Don't know the timings of _GRBUFCPY_V, but I do know that with ionFastCopy
(much faster) I had a framerate of about 144 (while plotting new sprites in
between).
;by Joe Wingbermuehle
FastCopy:
;di
ld a,$80 ; 7
out ($10),a ; 11
ld hl,$8E29-12-(-(12*64)+1) ; 10
ld a,$20 ; 7
ld c,a ; 4
inc hl ; 6 waste
dec hl ; 6 waste
fastCopyAgain:
ld b,64 ; 7
inc c ; 4
ld de,-(12*64)+1 ; 10
out ($10),a ; 11
add hl,de ; 11
ld de,10 ; 10
fastCopyLoop:
add hl,de ; 11
inc hl ; 6 waste
inc hl ; 6 waste
inc de ; 6
ld a,(hl) ; 7
out ($11),a ; 11
dec de ; 6
djnz fastCopyLoop ; 13/8
ld a,c ; 4
cp $2B+1 ; 7
jr nz,fastCopyAgain ; 10/1
ret ; 10
Hope this helps, btw, ionFastCopy is a built-in lib of Ion. And the code
needed for Venus lib is (hope it's good, my TASM syntax is a but rusty):
#define vnFastCopy $FE6F
.org $932C
.db "ç9_[?" ; send(9prgm0 (where 0 is theta)
#if venus ;
.db $0,$1,$1 ; No description nor icon
#else
.db $1 ; V-Explorer descriptor
.db icon-description ; lengthOfDescription+1
description: ;
.db "description..." ; no zero terminator
.db externals-icon ; heightOfIcon+1
icon: ;
.db 00000000b ; Icon (max. heightOfIcon = 7 bytes)
.db $2 ; numberOfExternals+1 (maximum = 11d)
externals: ;
.db $5,"~FCPY",$FF; We use the FastCopy-lib
You then only need to "call vnFastCopy" (or FastCopy).
Henk Poley <><