SteveB Posted November 4, 2022 Share Posted November 4, 2022 Hi, I am thinking about a game where I need to store data efficiently. I was thinking of using the lower 8kb and read the data with CALL PEEK. I never did something with CALL LOAD and CALL PEEK in the past and the XB documentation leaves some room for improvement. Is it possible to load data from a file, and not object-files, with CALL LOAD to the lower 8kb of the memory expansion (>2000 or decimal 8192)? Are there any conventions I should be aware of using this address space? Thank you Steve 1 Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted November 5, 2022 Share Posted November 5, 2022 (edited) Well, I believe the XB loader expects files to be in object-code, format. That said, there's nothing to prevent one from loading an object-code, file, built purely from DATA, directives. You should than be able to PEEK, the data, rather than LINK, to a program. Since an object-code file is in DF80, format, XB's file support should be able to alter the file's data. However, I believe the TAGS, will always need to co-mingle with the data, in order to satisfy the LOADER. Edited November 5, 2022 by HOME AUTOMATION DV80 3 Quote Link to comment Share on other sites More sharing options...
+FarmerPotato Posted November 5, 2022 Share Posted November 5, 2022 To be sure what address your data begins at, you can use an AORG directive. XB CALL INIT puts support routines and data in 2000-24F3(?) You can cautiously overwrite most of them if you need to. I liked AORG >2500 so data begins at decimal 9472. Rather than retrieving with CALL PEEK, it might make sense to write a CALL LINK(“FETCH”, X,X$) which copies to a string… that’s tricky too. 2 1 Quote Link to comment Share on other sites More sharing options...
RXB Posted November 5, 2022 Share Posted November 5, 2022 RXB has CALL PLOAD that loads a Program Image file saved by CALL PSAVE. So load your assembly program into lower 8K using call load or call peeks, put this line at end so it saves the lower 8K to disk CALL PSAVE(2,"DSK1.2000FILE",3,"DSK1.3000FILE") The 2 is for >2000 area of memory and 3 is for >3000 area of memory to save the file. CALL PLOAD(2,"DSK1.2000FILE",3,"DSK1.3000FILE") This line will load those save files very quickly taking the place of very slow CALL LOAD instead. How fast? About 3 times faster or more depending on your disk drive or hard drive. I have posted demos of using it and it is faster than anything anyone else has recommended. 1 Quote Link to comment Share on other sites More sharing options...
SteveB Posted November 5, 2022 Author Share Posted November 5, 2022 I knead the data to fit in 8kb ... starting at >2500 will be a challenge again, losing another 5 pages. I might learn TMS9900 assembler one day, but for now I need some help with getting my data ready to use in my game. I create them with a PC tool and may define the output as needed. How would this look like? AORG >2500 SEC1 BYTE 1,2,3,4,5,6,7,8 BYTE 9,10,11,12,13,14,15,16 SEC2 BYTE 100,200,300,400 BYTE 500,600,700,800 END This runs through ASM994a .. what to do next with the OBJ file? When I try a 30 CALL LOAD("DSK4.TESTOBJ") I get a "UNRECOGNIZED CHARACTER IN 30" because I don't really know what I'm doing here ... Please advise! 1 Quote Link to comment Share on other sites More sharing options...
SteveB Posted November 5, 2022 Author Share Posted November 5, 2022 15 minutes ago, RXB said: RXB has CALL PLOAD that loads a Program Image file saved by CALL PSAVE. So load your assembly program into lower 8K using call load or call peeks, put this line at end so it saves the lower 8K to disk CALL PSAVE(2,"DSK1.2000FILE",3,"DSK1.3000FILE") The 2 is for >2000 area of memory and 3 is for >3000 area of memory to save the file. This could be another option ... how could I create the file on a PC instead of PSAVE? Just the raw binary data, each 4kb? Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted November 5, 2022 Share Posted November 5, 2022 (edited) 1 hour ago, SteveB said: AORG >2500 SEC1 BYTE 1,2,3,4,5,6,7,8 BYTE 9,10,11,12,13,14,15,16 SEC2 BYTE 100,200,300,400 BYTE 500,600,700,800 END This runs through ASM994a .. what to do next with the OBJ file? When I try a 30 CALL LOAD("DSK4.TESTOBJ") I get a "UNRECOGNIZED CHARACTER IN 30" because I don't really know what I'm doing here ... Did you assemble this, or are you trying to load the source code directly? Did you use Asm994a? I think BYTE, values need to be kept below decimal 256. CALL LOAD, uses a NAMLNK, routine, to look-up programs by name. So, you'll need to specify a name in your source code(up to 6 characters). 1 hour ago, SteveB said: DEF NAME AORG >2500 NAME SEC1 BYTE 1,2,3,4,5,6,7,8 BYTE 9,10,11,12,13,14,15,16 SEC2 BYTE 100,200,300,400 BYTE 500,600,700,800 END The name is used by CALL LINK, to run the assembled program. Edited November 5, 2022 by HOME AUTOMATION Quote Link to comment Share on other sites More sharing options...
RXB Posted November 5, 2022 Share Posted November 5, 2022 41 minutes ago, SteveB said: This could be another option ... how could I create the file on a PC instead of PSAVE? Just the raw binary data, each 4kb? Yea RXB does exactly that it just dumps the raw data to disk or loads that saved data from disk. So you run a program and where you want the dump use CALL PSAVE, then of course you no longer need the program that created it for CALL PLOAD Originally RXB used 8K at a time but was not very useful with SAMS that uses 4K so I changed it to 4K from only 8K. Yes takes more files but RXB then could load 4K anywhere was a better trade off. Quote Link to comment Share on other sites More sharing options...
RXB Posted November 5, 2022 Share Posted November 5, 2022 9 minutes ago, HOME AUTOMATION said: Did you assemble this, or are you trying to load the source code directly? Did you use Asm994a? I think BYTE, values need to be kept below decimal 256. CALL LOAD, uses a NAMLNK, routine, to look-up programs by name. So, you'll need to specify a name in your source code(up to 6 characters). The name is used by CALL LINK, to run the assembled program. In using RXB instead you can still use the CALL LINK as before just the loader is much faster. Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted November 5, 2022 Share Posted November 5, 2022 1 hour ago, SteveB said: AORG >2500 SEC1 BYTE 1,2,3,4,5,6,7,8 BYTE 9,10,11,12,13,14,15,16 SEC2 BYTE 100,200,300,400 BYTE 500,600,700,800 END I didn't want to type all this in, so I assembled on Classic99. I got some OUT OF RANGE, errors, but CALL LOAD, seemed to load the file without complaint. Quote Link to comment Share on other sites More sharing options...
SteveB Posted November 5, 2022 Author Share Posted November 5, 2022 (edited) 21 minutes ago, HOME AUTOMATION said: I think BYTE, values need to be kept below decimal 256. Shame on me ... I started out with DATA, as you suggested, and found BYTE better for my needs ... without adjusting the list ... DEF WDATA AORG >2500 WDATA SEC1 BYTE 1,2,3,4,5,6,7,8 BYTE 9,10,11,12,13,14,15,16 SEC2 BYTE 10,20,30,40 BYTE 50,60,70,80 END assembles with ASM994a without warning ... but CALL LOAD still fails with "UNRECOGNIZED CHARACTER IN 30". I use the ASM994a settings I always use for compiling XB with Jewel. Edited November 5, 2022 by SteveB 1 Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted November 5, 2022 Share Posted November 5, 2022 1 hour ago, HOME AUTOMATION said: I didn't want to type all this in, so I assembled on Classic99. I got some OUT OF RANGE, errors, but CALL LOAD, seemed to load the file without complaint. 1 Quote Link to comment Share on other sites More sharing options...
RXB Posted November 5, 2022 Share Posted November 5, 2022 From looking at source it did not even assembly SEC2 at all. Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted November 5, 2022 Share Posted November 5, 2022 2 hours ago, SteveB said: I might learn TMS9900 assembler one day ... To store/retrieve XB's, numeric/string variable's contents, from ASSY, you can use: NUMASN STRASN NUMREF STRREF These are detailed somewhat in E/A 17.2... https://archive.org/details/TI994a_Editor_Assembler_Manual/page/n285/mode/2up?view=theater They are also loaded into XB, when CALL INIT is executed. But if you intend to use them from XB, you'll need to use EQUATES, as opposed to REFs. The EQUATES are listed in E/A 24.4.8. https://archive.org/details/TI994a_Editor_Assembler_Manual/page/n415/mode/2up?view=theater I believe NUMREF is actually >200C. 2 Quote Link to comment Share on other sites More sharing options...
SteveB Posted November 5, 2022 Author Share Posted November 5, 2022 I will check this, but right now I don't need more than CALL PEEK to use the data, no direct ASSY/XB exchange. I started the Classic99 debugger the first time and saw: The first two lines are correct. The first two bytes in the third line also ... >0A = 10, >14 = 20 ... but then CD makes no sense, there should be a >1E ... Which I also can't find in the object file: Every two bytes the is a "B" token, but not there .. what am I missing? I guess the "7" leads to the error... I would habe expected ...B0A14B1E28B 1 Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted November 5, 2022 Share Posted November 5, 2022 Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted November 5, 2022 Share Posted November 5, 2022 1 hour ago, SteveB said: I guess the "7" leads to the error... E/A 15.3... https://archive.org/details/TI994a_Editor_Assembler_Manual/page/n241/mode/2up?view=theater 1 Quote Link to comment Share on other sites More sharing options...
RXB Posted November 5, 2022 Share Posted November 5, 2022 I get stuff like that sometimes the >CD instead of the value that should be there. I have found it is a corrupted source file usually due to Windows fkn up the files. More than a few times this has occurred. 1 Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted November 5, 2022 Share Posted November 5, 2022 The >CD, was left over util. code, originally loaded by CALL INIT... Quote Link to comment Share on other sites More sharing options...
HOME AUTOMATION Posted November 5, 2022 Share Posted November 5, 2022 4 hours ago, RXB said: From looking at source it did not even assembly SEC2 at all. Actually... 100 = >64 200 = >C8 300 = >12C 400 = >190 500 = >1F4 600 = >258 700 = >2BC 800 = >320 ...Sans overflow, this is from SEC2. Starting at >2510... 4 hours ago, HOME AUTOMATION said: 1 Quote Link to comment Share on other sites More sharing options...
+FarmerPotato Posted November 5, 2022 Share Posted November 5, 2022 4 hours ago, SteveB said: assembles with ASM994a without warning ... but CALL LOAD still fails with "UNRECOGNIZED CHARACTER IN 30". I forget what the 30 refers to, but UNRECOGNIZED CHARACTER usually means there is an unsupported tag in the object code. Tags are the things that signal what’s coming next. Here: 5 absolute address from AORG B data word 7 checksum for line F end of line 6 DEF address and 6 char symbol : end of file 7 is expected - it is the checksum. F is the end of line. Maybe the : line is too long? weird. XB’s loader is more limited than others in the tags it can process. 1 Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted November 5, 2022 Share Posted November 5, 2022 14 minutes ago, HOME AUTOMATION said: Actually... 100 = >64 200 = >C8 300 = >12C 400 = >190 500 = >1F4 600 = >258 700 = >2BC 800 = >320 ...Sans overflow, this is from SEC2. Starting at >2510... Yup—the Assembler BYTE directive evaluates the number for each entry and truncates it to the rightmost byte. ...lee Quote Link to comment Share on other sites More sharing options...
SteveB Posted November 5, 2022 Author Share Posted November 5, 2022 I made some progress... my file gets now loaded without error, I can see all data (now the real data from my PC export) starting memory >2500. But the CALL LOAD did not return and the debugger dumps Illegal opcode messages. It worked when I moved to >2800. I overwrote some code the BASIC Compiler is using! When I disabled DSK1 it started to work without problems, even starting >2000. Now I can have my 8kb of game data, but need to ask @senior_falcon how to compile this or which lower RAM needs to be left untouched. In the end, I would like to create a module out of my compiled game .. If this is possible... XB program without assembly but static data in the lower 8kb RAM ... Thanks to everyone who helped me ! Steve 1 Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted November 5, 2022 Share Posted November 5, 2022 5 hours ago, HOME AUTOMATION said: CALL LOAD, uses a NAMLNK, routine, to look-up programs by name. So, you'll need to specify a name in your source code(up to 6 characters). If you are only PEEKing data from direct addresses (i.e., you know where you put it), you should not need DEF. ...lee 3 1 Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted November 6, 2022 Share Posted November 6, 2022 This document should help. Kroll & Prumni stores all of its data in the lower 8K of the memory expansion. By default, after a CALL INIT, anything you store in the lower 8K starts at >24F4 down to >3FFF, although your DEF table will grow down from >3FFF, so you have to be careful not to overwrite it. I have also attached the source of one of the support modules for K&P which will give you an example. All the data starts at the PLANET label, with the support routines taking the space before it. K&P does not access the data directly from XB but rather calls assembly routines using CALL LINKs to fetch it or manipulate it depending on the program needs. TI Extended BASIC Assembly Language Code Programmer_s Guide.pdf KPSUP.txt 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.