Jump to content
IGNORED

CALL LOAD for data


SteveB

Recommended Posts

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

 

  • Like 1
Link to comment
Share on other sites

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.:ponder:

Edited by HOME AUTOMATION
DV80
  • Like 3
Link to comment
Share on other sites

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. 

 

 

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

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.

 

  • Thanks 1
Link to comment
Share on other sites

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!

 

  • Like 1
Link to comment
Share on other sites

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?

 

Link to comment
Share on other sites

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. :ponder:

 

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 by HOME AUTOMATION
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. :ponder:

 

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.

Link to comment
Share on other sites

21 minutes ago, HOME AUTOMATION said:

I think BYTE, values need to be kept below decimal 256. :ponder:

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". 

image.thumb.png.4bc3d752c0cb781d04fef2edb855f115.png

 

I use the ASM994a settings I always use for compiling XB with Jewel.

 

Edited by SteveB
  • Haha 1
Link to comment
Share on other sites

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.

  • Thanks 2
Link to comment
Share on other sites

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:

image.png.fd76ff299577f8db7df9fe2e0b998e06.png

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:

image.thumb.png.2e9be8f89ff4a78a2ac27adb822b0a8b.png

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

 

 

 

  • Like 1
Link to comment
Share on other sites

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. 

 

  • Thanks 1
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

 

 

 

 

image.png

  • Like 1
Link to comment
Share on other sites

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

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

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

  • Like 2
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...