þþ×èX;SAVE #D2:DUPLOAD.M65òAŽLOADER ROUTINEAü!X; **** LOADER ROUTINE ****X;X;5X; LOADS FROM THE FILE (MUST BE LOAD FORMAT)$!X; INTO MEMORY. RETURNS:.X; X=0 LOAD OK8(X; X=1 OPEN ERRORS Y=CIO CODEB(X; X=2 READ ERRORS Y=CIO CODELX; X=3 BAD LOAD FILEV0X; ON ENTRY, IOCB 1 POINTS TO FILENAME.`X;j‡@ALIGN t.†DUPFLG ;;FLAG -IF DUP IN MEMORY NOT ZERO~/ƒOPT ;;HOLDS VALUE OF OPTION GIVEN BY USERˆ>†LOADFG ;;FLAG = $80 IF MEMORY FILE DOESN'T HAVE TO BE LO’…HDBUFœ†SFLOADQ>€¦†STLOADP†LOADFG°„LOADQ>4ƒRTSº P…RUNADÄ Q>5ƒRTSÎ-P…RUNAD;;MAKE RUN AT EOF DEFAULT TO RTSØ$>â Q>„OPENìP…ICCOM9öQ>;;OPEN TYPE=INPUT P…ICAX19 †CIOOPN;;TRY TO OPEN FILEI„RDLF;;CONT IF OKQ>;;OPEN ERRORS(H„CLFX;;CLOSE AND EXIT2„RDLF$><Q>4„DBUFFP…ICBAL9PQ>5„DBUFZP…ICBAH9dQ>nP…ICBLL9xQ> ‚P…ICBLH9Œ&P†MEMLDD;;CLEAR MEM.SAV LOADED FLAG–Q>†GETCHR P…ICCOM9ª ƒCIO´G„ERST;;IF ERRS¾Q>ÿÈ$R„DBUF;;CHECK FOR VALID LOAD FILEÒ H„LNLFÜR„DBUFæ$H„LNLF;;BRANCH IF NOT A LOAD FILEð …RDDRC$>úQ>4…HDBUFP…ICBAL9Q>5…HDBUFP…ICBAH9"Q>,†RDDRC1P…ICBLL96Q> @P…ICBLH9J) ƒCIO;;NO ERROR CHECK SO CAN CATCH EOFTI„STOK;;IF NO ERROR^)>ˆ;;SEE IF EOFhH„ERST;;IF SOME ERROR STATUSrX;|X;EOF SO DONE, EXIT†X; …CLOSX;;CLOSE IOCB'S 1 AND 2š*ƒOPT¤"G„DRUN;;BRANCH IF NO RUN OPTION®$ †JMPRUN;;JUMP THROUGH RUN VECTOR¸„DRUNQ> ;;OK STATUS *†LOADFG;;WAS MEMORY SWAPPED?ÌP†LOADFGÖ*G„CLFX;;BRANCH IF MEMORY WASN'T SWAPPEDà) †MEMSVQ;;DOES MEMORY SAVE FILE EXIST?êG…DRUN1;;BRANCH IF NOTô7þ7&!„GOOD;;WRITE MEMORY AND RELOAD DUPX;MX; SEE IF DUP WRITTEN OVER. IF IS RELOAD & TELL USER NEED MEM.SAV TO&X; LOAD THIS FILE.0X;:'…DRUN1Q†DUPFLG;;SEE IF DUP CLOBBEREDDH…DRUN2;;NO, THEN RETURNN(Q>4„NMSF;;ELSE TELL USER NEED MEM.SAVX$>5„NMSFb ‡PRNTMSG;;PRINT MSGl!…RRDUP;;RELOAD & RUN DUPvX;€%X; RETURN TO CALLING ROUTINEŠX;”$…DRUN2Q> ;;NO DUP ERR MSG ON EOFž „CLFX>¨ƒRTS:²X;¼X; ERROR RETURNSÆX;ЄLNLF …CLOSXÚQ>;;BAD LOAD FILEä H„CLFXî „ERSTCø5 …CLOSX7? H„CLFX*X;4>X; CONTINUE WITH LOAD - CHECK LOAD ADDRESS FOR HEADER>2X; HEADER IF HAVE CONCATENATED LOAD FILESHX;R„STOK$>\Q…HDBUF;;MOVE PARAMS TO IOCBfP…ICBAL9p5z Q…HDBUF„P…ICBAH9Ž?˜7¢3;;WAS ADDRESS FF?¬H„ADOK;;BRANCH IF NOT¶?À3;;OTHER BYTE FF?ÊH„ADOK;;BRANCH IF NOTÔX;ÞOX; HAVE A HEADER & START ADDRESS - GET END ADDRESS FOR TEXT & DO AGAINèX;ò Q…HDBUFü P…HDBUF Q…HDBUF P…HDBUF;;MOVE LOAD ADDRESS Q>4…HDBUF$ P…ICBAL9. Q>5…HDBUF 8
L !†RDDRC1V X;` 8X; GET LENGTH OF TEXT. THEN DETERMINE IF IN DUPj X;t /X; *** The NOP's in the next section of code~ *X; are there only to make changed codeˆ 0X; occupy the same space as the old DUP 2.0s’ 0X; code. Since the new version was shorter,œ 0X; filler was required (The new version also¦ X; works!).° X;º „ADOKQ…HDBUFÄ ;Î S…HDBUFØ P…ICBLL9â Q…HDBUFì S…HDBUFö P…ICBLH9 Q…HDBUF *R>5…NMDUP ;; IS BEGINNING PAST DUP? 4 E„ANWD;; BRANCH IF SO( Q…HDBUF2 R>5„NDOS;; IS END BELOW DUP?< 4F EƒAWD;;BRANCH IF NOTP X;Z 8X; SINCE TEXT IN DUP, LOAD MEM.SAV IF NECCESARYd X;n „ANWDQ†MEMLDDx *GƒAWD;;BRANCH IF MEM.SAV ALREADY LOADED‚ Q>€Œ L†LOADFG– 7P†LOADFG;;SET MEM.SAV DOESN'T HAVE TO BE LOADED FLAG ƒAWD#…ICBLL9ª H…:AWD1´ #…ICBLH9¾ 0…:AWD1*†LOADFG;;DOES MEMORY HAVE TO BE LOADEDÈ GƒDLM;;BRANCH IF NOTÒ (Q†MEMLDD;;WAS MEM.SAV ALREADY LOADED?Ü GƒDLM;;BRANCH IF SOæ "†MEMLDDð - …LDMEM;;LOAD MEM.SAVE FILE (IF IT EXISTS)ú )Q> ;;SHOW USER AREA NOT DUP IN MEMORYP†DUPFLG1 †RELDIN;;RESTORE DOS IN VECTOR FROM SAVED LOCX;"EX; SET NO INIT ADDR DEFAULT THEN READ IN TEXT & ATTEMPT INIT,X;6ƒDLM$>@ Q>4ƒRTSJP†INITADT Q>5ƒRTS^'P†INITAD;;INIT DEFAULTS TO AN RTSh& ƒCIO;;READ DATA DIRECTLY TO MEMORYr I„DLM1|!„ERST;;IF ERRORS† „DLM1*ƒOPT"G…DINIT;;BRANCH IF NO GO OPTIONš †JMPINT;;DO INIT¤/…DINIT!…RDDRC;;GET NEXT SECTION OF LOAD FILE®X;¸2X; *** A subroutine existed here in DOS 2.0s toÂ3X; supposedly check for a load file overwritingÌ0X; DUP.SYS. It didn't work properly, so theÖ1X; code was rewritten without the subroutine.à/X; The final result used less code than theêX; original!ôX;þBX; But we must fill up the old space... so here's the old code:„AWDQR>5„NDOS*D…AWDQR;;BRANCH IF HI BYTE LT DUP STARTR>5…NMDUP &U?0N>:V?;;COMPLEMENT CARRYD …AWDQR:NX; *** End of unused code!X‡@ALIGN bX;lX;v†JMPINT!@†INITAD:€†JMPRUN!@…RUNAD:ŠX;”X;ž †MEMLDD ¨‚AFAŽD1:AUTORUN.SYSA=‚CR²/„NMSFAŸNEED MEM.SAV TO LOAD THIS FILE.A=‚CR