How to load data from memory

Just starting out? Need help? Post your questions and find answers here.
User avatar
rndrei
Enthusiast
Enthusiast
Posts: 185
Joined: Thu Dec 28, 2023 9:04 pm

How to load data from memory

Post by rndrei »

This is code not work!?

s$=Read ?start
PrintN(s$)
DataSection:
start:
Data.s "Hello world!"
EndDataSection
User avatar
STARGÅTE
Addict
Addict
Posts: 2260
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: How to load data from memory

Post by STARGÅTE »

You use the wrong syntax.
If you want to read from a data section, you have to use Restore to begin the reading and then Read to read the data into a variable. And if you want to use PrintN() you have to open a console:

Code: Select all

OpenConsole()

Restore start
Read.s s$
PrintN(s$)
Input()

DataSection:
start:
Data.s "Hello world!"
EndDataSection
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
rndrei
Enthusiast
Enthusiast
Posts: 185
Joined: Thu Dec 28, 2023 9:04 pm

Re: How to load data from memory

Post by rndrei »

thanks, I figured it out

Code: Select all

s$=PeekS(?mem1,12)
PrintN(s$)
DataSection:
mem1: 
Data.s "Hello world!" 
EndDataSection
Post Reply