Ultimate Amiga

Network Boards => AMOS Language Discussion => AMOS Factory => AMOS Professional Forum => Topic started by: selur on October 19, 2016, 08:57:17 AM

Title: strings from bank
Post by: selur on October 19, 2016, 08:57:17 AM
Hi

Is there any possibility to read strings from bank data to variable ?
I know that varptr keep pointer to string in memory, but how to set manually pointer?
I dont want to keep whole strings in AMOS by "data" i want them load from bank.
 :-\
Title: Re: strings from bank
Post by: SamuraiCrow on October 19, 2016, 02:16:13 PM
If you can figure the start address of a string you can use PEEK$() on its address.
Title: Re: strings from bank
Post by: selur on October 19, 2016, 04:20:52 PM
Thanks
I completely missed this command.
Title: Re: strings from bank
Post by: bruceuncle on October 19, 2016, 11:12:09 PM
Just use the Resource Editor to create a Resource Bank that only contains your strings.  You can then retrieve each string using Resource$(StringNumber).
There are limitations of a maximum 256 strings and (not sure) but I think I recall a max of 255 characters.
If your program is already using a Resource Bank for Interface instructions, simply load your bank into a spare slot and swap banks when you need to reference your strings.
If you need more than the limits allow, you'll have to use SamuraiCrow's method instead.  Consider writing a simple program to create your bank of strings.  For the fastest access to the strings, try using an offset table at the start of the bank where each entry points to the start of a string, and the string is in the format length/string.  Then to get at a particular string, use its number to get the offset, use that offset to get an address pointer to the start of the string, Peek, Deek or Leek the string length (which one depends on what format you're using for string storage) then Peek$() the string you want.
Sent from my Lumia 640 using Tapatalk
Title: Re: strings from bank
Post by: selur on October 26, 2016, 06:34:35 PM
I rather don't use AMOS tools. They have unfriendly GUI and bad design.
Still I  only use Sample Bank Maker, because i don't know samples structure well.