\ 2CARD2 8/26/94 Copyright Jeff Fox COMMENT: LATEST MOD 8/26/94 TO 2CARD2 moves 32K TO BOTTOM OF CARD AND 32K TO TOP This program allocates 128k of memory, then prompts for a file name and moves a 16k simulated MuP21 file into 64k of DOS memory. An image from the card is then loaded into the other 64k of allocated memory, and the simulated MuP21 DRAM is packed into the copy of the MuP21 BOOT RAM so that it will be loaded into real DRAM when MuP21 boots. Finally it moves the 64k to the PCMCIA CARD. The first 32k goes to the boottom 32k on the card, and the second 32k goes to the top 32k on the 128k card. These areas of the card are read when the card is booted on MuP21. This utility copies 14K WORDS of simulated MuP21 code 14K from 800-3FFF to allow room for Dr. Ting's video 4/23/94 FROM addresses 800-3FFF in a *.P21 file This is the upper 14K 20 bit words from an S21 type file These files are produced with OKX, X21D, X21, or S21 TO the locations on the MuP21 PCMCIA CARD such that when the MuP21 boots the code will load to 800-3F00 in MuP21 This program assumes these address, but will prompt for a filename for the *.P21 file to load into the PCMCIA card. It will also show all *.?21 files in the current directory before it prompts for the filename of the file to load. Chuck's OK code loads less than 1k MuP21 WORDS from the PCMCIA SRAM into DRAM at boot, so the loop counter in the OK boot code must be changed to load 16k WORDS. NOTE the utility FLOPCARD will swap the upper and lower halfs of the card. in DOS <-----32k-----><-----32k-----><-----32k-----><-----32k-----> BFD<---24k----><-----32k-----><-----32k-----><-----32k-----> Boot sector, File allocation table, directory and files eForth is here <-P21eForth2--><-P21eForth1--> < this is read only in dos > After FLOPCARD read to boot on MuP21 in eForth <-P21eForth1--><-----32k----->BFD<---24k----><-P21eForth2--> <-Boot-blocks-><--DOS-blocks-><--DOS-blocks-><-Boot-blocks-> <-----32k-----><-----32k-----> < DOS FILE STRUCTURES HERE > COMMENT; HEX -1 CONSTANT MUPSIZE variable MUPseg \ pointer to 64k segment variable sramseg \ pointer to 64k segment ( 128k 3/9/93 ) : ALLOCMEM ( ALLOCATE 64K OF RAM FOR USE AS 16K 20 BIT LOCATIONS ) ( and a second 64k segment for PCMCIA SRAM SIMULATION ) 2000 ALLOC IF SWAP DROP DEALLOC ." ERROR CANNOT ALLOCATE 128K RAM " CR DROP CR ." PRESS A KEY TO CONTINUE " KEY DROP QUIT ELSE MUPSEG ! DROP ( STORE SEGMENT IF WE ALLOCATED OK ) MUPseg @ 1000 + sramseg ! ( set sram segment value also ) THEN ; \ ALLOCMEM \ do allocmem at runtime \ MUPseg is first 64k where *.?21 files get loaded as in S21, OKX, and X21 \ sramseg is the second 64k this is the packed SRAM that goes >card \ use the standard file access BLOAD BSAVE 21DIR words to load the *.?21 file FLOAD F21FILE HEX 0 value cardbuf 3 VALUE carddrive \ A=0 B=1 C=2 D=3 0 or 1 on POQET 3 on 386 \ to change drives on the fly you would have to modify the code words \ CARD> and >CARD so they take an argument at runtime, or use a word like \ fixsegments that changes the code words CARD> and >CARD. \ DS:BX IS THE TRANSFER ADDRESS CODE CARD> \ TRANSFER 64K FROM PCMCIA CARD TO buffer PUSH AX PUSH BX PUSH BP PUSH SI PUSH DI PUSH DS MOV AX, # sramseg \ set ds to address of sram segment ' card> 7 + MOV DS, AX MOV AX, # carddrive \ SPECIFY DRIVE MOV BX, # cardbuf \ TRANSFER TO SRAMBUF MOV CX, # $80 \ 128 512 BYTE SECTORS = 64K BYTES MOV DX, # 0 \ starting sector INT $25 POPF POP DS POP DI POP SI POP BP POP BX POP AX NEXT END-CODE CODE >CARD \ transfer 64k from buffer to PCMCIA card PUSH AX PUSH BX PUSH BP PUSH SI PUSH DI PUSH DS MOV AX, # sramseg \ set DS to segment of allocated memory MOV DS, AX MOV AX, # carddrive \ SPECIFY DRIVE MOV BX, # cardbuf \ TRANSFER FROM SRAMBUF MOV CX, # $40 \ 64 512 BYTE SECTORS = 32K BYTES MOV DX, # 0 \ first sector INT $26 POPF POP DS POP DI POP SI POP BP POP BX POP AX NEXT END-CODE CODE >CARDhi \ transfer 64k from buffer to PCMCIA card PUSH AX PUSH BX PUSH BP PUSH SI PUSH DI PUSH DS MOV AX, # sramseg \ set DS to segment of allocated memory MOV DS, AX MOV AX, # carddrive \ SPECIFY DRIVE MOV BX, # $8000 \ TRANSFER FROM SRAMBUF START AT 32K NOT 0 MOV CX, # $40 \ 64 512 BYTE SECTORS = 32K BYTES MOV DX, # $C0 \ first sector IS THIRD QUARTER OF CARD INT $26 POPF POP DS POP DI POP SI POP BP POP BX POP AX NEXT END-CODE : fixsegments \ used at runtime to initialize segment pointers sramseg @ [ ' card> ] literal 7 + ! \ patch the allocated segment into code words sramseg @ [ ' >cardhi ] literal 7 + ! \ patch the allocated segment into code words sramseg @ [ ' >card ] literal 7 + ! ; \ patch the allocated segment into code words COMMENT: : showsram cls ." SRAM CARD buffer SEGMENT DUMP " CR CR sramseg @ 0 200 ldump ; : showmup cls ." MUP buffer SEGMENT DUMP " CR CR mupseg @ 0 200 ldump ; COMMENT; \ 4/24/94 : 4>3 \ move 4 byte X21 inst to 3 byte OK SRAM PACKED format in CARD buffer \ C00 AAA xor => 6AA as the first location in SRAM for 400 in DRAM \ AC00 \ starting address for 400 in DRAM \ 4000 400 DO DUP $AAAA XOR \ address xor AAA B800 \ B800 AC00 - C00 = 3*400 \ starting address for 800 in DRAM 4000 800 DO DUP $AAAA XOR \ address xor AAA MUPSEG @ I 4 * 2+ C@L SWAP SRAMSEG @ SWAP C!L \ MS byte high word low byte 1+ DUP $AAAA XOR MUPSEG @ I 4 * 1+ C@L SWAP SRAMSEG @ SWAP C!L \ low word high byte 1+ DUP $AAAA XOR MUPSEG @ I 4 * C@L SWAP SRAMSEG @ SWAP C!L \ low word low byte packed last 1+ LOOP DROP ; \ AC00 + (3 * 4000) = AC00 + C000 = 16C00 : main f21dir cls allocmem fixsegments card> \ read 64k bytes including Chuck's 1K WORD OK bload \ ask for file - you CAN change CARDS here 4>3 \ for 800 load 4/24/94 \ convert from S21 format to PCMCIA BOOT >card \ block transfer 64k back to the PCMCIA CARD >cardhi \ added 8/21/94 bye ; ' main is boot save-exe 2card2.exe