[Coco] GFX2("DEFBUFF"

L. Curtis Boyle curtisboyle at sasktel.net
Sat Feb 27 19:33:31 EST 2021


Are you running EOU? If so, can you go to another window and run GPMAP, and make sure that the DefBuff is properly allocating the get/put buffer. 
(I am not back to my computer for a bit - I will try your exact code when I get back)


L. Curtis Boyle
curtisboyle at sasktel.net



> On Feb 27, 2021, at 5:33 PM, coco at jechar.ca wrote:
> 
> The error I get the second time I run the program.
> 
> Error #194 - Bad/Undefined buffer number.
> 
> On 2021-02-27 17:53, coco at jechar.ca wrote:
>> 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
> 
> -- 
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
> 



More information about the Coco mailing list