From: "French Luser" Newsgroups: comp.os.cpm Subject: AFTER8 File Format Date: Sat, 20 Nov 2004 11:14:52 +0100 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Lines: 293 Message-ID: <419f187a$0$7241$8fcfb975@news.wanadoo.fr> Organization: les newsgroups par Wanadoo NNTP-Posting-Host: APoitiers-106-2-3-133.w81-248.abo.wanadoo.fr X-Trace: 1100945531 news.wanadoo.fr 7241 81.248.43.133:21796 X-Complaints-To: abuse@wanadoo.fr AFTER8A.TXT ----------- Looking after 8 segments, again... Back home, after discovering that I was not the only one (surprisingly) thinking about CP/M-86 (Plus) CMD files with 8 segments, I decided to automate the process of creating them, in order to play with them in the near future. The big advantage of the AFTER8 file format is that no change need to be done to any CP/M-86 (Plus) system or utility, contrary to the Large Memory Model, which obliged DRI to make a RUN.CMD utility just to load those files in the TPA of CP/M-86 v1.x or Concurrent CP/M 1.0. After more than one hour of play, I got the following on the screen of my CP/M-86 Plus system: A>mbasic after8 BASIC-86 Rev. 5.22 [CP/M-86 Plus] Copyright 1977-1982 (C) by Microsoft Created: 5-Mar-82 62390 Bytes free AFTER8> Enter 1st CMD File Name: ? CMDX4 Enter 2nd CMD File Name: ? CMDY4 Enter Destination CMD File Name: ? AFTER8 Pass 1 Pass 2 Ok Not very impressive, isn't it? But let us have a look to the file AFTER8.CMD produced: A>sid after8 SID86 1.01 1/4/83 START END CS 1CC1:0000 1CC1:007F DS 1CC9:0000 1CC9:017F ES 1CE1:0000 1CE1:007F SS 1CE9:0000 1CE9:007F X1 1CF1:0000 1CF1:007F X2 1CF9:0000 1CF9:007F X3 1D01:0000 1D01:007F X4 1D09:0000 1D09:007F #dcs:0 1CC1:0000 20 43 50 2F 4D 2D 38 36 20 50 6C 75 73 20 2D 2D CP/M-86 Plus -- 1CC1:0010 20 43 6F 64 65 20 53 65 67 6D 65 6E 74 20 20 20 Code Segment 1CC1:0020 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F !"#$%&'()*+,-./ 1CC1:0030 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 0123456789:;<=>? 1CC1:0040 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F @ABCDEFGHIJKLMNO 1CC1:0050 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F PQRSTUVWXYZ[\]^_ 1CC1:0060 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F `abcdefghijklmno 1CC1:0070 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 00 pqrstuvwxyz{|}~. 1CC1:0080 7F 00 00 C1 1C 00 7F 01 00 C9 1C 00 7F 00 00 E1 ................ 1CC1:0090 1C 00 7F 00 00 E9 1C 00 7F 00 00 F1 1C 00 7F 00 ................ 1CC1:00A0 00 F9 1C 00 7F 00 00 01 1D 00 7F 00 00 09 1D 00 ................ 1CC1:00B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ By the way, if you remember the BASEPAGE.BAS program that I published in the comp.os.cpm Newsgroup many years ago, you should remember that the DS starts with 8 areas holding the Segments characteristics, each 6 bytes long. Each area contains the length of the segment (3 bytes), then its base in the TPA (2 bytes), then either the M80 Byte for the CS or an unused byte for the other segments. Since then, I did not make an assembly language version of BASEPAGE, but I hope that it is obvious that: 1CC1:0080| 7F 00 00 C1 1C 00 = CS (1CC1) 1CC1:0086| 7F 01 00 C9 1C 00 = DS (1CC9) 1CC1:008C| 7F 00 00 E1 1C 00 = ES (1CE1) 1CC1:0092| 7F 00 00 E9 1C 00 = SS (1CE9) 1CC1:0088| 7F 00 00 F1 1C 00 = X1 (1CF1) 1CC1:008E| 7F 00 00 F9 1C 00 = X2 (1CF9) 1CC1:0094| 7F 00 00 01 1D 00 = X3 (1D01) 1CC1:009A| 7F 00 00 09 1D 00 = X4 (1D09) as displayed by SID-86. This could be useful to an AFTER8 program wanting to pass control to code in one of the Auxiliary Segments... (Those Auxiliary Segments would be perfect to put Run-Time System subroutines. This way, we would have the 64K of the CS available for the program. In fact, since there are 4 Auxiliary Segments but only one Code Segment, it would probably be more reasonable to do the reverse: place the RTS in the CS, and have the four X-Segments (4 * 64k = 256k!!!) contain the program...) You will note that several Internet programs running under MS-DOS are smaller than 256K... Stop dreaming. Back to our demo. #d 1CC1:00C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 1CC1:00D0 00 00 00 00 00 00 00 00 00 00 00 00 00 20 20 20 ............. 1CC1:00E0 20 20 20 20 20 20 20 20 00 00 00 00 00 20 20 20 ..... 1CC1:00F0 20 20 20 20 20 20 20 20 00 00 00 00 00 00 00 00 ........ 1CC1:0100 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 1CC1:0110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 1CC1:0120 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 1CC1:0130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 1CC1:0140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 1CC1:0150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 1CC1:0160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 1CC1:0170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ #d 1CC1:0180 20 43 50 2F 4D 2D 38 36 20 50 6C 75 73 20 2D 2D CP/M-86 Plus -- 1CC1:0190 20 44 61 74 61 20 53 65 67 6D 65 6E 74 20 20 20 Data Segment 1CC1:01A0 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F !"#$%&'()*+,-./ 1CC1:01B0 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 0123456789:;<=>? 1CC1:01C0 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F @ABCDEFGHIJKLMNO 1CC1:01D0 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F PQRSTUVWXYZ[\]^_ 1CC1:01E0 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F `abcdefghijklmno 1CC1:01F0 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 00 pqrstuvwxyz{|}~. 1CC1:0200 20 43 50 2F 4D 2D 38 36 20 50 6C 75 73 20 2D 2D CP/M-86 Plus -- 1CC1:0210 20 45 78 74 72 61 20 53 65 67 6D 65 6E 74 20 20 Extra Segment 1CC1:0220 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F !"#$%&'()*+,-./ 1CC1:0230 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 0123456789:;<=>? #d 1CC1:0240 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F @ABCDEFGHIJKLMNO 1CC1:0250 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F PQRSTUVWXYZ[\]^_ 1CC1:0260 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F `abcdefghijklmno 1CC1:0270 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 00 pqrstuvwxyz{|}~. 1CC1:0280 20 43 50 2F 4D 2D 38 36 20 50 6C 75 73 20 2D 2D CP/M-86 Plus -- 1CC1:0290 20 53 74 61 63 6B 20 53 65 67 6D 65 6E 74 20 20 Stack Segment 1CC1:02A0 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F !"#$%&'()*+,-./ 1CC1:02B0 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 0123456789:;<=>? 1CC1:02C0 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F @ABCDEFGHIJKLMNO 1CC1:02D0 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F PQRSTUVWXYZ[\]^_ 1CC1:02E0 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F `abcdefghijklmno 1CC1:02F0 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 00 pqrstuvwxyz{|}~. #d 1CC1:0300 20 43 50 2F 4D 2D 38 36 20 50 6C 75 73 20 2D 2D CP/M-86 Plus -- 1CC1:0310 20 20 20 58 31 20 53 65 67 6D 65 6E 74 20 20 20 X1 Segment 1CC1:0320 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F !"#$%&'()*+,-./ 1CC1:0330 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 0123456789:;<=>? 1CC1:0340 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F @ABCDEFGHIJKLMNO 1CC1:0350 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F PQRSTUVWXYZ[\]^_ 1CC1:0360 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F `abcdefghijklmno 1CC1:0370 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 00 pqrstuvwxyz{|}~. 1CC1:0380 20 43 50 2F 4D 2D 38 36 20 50 6C 75 73 20 2D 2D CP/M-86 Plus -- 1CC1:0390 20 20 20 58 32 20 53 65 67 6D 65 6E 74 20 20 20 X2 Segment 1CC1:03A0 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F !"#$%&'()*+,-./ 1CC1:03B0 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 0123456789:;<=>? #d 1CC1:03C0 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F @ABCDEFGHIJKLMNO 1CC1:03D0 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F PQRSTUVWXYZ[\]^_ 1CC1:03E0 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F `abcdefghijklmno 1CC1:03F0 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 00 pqrstuvwxyz{|}~. 1CC1:0400 20 43 50 2F 4D 2D 38 36 20 50 6C 75 73 20 2D 2D CP/M-86 Plus -- 1CC1:0410 20 20 20 58 33 20 53 65 67 6D 65 6E 74 20 20 20 X3 Segment 1CC1:0420 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F !"#$%&'()*+,-./ 1CC1:0430 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 0123456789:;<=>? 1CC1:0440 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F @ABCDEFGHIJKLMNO 1CC1:0450 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F PQRSTUVWXYZ[\]^_ 1CC1:0460 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F `abcdefghijklmno 1CC1:0470 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 00 pqrstuvwxyz{|}~. #d 1CC1:0480 20 43 50 2F 4D 2D 38 36 20 50 6C 75 73 20 2D 2D CP/M-86 Plus -- 1CC1:0490 20 20 20 58 34 20 53 65 67 6D 65 6E 74 20 20 20 X4 Segment 1CC1:04A0 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F !"#$%&'()*+,-./ 1CC1:04B0 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F 0123456789:;<=>? 1CC1:04C0 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F @ABCDEFGHIJKLMNO 1CC1:04D0 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F PQRSTUVWXYZ[\]^_ 1CC1:04E0 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F `abcdefghijklmno 1CC1:04F0 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 00 pqrstuvwxyz{|}~. 1CC1:0500 10 01 EB A0 8B 16 10 01 8A 1E 12 01 33 C0 B0 80 ............3... 1CC1:0510 A2 BC 05 88 26 BD 05 E9 FA FC BB B4 05 81 07 80 ....&........... 1CC1:0520 00 B9 03 00 73 0E 43 43 FF 07 75 08 E2 F8 FE 06 ....s.CC..u..... 1CC1:0530 BC 05 D1 1F 74 1B F6 06 B4 05 FF 75 05 80 26 B5 ....t......u..&. #^C Conclusion: AFTER8.BAS seems to have produced a viable AFTER8 ComManD file for CP/M-86 (Plus). At least, SID-86 accepts it. I wonder if I should give you the program which does this magic? Ha, well... I am too kind! 10 REM AFTER8.BAS for CP/M-86 Plus by Emmanuel ROCHE 20 : 30 PRINT 40 INPUT "AFTER8> Enter 1st CMD File Name: " ; file1$ 50 file1$ = file1$ + ".CMD" 60 OPEN "R", #1, file1$, 1 70 FIELD #1, 1 AS byte1$ 80 : 90 GET #1, 10 : IF ASC (byte1$) = 0 THEN NrSeg1 = 1 100 GET #1, 19 : IF ASC (byte1$) = 0 THEN NrSeg1 = 2 110 GET #1, 28 : IF ASC (byte1$) = 0 THEN NrSeg1 = 3 120 GET #1, 37 : IF ASC (byte1$) = 0 THEN NrSeg1 = 4 ELSE GOTO 170 130 : 140 GET #1, &H80 : IF ASC (byte1$) <> 0 THEN GOTO 340 150 GOTO 220 160 : 170 PRINT 180 PRINT CHR$ (7) "ERROR: This CMD file has more than 4 Segments..." 190 PRINT 200 END 210 : 220 INPUT " Enter 2nd CMD File Name: " ; file2$ 230 file2$ = file2$ + ".CMD" 240 OPEN "R", #2, file2$, 1 250 FIELD #2, 1 AS byte2$ 260 : 270 GET #2, 10 : IF ASC (byte2$) = 0 THEN NrSeg2 = 1 280 GET #2, 19 : IF ASC (byte2$) = 0 THEN NrSeg2 = 2 290 GET #2, 28 : IF ASC (byte2$) = 0 THEN NrSeg2 = 3 300 GET #2, 37 : IF ASC (byte2$) = 0 THEN NrSeg2 = 4 ELSE GOTO 170 310 : 320 GET #2, &H80 : IF ASC (byte2$) = 0 THEN GOTO 420 330 : 340 PRINT 350 PRINT CHR$ (7) "ERROR: This CMD file has LOADER Flag(s) set." 360 PRINT 370 PRINT "AFTER8 only works for CMD files without LOADER Flag(s)," 380 PRINT "since it cannot decide which LOADER Flag(s) should be copied." 390 PRINT 400 END 410 : 420 PRINT 430 INPUT "Enter Destination CMD File Name: " ; file3$ 440 file3$ = file3$ + ".CMD" 450 OPEN "R", #3, file3$, 1 460 FIELD #3, 1 AS byte3$ 470 : 480 PRINT 490 PRINT "Pass 1" 500 CLOSE #1 510 OPEN "R", #1, file1$, 1 520 WHILE NOT EOF(1) OR LOC(1) = 0 530 GET #1 540 IF EOF(1) THEN GOTO 570 550 LSET byte3$ = byte1$ 560 PUT #3 570 WEND 580 : 590 PRINT "Pass 2" 600 CLOSE #2 610 OPEN "R", #2, file2$, 1 620 GET #2, &H80 ' Skip over Header Record 630 WHILE NOT EOF(2) OR LOC(2) = 0 640 GET #2 650 IF EOF(2) THEN GOTO 680 660 LSET byte3$ = byte2$ 670 PUT #3 680 WEND 690 : 700 ' Now, relocate the Group Descriptors 710 : 720 CLOSE #2 730 OPEN "R", #2, file2$, 1 740 PUT #3, 9 * NrSeg1 750 FOR i = 1 TO NrSeg2 760 GET #2 770 LSET byte3$ = CHR$ (ASC (byte2$) + 4) 780 PUT #3 790 FOR j = 1 TO 8 800 GET #2 810 LSET byte3$ = byte2$ 820 PUT #3 830 NEXT j 840 NEXT i 850 : 860 PRINT 870 CLOSE 880 END (Regarding LOADER Flags: They can be added to the AFTER8 CMD file after its creation. GENRSX adds, of course, the RSX Footer Record at the end of the CMD file. The Concurrent CP/M CHSET utility (which should have been named SETHR, since it sets Header Record fields in CMD files) can modify the other flags. I think it is also available under DOS Plus.) A>That's all, folks! Yours Sincerely, "French Luser" EOF