Ultimate Amiga

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: strings from bank  (Read 2724 times)

0 Members and 5 Guests are viewing this topic.

selur

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 83
strings from bank
« 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.
 :-\
Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: strings from bank
« Reply #1 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.
Logged

selur

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 83
Re: strings from bank
« Reply #2 on: October 19, 2016, 04:20:52 PM »

Thanks
I completely missed this command.
Logged

bruceuncle

  • AMOS Dev
  • A500
  • *****
  • Karma: 6
  • Offline Offline
  • Gender: Male
  • Posts: 425
  • WINUAE Amiga User
Re: strings from bank
« Reply #3 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
Logged
Repeat after me ...  "The AMOS Pro architecture is complex but it is not complicated."

selur

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 83
Re: strings from bank
« Reply #4 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.
Logged
Pages: [1]   Go Up
 

TinyPortal 2.2.2 © 2005-2022