[Coco] GFX2("DEFBUFF"
coco at jechar.ca
coco at jechar.ca
Sat Feb 27 17:53:47 EST 2021
I dont get what that URL part is about so I tried this
It compiles but gives the wrong answer the first time it is run
and produces an error the second time it is run. Maybe you can
see what I am doing wrong.
PROCEDURE buffy
(* Test Program for
(* BASIC09 to get group 4, buffer 1 as an example.
(*
DIM gpptr,gpsize:INTEGER
gpptr = 0
gpsize = 0
RUN GFX2("DEFBUFF",4,1,128)
RUN GetGPAddress(gpptr,gpsize)
PRINT "The ADDRESS of group 4, buffer 1 is:";
PRINT gpptr
PRINT "The SIZE of group 4, buffer 1 is:";
PRINT gpsize
END
PROCEDURE GetGPAddress
PARAM gpptr,gpsize:INTEGER
TYPE registers=cc,a,b,dp:BYTE;x,y,u:INTEGER
DIM regs:registers
(* Std Out
regs.a=1
regs.b=$84
(* group & buffer #’s
regs.x=$0401
(* Map it in (regs.y=0 to map it back out again)
regs.y=1
RUN SYSCALL($8d,regs)
gpptr=regs.x
gpsize=regs.y
END
On 2021-02-25 21:43, L. Curtis Boyle wrote:
> On Feb 25, 2021, at 8:25 PM, coco at jechar.ca wrote:
>>
>>
>> If you have defined a graphics buffer with DEFBUFF is there some
>> way to determine it's actual address in your process space
>> so that you can poke values directly to the buffer.
>>
>> Charlie.
>>
> Defbuff doesn’t map the buffer in; it merely allocates it from the
> computer's memory and lets you define the group/buffer #’s, and the
> size of the buffer itself. To map it in (and map it out), use the
> GetStat call SS.MpGPB.
>
> An example in BASIC09 to get group 4, buffer 1 as an example (set up
> as a callable module: Call with RUN GetGPAddress(buffptr,buffsize):
> PROCEDURE GetGPAddress
> PARAM gpptr,gpsize:INTEGER
> TYPE registers=cc,a,b,dp:BYTE;x,y,u:INTEGER
> DIM regs:registers
> (* Std Out
> regs.a=1
> regs.b=$84
> (* group & buffer #’s
> regs.x+$0401
> (* Map it in (regs.y=0 to map it back out again)
> regs.y=1
> RUN SYSCALL($8d,regs)
> IF LAND(regs.cc <http://regs.cc/>,1)=1 THEN
> PRINT “ERROR #”;regs.b
> gpptr=0
> gpsize=0
> ELSE
> gpptr=regs.x
> gpsize=regs.y
> ENDIF
> END
>
>
>
> L. Curtis Boyle
> curtisboyle at sasktel.net
>
> TRS-80 Color Computer Games website
> http://www.lcurtisboyle.com/nitros9/coco_game_list.html
>
> NitrOS-9 Ease of Use (EOU) Project
> http://www.lcurtisboyle.com/nitros9/nitros9.html
More information about the Coco
mailing list