Here is a first stab at making a utility that allows the use of the full 32K memory expansion for an XB program. This was only tested on a short program, but it should work fine for its intended purpose.
Divide the program into two parts. The highest line numbers will go into the 8K low memory. The lowest line numbers will go into the 32K high memory where XB normally stores programs. For my testing purposes I used the HELLO program from the compiler package. Lines 5 to 30 were saved as HELLOHM and lines 40 to 120 were saved as HELLOLM.
The assembled version of the program below is XB32K.OBJ
To use it:
CALL INIT::CALL LOAD("DSK1.XB32K.OBJ") - This sets pointers in the scratchpad to force XB to load a program into low memory.
OLD DSK1.HELLOLM - and now the program is loaded into low memory
CALL LINK("X") will embed this program in a short XB loader. This is sitting in low memory. It can't be edited there, but it can be saved, so let's do it.
NEW and then
OLD DSK1.HELLOHM - and now the high memory segment of the program is in the 24K high memory where XB usually keeps programs, and the low memory part if the program is still sitting in the 8K of low memory.
Now to merge the line number table from the program lines in low memory into the program in high memory.
CALL LINK("X") - and now the line number tables have been merged so the program can find the code stored in low memory. Now save it:
Just one more thing to do:
OLD DSK1.HELLOLM1 and modify line 10 so that it will "RUN DSK1.HELLOHM1" and then save the modified program.
Now if you RUN "DSK1.HELLOLM1" the program is loaded into high memory, then the program is copied into low memory where it was when you originally saved it. Then HELLOHM1 is loaded and run and the program runs normally even though half of it is in the "wrong" memory location.
The limitations need to be discovered. For example, you cannot resequence the program. I am not sure how much editing can be done from XB but I think it is possible for the low line numbers.
This is not very sophisticated, so be sure the high line numbers go into the low memory segment and the low line numbers go into the high memory segment.
*TO USE *CALL INIT::CALL LOAD("DSK1.XB32K.OBJ") *OLD DSK1.HELLOLM *CALL LINK("X") *SAVE DSK1.HELLOLM1 *NEW *OLD DSK1.HELLOHM *CALL LINK("X") *SAVE DSK1.HELLOHM1 AORG >3FC8 *Merge Line Number Table MRGLNT MOV @>8330,R1 Beginning of Line # table MOV @>3FFC,R2 Beginning of LNT in lowmem A R2,R1 S @>3FFE,R1 DEC R1 Can now add low mem LNT to HM LNT MOV R1,@>8330 New beginning of LNT LOOP2 MOVB *R2+,*R1+ Add line number table C R2,@>3FFE JLE LOOP2 B @>006A *Copy code from high memory into low memory *This starts at >FFD0 (255,208) LI R1,>FFE6 Program ends at >FFE7 LOOP1 MOV *R1,@>3FFE->FFE6(R1) Copies >FFE6 to >3FFE DECT R1 C R1,@>8330 Pointer to start of program in high mem JHE LOOP1 Loop until program copied into low mem B @>006A Back to XB DATA >1234,>5678 Beginning and end of line # table AORG >B000 *10 CALL INIT :: CALL LOAD(8192,255,208):: CALL LINK("X"):: RUN "DSK1.HMPROG1" XBPROG DATA >000A,>FFA8,>409D,>C804,>494E,>4954,>829D,>C804 DATA >4C4F,>4144,>B7C8,>0438,>3139,>32B3,>C803,>3235 DATA >35B3,>C803,>3230,>38B6,>829D,>C804,>4C49,>4E4B DATA >B7C7,>0158,>B682,>A9C7,>0B44,>534B,>312E,>484D DATA >5052,>4F47,>0000 CREATP MOV @>8330,@>3FFC Store beginning of line number table MOV @>8332,@>3FFE Store end of line number table MOV @>8330,R1 Pointer to beginning of LNT ANDI R1,>FFFE Round down so it is even AI R1,-67 New end of LNT MOV R1,@>8332 Store it AI R1,-3 New beginning of LNT MOV R1,@>8330 Store it MOV R1,R3 Store for later AI R3,5 starting address of program LI R2,XBPROG Start of XB program LOOP3 MOV *R2+,*R1+ Copy XB program JNE LOOP3 MOV R3,@-3(R3) Update pointer to start of program LI R0,>3FFF Save program to >3FFF MOV R0,@>8384 LI R0,MRGLNT Next CALL LINK("X") will merge LN Table MOV R0,@>2000 B @>006A AORG >8330 DATA >3FC7,>3FC7 AORG >8384 DATA >3FC7,>3FC7 AORG >2000 DATA CREATP END
(Newest version attached)
Edited by senior_falcon, Wed Feb 27, 2019 8:22 PM.