Jump to content
IGNORED

Hisoft basic users ?


Recommended Posts

I am trying to do a bit of HISoft Basic programming though keep getting stuck on simple things.

 

For example, I can create forms with the RSC file, load them in the editor etc. I can use vst_effect and related commands for graphics and text on screen. Though I am totally stuck on how to get text out of a button or object on the form ? I would have thought as I know the object/tree number (I can click on the button text and have it turning the button number) that I can use that button number to get the text from within it. Though so far I cannot find a command to actually do that. There must be one somewhere as when typing something manually in a box on screen you can normally get that text and save it into a file. Though I cannot see any way to do that :(

Link to comment
Share on other sites

Hi Exxos have you looked at the WTEST.BAS (and associated WTEST.PRG/ WTEST.RSC) example on the Hisoft basic disk, this should give a basic example of how to set up and use a RSC file in Hisoft. There is another section on using WERCS in the technical reference manual, I'll try and get it scanned tomorrow for you. I think it might be the SET_GETINFO/ GET_TEDINFO and SET_BUTTON/ GET_BUTTON stuff in there that you want to look at in WTEST.BAS.

Link to comment
Share on other sites

I used a lot changing of button (and other objects) text in AES . And that should be complete independent from programming language you use. All you need to do is to redraw that button, after changing it's text in RSC self.

If RSC is loaded as separated file, you need function to get button's address in RAM, then can get text address too. If RSC is integrated in code, then you have text address directly.

So, all you need in fact is to know AES commands and how to call them from used programming language.

objc_draw is what you need . objc_change will not change txt.

Link to comment
Share on other sites

Hi Exxos have you looked at the WTEST.BAS (and associated WTEST.PRG/ WTEST.RSC) example on the Hisoft basic disk, this should give a basic example of how to set up and use a RSC file in Hisoft. There is another section on using WERCS in the technical reference manual, I'll try and get it scanned tomorrow for you. I think it might be the SET_GETINFO/ GET_TEDINFO and SET_BUTTON/ GET_BUTTON stuff in there that you want to look at in WTEST.BAS.

 

I only have Hisoft basic itself and wercs. I never had a original copy of it. So other than the editor itself, I have nothing else to do with it (other than a few lib files)

Link to comment
Share on other sites

I used a lot changing of button (and other objects) text in AES . And that should be complete independent from programming language you use. All you need to do is to redraw that button, after changing it's text in RSC self.

If RSC is loaded as separated file, you need function to get button's address in RAM, then can get text address too. If RSC is integrated in code, then you have text address directly.

So, all you need in fact is to know AES commands and how to call them from used programming language.

objc_draw is what you need . objc_change will not change txt.

 

The buttons are loaded from a RSC file. So like you say, need to know address in RAM. But I have no idea how to work that. But similar problem is when I have a input box, I still need to read text from that somehow. I guess input box could be generated in code rather than RSC file. But I am a total beginner at hisoft basic, and figuring anything out is near impossible.

 

If I could generate buttons in code and replicate the locations on screen then I could do it that way. I think it may be easier to do buttons in code, but without some easy to follow examples or instructions its very difficult to figure stuff out. I do think not using RSC file for stuff might make life easier as more stuff is controlled in code without having to access RAM address's for stuff. The RSC file seems more of a hack way of doing things to me :-\

Link to comment
Share on other sites

Actually RSC file are the easy way, because the RSC editor assigns the object numbers to variables for you. Otherwise, you would have to hand edit all the object numbers every time you add or remove an object. GEM uses object numbers to return results for like form_do() and so on. You probably won't find any code to build dialogs on the fly in BASIC, that would be hard to do.

 

In GFA you have OB_xxx() commands, like OB_X(tree,object)=newx, etc.. or to set a string CHAR{OB_SPEC(tree,object)}="text". Likewise they work as functions so you can inquire what the user has done after the dialog management ends. I'm sure Hisoft has similar commands and if not they are easy commands to write, once you know the layout of an object tree.

 

See rsrc_gaddr() to get the address of various structures in a loaded RSC file.

Edited by lp060
Link to comment
Share on other sites

I know the object numbers, if I click on a button it returns its number in the tree. The first one is "53". and each button go up a number. That isn't a problem. Just how to read and/or edit text from that button is the problem. So far I have been unable to find a command to do it, but there must be a way. I can call a window with all the objects from the RSC file. Though rsrc_gaddr() just seems to return "1" which makes no sense either. When I get home on Monday I will post the lines I am using.

 

I was looking at ob_Spec, but that seems to return values and needs a array of variables which I have not a lot of clue what the docs are on about. They seem to assume you know all about GEM and how to use it before picking up the manual. zogging kindly scanned the manual for me, though it seems to be one of those manuals which tells you all about what hisoft basic can do, but not actually tell you how to do it :mad:

Link to comment
Share on other sites

RSRC_GADDR() is supposed to return something other than zero if the command was carried out without problems, so if it returns "1" then that simply means "no error" :)

 

According to the Atari Compendium, the address to the object tree (or individual object) sought for is filled in at the location pointed to by "addr". (See syntax below)

 

rsrc_gaddr( type, index, addr )

 

WORD type, index;
VOIDPP addr;

 

I have no clue about the level of support for AES commands built into HiSoft Basic but considering this is standard stuff for any GEM app I assume it ought to look more or less identical to the syntax above.

 

 

Regards,

 

/Joakim

Link to comment
Share on other sites

As gokmase was trying to point out status=rsrc_gaddr( type, index, addr ), the address is returned in the 3rd parameter and not at status. Even gfa follows this 'C' binding exactly, I would expect HiSoft to do the same, I hope so anyway.

 

With ob_spec() it returns a pointer to a string or a pointer to another structure, it depends on the object type. Hence the term OBject SPECific.

 

Indeed most manuals do not have tutorials. They often show just enough to explain the parameters, the GFA manual is the same way, plus tons of typos as a bonus feature. You really need some additional GEM tutorial with documentation on the structure of object trees.

Edited by lp060
Link to comment
Share on other sites

The things are that Basic is programming language with more-less standardized command, function set. And that includes not AES, RSC related commands, of course. So, first thing you need to do is to get some AES documentation. Atari Compendium is for instance pretty complete doc, including AES, GEMDOS, BIOS, VDI ... All what Basic need to do is support for diverse OS function calls.

Link to comment
Share on other sites

I have been using this site http://toshyp.atari.org/en/008010.html Though there is many pages on there which explain stuff..

 

 

As gokmase was trying to point out status=rsrc_gaddr( type, index, addr ), the address is returned in the 3rd parameter and not at status. Even gfa follows this 'C' binding exactly, I would expect HiSoft to do the same, I hope so anyway.

 

ahhh, see I did not know that, it was part of what was confusing me as variables seem to appear form nowhere, so that would explain it.

 

 

http://toshyp.atari.org/en/008011.html#rsrc_gaddr

 

See that site does not explain it very well.

8.17.2 rsrc_gaddr

Name:	»Resource get address« - Obtain address of an object in a resource set.
Opcode:	112
Syntax:	int16_t rsrc_gaddr ( int16_t re_gtype, int16_t re_gindex, void *gaddr );
Description:	The call rsrc_gaddr obtains the start addresses of various object structures of resource files loaded into memory with rsrc_load. The following apply:

Parameter	Meaning
re_gtype	Type of structure searched for:
 	R_TREE 0  = Object tree
 	R_OBJECT 1  = Individual OBJECT
 	R_TEDINFO 2  = TEDINFO structure
 	R_ICONBLK 3  = ICONBLK structure
 	R_BITBLK 4  = BITBLK structure
 	R_STRING 5  = Free string data
 	R_IMAGEDATA 6  = Free image data
 	R_OBSPEC 7  = ob_spec field in OBJECT
 	R_TEPTEXT 8  = te_ptext in TEDINFO
 	R_TEPTMPLT 9  = te_ptmplt in TEDINFO
 	R_TEPVALID 10 = te_pvalid in TEDINFO
 	R_IBPMASK 11 = ib_pmask in ICONBLK
 	R_IBPDATA 12 = ib_pdata in ICONBLK
 	R_IBPTEXT 13 = ib_ptext in ICONBLK
 	R_BIPDATA 14 = ib_pdate in BITBLK
 	R_FRSTR 15 = ad_frstr free string
 	R_FRIMG 16 = ad_frimg free image
re_gindex	Index of the structure searched for
gaddr	Address of the desired structure

So gaddr is actually the RETURNED address then ? see if that document said "returned address" I would have known it was a returned value, not a address I actually had to input :thumbsdown:

Link to comment
Share on other sites

The TOS HYP site is actually more accurate than The Atari Compendium which is plagued with typos. However, it does suffer a little bit from being translated from German. ;) If you contact Gerhard at http://toshyp.atari.org/en/001001.html he will fix it. He is very good at supporting his site.

Edited by lp060
Link to comment
Share on other sites

Personally I have learned most of what I know now about GEM through example code. Digesting other programmers code and understanding their solutions has been a great way for me to move forward :)

 

I guess there is a chance you are at a disadvantage when it comes to finding existing GEM examples written in Hisoft Basic, but surely there ought to be something out there for you to find?

 

 

Best of luck with continued work on your project!

 

 

Regards,

 

/Joakim

Link to comment
Share on other sites

Thats the problem that there isn't anything online anywhere. I always try to keep STOS stuff online, but does not seem to have been anyone to keep stuff like hisoft basic stuff online. A source might be coverdisks where sometimes they have code snippets etc. I can't find anything in floppyshop or a few other places I've looked around either. Its pretty much like nobody ever used Hisoft basic, ever :(

Link to comment
Share on other sites

What I have tried is poking the value returned by rsrc_gaddr and just looping though util i found the data.

 ÿÿÿÿ      ‰z ˜   Ø           A”° P P à ÿÿÿÿ      î   0 " ÿÿÿÿ        P 0 " ÿÿÿÿ      2  ” 0 " 
  	      A”  P P à ÿÿÿÿ      T   0 " 	ÿÿÿÿ      v  P 0 " ÿÿÿÿ      ˜  ” 0 "        q | P Ð ÿÿÿÿ      ‰–   ¨  
ÿÿÿÿ      ‰²   ¨  ÿÿÿÿ      ‰Î  $ ø          ‰ê  4 ø  ÿÿÿÿ      Š"  „ ø  ÿÿÿÿ      Š>  ”    ÿÿÿÿ      ŠZ  ¤ ˜  ÿÿÿÿ      Šv  ´            Š’  D ø          ŠÊ  T ø          ‹  d ø  
        ‹V  t ø  ÿÿÿÿ    ’à    @   ÿÿÿÿ    ’ç¸   @  ÿÿÿÿ      Š    ”  ÿÿÿÿ      Š®      ÿÿÿÿ      Šæ $             ‹ @     ÿÿÿÿ      ‹:      ÿÿÿÿ      ‹r 0   Ä ÿÿ  @      € @ 9 0 2  "     ’î  8           °  8 ð ÿÿÿÿ      ’ï     8  ÿÿÿÿ      ’÷    8  ÿÿÿÿ      ’ÿ     8  ÿÿÿÿ      “   0 8  ÿÿÿÿ      “   @ 8  	ÿÿÿÿ      “   P 8  
ÿÿÿÿ      “   ` 8  ÿÿÿÿ      “'   p 8  ÿÿÿÿ      “/   € 8  
ÿÿÿÿ      “7    8  ÿÿÿÿ      “?     8  ÿÿÿÿ      “G   ° 8  ÿÿÿÿ      “O   À 8  ÿÿÿÿ      “W   Ð 8  ÿÿÿÿ      “_   à 8  "  !        ø  0 ð ÿÿÿÿ      “g     0  ÿÿÿÿ      “n    0  ÿÿÿÿ      “u     0  ÿÿÿÿ      “|   0 0  ÿÿÿÿ      “ƒ   @ 0  ÿÿÿÿ      “Š   P 0  ÿÿÿÿ      “‘   ` 0  ÿÿÿÿ      “˜   p 0  ÿÿÿÿ      “Ÿ   € 0  ÿÿÿÿ      “¦    0  ÿÿÿÿ      “­     0  ÿÿÿÿ      “´   ° 0   ÿÿÿÿ      “»   À 0  !ÿÿÿÿ      “   Ð 0  ÿÿÿÿ      “É   à 0   # 1             ð $ÿÿÿÿ  A “Ð    ˆ  %ÿÿÿÿ    “á   ˆ  &ÿÿÿÿ    “ì      'ÿÿÿÿ    “ÿ  0 €  (ÿÿÿÿ    ”  @ ˆ  )ÿÿÿÿ    ”  P ˆ  *ÿÿÿÿ    ”,  `   +ÿÿÿÿ    ”?  p ˆ  ,ÿÿÿÿ    ”L  € ˆ  -ÿÿÿÿ    ”Y   `  .ÿÿÿÿ    ”f    ˆ  /ÿÿÿÿ    ”q  ° ˆ  0ÿÿÿÿ    ”~  À ˆ  1ÿÿÿÿ    ”  Ð h  "ÿÿÿÿ    ”  à h  : 3 9    ”«X  ˜ ` 4ÿÿÿÿ      ”¬   @  8 5 7        X  0 @ 6ÿÿÿÿ      ”µ     0  7ÿÿÿÿ      ”¼    0  4ÿÿÿÿ      ”à   0 0  9ÿÿÿÿ      ”Ê  !    2ÿÿÿÿ      ”Ï  @ @  ;ÿÿÿÿ    ”ØX € ˜   <ÿÿÿÿ     ‹ŽX  €  =ÿÿÿÿ     ‹ª À  4  >ÿÿÿÿ     ‹Æ`  X  ?ÿÿÿÿ     ‹â  4  @ÿÿÿÿ     ‹þ   4   ÿÿÿÿ     Œ` x P ÿÿ      €     0  ÿÿÿÿ `  Œ6   ð ÿÿ        €    X       •;  Ð8 0 ÿÿÿÿ     ŒR           •k  8 ° ÿÿÿÿ     •r  (  ÿÿÿÿ     •˜   (  ÿÿÿÿ     •¾  0(  ÿÿÿÿ     •ä  @(  	ÿÿÿÿ     –
  P(  
ÿÿÿÿ     –0  `(  ÿÿÿÿ     –V  p(  ÿÿÿÿ     –|  €(  ÿÿÿÿ     –¢  ( ÿÿ                                                (  ÿÿÿÿ       –È     P  ÿÿÿÿ       –Ò P   0  ÿÿÿÿ       –Ø €   0  ÿÿÿÿ       –Þ °   H  ÿÿÿÿ       –ç ø   0    	 !             0  
       ÿ     ¨ € ÿÿÿÿ      –í     ¨  ÿÿÿÿ    —    ¨  
ÿÿÿÿ      —     ¨  ÿÿÿÿ      —/   0 ¨  ÿÿÿÿ      —E   @ ¨  ÿÿÿÿ      —[   P ¨  ÿÿÿÿ      —q   ` ¨  	ÿÿÿÿ      —‡   p ¨          ÿ  `   p ` ÿÿÿÿ      —     p  ÿÿÿÿ      —¬    p  ÿÿÿÿ      —»     p  ÿÿÿÿ      —É   0 p  ÿÿÿÿ    —×   @ p  ÿÿÿÿ      —æ   P p          ÿ     x 0 ÿÿÿÿ      —õ     x  ÿÿÿÿ      ˜    x  ÿÿÿÿ      ˜     x  !         ÿ  À   ˆ 0 ÿÿÿÿ      ˜%     ˆ   ÿÿÿÿ     ˜7     ˆ  ÿÿÿÿ      ˜I    ˆ   " $      ÿ    À 0 #ÿÿÿÿ      ˜Z     À  $ÿÿÿÿ      ˜s    À  !ÿÿÿÿ      ˜‹     À ÿÿ        €    8  ÿÿÿÿ @   ƒ   0 ÿÿÿÿ    Œn 8 P È  ÿÿÿÿ @   ŒŠ 8 ` È  ÿÿÿÿ  @   Œ¦ 8 € ¸  ÿÿÿÿ  @   ŒÂ <  ¸  ÿÿÿÿ  @   ŒÞ 8   È  ÿÿÿÿ @   Œú 8 Ð À  	ÿÿÿÿ @     à  
ÿÿÿÿ @   2  À  ÿÿÿÿ      º `  €    ÿÿÿÿ      È  T    ÿÿ      €     P ÿÿÿÿ     Ö       ÿÿÿÿ      ™v @     ÿÿÿÿ      ™Š @   ˜   ÿÿÿÿ      ™œ @ 0  ÿÿ              H 7  ÿÿÿÿ      ä      ÿÿ      €      ÿÿÿÿ@  ‘€€     ÿÿÿÿ     ™¯  p  
       ™Ç  0 ° À ÿÿÿÿ   ™Õ     ÿÿÿÿ    ™æ      ÿÿÿÿ    ™÷  0 H  ÿÿÿÿ   ™ÿ  @ x  	ÿÿÿÿ   š
  P h  
ÿÿÿÿ    š  ` H  ÿÿÿÿ   š!  p X  ÿÿÿÿ   š+  € `  ÿÿÿÿ   š6    €         šM Ð 0 ° À ÿÿÿÿ    š[     ÿÿÿÿ   šl    Œ  ÿÿÿÿ    š}  0 H  ÿÿÿÿ    š…  @ x  ÿÿÿÿ    š“  P h  ÿÿÿÿ    šŸ  ` H  ÿÿÿÿ   š§  p X  ÿÿÿÿ    š±  € `  ÿÿÿÿ   š¼   H  
ÿÿÿÿ   šÄ    €  ÿÿÿÿS   šÓ `  8  ÿÿÿÿO   šØ ¨  8   ÿÿÿÿC   šÛ ð  8  ÿÿÿÿ !  šE   H ÿÿ      €     ð   ÿÿÿÿ@  ‘€ à     ÿÿÿÿ     šâ   Ð  ÿÿÿÿN   N  0 Ð  ÿÿÿÿS   ›8 X € @  ÿÿÿÿ     j @ `   ÿÿÿÿ     †  ` 0  ÿÿÿÿD   ¢  @ p   ÿÿÿÿ     ¾ @ P @ ÿÿ        €    0`          €  @       ›     P ÿÿÿÿ     Ú   ð  ÿÿÿÿ     ö    ð  ÿÿÿÿ      Ž  0 X  ÿÿÿÿ      Ž. x 0         œ)   ` à 	ÿÿÿÿ     ŽJ   ð  
ÿÿÿÿ     Žf    ð  ÿÿÿÿ     Ž‚  0 ð  ÿÿÿÿ     Žž  @ ð  
ÿÿÿÿ     Žº  P ð  ÿÿÿÿ     ŽÖ  ` ð  ÿÿÿÿ     Žò  p ð  ÿÿÿÿ       € ð  ÿÿÿÿ     *   ð  ÿÿÿÿ     F    ð  ÿÿÿÿ     b  ° ð  ÿÿÿÿ     ~  À ð ÿÿ        €    X0       Á  8 ð ÿÿÿÿ     Î  (  ÿÿÿÿ     ô   (  ÿÿÿÿ     ž  0(  ÿÿÿÿ     ž@  @(  ÿÿÿÿ     žf  P(  ÿÿÿÿ     žŒ  `(  	ÿÿÿÿ     ž²  p(  
ÿÿÿÿ     žØ  €(  ÿÿÿÿ     žþ  (  ÿÿÿÿ     Ÿ$   (  
ÿÿÿÿ    š  °(  ÿÿÿÿ    ¶  À(  ÿÿÿÿ    Ò  Ð(              0 ø  ÿÿÿÿO      `   @  ÿÿÿÿC    £ ¸   @  ÿÿÿÿU%    ª     H ÿÿ                                                 ˜  ÿÿÿÿ        ³     0  ÿÿÿÿ        ¹ 0   0  ÿÿÿÿ        ¿ `   8                  0 
        ÿ     p P 	ÿÿÿÿ       Æ     p  
ÿÿÿÿ       Õ    p  ÿÿÿÿ       ä     p  ÿÿÿÿ     ò   0 p  ÿÿÿÿ      ¡   @ p          ÿ  @   x 0 ÿÿÿÿ      ¡     x  ÿÿÿÿ      ¡     x  
ÿÿÿÿ      ¡0     x          ÿ  p   À p ÿÿÿÿ      ¡@     À  ÿÿÿÿ     ¡X     À  ÿÿÿÿ      ¡p   0 À  ÿÿÿÿ      ¡ˆ   @ À  ÿÿÿÿ     ¡    P À  ÿÿÿÿ     ¡¹   ` À  ÿÿÿÿ      ¡Ë    À  ò ‘ ‘
    a‚      ‘, ‘B ‘C           ‘D ‘Z ‘[            ‘\ ‘| ‘}             ‘~ ‘ž ‘Ÿ             ‘  ‘® ‘¯            ‘° ‘Ð ‘Ñ             ‘Ò ‘ç ‘è            ‘é ‘ý ‘þ            ‘ÿ ’ ’            ’ ’6 ’7             ’8 ’= ’>            ’? ’_ ’`             ’a ’t ’u     2       ’v ’– ’—             ’˜ ’ ’ž            ’Ÿ ’¤ ’¥            ’¦ ’Æ ’Ç             ’È ’Þ ’ß     "       ”Ù ”é ”ê            ”ë ”ð ”ñ    €  ÿÿ   ”ò ”ý ”þ    €  ÿÿ   ”ÿ • •    €  ÿÿ   • • •
    €  ÿÿ   • • •    €  ÿÿ 
  • •9 •:    €  ÿþ   •E •i •j          $  ˜£ ˜¶ ˜·       ÿþ   ˜¸ ˜Ð ˜Ñ            ˜Ò ˜î ˜ï            ˜ð ™ ™    A       ™	 ™! ™"    A       ™# ™, ™-    "     	  ™. ™P ™Q    "     "  ™R ™t ™u    "     "  šó › ›#     €  ÿþ   ›= ›V ›W             ›X ›a ›b           	  ›c ›j ›y     €  ÿþ   ›€ ›‹ ›Œ             ›– ›µ ›¶             ›· ›à ›á           )  ›â ›é ›ø             ›ÿ œ œ            	  œ5 œT œU             œV œu œv             œw œ– œ—             œ˜ œ· œ¸             œ¹ œØ œÙ             œÚ œù œú             œû                ; <             = \ ]             ^ } ~              ž Ÿ               ¿ À             ŸJ Ÿp Ÿ–     €  ÿþ & & Ÿ¼ Ÿâ       €  ÿþ & &  .  T  z     €  ÿþ & & ¡ä ¢T ‘A  
           ¢Ä £4 ‘A  
           £¤ ¤ ‘A  
           ¤„ ¤ô ‘A  
           ¥d ¥Ô ‘"A  
           ¦D ¦´ ‘'A  
           §$         ©$         ©¤         ª$        	GEM Bench V5 - exxos 2015   ICON ICON ICON ICON ICON ICON             \ | | | /               ( o   o )     /~~~~~~~ooO~~(_)~~~~~~~~~~~~\     |                           |   Don't believe     |~~~~~~~~~~~~~~~~~~~ooO~~~~~|                |__|__|                 || ||                ooO Ooo     |                           |   TEXT     |                           |   Anything you see..     |                           |   TEXT   TEXT     |                           |               or hear..   BUTTON BUTTON  xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx xxxxxx GEM [Dialog Box: [VDI Text: VDI Te[xt Effects: VDI [Small Text: VDI [Graphics: GEM [Window: [Integer Division: [Float Math: [RAM Access: R[OM Access: B[litting: VDI S[croll: [Justified Text: VDI [Enquire: [New Dialogs:  Display:     0%     0%     0% CPU: Average:                    Time   Statistics   Ratio   Test   Reference   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   Reference xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx   System xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  GEMBench  File  Test  Windows  Help   About...       A  ---------------------   123456789012345678  2                     3                     4                     5                 

But the info form which has the text and buttons on, I know the first button on that form is "52" but I don't get how button 52 relates to a a area in ram.

 

junk=rsrc_gaddr(0,0,tree&) returns the info form with all the stuff on, so I can open it with junk=objc_draw(tree&,0,10,x,y,w,h)

 

So it looks like if I have rsrc_gaddr(1,0,tree&), it should return a object in form0, but what object, again the docs are not clear on whats going on there :(

Link to comment
Share on other sites

 

But the info form which has the text and buttons on, I know the first button on that form is "52" but I don't get how button 52 relates to a a area in ram.

 

junk=rsrc_gaddr(0,0,tree&) returns the info form with all the stuff on, so I can open it with junk=objc_draw(tree&,0,10,x,y,w,h)

 

So it looks like if I have rsrc_gaddr(1,0,tree&), it should return a object in form0, but what object, again the docs are not clear on whats going on there :(

 

You shouldn't have to find out the direct address to an individual object to be able to draw it onto screen.

 

Just use RSRC_GADDR() to find out the address to the tree in question, then draw any object inside this tree => OBJC_DRAW(tree,obj,depth,bx,by,bw,bh)

 

tree = address to the object tree

obj (WORD) = the objects number

depth (WORD) = how many levels to include (use 0 if you don't need to include child objects, use 1 if you want to include child objects, use 2 if you wish to include child objects, and child objects to the child objects, etc)

bx,by,bw,bh (WORD) = specifies the clipping rectangle which limits the graphical output

 

To find out the coordinates of an object relative to its parent, you use OB_X(tree,obj) and OB_Y(tree,obj).

For example:

 

xpos=OB_X(tree,obj)

 

It can also work the other way around, allowing you to set the coordinate of an object relative to its parent.

For example:

 

OB_X(tree,obj)=xpos

 

 

If you need to find out an individual objects exact coordinates on screen you can use OBJC_OFFSET(tree,obj,xpos,ypos)

The objects coordinates are then stored into xpos and ypos.

 

 

 

Hope this information can be of some help.

 

 

Regards,

 

/Joakim

Link to comment
Share on other sites

I was looking at the objc_draw and objc_Add , objc deletes the object on my form, so I know I am referencing it correctly. Though neither of those 2 commands have any mention of adding text into the button. There must be something I am missing somewhere, as the commands draw a blank box and there is no way of adding any text on them.

Link to comment
Share on other sites

Well, if you are trying to update the text of an object - what object type are you drawing in this example?

For example, if you are drawing an object type that is either G_TEXT, G_BOXTEXT, G_FTEXT and G_FBOXTEXT then the OB_SPEC field contains a pointer to a TEDINFO structure.

typedef struct text_edinfo
{
char * te_ptext;
char * te_ptmplt;
char * te_pvalid;
WORD te_font;
WORD te_fontid;
WORD te_just;
WORD te_color;
WORD te_fontsize;
WORD te_thickness;
WORD te_txtlen;
WORD te_tmplen;
} TEDINFO;

To alter the text of the above mentioned object types, you should start by finding out the current length of the text that was entered when the object was created in the RSC editor. Why? Well, when the RSC file was loaded through RSRC_LOAD() all buffers needed to store these text strings was stored in RAM together with all the rest of the RSC data. Hence, the default text for an object should be long enough for any text you wish to update the object with from the program. If you overflow such text buffers by entering too long text strings, you will corrupt the RSC data in ram. That is likely to trigger interesting stuff to show up on screen :-D

Find out length of text buffer for objects who use TEDINFO struct:

te_txtlen = WORD{OB_SPEC(addr,obj)+24}

To update the text buffer:

Copy the new string data (including an ending NULL byte) to the address pointed to from OB_SPEC(addr,obj)+0


When the contents of the text buffer has been changed, you must of course issue an OBJC_DRAW() in order to make a visual change.

(NOTE: For object type G_BUTTON the OB_SPEC field contains a pointer to the actual text buffer)

Link to comment
Share on other sites

I am afraid I can't help you with exactly how to proceed in Hisoft Basic.

IIRC Matthew Bacon was devloping advanced GEM library routines back in the days, maybe he is still around in some of the forums?

 

In GFA I would probably have done something like this:

 

te_txtlen& = WORD{OB_SPEC(addr%,obj&)+24} ! Find the size of the text buffer attached to this object

te_ptext% = LONG{OB_SPEC(addr%,obj&)+0} ! Find the address to the text buffer

 

new_text$="Hello world" ! Find nice example text :-)

new_text$=left$(new_text$,te_txtlen&) ! Make sure it fits the available buffer

 

CHAR{te_ptext%}=new_text$ ! Update the text buffer with our brilliant example text (CHAR{} automatically adds en ending NULL byte)

 

dummy%=OBJC_DRAW(addr%,obj&,0,form_x&,form_y&,form_w&,form_h&) ! Draw the updated object contents to screen. Last 4 parameters consist the clipping rectangle.

 

 

Regards,

 

/Joakim

Link to comment
Share on other sites

8.17.2 rsrc_gaddr

Name:	»Resource get address« - Obtain address of an object in a resource set.
Opcode:	112
Syntax:	int16_t rsrc_gaddr ( int16_t re_gtype, int16_t re_gindex, void *gaddr );
Description:	The call rsrc_gaddr obtains the start addresses of various object structures of resource files loaded into memory with rsrc_load. The following apply:

Parameter	Meaning
re_gtype	Type of structure searched for:
 	R_TREE 0  = Object tree
 	R_OBJECT 1  = Individual OBJECT
 	R_TEDINFO 2  = TEDINFO structure
 	R_ICONBLK 3  = ICONBLK structure
 	R_BITBLK 4  = BITBLK structure
 	R_STRING 5  = Free string data
 	R_IMAGEDATA 6  = Free image data
 	R_OBSPEC 7  = ob_spec field in OBJECT
 	R_TEPTEXT 8  = te_ptext in TEDINFO
 	R_TEPTMPLT 9  = te_ptmplt in TEDINFO
 	R_TEPVALID 10 = te_pvalid in TEDINFO
 	R_IBPMASK 11 = ib_pmask in ICONBLK
 	R_IBPDATA 12 = ib_pdata in ICONBLK
 	R_IBPTEXT 13 = ib_ptext in ICONBLK
 	R_BIPDATA 14 = ib_pdate in BITBLK
 	R_FRSTR 15 = ad_frstr free string
 	R_FRIMG 16 = ad_frimg free image
re_gindex	Index of the structure searched for
gaddr	Address of the desired structure

Thats the only place I can see ob_spec..

 

Normally I am using..

junk=rsrc_gaddr(0,dial,tree&)

 

So maybe that should be

junk=rsrc_gaddr(7,dial,tree&)

 

Not really sure what that would return though, I guess its something new to try out next though.

 

I have got in contact with matt, he seems happy to help, but hes working away at the moment so he cant help currently.

Link to comment
Share on other sites

RSRC_GADDR() is for most practical cases only ever used to find the address to the object tree(s).

 

 

dummy%=RSRC_LOAD(0,tree_index&,tree_adr%) ! The address to the object tree (tree_index&) is then stored in tree_adr%

 

 

But I realize that when coding for GFABASIC I have been spoiled with access to built in commands that offers shortcuts to individual objects and their structures, such as eg. OB_ADR and OB_SPEC.

However, the object tree laytout is known:

 

typedef struct object
{
WORD ob_next;
WORD ob_head;
WORD ob_tail;
UWORD ob_type;
UWORD ob_flags;
UWORD ob_state;
VOIDP ob_spec;
WORD ob_x;
WORD ob_y;
WORD ob_width;
WORD ob_height;
} OBJECT;

 

From this we can conclude that every object structure occupies exactly 24 bytes (same goes for the root object of course, since it too is an object).

And I learned from a discussion earlier today that all the objects structures in a tree are stored one after the other, which means that we can locate the address of an individual object structure within a specified object tree by knowing its index:

 

ob_adr%=tree_adr%+obj&*24 ! Start at the address where object tree begins, move 24 bytes forward for each object you wish to "skip". This line of code locates the address of the individual object.

 

ob_spec%=LONG{ob_adr%+12} ! Essentially, 12 bytes into the individual object structure, you find the ob_spec field.

 

Then we should be able to use the concept previously described:

 

te_txtlen& = WORD{ob_spec%+24} ! Find the size of the text buffer attached to this object

te_ptext% = LONG{ob_spec%+0} ! Find the address to the text buffer

 

new_text$="Hello world" ! Find nice example text :-)

new_text$=left$(new_text$,te_txtlen&) ! Make sure it fits the available buffer

 

CHAR{te_ptext%}=new_text$ ! Update the text buffer with our brilliant example text (CHAR{} automatically adds en ending NULL byte)

 

dummy%=OBJC_DRAW(tree_adr%,obj&,0,form_x&,form_y&,form_w&,form_h&) ! Draw the updated object contents to screen. Last 4 parameters consist the clipping rectangle.

 

 

 

Oh, and I realize the above is GFABASIC code, but it should be dead simple to get the same scheme going with Hisoft Basic I think.

 

Regards,

 

/Joakim

Link to comment
Share on other sites

I am afraid I can't help you with exactly how to proceed in Hisoft Basic.

IIRC Matthew Bacon was devloping advanced GEM library routines back in the days, maybe he is still around in some of the forums?

By the power of the internet I have been reached. It will be a good excuse to get out my old STE and fire her up again.

 

The advanced GEM library you spoke of was called Enchant (http://atariage.com/forums/index.php?app=core&module=attach&section=attach&attach_id=306622)

Edited by mattbacon
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...