Opry99er Posted April 4, 2015 Share Posted April 4, 2015 What all is retained when you do a "RUN DSK1.xxx" from inside an XB program? From what I can tell through the minor testing I have done is that character patterns are retained, but all numeric variables get set to zero and all string variables get set to null. The XB manual talks about the wiping of variables prior to executing the RUN statement, but doesn't go any further than that in it's explanation. What I'm hoping to find out is whether it wipes anything else, or whether JUST the numeric and string variables are wiped. I'm assuming that all the values that get cleaned out are stored in VDP (but that's just an assumption) and I'm not sure the memory locations that are reserved for XB variables. Would there be a way to have all variables in DATA statements and then "READ" them (within a loop) into specific memory locations that do NOT get affected by the wipe? This is more of a curiosity than anything... I am pretty sure an assembly subprogram can be written and then LINKed and LOADed from the XB program itself, and potentially a looped READ from DATA could be used to stick values and strings into non-wiped memory locations. Then again, maybe not. I have some reasons for asking this, but I'm curious to see what you fellas think before I go into much detail. Thanks in advance Quote Link to comment Share on other sites More sharing options...
RobertLM78 Posted April 4, 2015 Share Posted April 4, 2015 You could save them to disk and then reload them at the beginning of the "RUN DSK1.xxxx" program. Quote Link to comment Share on other sites More sharing options...
Opry99er Posted April 4, 2015 Author Share Posted April 4, 2015 Yes, I actually already have the disk read/write routines written. Just exploring other possibilities. BTW, nice avatar, homie. 1 Quote Link to comment Share on other sites More sharing options...
RXB Posted April 4, 2015 Share Posted April 4, 2015 Well the code in GPL of the XB module are included in RXB and the code mostly unchanged except where RXB makes changes and is marked with * RXB PATCH CODE * to indicate changes. [0655] ********************************************************* [0656] * START OF BASIC INTERPETER [0657] ********************************************************* [0658] * GROM Address >6372 TOPLEV [0659] 6372 86,A3,71 TOPLEV CLR V@LODFLG Initialize temp area [0660] 6375 35,00,4D MOVE 77,V@LODFLG,V@LODFLG+1 6378 A3,72,A3 637B 71 [0661] 637C BE,74,05 ST 5,@KEYBD Select full keyboard [0662] 637F 03 SCAN [0663] 6380 8E,74 CZ @KEYBD [0664] 6382 43,88 BR G6388 99/4A Console? [0665] 6384 BE,A3,BB ST >01,V@CONFLG Select 99/4A console 6387 01 [0666] 6388 86,74 G6388 CLR @KEYBD [0667] 638A BF,A3,8C DST NLNADD,V@BUFSRT Initialize edit-buffer start 638D 02,E2 [0668] 638F BF,A3,8E DST NLNADD,V@BUFEND Initialize edit-buffer end 6392 02,E2 [0669] 6394 31,00,02 MOVE 2,G@ATNZZ,@INTRIN Get address of ATNZZ 6397 38,00,32 [0670] 639A B2,38,1F AND >1F,@INTRIN Throw away the BR opcode [0671] 639D A3,38,00 DADD >5B,@INTRIN Address of polynomial constan 63A0 5B [0672] 63A1 BE,A3,71 ST >31,V@LODFLG indicate try auto-boot 63A4 31 [0673] *---------------------------------------------------------- [0674] * Add the following line for fixing "MEMORY FULL" error [0675] * occurring during MERGE execution will leave the file open [0676] * to disk DSR bug, 5/19/81 [0677] 63A5 86,A3,9E SZNEW CLR V@MRGPAB Initialize merged temporary [0678] * for PAB pointer [0679] *---------------------------------------------------------- [0680] 63A8 BE,73,88 ST RSTK,@SUBSTK Load base of subroutine stack [0681] 63AB 06,69,17 CALL CHRTA2 Load character table [0682] 63AE 86,45 CLR @FLAG Initialize flag byte [0683] 63B0 87,46 DCLR @BUFLEV Initialize crunch buffer leve [0684] 63B2 06,80,12 CALL CLSALL Close all open files [0685] 63B5 86,34 CLR @DATA Initialize READ/DATA pointer [0686] 63B7 BF,6E,09 DST VRAMVS,@VSPTR Initialize base of value stac 63BA 58 [0687] 63BB BD,24,6E DST @VSPTR,@STVSPT Save in permanent base [0688] 63BE BD,A3,88 DST @VSPTR,V@SAVEVP 63C1 6E [0689] 63C2 06,68,C3 CALL INITPG Initialize program & s.t. [0690] 63C5 06,A0,18 CALL INTRND Initialize random number [0691] 63C8 8E,A3,71 CZ V@LODFLG [0692] 63CB 63,D3 BS TOPL02 If need auto-boot 99/4 GPL-ASSEMBLER (Pass 3) correct PAGE 0015 EDIT-359 [0693] [0694] 63CD 86,A3,71 CLR V@LODFLG Won't ever need to do again [0695] 63D0 06,64,8E G63D0 CALL AUTOLD Attempt an auto-boot [0696] * Label TOPL02 is used by auto-boot in detection of err [0697] 63D3 ERRRDY EQU $ [0698] 63D3 06,6A,84 TOPL02 CALL G6A84 Say READY [0699] 63D6 00 BYTE 0 * returns to TOPL15 [0700] 63D7 06,68,C3 TOPL05 CALL INITPG Initialize program space [0701] 63DA 06,68,DC TOPL10 CALL KILSYM Kill the symbol table [0702] 63DD B2,45,F7 TOPL15 AND >F7,@FLAG If error in UDF execution [0703] 63E0 BE,74,05 G63E0 ST 5,@KEYBD Select full keyboard [0704] 63E3 03 SCAN [0705] 63E4 86,74 CLR @KEYBD [0706] 63E6 BE,73,88 TOPL20 ST RSTK,@SUBSTK Initialize subroutine stack [0707] 63E9 BF,20,02 TOPL25 DST NLNADD,@VARW Screen addr = lower left corn 63EC E2 [0708] 63ED 86,80,89 CLR @RAMFLG Clear the RAMFLG [0709] 63F0 86,44 CLR @PRGFLG Make sure not in program mode [0710] * Check for auto-num mode [0711] 63F2 DA,45,01 CLOG >01,@FLAG If auto-num on [0712] 63F5 64,1E BS TOPL35 [0713] 63F7 A1,14,0E DADD @CURINC,@CURLIN Generate new line number [0714] 63FA D2,14,00 CGE 0,@CURLIN >32767? [0715] 63FD 64,05 BS TOPL30 [0716] 63FF B2,45,FE AND >FE,@FLAG If out of range->exit auto-nu [0717] 6402 05,64,1E B TOPL35 Merge in below [0718] * Must be a long branch!! [0719] 6405 D5,30,32 TOPL30 DCEQ @ENLN,@STLN Line might exist [0720] 6408 64,12 BS G6412 [0721] 640A BD,4A,14 DST @CURLIN,@FAC Ready for program search [0722] 640D 0F,7E XML SPEED [0723] 640F 03 BYTE SEETWO * Search for existence of line [0724] 6410 65,1D BS EDTZ05 COND set = line found [0725] 6412 0F,83 G6412 XML SCROLL Scroll to the next line [0726] 6414 BD,5E,14 DST @CURLIN,@ARG2 New line # [0727] 6417 06,6A,7C CALL G6A7C Display the line number [0728] 641A 91,20 DINC @VARW Following by a space [0729] 641C 44,20 BR G6420 [0730] 641E 0F,83 TOPL35 XML SCROLL Scroll the screen [0731] 6420 BE,A2,E1 G6420 ST >9E,V@NLNADD-1 Display the prompt character 6423 9E [0732] 6424 06,6A,76 CALL G6A76 Read in a line [0733] 6427 06,D0,AF CALL SAVLIN Save input line for recall [0734] * Crunch the input line [0735] 642A 86,22 CLR @ERRCOD Assume no-error return [0736] 642C BF,0A,08 DST CRNBUF,@RAMPTR Initialize crunch pointer 642F 20 [0737] 6430 0F,7F XML CRUNCH CRUNCH the input line [0738] 6432 00 BYTE 0 * Normal crunch mode [0739] 6433 8A,23 TOPL42 CASE @ERRCOD+1 [0740] 6435 44,45 BR TOPL45 No error detected [0741] 6437 49,7C BR ERRSYN *SYNTAX ERROR [0742] 6439 49,90 BR ERRBLN *BAD LINE NUMBER [0743] 643B 49,94 BR ERRLTL *LINE TOO LONG [0744] 643D 49,86 BR ERRNTL *NAME TOO LONG [0745] 643F 49,80 BR ERRNQS *UNMATCHED QUOTES [0746] 6441 49,9A BR ERRCIP *COMMAND ILLEGAL IN PROGRAM [0747] 6443 49,A4 BR ERRIVN *UNRECOGNIZED CHARACTER [0748] 6445 8F,4A TOPL45 DCZ @FAC Line # present [0749] 6447 64,62 BS TOPL55 [0750] 6449 DA,45,01 CLOG >01,@FLAG Not AUTONUM [0751] 644C 44,5B BR G645B [0752] 644E D6,75,0D CEQ >0D,@RKEY Must be up or down [0753] 6451 64,5B BS G645B 99/4 GPL-ASSEMBLER (Pass 3) correct PAGE 0016 EDIT-359 [0754] 6453 D6,42,01 CEQ >01,@CHAT Start EDIT mode [0755] 6456 44,5B BR G645B [0756] 6458 05,D0,00 B EDTZZ0 [0757] 645B 06,66,CF G645B CALL EDITLN EDIT the line into the progra [0758] 645E 63,E9 BS TOPL25 If didn't change the line [0759] 6460 43,DA BR TOPL10 [0760] * Jump always [0761] 6462 D6,42,01 TOPL55 CEQ >01,@CHAT If blank line - ignore [0762] 6465 63,E9 BS TOPL25 [0763] 6467 D6,A8,20 CEQ >EB,V@CRNBUF 646A EB [0764] 646B 65,C9 BS SZSIZE [0765] 646D C6,A8,20 CH >08,V@CRNBUF If imperative 6470 08 [0766] * GKXB Branch code for new commands DEL, COPY, and MOVE. [0767] 6471 77,59 BS NEWCMD Go here to test for new [0768] * keywords [0769] 6473 BF,2C,08 DST CRNBUF+1,@PGMPTR Anticipate usage of PGMCHR 6476 21 [0770] 6477 0F,79 XML PGMCHR Prepare CHAT for OLD and SAVE [0771] 6479 8A,A8,20 CASE V@CRNBUF Select the keyword [0772] 647C 43,A5 BR SZNEW NEW 0 [0773] 647E 45,20 BR SZCONT CONTINUE 1 [0774] 6480 45,BE BR SZLIST LIST 2 [0775] 6482 45,BA BR SZBYE BYE 3 [0776] 6484 45,60 BR SZNUM NUMBER 4 [0777] 6486 45,B7 BR SZOLD OLD 5 [0778] 6488 46,25 BR SZRES RESEQUENCE 6 [0779] 648A 45,AF BR SZSAVE SAVE 7 [0780] 648C 45,C6 BR SZMERG MERGE 8 [0781] * AUTO-BOOT - attempt a ----> RUN "DSK1.LOAD" [0782] 648E 31,00,0B AUTOLD MOVE 11,G@DSCLOD,V@CRNBUF 6491 A8,20,63 6494 51 [0783] 6495 BF,2C,08 DST CRNBUF,@PGMPTR DSK1.LOAD is in crunch buffer 6498 20 [0784] * RXB PATCH CODE ************* [0785] * BR SZRUNL Go to the RUN "NAME" CODE [0786] 6499 5A,38 BR RXBRUN RXB MENU here that waits for a keypress for 1.5 seconds. [0787] ********************************* RUN ********************* [0788] 649B D6,42,C7 SZRUN CEQ >C7,@CHAT 'RUN "NAME" QUOTED STRING [0789] 649E 44,BF BR G64BF [0790] 64A0 BD,58,2C SZRUNL DST @PGMPTR,@FAC14 Save pointer to name [0791] 64A3 0F,79 XML PGMCHR Get the length of the string [0792] 64A5 BC,57,42 ST @CHAT,@FAC13 Put it in FAC13 [0793] 64A8 86,56 CLR @FAC12 Make it a double byte [0794] 64AA A1,2C,56 DADD @FAC12,@PGMPTR Skip the string [0795] 64AD 0F,79 XML PGMCHR To see there is line no. ahea [0796] 64AF 06,80,24 CALL G8024 Only RUN "NAME" ? [0797] 64B2 49,7C BR ERRSYN No - junk on end so error [0798] 64B4 BE,42,C7 ST STRINZ,@CHAT Prepare for LOAD routine [0799] 64B7 BD,2C,58 DST @FAC14,@PGMPTR Restore the saved PGMPTR [0800] 64BA 06,80,26 CALL OLD1 Load the program [0801] 64BD 44,DA BR SZRUN0 Go ahead from here [0802] * No RUN "NAME" : just run the [0803] * current program in memory [0804] 64BF D6,42,C9 G64BF CEQ >C9,@CHAT Is there a line # after RUN? [0805] 64C2 44,D5 BR G64D5 No just a RUN [0806] 64C4 0F,79 G64C4 XML PGMCHR Get the line number [0807] 64C6 BC,4A,42 ST @CHAT,@FAC Put it in FAC for SEETWO [0808] 64C9 0F,79 XML PGMCHR [0809] 64CB BC,4B,42 ST @CHAT,@FAC1 [0810] 64CE 0F,79 XML PGMCHR Should be EOS now [0811] 64D0 06,80,24 CALL G8024 Is it? 99/4 GPL-ASSEMBLER (Pass 3) correct PAGE 0017 EDIT-359 [0812] 64D3 64,EA BS SZRUN2 Yes - Go ahead from here [0813] * Just 'RUN' [0814] 64D5 06,80,24 G64D5 CALL G8024 Should be EOS now [0815] 64D8 49,7C BR ERRSYN No-SYNTAX ERROR [0816] 64DA D5,30,32 SZRUN0 DCEQ @ENLN,@STLN Refuse without program [0817] 64DD 64,EF BS ILLST [0818] 64DF BD,A3,72 DST @ENLN,V@START Defualt to beginning 64E2 32 [0819] 64E3 A7,A3,72 DSUB 3,V@START Offset into the table 64E6 00,03 [0820] 64E8 45,02 BR SZRUN1 Merge in below [0821] * Jump always [0822] 64EA D5,30,32 SZRUN2 DCEQ @ENLN,@STLN Refuse without program [0823] 64ED 44,F9 BR G64F9 [0824] 64EF 0F,83 ILLST XML SCROLL Scroll the screen for message [0825] 64F1 86,44 CLR @PRGFLG Prevent line # printing [0826] 64F3 06,6A,82 WRNNPP CALL G6A82 [0827] 64F6 1D BYTE 29 * NO PROGRAM PRESENT [0828] 64F7 43,DD BR TOPL15 [0829] * Condition can never be set since line 0 is prohibited [0830] 64F9 0F,7E G64F9 XML SPEED [0831] 64FB 03 BYTE SEETWO * Find the line in the program [0832] 64FC 49,8C BR ERRLNF * LINE NOT FOUND [0833] 64FE BD,A3,72 DST @EXTRAM,V@START Program run starts here 6501 2E [0834] * GKXB RUN code for color change. [0835] 6502 57,74 SZRUN1 BR RUNPAT Change colors. [0836] 6504 06,80,12 G6504 CALL CLSALL Close any open files [0837] 6507 92,44 DEC @PRGFLG Put it back in execution [0838] 6509 BC,80,89 ST @RAMTOP+1,@RAMFLG Set/reset RAMFLG flag -- when 650C 80,85 [0839] 650E 87,A3,86 DCLR V@SEXTRM in program mode & ERAM exist [0840] 6511 87,A3,8A DCLR V@ERRLN Disallow CONTINUE after RUN [0841] 6514 06,68,DC CALL KILSYM Reset ERR handling to defualt [0842] 6517 BE,73,88 ST RSTK,@SUBSTK Set the stack empty [0843] 651A 05,6A,70 B G6A70 [0844] 651D 05,D0,0D EDTZ05 B EDTZ00 Quote Link to comment Share on other sites More sharing options...
Tursi Posted April 4, 2015 Share Posted April 4, 2015 The only thing that is preserved is that character definitions and colors are not reset. I /believe/ assembly language routines are preserved but I have not tested this. For carrying data across, you can try CALL LOADs in unused parts of RAM, it's not wiped. A trick I actually did back in the day without memory expansion was to store data with CALL CHAR and read it back in the second program with CALL CHARPAT. But it's a new "RUN", so don't count on anything in the program's state being preserved. 2 Quote Link to comment Share on other sites More sharing options...
+OLD CS1 Posted April 4, 2015 Share Posted April 4, 2015 My Commodore BBS is written mostly in BASIC with a bunch of ML routines for support and tasking. The Commodore BASIC loader has some peculiar restrictions, including screwing with variables. Aside from several custom string manipulation routines, I do two things to prevent this: first, once I define the base system variables I make changes to BASIC and variable table pointers which prevent them from being wiped out, and secondly for variables which are not by this chicanery I perform a garbage collection then stash the new pointers, load the module, then restore the pointers. Can that be done with XB? Quote Link to comment Share on other sites More sharing options...
RXB Posted April 4, 2015 Share Posted April 4, 2015 The Lower 8K and UPPER 24K are left untouched except for memory pointers are reset. So the best place is to use unused space in these to places instead of VDP as VDP can be unpredictable. Quote Link to comment Share on other sites More sharing options...
+acadiel Posted April 4, 2015 Share Posted April 4, 2015 What all is retained when you do a "RUN DSK1.xxx" from inside an XB program? From what I can tell through the minor testing I have done is that character patterns are retained, but all numeric variables get set to zero and all string variables get set to null. The XB manual talks about the wiping of variables prior to executing the RUN statement, but doesn't go any further than that in it's explanation. What I'm hoping to find out is whether it wipes anything else, or whether JUST the numeric and string variables are wiped. I'm assuming that all the values that get cleaned out are stored in VDP (but that's just an assumption) and I'm not sure the memory locations that are reserved for XB variables. Would there be a way to have all variables in DATA statements and then "READ" them (within a loop) into specific memory locations that do NOT get affected by the wipe? This is more of a curiosity than anything... I am pretty sure an assembly subprogram can be written and then LINKed and LOADed from the XB program itself, and potentially a looped READ from DATA could be used to stick values and strings into non-wiped memory locations. Then again, maybe not. I have some reasons for asking this, but I'm curious to see what you fellas think before I go into much detail. Thanks in advance I know this isn't XB, but it'd be cool if you could sandbox XB a little bit to where you could still have an EXPMEM2 to load crap into (upper 24K). If it were a TI BASIC program, I wonder if you really wanted to preload some stuff if you could open EXPMEM2 (with Mini Memory) and if that would get wiped if you preloaded your data into it, and then tried to access (OPEN) it from inside the program for data access. Been a while since I used EXPMEM2, though. Man, I'm getting rusty. Not messing with stuff for over a year will do that to oneself Quote Link to comment Share on other sites More sharing options...
+acadiel Posted April 4, 2015 Share Posted April 4, 2015 Another thing I just thought of... if you make one of Ksarul's Supercarts, you could write a loader to load the data 8K at a time into the SuperCart banks (32K max). Then (if possible) compile your XB program to run from the E/A 5 part of the Supercart. (I've never used the compiler, so I don't know its limitations). Just simply prod the user to move the switches on the Supercart to Bank 0, 1, 2, or 3 to get to certain data. You could make the whole thing stand alone almost, with just bootstrapping the program from somewhere (disk drive, CF7, HDX, HxC Floppy, etc.) Quote Link to comment Share on other sites More sharing options...
+InsaneMultitasker Posted April 4, 2015 Share Posted April 4, 2015 I pass information between XB programs using CALL LOAD and CALL PEEK quite often. If you are using the lower 8K for assembly routines and have no memory to spare, the next best place is the 24K area starting at 0xA000 (-24576). The lowest area of 0xA000-0xFFFF is untouched unless you exhaust the entire 24K during run-time. Extended BASIC does not wipe the contents when running one program from another. CALL LOAD(-24576,A,B,C,D) !save values into memory starting at -24576, from variables A,B,C,D CALL PEEK(-24576,Q,R,S,T) !read the values from memory into variables Q,R,S,T CALL LOAD and CALL PEEK operate on single byte (8-bit) integer values. You cannot save floating point values however, a value larger than 255 can be stored across multiple 8-bit values with some simple math. You can also save and load strings if you pick them apart byte by byte (hopefully I did not make any mistakes:) 10 A$="TEST STRING" 20 b=LEN(A$) 30 CALL LOAD(-24576,B) !save length of string 40 FOR A=1 to B 50 CALL LOAD(-24576+A,ASC(SEG$(A$,A,1))) !Save each character value 60 NEXT A 1 !READ 10 CALL PEEK(-24576,A) !grab length 20 FOR B=1 to A 30 CALL PEEK(-24576+B,C) !read value of the string 40 A$=A$&CHR$(C) 50 NEXT B 60 PRINT A$ A000 is represented as a negative number in decimal. This means A001 is represented by -24575, A002 by -24574, etc. This is good to keep in mind if you only want a single byte out of multiple bytes you saved/loaded. It is much faster to save/load strings with an assembly language link, especially if you want multiple variables. It really depends on your needs and how much info you are trying to pass. As always, there are many ways to perform a similar operation. 2 Quote Link to comment Share on other sites More sharing options...
Opry99er Posted April 5, 2015 Author Share Posted April 5, 2015 Precisely the info I was looking for, THANKS GUYS!!! Quote Link to comment Share on other sites More sharing options...
RXB Posted April 5, 2015 Share Posted April 5, 2015 (edited) RXB has a much more easy way to do this. 10 ! SAVE 20 A$="TEST STRING" 30 CALL LOAD(-24576,LEN(A$)) ! LENGTH BYTE 40 CALL MOVES("$R",LEN(A$),A$,-24577) ! MOVES LENGTH, FROM A$ TO RAM ADDRESS 10 ! READ 20 CALL PEEK(-24576,L) ! GET LENGTH BYTE 30 CALL MOVES("R$",L,-24577,A$) ! MOVES LENGTH, FROM RAM ADDRESS TO A$ Edited April 5, 2015 by RXB Quote Link to comment Share on other sites More sharing options...
+InsaneMultitasker Posted April 6, 2015 Share Posted April 6, 2015 RXB has a much more easy way to do this. 10 ! SAVE 20 A$="TEST STRING" 30 CALL LOAD(-24576,LEN(A$)) ! LENGTH BYTE 40 CALL MOVES("$R",LEN(A$),A$,-24577) ! MOVES LENGTH, FROM A$ TO RAM ADDRESS 10 ! READ 20 CALL PEEK(-24576,L) ! GET LENGTH BYTE 30 CALL MOVES("R$",L,-24577,A$) ! MOVES LENGTH, FROM RAM ADDRESS TO A$ Yep, that's nice and simple for those using RXB. One small change: -24577 should be -24575. We could throw more strings after the first by computing the next memory location which in this case would be: -24576+1+LEN(A$) 1 Quote Link to comment Share on other sites More sharing options...
RXB Posted April 6, 2015 Share Posted April 6, 2015 Something else RXB can do that would be much tougher than normal XB is this one: 100 ! SAVE 110 A$="TEST STRING" 120 B$="ANOTHER TEST STRING" 130 C$="LAST TEST STRING" 140 L=LEN(A$&B$&C$) 150 CALL LOAD(-24576,L) 160 CALL MOVES("$R",L,A$&B$&C$,-24577) This would be useful for embedding a Assembly program in strings then into Upper 24K. Like RXB used this for that game I wrote called IN THE DARK and without using a CALL LINK but instead used CALL EXECUTE(address) CALL LINK requires you to load excess stuff not needed. So I created EXECUTE to fix that issue. And I see your point about the strings, I was just thinking large sections to be saved larger than a string. (255 Characters) Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted April 6, 2015 Share Posted April 6, 2015 I pass information between XB programs using CALL LOAD and CALL PEEK quite often. If you are using the lower 8K for assembly routines and have no memory to spare, the next best place is the 24K area starting at 0xA000 (-24576). The lowest area of 0xA000-0xFFFF is untouched unless you exhaust the entire 24K during run-time. Extended BASIC does not wipe the contents when running one program from another. CALL LOAD(-24576,A,B,C,D) !save values into memory starting at -24576, from variables A,B,C,D CALL PEEK(-24576,Q,R,S,T) !read the values from memory into variables Q,R,S,T CALL LOAD and CALL PEEK operate on single byte (8-bit) integer values. You cannot save floating point values however, a value larger than 255 can be stored across multiple 8-bit values with some simple math. You can also save and load strings if you pick them apart byte by byte (hopefully I did not make any mistakes:) 10 A$="TEST STRING" 20 b=LEN(A$) 30 CALL LOAD(-24576,B) !save length of string 40 FOR A=1 to B 50 CALL LOAD(-24576+A,ASC(SEG$(A$,A,1))) !Save each character value 60 NEXT A 1 !READ 10 CALL PEEK(-24576,A) !grab length 20 FOR B=1 to A 30 CALL PEEK(-24576+B,C) !read value of the string 40 A$=A$&CHR$(C) 50 NEXT B 60 PRINT A$ A000 is represented as a negative number in decimal. This means A001 is represented by -24575, A002 by -24574, etc. This is good to keep in mind if you only want a single byte out of multiple bytes you saved/loaded. It is much faster to save/load strings with an assembly language link, especially if you want multiple variables. It really depends on your needs and how much info you are trying to pass. As always, there are many ways to perform a similar operation. Well nuts... I wish I knew about this before... When I coded Close Action which has 4 chained programs, I saved the entire state of each program to disk before loading the next and then loaded them back in, which probably slowed down the process... This is really nifty! 1 Quote Link to comment Share on other sites More sharing options...
Opry99er Posted April 6, 2015 Author Share Posted April 6, 2015 ^^My predicament. Quote Link to comment Share on other sites More sharing options...
JamesD Posted April 6, 2015 Share Posted April 6, 2015 FWIW, the TRS-80 version of Temple of Apshai was written in BASIC and reserved an area of memory for variables and then appeared to PEEK and POKE to access them with it's different modules.I think games like Silvern Castle on the Apple have the same issue.Why more BASICs didn't support the CHAIN command I'll never know.I think one approach on other BASICs (Microsoft derived at least) was to mess with BASIC's memory pointers. They tell where variable areas start and where the top of memory is.By lowering the top of RAM pointer and pointer to variables a program can hide the memory used for variables so it isn't cleared before loading the next BASIC module.Then the first line of the next module restores the proper addresses and BASIC suddenly sees it all again.That's a bit of a simplification of what goes on but you get the idea.I don't know that TI BASIC has equivalents of those pointers though. Quote Link to comment Share on other sites More sharing options...
RXB Posted April 6, 2015 Share Posted April 6, 2015 (edited) FWIW, the TRS-80 version of Temple of Apshai was written in BASIC and reserved an area of memory for variables and then appeared to PEEK and POKE to access them with it's different modules. I think games like Silvern Castle on the Apple have the same issue. Why more BASICs didn't support the CHAIN command I'll never know. I think one approach on other BASICs (Microsoft derived at least) was to mess with BASIC's memory pointers. They tell where variable areas start and where the top of memory is. By lowering the top of RAM pointer and pointer to variables a program can hide the memory used for variables so it isn't cleared before loading the next BASIC module. Then the first line of the next module restores the proper addresses and BASIC suddenly sees it all again. That's a bit of a simplification of what goes on but you get the idea. I don't know that TI BASIC has equivalents of those pointers though. TI BASIC ONLY uses VDP memory so all the pointers are in VDP ONLY. There is not a single RAM pointer in TI BASIC. (Unless EA module is used but that is for loading and saving RAM and there are no pointers really.) On the other hand XB uses VDP and RAM and has pointers for both to modify and use. Edited April 6, 2015 by RXB Quote Link to comment Share on other sites More sharing options...
JamesD Posted April 6, 2015 Share Posted April 6, 2015 TI BASIC ONLY uses VDP memory so all the pointers are in VDP ONLY. There is not a single RAM pointer in TI BASIC. (Unless EA module is used but that is for loading and saving RAM and there are no pointers really.) On the other hand XB uses VDP and RAM and has pointers for both to modify and use. Even VDP RAM would need some sort of allocation scheme. You probably have no mechanism to reserve memory at the top of available RAM though so that would be a problem. Quote Link to comment Share on other sites More sharing options...
Tursi Posted April 8, 2015 Share Posted April 8, 2015 You do, but only BEFORE a program is loaded, you can't do it (non-trivally) inside of a BASIC program. You could probably write a little assembly stub to set it up and chain. A secondary issue (not affecting most projects today) is that an unexpanded console can't PEEK and POKE at all, and normal XB can't PEEK or POKE to VDP memory. Again, as long as you have 32k, a little assembly stub can help with that. Quote Link to comment Share on other sites More sharing options...
JamesD Posted April 8, 2015 Share Posted April 8, 2015 You do, but only BEFORE a program is loaded, you can't do it (non-trivally) inside of a BASIC program. You could probably write a little assembly stub to set it up and chain. A secondary issue (not affecting most projects today) is that an unexpanded console can't PEEK and POKE at all, and normal XB can't PEEK or POKE to VDP memory. Again, as long as you have 32k, a little assembly stub can help with that. Yeah, you would need to be able to PEEK and POKE to modify the values. I guess VPEEK and VPOKE might be the better way to put it. Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted April 8, 2015 Share Posted April 8, 2015 Yeah, you would need to be able to PEEK and POKE to modify the values. I guess VPEEK and VPOKE might be the better way to put it. FYI—In XB, we only have PEEK and LOAD (“POKE”). As @Tursi said, we need 32KiB expansion to do it in TI Basic. Actually, with the E/A cartridge (or equivalent ALC loaded by TI Basic) we have PEEKV and POKEV for VRAM in addition to PEEK and LOAD. ...lee Quote Link to comment Share on other sites More sharing options...
Tursi Posted April 8, 2015 Share Posted April 8, 2015 FYI—In XB, we only have PEEK and LOAD (“POKE”). As @Tursi said, we need 32KiB expansion to do it in TI Basic. Actually, with the E/A cartridge (or equivalent ALC loaded by TI Basic) we have PEEKV and POKEV for VRAM in addition to PEEK and LOAD. ...lee You need 32k expansion to do it in XB. TI BASIC can't PEEK and POKE without Editor/Assembler or MIniMemory (and possibly other carts) /and/ 32k. (But yes, E/A adds POKEV and PEEKV, and XB doesn't have VDP access built in either way.) Quote Link to comment Share on other sites More sharing options...
RXB Posted April 8, 2015 Share Posted April 8, 2015 (edited) RXB and other updated XB's have POKEV and PEEKV and POKEG and PEEKG but RXB also has CALL MOVES(any memory type, # of Bytes,FROM ADDRESS, TO ADDRESS) XB3 has CALL MOVE but can not move from or into strings like RXB can do. CALL MOVES(any memory type,# Bytes,FROM ADDRESS, to String Variable) RXB also has CALL POKER(value,VDP Register) and CALL IO(CRU byte,CRU ADDRESS) and CALL EXECUTE(CPU ASSEMBlY ADDRESS) Edited April 8, 2015 by RXB Quote Link to comment Share on other sites More sharing options...
JamesD Posted April 8, 2015 Share Posted April 8, 2015 Well, whatever version of BASIC is required... you need to figure out what addresses to modify to reserve memory to store the data at or how to temporarily hide/un-hide the variable data.If the start address of where variables is stored is fixed in ROM/GROM and can't be modified in RAM, then you may be out of luck. 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.