Pascal [Rev 3.0M 6/ 4/84] DM.TEXT 28-Jun-89 17:44:53 Page 1 1:D 0 (* sccs info: @(#) dm 8.1 84/05/04 00:20:44 *) 2:S 3:D 0 $modcal, debug off, range off, ovflcheck off, stackcheck off, callabs off$ 4:S 5:D 0 $search 'BRDECS', 'MISCASM', 'SR'$ 6:S 7:S 8:D 0 (****************************************************************************) 9:D 0 (* *) 10:D 0 (* * *** ***** *) 11:D 0 (* * * * *) 12:D 0 (* * * * *) 13:D 0 (* * * *** *) 14:D 0 (* * * * *) 15:D 0 (* * * * *) 16:D 0 (* ***** *** * *) 17:D 0 (* *) 18:D 0 (****************************************************************************) 19:S 20:S 21:D 0 module dmLIF; {directory managers} 22:S 23:D 1 import 24:D 1 brdecs, 25:D 1 miscasm, 26:D 1 sr; 27:S 28:D 1 export 29:D 1 function sysrec_valid: boolean; 30:D 1 function fileopen(var filename: string255; var filetype: signed16; 31:D 2 var sector_addr, length: integer; var exec_addr: anyptr): boolean; 32:S 33:D 1 implement {dmLIF} 34:S 35:D 1 type 36:S 37:D 1 bcd = 0..9; 38:D 1 bcd12 = packed array[1..12] of bcd; 39:D 1 unsgn15 = 0..32767; 40:S 41:D 1 LIF_vol_type = {LIF volume label} 42:D 1 packed record 43:D 1 LIFid: signed16; 44:D 1 LIFvolume_label: packed array[1..6] of char; 45:D 1 LIFdir_start_address: integer; 46:D 1 LIFoct_10000: signed16; 47:D 1 LIFdummy: signed16; 48:D 1 LIFdir_length: integer; 49:D 1 LIFversion: signed16; 50:D 1 LIFzero: signed16; 51:D 1 end; Pascal [Rev 3.0M 6/ 4/84] DM.TEXT 28-Jun-89 17:44:53 Page 2 52:D 1 $page$ 53:S 54:D 1 LIF_dir_entry = {LIF directory entry} 55:D 1 packed record 56:D 1 LIFfile_name: pac10 {array[1..10] of char}; 57:D 1 LIFfile_type: signed16; 58:D 1 LIFstart_address: integer; 59:D 1 LIFfile_length: integer; 60:D 1 LIFtoc: bcd12; 61:D 1 LIFl_flag: boolean; 62:D 1 LIFvol_number: unsgn15; 63:D 1 LIFimplement: integer; 64:D 1 end; 65:S 66:D 1 var 67:D 1 my_fubuffer[-558]: {256 byte general purpose buffer} 68:D 1 record case integer of 69:D 1 1: (LIF_vol_label: LIF_vol_type); 70:D 1 2: (LIF_dir_record: packed array[0..7] of LIF_dir_entry); 71:D 1 end; 72:S 73:S 74:D 1 function sysrec_valid: boolean; 75:C 2 begin {sysrec_valid} 76:C 2 with my_fubuffer.LIF_vol_label do 77:C 3 if (LIFid=-32768) and (LIFoct_10000=4096) and (LIFdummy=0) and (LIFzero=0) then 78:C 4 begin 79:C 4 sysrec_valid := true; 80:C 4 with f_area^ do 81:C 5 begin 82:C 5 m_dirsec := LIFdir_start_address; 83:C 5 m_dirlen := LIFdir_length; 84:C 5 m_dirent := 0; 85:C 5 end; {with} 86:C 4 end {then} 87:C 4 else 88:C 4 sysrec_valid := false; 89:C 2 end; {sysrec_valid} Pascal [Rev 3.0M 6/ 4/84] DM.TEXT 28-Jun-89 17:44:53 Page 3 90:D 1 $page$ 91:S 92:D 1 function fileopen(var filename: string255; var filetype: signed16; 93:D 2 var sector_addr, length: integer; var exec_addr: anyptr): boolean; 94:D 2 var 95:D -1 2 opened: boolean; 96:C 2 begin {fileopen} 97:S 98:C 2 opened := false; 99:S 100:C 2 with f_area^ do 101:C 3 while (m_dirlen>0) and not opened do 102:C 4 begin 103:S 104:C 4 dd_deviceread(my_fubuffer, 256, m_dirsec); 105:S 106:C 4 while (m_dirent<=7) and not opened do 107:C 5 begin 108:S 109:C 5 with my_fubuffer.LIF_dir_record[m_dirent] do 110:C 6 case LIFfile_type of 111:C 7 -1: {logical end of file} 112:C 7 begin 113:C 7 m_dirent := 7; 114:C 7 m_dirlen := 1; 115:C 7 end; 116:C 7 0: {purged directory entry} 117:C 7 {do nothing}; 118:C 7 otherwise {valid directory entry} 119:C 7 if (filetype=-1) or (filetype=LIFfile_type) then {the filetype matches} 120:C 8 if file_name_matches(filename, LIFfile_name) then 121:C 9 begin 122:C 9 filetype := LIFfile_type; 123:C 9 sector_addr := LIFstart_address; 124:C 9 length := LIFfile_length*256; 125:C 9 exec_addr := anyptr(LIFimplement); 126:C 9 opened := true; 127:C 9 end; {then} 128:C 7 end; {case} 129:S 130:C 5 m_dirent := m_dirent+1; 131:S 132:C 5 end; {while} 133:S 134:C 4 if m_dirent>7 then 135:C 5 begin 136:C 5 m_dirent := 0; 137:C 5 m_dirlen := m_dirlen-1; 138:C 5 m_dirsec := m_dirsec+1; 139:C 5 end; {then} 140:S 141:C 4 end; {while} 142:S 143:C 2 fileopen := opened; 144:S 145:C 2 end; {fileopen} 146:S 147:S 148:C 1 end; {dmLIF} Pascal [Rev 3.0M 6/ 4/84] DM.TEXT 28-Jun-89 17:44:53 Page 4 149:D 1 $page$ 150:S 151:D 1 (****************************************************************************) 152:D 1 (* *) 153:D 1 (* *** **** ***** *) 154:D 1 (* * * * * * *) 155:D 1 (* * * * * *) 156:D 1 (* *** * * *** *) 157:D 1 (* * * * * *) 158:D 1 (* * * * * * *) 159:D 1 (* *** **** * *) 160:D 1 (* *) 161:D 1 (****************************************************************************) 162:S 163:S 164:D 1 module dmSDF; {directory managers} 165:S 166:D 1 import 167:D 1 brdecs, 168:D 1 miscasm, 169:D 1 sr; 170:S 171:D 1 export 172:D 1 function sysrec_valid: boolean; 173:D 1 function fileopen(var filename: string255; var filetype: signed16; 174:D 2 var sector_addr, length: integer; var exec_addr: anyptr): boolean; 175:S 176:D 1 implement {dmSDF} 177:S 178:D 1 type 179:S 180:D 1 string16 = string[16]; 181:S 182:D 1 SDF_vol_type = {SDF volume label} 183:D 1 packed record 184:D 1 SDFid: signed16; 185:D 1 SDFreserved1: packed array[2..3] of char; 186:D 1 SDFreserved2: packed array[1..6] of integer; 187:D 1 SDFlogical_block_size: integer; 188:D 1 SDFboot_start_block: integer; 189:D 1 SDFboot_block_count: integer; 190:D 1 end; 191:S 192:D 1 SDF_boot_head_type = {SDF boot block header} 193:D 1 packed record 194:D 1 SDFowner: signed16; 195:D 1 SDFexecution_address: integer; 196:D 1 SDFfilename: string16; 197:D 1 end; 198:S 199:D 1 var 200:D 1 my_fubuffer[-558]: {256 byte general purpose buffer} 201:D 1 record case integer of 202:D 1 1: (SDF_vol_label: SDF_vol_type); 203:D 1 2: (SDF_boot_head: SDF_boot_head_type); 204:D 1 end; Pascal [Rev 3.0M 6/ 4/84] DM.TEXT 28-Jun-89 17:44:53 Page 5 205:D 1 $page$ 206:S 207:D 1 function sysrec_valid: boolean; 208:D -4 2 var size: integer; 209:C 2 begin {sysrec_valid} 210:C 2 with my_fubuffer.SDF_vol_label do 211:C 3 if (SDFid=1792) then 212:C 4 begin 213:C 4 sysrec_valid := true; 214:C 4 with f_area^ do 215:C 5 begin 216:C 5 size := SDFlogical_block_size div 256; 217:C 5 m_dirsec := SDFboot_start_block * size; 218:C 5 m_dirlen := SDFboot_block_count * size; 219:C 5 m_dirent := 0; 220:C 5 end; {with} 221:C 4 end {then} 222:C 4 else 223:C 4 sysrec_valid := false; 224:C 2 end; {sysrec_valid} 225:S 226:S 227:D 1 function fileopen(var filename: string255; var filetype: signed16; 228:D 2 var sector_addr, length: integer; var exec_addr: anyptr): boolean; 229:C 2 begin {fileopen} 230:C 2 fileopen := false; 231:C 2 with f_area^ do 232:C 3 if (m_dirlen > 0) and (m_dirent = 0) then 233:C 4 begin 234:C 4 m_dirent := 1; 235:C 4 dd_deviceread(my_fubuffer, 256, m_dirsec); 236:C 4 with my_fubuffer.SDF_boot_head do 237:C 5 if SDFowner = -5822 then 238:C 6 begin 239:C 6 filename := SDFfilename; 240:C 6 filetype := -5822; 241:C 6 sector_addr := m_dirsec + 1; 242:C 6 length := m_dirlen - 1; 243:C 6 exec_addr := anyptr(SDFexecution_address); 244:C 6 fileopen := true; 245:C 6 end; {then} 246:C 4 end; {with} 247:C 2 end; {fileopen} 248:S 249:S 250:C 1 end; {dmSDF} Pascal [Rev 3.0M 6/ 4/84] DM.TEXT 28-Jun-89 17:44:53 Page 6 251:D 1 $page$ 252:S 253:D 1 (****************************************************************************) 254:D 1 (* *) 255:D 1 (* * * * * *** * * *) 256:D 1 (* * * * * * * * *) 257:D 1 (* * * ** * * * * *) 258:D 1 (* * * * * * * * *) 259:D 1 (* * * * ** * * * *) 260:D 1 (* * * * * * * * *) 261:D 1 (* *** * * *** * * *) 262:D 1 (* *) 263:D 1 (****************************************************************************) 264:S 265:S 266:D 1 module dmUNIX; {directory managers} 267:S 268:D 1 import 269:D 1 brdecs, 270:D 1 miscasm, 271:D 1 sr; 272:S 273:D 1 export 274:D 1 function sysrec_valid: boolean; 275:D 1 function fileopen(var filename: string255; var filetype: signed16; 276:D 2 var sector_addr, length: integer; var exec_addr: anyptr): boolean; 277:S 278:D 1 implement {dmUNIX} 279:S 280:D 1 type 281:S 282:D 1 string16 = string[16]; 283:S 284:D 1 UNIX_vol_type = {UNIX volume label} 285:D 1 packed record 286:D 1 UNIXid: signed16; 287:D 1 UNIXreserved1: packed array[2..3] of char; 288:D 1 UNIXowner: integer; 289:D 1 UNIXexecution_address: integer; 290:D 1 UNIXboot_start_sector: integer; 291:D 1 UNIXboot_byte_count: integer; 292:D 1 UNIXfilename: string16; 293:D 1 end; 294:S 295:D 1 var 296:D 1 UNIX_vol_label[-558]: {256 byte general purpose buffer} 297:D 1 UNIX_vol_type; Pascal [Rev 3.0M 6/ 4/84] DM.TEXT 28-Jun-89 17:44:53 Page 7 298:D 1 $page$ 299:S 300:D 1 function sysrec_valid: boolean; 301:C 2 begin {sysrec_valid} 302:C 2 with UNIX_vol_label do 303:C 3 if (UNIXid=12288) then 304:C 4 begin 305:C 4 sysrec_valid := true; 306:C 4 with f_area^ do 307:C 5 begin 308:C 5 m_dirsec := UNIXboot_start_sector; 309:C 5 m_dirlen := UNIXboot_byte_count; 310:C 5 m_dirent := 0; 311:C 5 m_filesec := UNIXowner; 312:C 5 end; {with} 313:C 4 end {then} 314:C 4 else 315:C 4 sysrec_valid := false; 316:C 2 end; {sysrec_valid} 317:S 318:S 319:D 1 function fileopen(var filename: string255; var filetype: signed16; 320:D 2 var sector_addr, length: integer; var exec_addr: anyptr): boolean; 321:C 2 begin {fileopen} 322:C 2 with f_area^ do 323:C 3 if (m_filesec = -5822) and (m_dirlen > 0) and (m_dirent = 0) then 324:C 4 begin 325:C 4 m_dirent := 1; 326:C 4 filetype := -5822; 327:C 4 sector_addr := m_dirsec; 328:C 4 length := m_dirlen; 329:C 4 exec_addr := anyptr(m_dirent); 330:C 4 dd_deviceread(UNIX_vol_label, 256, 0); 331:C 4 filename := UNIX_vol_label.UNIXfilename; 332:C 4 exec_addr := anyptr(UNIX_vol_label.UNIXexecution_address); 333:C 4 fileopen := true; 334:C 4 end {if} 335:C 4 else 336:C 4 fileopen := false; 337:C 2 end; {fileopen} 338:S 339:S 340:C 1 end. {dmUNIX} 341:S 342:S No errors. No warnings. ***** Nonstandard language features enabled *****