? The following are lists of two methods of implementing the DSR, GPL and CIF (Convert Integer to Floating-point) routines in Extended Basic. These routines are not included in the package of routines loaded into low memory by the CALL INIT command. First is an Assembly program list that implements the routines. The second is a list of X-Basic CALL LOAD Pokes that will load the routines into low memory. EQU statements needed for BLWP to these routines are DSRLNK EQU >24F4 GPLLNK EQU >24F8 CIFLNK EQU >24FC The DSR and GPL routines work as documented in the Editor/ Assembler manual. The CIF routine provided, like the routine loaded by the Ed/Assmblr cartridge and called through XMLLNK, takes the one-word integer value at the FAC (Floating point ACcumulator) at >834A and returns the converted result at FAC. Unlike the XMLLNK-provided routine, this routine should NOT have a DATA >2300 statement following the BLWP @CIFLNK statement. The DSR and CIF routines were both created from dis-assembly listing of the routines provided by the Ed/Assmblr cartridge. The GPL routine was picked up many months ago on a bulletin board (I can't remember which one), and appears to work - although the specifics of HOW it works is a mystery to me. Warning!! Handling your own DSR PABs (Peripheral Access Blocks) and buffer areas appears to be VERY dangerous in the Extended Basic environment. You can very easily destroy data in VDP memory currently in-use by the X-Basic interpreter. One way of handling this is to OPEN the file in Basic and use the value at >833C to find the PAB and buffer area allocated by the file. (See page 302 of the Editor/Assembler manual) Or, save the VDP memory you're going to use to RAM and then restore it to the original value after the DSRLNK. ALSO, be advised that the Get String Space routine provided via the GPLLNK appears to not work in the X-Basic environment. Eventually (usually after the first "garbage collection" is forced), VDP memory in use by the X-Basic interpreter will get corrupted and (as we frequently say), "Results may be unpredictable". The following Assembler listing may be used as a stand-alone code file by: 1) Stripping out my comments and the CALL LOAD listing 2) Create a code file by running it through the Assembler. 3) In your X-Basic program: a) CALL LOAD("DSKn.") b) CALL LINK("FIXFFA") c) CALL LOAD your code file that will use the routines. Or, you may wish to simply include the Assembler source statements in your Assembler program. If so, take out my DEF and AORG statements and the FIXFFA routine (the last 5 lines of the listing). DEF FIXFFA AORG >24F4 GPLWS EQU >83E0 Equates needed in Extended Basic Environment UTILWS EQU >2038 VSBR EQU >2028 FAC EQU >834A GRMRA EQU >9802 GRMWA EQU >9C02 PABADD EQU >8356 PAD EQU >8300 SUBSTK EQU >8373 DSRLNK DATA UTILWS Set-up BLWP fields DATA DSRBGN GPLLNK DATA UTILWS DATA GPLBGN CIFLNK DATA UTILWS DATA CIFBGN FNAME TEXT '----------' Work area and Constants used by DSR routine VAL1 BYTE >20 VAL2 BYTE >AA VAL3 BYTE >2E DSRBGN MOV *R14+,R5 Begin of DSR routine SZCB @VAL1,R15 MOV @PABADD,R0 MOV R0,R9 AI R9,-8 BLWP @VSBR MOVB R1,R3 SRL R3,8 SETO R4 LI R2,FNAME DSR1 INC R0 INC R4 C R4,R3 JEQ DSR2 BLWP @VSBR MOVB R1,*R2+ CB R1,@VAL3 JNE DSR1 DSR2 MOV R4,R4 JEQ DSR10 CI R4,>0007 JGT DSR10 CLR @>83D0 MOV R4,@>8354 INC R4 A R4,@PABADD LWPI GPLWS CLR R1 LI R12,>0F00 DSR3 MOV R12,R12 JEQ DSR4 SBZ >0000 DSR4 AI R12,>0100 CLR @>83D0 CI R12,>2000 JEQ DSR9 MOV R12,@>83D0 SBO >0000 LI R2,>4000 CB *R2,@VAL2 JNE DSR3 A @UTILWS+10,R2 JMP DSR6 DSR5 MOV @>83D2,R2 SBO >0000 DSR6 MOV *R2,R2 JEQ DSR3 MOV R2,@>83D2 INCT R2 MOV *R2+,R9 MOVB @>8355,R5 JEQ DSR8 CB R5,*R2+ JNE DSR5 SRL R5,8 LI R6,FNAME DSR7 CB *R6+,*R2+ JNE DSR5 DEC R5 JNE DSR7 DSR8 INC R1 BL *R9 JMP DSR5 SBZ >0000 LWPI UTILWS MOV R9,R0 BLWP @VSBR SRL R1,13 JNE DSR11 RTWP DSR9 LWPI UTILWS DSR10 CLR R1 DSR11 SWPB R1 MOVB R1,*R13 SOCB @VAL1,R15 RTWP GPLBGN MOVB @GRMRA,R1 Begin of GPL routine SWPB R1 MOVB @GRMRA,R1 SWPB R1 AI R1,-3 MOVB @SUBSTK,R2 SRL R2,8 AI R2,PAD INCT R2 MOVB R1,*R2 SWPB R1 MOVB R1,@1(R2) SWPB R2 MOVB R2,@SUBSTK MOVB *R14+,@GRMWA MOVB *R14+,@GRMWA MOV @>2000,R4 LI R3,GPL1 MOV R3,@>2000 LWPI GPLWS RT GPL1 LWPI UTILWS MOV R4,@>2000 RTWP RADIX DATA 100 Constant used by CIF routine CIFBGN LI R4,FAC Start of CIF routine MOV *R4,R0 MOV R4,R6 CLR *R6+ CLR *R6+ MOV R0,R5 JEQ CIFRTN ABS R0 LI R3,>0040 CLR *R6+ CLR *R6 CI R0,100 JL CIF2 CI R0,10000 JL CIF1 INC R3 MOV R0,R1 CLR R0 DIV @RADIX,R0 MOVB @UTILWS+3,@3(R4) CIF1 INC R3 MOV R0,R1 CLR R0 DIV @RADIX,R0 MOVB @UTILWS+3,@2(R4) CIF2 MOVB @UTILWS+1,@1(R4) MOVB @UTILWS+7,*R4 INV R5 JLT CIFRTN NEG *R4 CIFRTN RTWP FIXFFA LI R0,EOF+2 Fix-up First Free Address value MOV R0,@>2002 after LOAD, do a CALL LINK("FIXFFA") CLR R0 EOF RT END The following is the Extended Basic statements necessary to LOAD the DSR, GPL and CIF routines into low memory. The First Free Address value (at >2002) is fixed up so that subsequent LOADs of Assembler code files will not overwrite the routines. Convert these lines with the DV80TO.PRO program into a MERGEable X-Basic file. They can then be MERGEd into into a X-Basic program that LOADs other Assembler subroutines that need these routines. Entry points for the 3 LNKs are the same as stated above. 100 CALL INIT 110 CALL LOAD(9460,32,56,37,14,32,56,37,222,32,56) 120 CALL LOAD(9470,38,46,45,45,45,45,45,45,45,45) 130 CALL LOAD(9480,45,45,32,170,46,0,193,126,83,224) 140 CALL LOAD(9490,37,10,192,32,131,86,194,64,2,41) 150 CALL LOAD(9500,255,248,4,32,32,40,208,193,9,131) 160 CALL LOAD(9510,7,4,2,2,37,0,5,128,5,132) 170 CALL LOAD(9520,128,196,19,6,4,32,32,40,220,129) 180 CALL LOAD(9530,152,1,37,12,22,246,193,4,19,71) 190 CALL LOAD(9540,2,132,0,7,21,68,4,224,131,208) 200 CALL LOAD(9550,200,4,131,84,5,132,168,4,131,86) 210 CALL LOAD(9560,2,224,131,224,4,193,2,12,15,0) 220 CALL LOAD(9570,195,12,19,1,30,0,2,44,1,0) 230 CALL LOAD(9580,4,224,131,208,2,140,32,0,19,44) 240 CALL LOAD(9590,200,12,131,208,29,0,2,2,64,0) 250 CALL LOAD(9600,152,18,37,11,22,238,160,160,32,66) 260 CALL LOAD(9610,16,3,192,160,131,210,29,0,192,146) 270 CALL LOAD(9620,19,230,200,2,131,210,5,194,194,114) 280 CALL LOAD(9630,209,96,131,85,19,9,156,133,22,242) 290 CALL LOAD(9640,9,133,2,6,37,0,156,182,22,237) 300 CALL LOAD(9650,6,5,22,252,5,129,6,153,16,232) 310 CALL LOAD(9660,30,0,2,224,32,56,192,9,4,32) 320 CALL LOAD(9670,32,40,9,209,22,4,3,128,2,224) 330 CALL LOAD(9680,32,56,4,193,6,193,215,65,243,224) 340 CALL LOAD(9690,37,10,3,128,208,96,152,2,6,193) 350 CALL LOAD(9700,208,96,152,2,6,193,2,33,255,253) 360 CALL LOAD(9710,208,160,131,115,9,130,2,34,131,0) 370 CALL LOAD(9720,5,194,212,129,6,193,216,129,0,1) 380 CALL LOAD(9730,6,194,216,2,131,115,216,62,156,2) 390 CALL LOAD(9740,216,62,156,2,193,32,32,0,2,3) 400 CALL LOAD(9750,38,34,200,3,32,0,2,224,131,224) 410 CALL LOAD(9760,4,91,2,224,32,56,200,4,32,0) 420 CALL LOAD(9770,3,128,0,100,2,4,131,74,192,20) 430 CALL LOAD(9780,193,132,4,246,4,246,193,64,19,35) 440 CALL LOAD(9790,7,64,2,3,0,64,4,246,4,214) 450 CALL LOAD(9800,2,128,0,100,26,19,2,128,39,16) 460 CALL LOAD(9810,26,8,5,131,192,64,4,192,60,32) 470 CALL LOAD(9820,38,44,217,32,32,59,0,3,5,131) 480 CALL LOAD(9830,192,64,4,192,60,32,38,44,217,32) 490 CALL LOAD(9840,32,59,0,2,217,32,32,57,0,1) 500 CALL LOAD(9850,213,32,32,63,5,69,17,1,5,20) 510 CALL LOAD(9860,3,128) 520 CALL LOAD(8194,38,134) ! Fix-up First Free Address Value Download complete. Turn off Capture File.