tschak909 Posted May 21, 2020 Share Posted May 21, 2020 Could I use the below code (this is from the DOS 2.0 source code), as a starting point for my XIO 39/40 implementation? 1170 .PAGE 1171 ;========================================================================= 1172 ; **** LOADER ROUTINE *** 1173 ;========================================================================= 1174 ; LOADS FROM THE FILE (MUST BE LOAD FORMAT) 1175 ; INTO MEMORY. RETURNS: 1176 ; X=0 LOAD OK 1177 ; X=1 OPEN ERRORS Y=CIO CODE 1178 ; X=2 READ ERRORS Y=CIO CODE 1179 ; X=3 BAD LOAD FILE 1180 ; ON ENTRY, IOCB 1 POINTS TO FILENAME. 1181 ;------------------------------------------------------------------------- 1182 DUPFLG .BYTE 0 ;FLAG -IF DUP IN MEMORY NOT ZERO 1183 OPT .BYTE 0 ;HOLDS VALUE OF OPTION GIVEN BY USER 1184 LOADFG .BYTE 0 ;FLAG = $80 IF MEMORY FILE DOESN'T HAVE 1185 HDBUF *=*+4 1186 HILO HDBUF 1187 HDBUFH = HDBUF/256 1188 HDBUFL = (-256)*HDBUFH+HDBUF 1189 SFLOAD LDA #$80 1190 STLOAD STA LOADFG 1191 LOAD LDA #.LOW.RTS 1192 STA RUNAD 1193 LDA #.HIGH.RTS 1194 STA RUNAD+1 ;MAKE RUN AT EOF DEFAULT TO RTS 1195 LDX #$10 1196 LDA #OPEN 1197 STA ICCOM,X 1198 LDA #4 ;OPEN TYPE=INPUT 1199 STA ICAX1,X 1200 JSR CIO ;TRY TO OPEN FILE 1201 BPL RDLF ;CONT IF OK 1202 LDA #1 ;OPEN ERRORS 1203 BNE CLFX ;CLOSE AND EXIT 1204 RDLF LDX #$10 1205 LDA #.LOW.DBUFL 1206 STA ICBAL,X 1207 LDA #.LOW.DBUFH 1208 STA ICBAH,X 1209 LDA #2 1210 STA ICBLL,X 1211 LDA #0 1212 STA ICBLH,X 1213 STA MEMLDD ;CLEAR MEM.SAV LOADED FLAG 1214 LDA #GETCHR 1215 STA ICCOM,X 1216 JSR CIO 1217 BMI ERST ;IF ERRS 1218 LDA #$FF 1219 CMP DBUF ;CHECK FOR VALID LOAD FILE 1220 BNE LNLF 1221 CMP DBUF+1 1222 BNE LNLF ;BRANCH IF NOT A LOAD FILE 1223 RDDRC LDX #$10 1224 LDA #.LOW.HDBUFL 1225 STA ICBAL,X 1226 LDA #.LOW.HDBUFH 1227 STA ICBAH,X 1228 LDA #4 1229 RDDRC1 STA ICBLL,X 1230 LDA #0 1231 STA ICBLH,X 1232 JSR CIO ;NO ERROR CHECK SO CAN CATCH EOF 1233 BPL STOK ;IF NO ERROR 1234 CPY #$88 ;SEE IF EOF 1235 BNE ERST ;IF SOME ERROR STATUS 1236 ;========================================================================= 1237 ;EOF SO DONE, EXIT 1238 ;========================================================================= 1239 JSR CLOSX ;CLOSE IOCB'S 1 AND 2 1240 BIT OPT 1241 BMI DRUN ;BRANCH IF NO RUN OPTION 1242 JSR JMPRUN ;JUMP THROUGH RUN VECTOR 1243 DRUN LDA #0 ;OK STATUS 1244 BIT LOADFG ;WAS MEMORY SWAPPED? 1245 STA LOADFG 1246 BMI CLFX ;BRANCH IF MEMORY WASN'T SWAPPED 1247 JSR MEMSVQ ;DOES MEMORY SAVE FILE EXIST? 1248 BMI DRUN1 ;BRANCH IF NOT 1249 PLA 1250 PLA 1251 JMP GOOD ;WRITE MEMORY AND RELOAD DUP 1252 ;========================================================================= 1253 ; SEE IF DUP WRITTEN OVER. IF IS RELOAD & TELL USER NEED MEM.SAV TO 1254 ; LOAD THIS FILE. 1255 ;========================================================================= 1256 DRUN1 LDA DUPFLG ;SEE IF DUP CLOBBERED 1257 BNE DRUN2 ;NO, THEN RETURN 1258 LDA #.LOW.NMSFL ;ELSE TELL USER NEED MEM.SAV 1259 LDX #.LOW.NMSFH 1260 JSR PRNTMSG ;PRINT MSG 1261 JMP RRDUP ;RELOAD & RUN DUP 1262 ;========================================================================= 1263 ; RETURN TO CALLING ROUTINE 1264 ;========================================================================= 1265 DRUN2 LDA #0 ;NO DUP ERR MSG ON EOF 1266 CLFX TAX 1267 RTS RTS -Thom Quote Link to comment Share on other sites More sharing options...
Alfred Posted May 21, 2020 Share Posted May 21, 2020 As a starting point, sure. You can likely lose anything that relates to DUP. Quote Link to comment Share on other sites More sharing options...
Rybags Posted May 22, 2020 Share Posted May 22, 2020 It doesn't seem to do much - only grabs the first 2 bytes, validatest $FFFF as a loadable file then grabs the following 4 bytes for start/length. The binary load algorithm is fairly simple and you can easily just do your own. Quote Link to comment Share on other sites More sharing options...
Alfred Posted May 22, 2020 Share Posted May 22, 2020 I assumed he just didn’t post the rest of the routine since what’s listed is incomplete. Quote Link to comment Share on other sites More sharing options...
tschak909 Posted May 22, 2020 Author Share Posted May 22, 2020 Yeah, sorry, the rest of it is there, I just didn't grab it all. still trying to work through what to do. Believe it or not, my assembler-fu is terrible. -Thom 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.