>
>
> Up next is P070301 (SEGMENT OPTIONS)
With this posting I complete the decompiling for STARTUP.CODE.
P070301 pcode (SEGMENT OPTIONS)
This is the pcode we want to generate:
FILE: 7 SEG: 3 PROC: 1
JTAB FOR SUBROUTINE 1:
DATA SIZE: 512
PARAM SIZE: 0
EXIT AT: 5227
ENTER AT: 5000
PROC NUMBER: 1
LEXICAL LEVEL: 1
5000 04 SLDC. PUSH #0004
5001 C6 01 LLA. PUSH #MP.01
5003 00 SLDC. PUSH #0000
5004 C7 00 02 LDCI. PUSH #0200
5007 00 SLDC. PUSH #0000
5008 00 SLDC. PUSH #0000
5009 9E 05 READ FROM VOL#
500B 04 SLDC. PUSH #0004
500C C6 01 LLA. PUSH #MP.01
500E 00 SLDC. PUSH #0000
500F C7 00 02 LDCI. PUSH #0200
5012 00 SLDC. PUSH #0000
5013 00 SLDC. PUSH #0000
5014 9E 06 WRITE VOL#
5016 9E 22 PUSH I/O ERROR STATUS
5018 10 SLDC. PUSH #0010
5019 CB NEQI. PUSH ((TOS-1) <> (TOS))
501A A1 03 UJP. IF NOT (TOS) THEN JUMP TO 501F
501C 00 SLDC. PUSH #0000
501D A1 F6 UJP. IF NOT (TOS) THEN JUMP TO 501C
501F B6 02 03 LOD. PUSH ACTREC(-02).03
5022 0C SLDC. PUSH #000C
5023 00 SLDC. PUSH #0000
5024 CD 00 11 CXP. CALL EXTERNAL PROCEDURE: 11 IN SEGMENT: 00
5027 B6 02 03 LOD. PUSH ACTREC(-02).03
502A D7 NOP. NOP
502B A6 28 43 4F 50 59 52 49 47 48 54 20 28 43 29 31 39 38 31 20 41 4C 4C 20 52 49 47 48 54 53 20 52 45 53 45 52 56 45 44 20 42 59
COPYRIGHT (C)1981 ALL RIGHTS RESERVED BY
LSA. PUSH #(PC+1) POINTER TO THE STRING
5055 00 SLDC. PUSH #0000
5056 CD 00 13 CXP. CALL EXTERNAL PROCEDURE: 13 IN SEGMENT: 00
5059 B6 02 03 LOD. PUSH ACTREC(-02).03
505C CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
505F B6 02 03 LOD. PUSH ACTREC(-02).03
5062 D7 NOP. NOP
5063 A6 28 41 4E 44 52 45 57 20 47 52 45 45 4E 42 45 52 47 2C 20 49 4E 43 20 26 20 52 4F 42 45 52 54 20 57 4F 4F 44 48 45 41 44 2C
ANDREW GREENBERG, INC & ROBERT WOODHEAD,
LSA. PUSH #(PC+1) POINTER TO THE STRING
508D 00 SLDC. PUSH #0000
508E CD 00 13 CXP. CALL EXTERNAL PROCEDURE: 13 IN SEGMENT: 00
5091 B6 02 03 LOD. PUSH ACTREC(-02).03
5094 CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
5097 B6 02 03 LOD. PUSH ACTREC(-02).03
509A D7 NOP. NOP
509B A6 28 49 4E 43 2E 20 20 54 48 49 53 20 50 52 4F 47 52 41 4D 20 20 49 53 20 20 50 52 4F 54 45 43 54 45 44 20 20 55 4E 44 45 52
INC. THIS PROGRAM IS PROTECTED UNDER
LSA. PUSH #(PC+1) POINTER TO THE STRING
50C5 00 SLDC. PUSH #0000
50C6 CD 00 13 CXP. CALL EXTERNAL PROCEDURE: 13 IN SEGMENT: 00
50C9 B6 02 03 LOD. PUSH ACTREC(-02).03
50CC CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
50CF B6 02 03 LOD. PUSH ACTREC(-02).03
50D2 D7 NOP. NOP
50D3 A6 28 54 48 45 20 4C 41 57 53 20 4F 46 20 54 48 45 20 55 4E 49 54 45 44 20 53 54 41 54 45 53 20 20 41 4E 44 20 4F 54 48 45 52
THE LAWS OF THE UNITED STATES AND OTHER
LSA. PUSH #(PC+1) POINTER TO THE STRING
50FD 00 SLDC. PUSH #0000
50FE CD 00 13 CXP. CALL EXTERNAL PROCEDURE: 13 IN SEGMENT: 00
5101 B6 02 03 LOD. PUSH ACTREC(-02).03
5104 CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
5107 B6 02 03 LOD. PUSH ACTREC(-02).03
510A D7 NOP. NOP
510B A6 28 43 4F 55 4E 54 52 49 45 53 2C 20 20 41 4E 44 20 49 4C 4C 45 47 41 4C 20 44 49 53 54 52 49 42 55 54 49 4F 4E 20 4D 41 59
COUNTRIES, AND ILLEGAL DISTRIBUTION MAY
LSA. PUSH #(PC+1) POINTER TO THE STRING
5135 00 SLDC. PUSH #0000
5136 CD 00 13 CXP. CALL EXTERNAL PROCEDURE: 13 IN SEGMENT: 00
5139 B6 02 03 LOD. PUSH ACTREC(-02).03
513C CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
513F B6 02 03 LOD. PUSH ACTREC(-02).03
5142 D7 NOP. NOP
5143 A6 28 52 45 53 55 4C 54 20 49 4E 20 43 49 56 49 4C 20 20 4C 49 41 42 49 4C 49 54 59 20 20 41 4E 44 20 43 52 49 4D 49 4E 41 4C
RESULT IN CIVIL LIABILITY AND CRIMINAL
LSA. PUSH #(PC+1) POINTER TO THE STRING
516D 00 SLDC. PUSH #0000
516E CD 00 13 CXP. CALL EXTERNAL PROCEDURE: 13 IN SEGMENT: 00
5171 B6 02 03 LOD. PUSH ACTREC(-02).03
5174 CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
5177 B6 02 03 LOD. PUSH ACTREC(-02).03
517A D7 NOP. NOP
517B A6 0C 50 52 4F 53 45 43 55 54 49 4F 4E 2E
PROSECUTION.
LSA. PUSH #(PC+1) POINTER TO THE STRING
5189 00 SLDC. PUSH #0000
518A CD 00 13 CXP. CALL EXTERNAL PROCEDURE: 13 IN SEGMENT: 00
518D B6 02 03 LOD. PUSH ACTREC(-02).03
5190 CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
5193 00 SLDC. PUSH #0000
5194 0C SLDC. PUSH #000C
5195 CD 00 1D CXP. CALL EXTERNAL PROCEDURE: 1D IN SEGMENT: 00
5198 B6 02 03 LOD. PUSH ACTREC(-02).03
519B A6 20 20 20 56 45 52 53 49 4F 4E 20 32 2E 31 20 4F 46 20 32 32 2D 4A 41 4E 2D 38 32 20 20 53 45 52 3A
VERSION 2.1 OF 22-JAN-82 SER:
LSA. PUSH #(PC+1) POINTER TO THE STRING
51BD D7 NOP. NOP
51BE 00 SLDC. PUSH #0000
51BF CD 00 13 CXP. CALL EXTERNAL PROCEDURE: 13 IN SEGMENT: 00
51C2 B6 02 03 LOD. PUSH ACTREC(-02).03
51C5 A5 05 LA0. PUSH #BASE.05
51C7 00 SLDC. PUSH #0000
51C8 CD 00 13 CXP. CALL EXTERNAL PROCEDURE: 13 IN SEGMENT: 00
51CB B6 02 03 LOD. PUSH ACTREC(-02).03
51CE CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
51D1 B6 02 03 LOD. PUSH ACTREC(-02).03
51D4 CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
51D7 B6 02 03 LOD. PUSH ACTREC(-02).03
51DA CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
51DD B6 02 03 LOD. PUSH ACTREC(-02).03
51E0 D7 NOP. NOP
51E1 A6 26 20 20 53 29 54 41 52 54 20 47 41 4D 45 20 20 55 29 54 49 4C 49 54 49 45 53 20 20 54 29 49 54 4C 45 20 50 41 47 45
S)TART GAME U)TILITIES T)ITLE PAGE
LSA. PUSH #(PC+1) POINTER TO THE STRING
5209 00 SLDC. PUSH #0000
520A CD 00 13 CXP. CALL EXTERNAL PROCEDURE: 13 IN SEGMENT: 00
520D 29 SLDC. PUSH #0029
520E 00 SLDC. PUSH #0000
520F CD 00 1D CXP. CALL EXTERNAL PROCEDURE: 1D IN SEGMENT: 00
5212 B6 02 02 LOD. PUSH ACTREC(-02).02
5215 A5 03 LA0. PUSH #BASE.03
5217 CD 00 10 CXP. CALL EXTERNAL PROCEDURE: 10 IN SEGMENT: 00
521A EA SLDO. PUSH BASE.03
521B 53 SLDC. PUSH #0053
521C C3 EQUI. PUSH ((TOS-1) = (TOS))
521D EA SLDO. PUSH BASE.03
521E 55 SLDC. PUSH #0055
521F C3 EQUI. PUSH ((TOS-1) = (TOS))
5220 8D LOR. PUSH ((TOS-1) OR (TOS))
5221 EA SLDO. PUSH BASE.03
5222 54 SLDC. PUSH #0054
5223 C3 EQUI. PUSH ((TOS-1) = (TOS))
5224 8D LOR. PUSH ((TOS-1) OR (TOS))
5225 A1 F4 UJP. IF NOT (TOS) THEN JUMP TO 520D
5227 AD 00 RNP. RETURN FROM NON-BASE PROCEDURE.
5229 00 SLDC. PUSH #0000
522A 1D SLDC. PUSH #001D
522B 00 SLDC. PUSH #0000
522C 10 SLDC. PUSH #0010
522D 02 SLDC. PUSH #0002
PROCEDURE OPTIONS is different from the one in LOL.
WRITELN( BASE05) is not correct.
I currently have it called RANDNUM, but see now that it is the SERIALNM
This is my first draft after changing BASE05 to RANDNUM.
1152 9 1:D 1 SEGMENT PROCEDURE OPTIONS; (* P050301 *)
1153 9 1:D 1
1154 9 1:D 1 CONST
1155 9 1:D 1 HOMECLR = 12;
1156 9 1:D 1
1157 9 1:D 1 VAR
1158 9 1:D 1 IOBUFF : PACKED ARRAY[ 0..511] OF CHAR;
1159 9 1:D 257
1160 9 1:0 0 BEGIN
1161 9 1:0 0
1162 9 1:1 0 UNITREAD( DRIVE1, IOBUFF, SIZEOF( IOBUFF), 0, 0);
1163 9 1:1 11 UNITWRITE( DRIVE1, IOBUFF, SIZEOF( IOBUFF), 0, 0);
1164 9 1:1 22
1165 9 1:1 22 IF IORESULT = 16 THEN
1166 9 1:2 28 REPEAT
1167 9 1:2 28 UNTIL FALSE;
1168 9 1:2 31
1169 9 1:1 31 WRITE( CHR( HOMECLR));
1170 9 1:1 39
1171 9 1:1 39 WRITELN( 'COPYRIGHT (C)1981 ALL RIGHTS RESERVED BY');
1172 9 1:1 95 WRITELN( 'ANDREW GREENBERG, INC & ROBERT WOODHEAD,');
1173 9 1:1 151 WRITELN( 'INC. THIS PROGRAM IS PROTECTED UNDER');
1174 9 1:1 204 WRITELN( 'THE LAWS OF THE UNITED STATES AND OTHER');
1175 9 1:1 259 WRITELN( 'COUNTRIES, AND ILLEGAL DISTRIBUTION MAY');
1176 9 1:1 314 WRITELN( 'RESULT IN CIVIL LIABILITY AND CRIMINAL');
1177 9 1:1 368 WRITELN( 'PROSECUTION.');
1178 9 1:1 396
1179 9 1:1 396 GOTOXY( 0, 12);
1180 9 1:1 401
1181 9 1:1 401 WRITE( ' VERSION 2.1 OF 22-JAN-82 SER:');
1182 9 1:1 444 WRITELN( RANDNUM);
1183 9 1:1 458 WRITELN;
1184 9 1:1 464 WRITELN;
1185 9 1:1 470
1186 9 1:1 470 WRITE( 'S)TART GAME U)TILITIES T)ITLE PAGE');
1187 9 1:1 514
1188 9 1:1 514 REPEAT
1189 9 1:2 514 GOTOXY( 41,0);
1190 9 1:2 519 READ( INCHAR)
1191 9 1:1 527 UNTIL (INCHAR = 'S') OR (INCHAR = 'T') OR (INCHAR = 'U')
1192 9 1:1 537
1193 9 1:1 537 (*
1194 9 1:1 537 GOTOXY( 0, 12);
1195 9 1:1 537 WRITE( 'VERSION -4- OF 04-MAY-83 SER:');
1196 9 1:1 537 WRITELN( SERIAL);
1197 9 1:1 537 WRITELN;
1198 9 1:1 537 WRITELN;
1199 9 1:1 537 WRITELN( ' S)TART GAME U)TILITIES' : 32);
1200 9 1:1 537 WRITELN;
1201 9 1:1 537 WRITELN( 'NOTE - YOU MUST MAKE AN ADDITIONAL SCEN-');
1202 9 1:1 537 WRITELN( ' ARIO DISKETTE BEFORE PLAYING. SEE');
1203 9 1:1 537 WRITE ( ' THE MANUAL FOR MORE DETAILS.' );
1204 9 1:1 537
1205 9 1:1 537 REPEAT
1206 9 1:1 537 GOTOXY( 41, 0);
1207 9 1:1 537 READ( INCHAR)
1208 9 1:1 537 UNTIL (INCHAR = 'S') OR (INCHAR = 'U')
1209 9 1:1 537
1210 9 1:1 537 *)
1211 9 1:0 537 END;
Sometimes first drafts have lots of errors, so now it is time to fix them.
Change "IORESULT = 16" to "IORESULT <> 16".
Change "INC. THIS PROGRAM IS PROTECTED UNDER" to "INC. THIS PROGRAM IS PROTECTED UNDER"
(Add some spaces to the message.)
change "THE LAWS OF THE UNITED STATES AND OTHER" to "THE LAWS OF THE UNITED STATES AND OTHER"
change "COUNTRIES, AND ILLEGAL DISTRIBUTION MAY" to "COUNTRIES, AND ILLEGAL DISTRIBUTION MAY
change "RESULT IN CIVIL LIABILITY AND CRIMINAL" to "RESULT IN CIVIL LIABILITY AND CRIMINAL"
change " VERSION 2.1 OF 22-JAN-82 SER:" to " VERSION 2.1 OF 22-JAN-82 SER:"
Now my code says it is using BASE.04 and not BASE.05.
For some reason the routine is generated as PROCEDURE: 0D instead of PROCEDURE: 13.
change "'S)TART GAME U)TILITIES T)ITLE PAGE'" to "' S)TART GAME U)TILITIES T)ITLE PAGE'
Remove temporary comments and old code from LOL.
53 55 54
The order in the UNTIL statement is "S" "U" "T".
Change RANDNUM to SERIAL
Final rough draft for P070301.
1151 8 1:0 104 (*$I WIZ1E:OPTIONS *)
1152 9 1:D 1 SEGMENT PROCEDURE OPTIONS; (* P070301 *)
1153 9 1:D 1
1154 9 1:D 1 CONST
1155 9 1:D 1 HOMECLR = 12;
1156 9 1:D 1
1157 9 1:D 1 VAR
1158 9 1:D 1 IOBUFF : PACKED ARRAY[ 0..511] OF CHAR;
1159 9 1:D 257
1160 9 1:0 0 BEGIN
1161 9 1:0 0
1162 9 1:1 0 UNITREAD( DRIVE1, IOBUFF, SIZEOF( IOBUFF), 0, 0);
1163 9 1:1 11 UNITWRITE( DRIVE1, IOBUFF, SIZEOF( IOBUFF), 0, 0);
1164 9 1:1 22
1165 9 1:1 22 IF IORESULT <> 16 THEN
1166 9 1:2 28 REPEAT
1167 9 1:2 28 UNTIL FALSE;
1168 9 1:2 31
1169 9 1:1 31 WRITE( CHR( HOMECLR));
1170 9 1:1 39
1171 9 1:1 39 WRITELN( 'COPYRIGHT (C)1981 ALL RIGHTS RESERVED BY');
1172 9 1:1 95 WRITELN( 'ANDREW GREENBERG, INC & ROBERT WOODHEAD,');
1173 9 1:1 151 WRITELN( 'INC. THIS PROGRAM IS PROTECTED UNDER');
1174 9 1:1 207 WRITELN( 'THE LAWS OF THE UNITED STATES AND OTHER');
1175 9 1:1 263 WRITELN( 'COUNTRIES, AND ILLEGAL DISTRIBUTION MAY');
1176 9 1:1 319 WRITELN( 'RESULT IN CIVIL LIABILITY AND CRIMINAL');
1177 9 1:1 375 WRITELN( 'PROSECUTION.');
1178 9 1:1 403
1179 9 1:1 403 GOTOXY( 0, 12);
1180 9 1:1 408
1181 9 1:1 408 WRITE( ' VERSION 2.1 OF 22-JAN-82 SER:');
1182 9 1:1 450 WRITELN( SERIAL);
1183 9 1:1 465 WRITELN;
1184 9 1:1 471 WRITELN;
1185 9 1:1 477
1186 9 1:1 477 WRITE( ' S)TART GAME U)TILITIES T)ITLE PAGE');
1187 9 1:1 525
1188 9 1:1 525 REPEAT
1189 9 1:2 525 GOTOXY( 41,0);
1190 9 1:2 530 READ( INCHAR)
1191 9 1:1 538 UNTIL (INCHAR = 'S') OR (INCHAR = 'U') OR (INCHAR = 'T')
1192 9 1:0 548 END;
1193 9 1:0 568 (*$I WIZ1E:OPTIONS *)
Once you're done re-engineering the Pascal code you look at it and say, "That looks obvious. What took you so long?"
Note, IORESULT = 16 means the diskette is write-protected.
So this check is making sure the diskette IS write protected, else it goes into an infinite loop. Trying to stop software pirates.
Next up is SEGMENT UTILS (P070101);
STARTUP.TEXT
$I WIZ1E:WIZUTILB
$I WIZ1E:WIZUTILC
$I WIZ1E:TITLELOA
$I WIZ1E:OPTIONS
I'm confused, why isn't there a WIZUTIL (or WIZUTILA) include file in STARTUP.TEXT?
Oh yeah, in LOL there is a separate executable called WIZUTIL.CODE so that WIZUTIL.TEXT is the code that includes WIZUTILB and WIZUTILC. WIZUTIL.TEXT is now STARTUP.TEXT (SYSTEM.STARTUP).
The reason there is a WIZUTILB.TEXT and WIZUTILC.TEXT is because the segment is too big for the Pascal editor. The placement of the break can be quite arbitrary, but it makes sense to do it "logically". You want about 1/2 the code in one file, and 1/2 in the other, and you usually want to start the second file with a procedure at a high lexical level. The reasons for this are purely logistical with regards to making global editting changes to the code and data. Heck, if you want to you can split the files in 2 places whereever white space is allowed, but I wouldn't recommend splitting onc procedure between the two.
This is the pcode we want for UTILS (P070101):
FILE: 7 SEG: 1 PROC: 1
JTAB FOR SUBROUTINE 1:
DATA SIZE: 1538
PARAM SIZE: 0
EXIT AT: 6B77
ENTER AT: 6A32
PROC NUMBER: 1
LEXICAL LEVEL: 1
6A32 D7 NOP. NOP
6A33 A6 12 57 49 5A 41 52 44 52 59 20 55 54 49 4C 49 54 49 45 53
WIZARDRY UTILITIES
LSA. PUSH #(PC+1) POINTER TO THE STRING
6A47 CE 0F CLP. CALL CHILD PROCEDURE: 0F
6A49 B6 02 03 LOD. PUSH ACTREC(-02).03
6A4C CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
6A4F B6 02 03 LOD. PUSH ACTREC(-02).03
6A52 D7 NOP. NOP
6A53 A6 10 43 48 4F 4F 53 45 20 41 4E 20 4F 50 54 49 4F 4E
CHOOSE AN OPTION
LSA. PUSH #(PC+1) POINTER TO THE STRING
6A65 1C SLDC. PUSH #001C
6A66 CD 00 13 CXP. CALL EXTERNAL PROCEDURE: 13 IN SEGMENT: 00
6A69 B6 02 03 LOD. PUSH ACTREC(-02).03
6A6C CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
6A6F B6 02 03 LOD. PUSH ACTREC(-02).03
6A72 CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
6A75 B6 02 03 LOD. PUSH ACTREC(-02).03
6A78 D7 NOP. NOP
6A79 A6 1B 52 29 45 43 4F 56 45 52 20 20 54 29 52 41 4E 53 46 45 52 20 42 29 41 43 4B 55 50
R)ECOVER T)RANSFER B)ACKUP
LSA. PUSH #(PC+1) POINTER TO THE STRING
6A96 22 SLDC. PUSH #0022
6A97 CD 00 13 CXP. CALL EXTERNAL PROCEDURE: 13 IN SEGMENT: 00
6A9A B6 02 03 LOD. PUSH ACTREC(-02).03
6A9D CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
6AA0 B6 02 03 LOD. PUSH ACTREC(-02).03
6AA3 CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
6AA6 B6 02 03 LOD. PUSH ACTREC(-02).03
6AA9 A6 1B 4D 29 41 4B 45 20 53 43 45 4E 41 52 49 4F 20 44 49 53 4B 20 55 29 50 44 41 54 45
M)AKE SCENARIO DISK U)PDATE
LSA. PUSH #(PC+1) POINTER TO THE STRING
6AC6 D7 NOP. NOP
6AC7 22 SLDC. PUSH #0022
6AC8 CD 00 13 CXP. CALL EXTERNAL PROCEDURE: 13 IN SEGMENT: 00
6ACB B6 02 03 LOD. PUSH ACTREC(-02).03
6ACE CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
6AD1 B6 02 03 LOD. PUSH ACTREC(-02).03
6AD4 CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
6AD7 B6 02 03 LOD. PUSH ACTREC(-02).03
6ADA D7 NOP. NOP
6ADB A6 1B 43 29 48 41 4E 47 45 20 4E 41 4D 45 53 20 20 20 20 20 20 20 4C 29 45 41 56 45 20
C)HANGE NAMES L)EAVE
LSA. PUSH #(PC+1) POINTER TO THE STRING
6AF8 22 SLDC. PUSH #0022
6AF9 CD 00 13 CXP. CALL EXTERNAL PROCEDURE: 13 IN SEGMENT: 00
6AFC B6 02 03 LOD. PUSH ACTREC(-02).03
6AFF CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
6B02 29 SLDC. PUSH #0029
6B03 00 SLDC. PUSH #0000
6B04 CD 00 1D CXP. CALL EXTERNAL PROCEDURE: 1D IN SEGMENT: 00
6B07 CE 04 CLP. CALL CHILD PROCEDURE: 04
6B09 EA SLDO. PUSH BASE.03
6B0A 52 SLDC. PUSH #0052
6B0B C3 EQUI. PUSH ((TOS-1) = (TOS))
6B0C EA SLDO. PUSH BASE.03
6B0D 54 SLDC. PUSH #0054
6B0E C3 EQUI. PUSH ((TOS-1) = (TOS))
6B0F 8D LOR. PUSH ((TOS-1) OR (TOS))
6B10 EA SLDO. PUSH BASE.03
6B11 4C SLDC. PUSH #004C
6B12 C3 EQUI. PUSH ((TOS-1) = (TOS))
6B13 8D LOR. PUSH ((TOS-1) OR (TOS))
6B14 EA SLDO. PUSH BASE.03
6B15 43 SLDC. PUSH #0043
6B16 C3 EQUI. PUSH ((TOS-1) = (TOS))
6B17 8D LOR. PUSH ((TOS-1) OR (TOS))
6B18 EA SLDO. PUSH BASE.03
6B19 42 SLDC. PUSH #0042
6B1A C3 EQUI. PUSH ((TOS-1) = (TOS))
6B1B 8D LOR. PUSH ((TOS-1) OR (TOS))
6B1C EA SLDO. PUSH BASE.03
6B1D 4D SLDC. PUSH #004D
6B1E C3 EQUI. PUSH ((TOS-1) = (TOS))
6B1F 8D LOR. PUSH ((TOS-1) OR (TOS))
6B20 EA SLDO. PUSH BASE.03
6B21 55 SLDC. PUSH #0055
6B22 C3 EQUI. PUSH ((TOS-1) = (TOS))
6B23 8D LOR. PUSH ((TOS-1) OR (TOS))
6B24 A1 F6 UJP. IF NOT (TOS) THEN JUMP TO 6B02
6B26 EA SLDO. PUSH BASE.03
6B27 B9 1C UJP. JUMP TO 6B45
6B29 CE 07 CLP. CALL CHILD PROCEDURE: 07
6B2B B9 47 UJP. JUMP TO 6B74
6B2D CE 17 CLP. CALL CHILD PROCEDURE: 17
6B2F B9 43 UJP. JUMP TO 6B74
6B31 CE 16 CLP. CALL CHILD PROCEDURE: 16
6B33 B9 3F UJP. JUMP TO 6B74
6B35 CE 11 CLP. CALL CHILD PROCEDURE: 11
6B37 B9 3B UJP. JUMP TO 6B74
6B39 CE 13 CLP. CALL CHILD PROCEDURE: 13
6B3B B9 37 UJP. JUMP TO 6B74
6B3D CE 1C CLP. CALL CHILD PROCEDURE: 1C
6B3F B9 33 UJP. JUMP TO 6B74
6B41 CE 20 CLP. CALL CHILD PROCEDURE: 20
6B43 B9 2F UJP. JUMP TO 6B74
6B45 AC 42 00 55 00 B9 28 TABLE: 13 00 19 00 06 00 08 00 0A 00 0C 00 0E 00 10 00 12 00 14 00 37 00 25 00 1A 00 1C 00 1E 00 20 00 3B 00 24 00 43 00 31 00
XJP. W1,W2,W3,<TABLE>
6B74 00 SLDC. PUSH #0000
6B75 A1 F4 UJP. IF NOT (TOS) THEN JUMP TO 6A32
6B77 AD 00 RNP. RETURN FROM NON-BASE PROCEDURE.
6B79 00 SLDC. PUSH #0000
6B7A 48 SLDC. PUSH #0048
6B7B 01 SLDC. PUSH #0001
6B7C 7A SLDC. PUSH #007A
6B7D 00 SLDC. PUSH #0000
This is a sketch of code we have in LOL:
WIZUTILB.TEXT
SEGMENT PROCEDURE UTILS; (* P050101 *) P070101
FUNCTION GETREC(...) (* P050102 *) P070102
PROCEDURE CHGNAMES ( ...) P070111
PROCEDURE GETNAME( ... ) P070112
WIZUTILC.TEXT
PROCEDURE BACKUP ( ...) P070113
PROCEDURE FRBACKUP( ...) P070114
BEGIN (* UTILS *)
TITLESCR( 'WIZARDRY UTILITIES');
CHOOSE AN OPTION
R)ECOVER T)RANSFER B)ACKUP
M)AKE SCENARIO DISK
C)HANGE NAMES L)EAVE
REPEAT
CASE
UNTIL FALSE
END; (* UTILS *)
Here is what I need to do:
Insert "U)PDATE" into menu.
Add "(INCHAR = 'U')" to REPEAT UNTIL test.
Add " 'U': UPDATE; (* P07011C *)
Add dummy procedures for the missing "U"pdate ones.
The following chart was created with information from the DeCompiler.
UTILS
Proc# lex Start Exit Order Hierarchy
----- --- ----- ---- ----- ----------
WIZUTILB 1 1 6A32 6B77 36 P070101
2 2 5000 5068 1 P070102
3 2 5074 50DC 2 P070103
4 2 50E8 510B 3 P070104
5 2 5118 51D0 4 P070105
6 2 51E0 51EC 5 P070106
7 2 51FA 5274 6 P070107
8 2 5282 52A9 7 P070108
9 2 52B6 5336 8 P070109
10 2 5344 5393 9 P07010A
11 2 53A4 53B7 10 P07010B
12 2 53C4 53D7 11 P07010C
13 2 53E4 53FD 12 P07010D
14 2 540A 5427 13 P07010E
15 2 5434 5480 14 P07010F
16 2 548E 550C 15 P070110
17 2 55AC 57E2 17 CHGNAMES (* P070111 *)
18 3 551A 5598 16 GETNAME (* P070112 *)
WIZUTILC
19 2 5BC2 5C4B 20 P070113
20 3 57F8 5A26 18 P070114
21 3 5A3A 5BB2 19 P070115
22 2 5C58 5D28 21 P070116
23 2 60A6 621D 26 TRANSFER (* P070117 *)
24 3 5D80 5F59 23 P070118
25 4 5D36 5D74 22 P070119
26 3 5F70 6064 24 P07011A
27 3 6074 6099 25 P07011B
28 2 62B2 6555 30 P07011C
29 3 622C 6267 27 P07011D
30 3 6274 6283 28 P07011E
31 3 6290 62A6 29 P07011F
32 2 6806 6A1F 35 P070120
33 3 6566 65A2 31 P070121
34 3 6610 6694 33 P070122
35 4 65AE 6604 32 P070123
36 3 66A2 67FA 34 P070124
I had to insert P070119.
Final rough draft for UTILS mainline:
881 7 1:0 0 BEGIN (* UTILS *)
882 7 1:1 0 REPEAT
883 7 1:2 0 TITLESCR( 'WIZARDRY UTILITIES');
884 7 1:2 23 WRITELN;
885 7 1:2 29 WRITELN( 'CHOOSE AN OPTION' : 28);
886 7 1:2 61 WRITELN;
887 7 1:2 67 WRITELN( 'R)ECOVER T)RANSFER B)ACKUP' : 34);
888 7 1:2 110 WRITELN;
889 7 1:2 116 WRITELN( 'M)AKE SCENARIO DISK U)PDATE' : 34);
890 7 1:2 159 WRITELN;
891 7 1:2 165 WRITELN( 'C)HANGE NAMES L)EAVE ' : 34);
892 7 1:2 208
893 7 1:2 208 REPEAT
894 7 1:3 208 GOTOXY( 41, 0);
895 7 1:3 213 GETKEY
896 7 1:2 213 UNTIL (INCHAR = 'R') OR (INCHAR = 'T') OR
897 7 1:2 222 (INCHAR = 'L') OR (INCHAR = 'C') OR
898 7 1:2 230 (INCHAR = 'B') OR (INCHAR = 'M') OR
899 7 1:2 238 (INCHAR = 'U');
900 7 1:2 244
901 7 1:2 244 CASE INCHAR OF
902 7 1:2 247
903 7 1:2 247 'L': BEGIN
904 7 1:2 247 (* BASE04 := 0; *)
905 7 1:4 247 EXITUTIL
906 7 1:3 247 END;
907 7 1:3 251
908 7 1:2 251 'T': TRANSFER;
909 7 1:2 255 'R': RECOVER;
910 7 1:2 259 'C': CHGNAMES;
911 7 1:2 263 'B': BACKUP;
912 7 1:2 267 'M': BEGIN
913 7 1:2 267 (* BASE04 := 1; *)
914 7 1:4 267 P07011C;
915 7 1:3 269 END;
916 7 1:2 271 'U': P070120;
917 7 1:2 275 END
918 7 1:1 322 UNTIL FALSE
919 7 1:0 322 END; (* UTILS *)
P070102 is next. The version for LOL produces almost exactly the code we want.
This is the pcode we want:
FILE: 7 SEG: 1 PROC: 2
JTAB FOR SUBROUTINE 2:
DATA SIZE: 4
PARAM SIZE: 10
EXIT AT: 5068
ENTER AT: 5000
PROC NUMBER: 2
LEXICAL LEVEL: 2
5000 B2 01 82 33 LDA. PUSH #ACTREC(-01).0233
5004 DC SLDL. PUSH MP.05
5005 A4 01 IXA. PUSH #((TOS-1)[TOS]). ARRAY SIZE=01
5007 F8 SIND. PUSH (TOS)^.0
5008 02 SLDC. PUSH #0002
5009 DB SLDL. PUSH MP.04
500A B2 01 82 1B LDA. PUSH #ACTREC(-01).021B
500E DC SLDL. PUSH MP.05
500F A4 01 IXA. PUSH #((TOS-1)[TOS]). ARRAY SIZE=01
5011 F8 SIND. PUSH (TOS)^.0
5012 86 DVI. PUSH ((TOS-1) / (TOS))
5013 8F MPI. PUSH ((TOS-1) * (TOS))
5014 82 ADI. PUSH ((TOS) + (TOS-1))
5015 CC 07 STL. MP.07 := (TOS)
5017 DA SLDL. PUSH MP.03
5018 DB SLDL. PUSH MP.04
5019 B2 01 82 1B LDA. PUSH #ACTREC(-01).021B
501D DC SLDL. PUSH MP.05
501E A4 01 IXA. PUSH #((TOS-1)[TOS]). ARRAY SIZE=01
5020 F8 SIND. PUSH (TOS)^.0
5021 8E MODI. PUSH ((TOS-1) MOD (TOS))
5022 8F MPI. PUSH ((TOS-1) * (TOS))
5023 CC 06 STL. MP.06 := (TOS)
5025 B6 01 82 02 LOD. PUSH ACTREC(-01).0202
5029 DE SLDL. PUSH MP.07
502A CB NEQI. PUSH ((TOS-1) <> (TOS))
502B A1 38 UJP. IF NOT (TOS) THEN JUMP TO 5065
502D B6 01 82 05 LOD. PUSH ACTREC(-01).0205
5031 A1 14 UJP. IF NOT (TOS) THEN JUMP TO 5047
5033 04 SLDC. PUSH #0004
5034 B2 01 01 LDA. PUSH #ACTREC(-01).01
5037 00 SLDC. PUSH #0000
5038 C7 00 04 LDCI. PUSH #0400
503B B6 01 82 02 LOD. PUSH ACTREC(-01).0202
503F B6 01 82 03 LOD. PUSH ACTREC(-01).0203
5043 82 ADI. PUSH ((TOS) + (TOS-1))
5044 00 SLDC. PUSH #0000
5045 9E 06 WRITE VOL#
5047 00 SLDC. PUSH #0000
5048 B8 01 82 05 STR. ACTREC(-01).0205 := TOS
504C DE SLDL. PUSH MP.07
504D B8 01 82 02 STR. ACTREC(-01).0202 := TOS
5051 04 SLDC. PUSH #0004
5052 B2 01 01 LDA. PUSH #ACTREC(-01).01
5055 00 SLDC. PUSH #0000
5056 C7 00 04 LDCI. PUSH #0400
5059 B6 01 82 02 LOD. PUSH ACTREC(-01).0202
505D B6 01 82 03 LOD. PUSH ACTREC(-01).0203
5061 82 ADI. PUSH ((TOS) + (TOS-1))
5062 00 SLDC. PUSH #0000
5063 9E 05 READ FROM VOL#
5065 DD SLDL. PUSH MP.06
5066 CC 01 STL. MP.01 := (TOS)
5068 AD 01 RNP. RETURN FROM NON-BASE PROCEDURE.
In WIZ1 and LOL, the line at $503F was correct to reference ACTREC(-01).203.
The line at $5048 had 2 different results:
WIZ1: ACTREC(-01).0205
LOL: ACTREC(-01).0204
To fix this difference, I need to insert another variable after the ACTREC(-01).203 variable. By looking at the LOL source code, I could see that "CACHEWRI := FALSE" generated the 0.205. Therefore, I needed to add the variable just before CACHEWRI in the VAR delcarations for UTILS.
These VARs are from WIZUTIL in LOL:
165 7 1:D 1 VAR
166 7 1:D 1
167 7 1:D 1 IOCACHE : PACKED ARRAY[ 0..1023] OF CHAR;
168 7 1:D 513 UNUSEDXX : INTEGER;
169 7 1:D 514 CACHEBL : INTEGER;
170 7 1:D 515 SCNTOCBL : INTEGER;
171 7 1:D 516 CACHEWRI : BOOLEAN;
172 7 1:D 517 SCNTOC : TSCNTOC;
These are the VARs we need for Wiz1 UTILs
VAR
IOCACHE : PACKED ARRAY[ 0..1023] OF CHAR;
UNUSEDXX : INTEGER;
CACHEBL : INTEGER;
SCNTOCBL : INTEGER;
BASE204 : INTEGER; (* NOT IN LOL, BUT IS IN WIZ1 *)
CACHEWRI : BOOLEAN;
SCNTOC : TSCNTOC;
P070102 (GETREC)
175 7 2:D 3 FUNCTION GETREC( DATATYPE : TZSCN; (* P050102 *)
176 7 2:D 4 DATAINDX : INTEGER;
177 7 2:D 5 DATASIZE : INTEGER) : INTEGER;
178 7 2:D 6
179 7 2:D 6 VAR
180 7 2:D 6 BUFFADDR : INTEGER;
181 7 2:D 7 DSKBLOCK : INTEGER;
182 7 2:D 8
183 7 2:0 0 BEGIN
184 7 2:1 0 DSKBLOCK := SCNTOC.BLOFF[ DATATYPE] +
185 7 2:1 8 2 * (DATAINDX DIV SCNTOC.RECPER2B[ DATATYPE]);
186 7 2:1 23 BUFFADDR := DATASIZE * (DATAINDX MOD SCNTOC.RECPER2B[ DATATYPE]);
187 7 2:1 37 IF CACHEBL <> DSKBLOCK THEN
188 7 2:2 45 BEGIN
189 7 2:3 45 IF CACHEWRI THEN
190 7 2:4 51 UNITWRITE( DRIVE1, IOCACHE, SIZEOF( IOCACHE),
191 7 2:4 59 CACHEBL + SCNTOCBL, 0);
192 7 2:3 71 CACHEWRI := FALSE;
193 7 2:3 76 CACHEBL := DSKBLOCK;
194 7 2:3 81 UNITREAD( DRIVE1, IOCACHE, SIZEOF( IOCACHE),
195 7 2:3 89 CACHEBL + SCNTOCBL, 0)
196 7 2:2 101 END;
197 7 2:1 101 GETREC := BUFFADDR
198 7 2:0 101 END;
The following routines are exactly the same in Wiz1 and LOL:
P070103
P070106
P070108
P070109
P07010B
P07010C
P07010D
P07010E
P07010F
P070110
P070111
P070112
P070113
P070114
P070116
No changes are made to those routines.
If you want to see the source code, please look at the WizardyIII (LOL) code that I uploaded to ASIMOV:
ftp://ftp.apple.asimov.net/pub/apple_II/images/games/rpg/wizardry/wizardry_III/
Wizardry_iii_SourceCode.zip/Wizardry.code
WizardryListing.txt
P070104
pcode we want:
FILE: 7 SEG: 1 PROC: 4
JTAB FOR SUBROUTINE 4:
DATA SIZE: 0
PARAM SIZE: 0
EXIT AT: 510B
ENTER AT: 50E8
PROC NUMBER: 4
LEXICAL LEVEL: 2
50E8 B6 03 02 LOD. PUSH ACTREC(-03).02
50EB A5 03 LA0. PUSH #BASE.03
50ED CD 00 10 CXP. CALL EXTERNAL PROCEDURE: 10 IN SEGMENT: 00
50F0 B6 03 02 LOD. PUSH ACTREC(-03).02
50F3 00 SLDC. PUSH #0000
50F4 00 SLDC. PUSH #0000
50F5 CD 00 0B CXP. CALL EXTERNAL PROCEDURE: 0B IN SEGMENT: 00
50F8 A1 03 UJP. IF NOT (TOS) THEN JUMP TO 50FD
50FA 0D SLDC. PUSH #000D
50FB AB 03 SRO. BASE.03 := (TOS)
50FD B6 01 82 04 LOD. PUSH ACTREC(-01).0204
5101 EA SLDO. PUSH BASE.03
5102 82 ADI. PUSH ((TOS) + (TOS-1))
5103 C7 03 04 LDCI. PUSH #0403
5106 8E MODI. PUSH ((TOS-1) MOD (TOS))
5107 B8 01 82 04 STR. ACTREC(-01).0204 := TOS
510B AD 00 RNP. RETURN FROM NON-BASE PROCEDURE.
510D 00 SLDC. PUSH #0000
pcode from LOL:
JTAB FOR SUBROUTINE 4:
DATA SIZE: 0
PARAM SIZE: 0
EXIT AT: 5106
ENTER AT: 50E8
PROC NUMBER: 4
LEXICAL LEVEL: 2
50E8 B6 03 02 LOD. PUSH ACTREC(-03).02
50EB A5 03 LA0. PUSH #BASE.03
50ED CD 00 10 CXP. CALL EXTERNAL PROCEDURE: 10 IN SEGMENT: 00
50F0 B6 03 02 LOD. PUSH ACTREC(-03).02
50F3 00 SLDC. PUSH #0000
50F4 00 SLDC. PUSH #0000
50F5 CD 00 0B CXP. CALL EXTERNAL PROCEDURE: 0B IN SEGMENT: 00
50F8 A1 03 UJP. IF NOT (TOS) THEN JUMP TO 50FD
50FA 0D SLDC. PUSH #000D
50FB AB 03 SRO. BASE.03 := (TOS)
50FD EC SLDO. PUSH BASE.05
50FE EA SLDO. PUSH BASE.03
50FF 82 ADI. PUSH ((TOS) + (TOS-1))
5100 C7 03 04 LDCI. PUSH #0403
5103 8E MODI. PUSH ((TOS-1) MOD (TOS))
5104 AB 05 SRO. BASE.05 := (TOS)
5106 AD 00 RNP. RETURN FROM NON-BASE PROCEDURE.
An earlier change now makes line 50FD read:
PUSH BASE.04
But the code we want is:
PUSH ACTREC(-01).0204
(The line at $5104 also changed to BASE.04.)
In this routine we see that the variable needs to change RANDNUM to ACTREC(-01).0204.
Change from LOL code:
RANDNUM := (RANDNUM + ORD( INCHAR)) MOD 1027
to WIZ1 code:
BASE204 := (BASE204 + ORD( INCHAR)) MOD 1027
P070104 Final rough draft:
PROCEDURE GETKEY; (* P070104 *)
BEGIN
READ( INCHAR);
IF EOLN THEN
INCHAR := CHR( 13);
BASE204 := (BASE204 + ORD( INCHAR)) MOD 1027
END;
The more I look at this, I now realize that BASE204 is just RANDNUM. They moved the variable in LOL to the mainline level.
P070105
pcode we want:
JTAB FOR SUBROUTINE 5:
DATA SIZE: 426
PARAM SIZE: 8
EXIT AT: 51D0
ENTER AT: 5118
PROC NUMBER: 5
LEXICAL LEVEL: 2
5118 C6 05 LLA. PUSH #MP.05
511A DA SLDL. PUSH MP.03
511B AA 50 SAS. TOS=CHAR::(TOS-1)^ := TOS CHAR
TOS=PTR ::(TOS-1)^ := (TOS)^ 50 CHARACTERS MAX
511D DB SLDL. PUSH MP.04
511E B2 01 01 LDA. PUSH #ACTREC(-01).01
5121 00 SLDC. PUSH #0000
5122 C7 00 04 LDCI. PUSH #0400
5125 02 SLDC. PUSH #0002
5126 00 SLDC. PUSH #0000
5127 9E 05 READ FROM VOL#
5129 9E 22 PUSH I/O ERROR STATUS
512B 00 SLDC. PUSH #0000
512C CB NEQI. PUSH ((TOS-1) <> (TOS))
512D A1 08 UJP. IF NOT (TOS) THEN JUMP TO 5137
512F 9E 22 PUSH I/O ERROR STATUS
5131 80 ABI. PUSH ABS( (TOS) ) )
5132 91 NGI. PUSH -(TOS) (2'S COMP)
5133 CC 01 STL. MP.01 := (TOS)
5135 B9 F4 UJP. JUMP TO 51D0
5137 B2 01 01 LDA. PUSH #ACTREC(-01).01
513A 00 SLDC. PUSH #0000
513B C6 2E LLA. PUSH #MP.2E
513D 00 SLDC. PUSH #0000
513E C7 52 01 LDCI. PUSH #0152
5141 9E 02 MVL. MOVELEFT
5143 C6 2E LLA. PUSH #MP.2E
5145 00 SLDC. PUSH #0000
5146 A4 0D IXA. PUSH #((TOS-1)[TOS]). ARRAY SIZE=0D
5148 A3 08 IND. PUSH (TOS)^.08
514A 00 SLDC. PUSH #0000
514B C9 LESI. PUSH ((TOS-1) < (TOS))
514C C6 2E LLA. PUSH #MP.2E
514E 00 SLDC. PUSH #0000
514F A4 0D IXA. PUSH #((TOS-1)[TOS]). ARRAY SIZE=0D
5151 A3 08 IND. PUSH (TOS)^.08
5153 08 SLDC. PUSH #0008
5154 C5 GRTI. PUSH ((TOS-1) > (TOS))
5155 8D LOR. PUSH ((TOS-1) OR (TOS))
5156 A1 08 UJP. IF NOT (TOS) THEN JUMP TO 5160
5158 01 SLDC. PUSH #0001
5159 91 NGI. PUSH -(TOS) (2'S COMP)
515A CC 01 STL. MP.01 := (TOS)
515C 07 SLDC. PUSH #0007
515D 05 SLDC. PUSH #0005
515E 9E 04 EXIT. EXIT FROM PROCEDURE. (TOS)=PROC# (TOS-1)=SEG#
5160 00 SLDC. PUSH #0000
5161 CC 80 D7 STL. MP.D7 := (TOS)
5164 01 SLDC. PUSH #0001
5165 CC 80 D8 STL. MP.D8 := (TOS)
5168 C6 2E LLA. PUSH #MP.2E
516A 00 SLDC. PUSH #0000
516B A4 0D IXA. PUSH #((TOS-1)[TOS]). ARRAY SIZE=0D
516D A3 08 IND. PUSH (TOS)^.08
516F CC 80 D9 STL. MP.D9 := (TOS)
5172 CA 80 D8 LDL. PUSH MP.D8
5175 CA 80 D9 LDL. PUSH MP.D9
5178 C8 LEQI. PUSH ((TOS-1) <= (TOS))
5179 A1 3E UJP. IF NOT (TOS) THEN JUMP TO 51B9
517B C6 2E LLA. PUSH #MP.2E
517D CA 80 D8 LDL. PUSH MP.D8
5180 A4 0D IXA. PUSH #((TOS-1)[TOS]). ARRAY SIZE=0D
5182 A2 02 INC. PUSH #(TOS)^.(02)
5184 04 SLDC. PUSH #0004
5185 00 SLDC. PUSH #0000
5186 BA LDP. PUSH FIELD. TOS: RTBIT;#;^
5187 01 SLDC. PUSH #0001
5188 C4 GEQI. PUSH ((TOS-1) >= (TOS))
5189 C6 2E LLA. PUSH #MP.2E
518B CA 80 D8 LDL. PUSH MP.D8
518E A4 0D IXA. PUSH #((TOS-1)[TOS]). ARRAY SIZE=0D
5190 A2 02 INC. PUSH #(TOS)^.(02)
5192 04 SLDC. PUSH #0004
5193 00 SLDC. PUSH #0000
5194 BA LDP. PUSH FIELD. TOS: RTBIT;#;^
5195 07 SLDC. PUSH #0007
5196 C8 LEQI. PUSH ((TOS-1) <= (TOS))
5197 84 LAND. PUSH ((TOS-1) AND (TOS))
5198 A1 15 UJP. IF NOT (TOS) THEN JUMP TO 51AF
519A C6 2E LLA. PUSH #MP.2E
519C CA 80 D8 LDL. PUSH MP.D8
519F A4 0D IXA. PUSH #((TOS-1)[TOS]). ARRAY SIZE=0D
51A1 A2 03 INC. PUSH #(TOS)^.(03)
51A3 C6 05 LLA. PUSH #MP.05
51A5 AF 04 EQU. PUSH ((TOS-1) = (TOS))--STRINGS
51A7 A1 06 UJP. IF NOT (TOS) THEN JUMP TO 51AF
51A9 CA 80 D8 LDL. PUSH MP.D8
51AC CC 80 D7 STL. MP.D7 := (TOS)
51AF CA 80 D8 LDL. PUSH MP.D8
51B2 01 SLDC. PUSH #0001
51B3 82 ADI. PUSH ((TOS) + (TOS-1))
51B4 CC 80 D8 STL. MP.D8 := (TOS)
51B7 B9 F6 UJP. JUMP TO 5172
51B9 CA 80 D7 LDL. PUSH MP.D7
51BC 00 SLDC. PUSH #0000
51BD C3 EQUI. PUSH ((TOS-1) = (TOS))
51BE A1 06 UJP. IF NOT (TOS) THEN JUMP TO 51C6
51C0 09 SLDC. PUSH #0009
51C1 91 NGI. PUSH -(TOS) (2'S COMP)
51C2 CC 01 STL. MP.01 := (TOS)
51C4 B9 0A UJP. JUMP TO 51D0
51C6 C6 2E LLA. PUSH #MP.2E
51C8 CA 80 D7 LDL. PUSH MP.D7
51CB A4 0D IXA. PUSH #((TOS-1)[TOS]). ARRAY SIZE=0D
51CD F8 SIND. PUSH (TOS)^.0
51CE CC 01 STL. MP.01 := (TOS)
51D0 AD 01 RNP. RETURN FROM NON-BASE PROCEDURE.
51D2 02 SLDC. PUSH #0002
51D3 00 SLDC. PUSH #0000
51D4 62 SLDC. PUSH #0062
51D5 00 SLDC. PUSH #0000
At line 5153 we need to have PUSH #0008.
5153 08 SLDC. PUSH #0008
In the LOL code this is PUSH #000C. We therefore need the following Pascal code change:
From LOL:
IF (DIR[ 0].FILECNT < 0) OR (DIR[ 0].FILECNT > 12) THEN
To WIZ1:
IF (DIR[ 0].FILECNT < 0) OR (DIR[ 0].FILECNT > 8) THEN
P070105 Final rough draft:
FUNCTION FINDFILE( DRIVE : INTEGER; (* P070105 *)
FILENAME : STRING) : INTEGER;
VAR
DIR : ARRAY[ 0..12] OF DIRENTRY;
FILEIFND : INTEGER;
FILEI : INTEGER;
FILECNT : INTEGER;
BEGIN
UNITREAD( DRIVE, IOCACHE, SIZEOF( IOCACHE), WIZDIRBL, 0);
IF IORESULT <> 0 THEN
FINDFILE := -ABS( IORESULT)
ELSE
BEGIN
MOVELEFT( IOCACHE, DIR, SIZEOF( DIR));
IF (DIR[ 0].FILECNT < 0) OR (DIR[ 0].FILECNT > 8) THEN
BEGIN
FINDFILE := -1;
EXIT( FINDFILE)
END;
FILEIFND := 0;
FILEI := 1;
FILECNT := DIR[ 0].FILECNT;
WHILE FILEI <= FILECNT DO
BEGIN
IF (DIR[ FILEI].FILEKIND.FT >= BADBLK) AND
(DIR[ FILEI].FILEKIND.FT <= FOTOFILE) THEN
BEGIN
IF DIR[ FILEI].FILENAME = FILENAME THEN
FILEIFND := FILEI
END;
FILEI := FILEI + 1;
END;
IF FILEIFND = 0 THEN
FINDFILE := -9
ELSE
FINDFILE := DIR[ FILEIFND].FIRSTBLK
END
END;
P070107 from LOL is almost what we need:
JTAB FOR SUBROUTINE 7:
DATA SIZE: 2
PARAM SIZE: 0
EXIT AT: 5274
ENTER AT: 51FA
PROC NUMBER: 7
LEXICAL LEVEL: 2
51FA 04 SLDC. PUSH #0004
51FB A6 0D 53 59 53 54 45 4D 2E 50 41 53 43 41 4C
SYSTEM.PASCAL
LSA. PUSH #(PC+1) POINTER TO THE STRING
520A D7 NOP. NOP
520B 00 SLDC. PUSH #0000
520C 00 SLDC. PUSH #0000
520D AE 05 CIP. CALL INTERMEDIATE PROCEDURE: 05
520F CC 01 STL. MP.01 := (TOS)
5211 D8 SLDL. PUSH MP.01
5212 00 SLDC. PUSH #0000
5213 C8 LEQI. PUSH ((TOS-1) <= (TOS))
5214 A1 5A UJP. IF NOT (TOS) THEN JUMP TO 5270
5216 B6 03 03 LOD. PUSH ACTREC(-03).03
5219 0C SLDC. PUSH #000C
521A 00 SLDC. PUSH #0000
521B CD 00 11 CXP. CALL EXTERNAL PROCEDURE: 11 IN SEGMENT: 00
521E 00 SLDC. PUSH #0000
521F 0A SLDC. PUSH #000A
5220 CD 00 1D CXP. CALL EXTERNAL PROCEDURE: 1D IN SEGMENT: 00
5223 B6 03 03 LOD. PUSH ACTREC(-03).03
5226 D7 NOP. NOP
5227 A6 28 50 4C 41 43 45 20 42 4F 4F 54 20 44 49 53 4B 20 49 4E 20 44 52 49 56 45 20 31 2C 20 50 52 45 53 53 20 52 45 54 55 52 4E
PLACE BOOT DISK IN DRIVE 1, PRESS RETURN
LSA. PUSH #(PC+1) POINTER TO THE STRING
5251 00 SLDC. PUSH #0000
5252 CD 00 13 CXP. CALL EXTERNAL PROCEDURE: 13 IN SEGMENT: 00
5255 AE 06 CIP. CALL INTERMEDIATE PROCEDURE: 06
5257 04 SLDC. PUSH #0004
5258 D7 NOP. NOP
5259 A6 0D 53 59 53 54 45 4D 2E 50 41 53 43 41 4C
SYSTEM.PASCAL
LSA. PUSH #(PC+1) POINTER TO THE STRING
5268 00 SLDC. PUSH #0000
5269 00 SLDC. PUSH #0000
526A AE 05 CIP. CALL INTERMEDIATE PROCEDURE: 05
526C CC 01 STL. MP.01 := (TOS)
526E B9 F6 UJP. JUMP TO 5211
5270 07 SLDC. PUSH #0007
5271 01 SLDC. PUSH #0001
5272 9E 04 EXIT. EXIT FROM PROCEDURE. (TOS)=PROC# (TOS-1)=SEG#
5274 AD 00 RNP. RETURN FROM NON-BASE PROCEDURE.
5276 65 SLDC. PUSH #0065
5277 00 SLDC. PUSH #0000
In LOL they look for the file "SYSTEM.CHARSET", so that name needs to be changed in 2 places in the Pascal code for Wiz1.
P070107 Final rough draft:
PROCEDURE EXITUTIL; (* P070107 *)
VAR
FILEINDX : INTEGER;
BEGIN
FILEINDX := FINDFILE( DRIVE1, 'SYSTEM.PASCAL');
WHILE FILEINDX <= 0 DO
BEGIN
WRITE( CHR( HOMECLR));
GOTOXY( 0, 10);
WRITE( 'PLACE BOOT DISK IN DRIVE 1, PRESS RETURN');
GETCR;
FILEINDX := FINDFILE( DRIVE1, 'SYSTEM.PASCAL')
END;
EXIT( UTILS)
END;
P07010A is almost exactly what we want, but we need to change RANDNUM to BASE204.
PROCEDURE GETPASS( VAR PASSWD : STRING ); (* P07010A *)
VAR
UNUSEDXX : INTEGER;
I : INTEGER;
PASSI : INTEGER;
BEGIN
PASSI := 0;
REPEAT
GETKEY;
IF INCHAR <> CHR( CR) THEN
BEGIN
WRITE( CHR( BS));
FOR I := 0 TO BASE204 MOD 2 DO
WRITE( 'X')
END;
PASSI := PASSI + 1;
PASSWD[ PASSI] := INCHAR
UNTIL (INCHAR = CHR( CR)) OR (PASSI = 15);
WRITELN;
PASSWD[ 0] := CHR( PASSI - 1)
END;
P070115
Only 1 small change is needed:
From:
WRITELN( 'IN DRIVE 1 AND PRESS [RET] TO SAVE.');
To:
WRITELN( 'IN DRIVE 1 AND PRESS [RETURN] TO SAVE.');
P070117
Comparing the pcode from Wiz3 with the pcode for Wiz1 I noticed we need the following changes:
Change:
MOVE CHARS FROM A SCENARIO
To:
MOVE CHARS BETWEEN SCENARIOS
Change:
TO LEGACY OF LLYLGAMYN ONLY!
To:
'' (Null string)
Change:
BL5BUFF[ 12] := CHR( (ORD( BL5BUFF[ 12]) + RANDNUM) MOD 256);
To:
BL5BUFF[ 12] := CHR( (ORD( BL5BUFF[ 12]) + BASE204) MOD 256);
There are a number of changes needed to the following code (from LOL):
272 UNITWRITE( DRIVE1, BL5BUFF, SIZEOF( BL5BUFF), SERIALBL, 0);
803 7 23:1 284 TODSKERR := IORESULT <> 0;
804 7 23:1 291 IF NOT TODSKERR AND (SERIALFR <> SERIALTO) THEN
805 7 23:2 306 BEGIN
806 7 23:3 306 FOR BASE04 := 0 TO (SCNTOC.RECPERDK[ ZCHAR] - 1) DO
807 7 23:4 329 BEGIN
808 7 23:5 329 RDCHARAC( PLAYREC1, BASE04);
809 7 23:5 334 IF (
PLAYREC1.NAME =
PLAYREC2.NAME) AND
810 7 23:5 340 (PLAYREC1.STATUS <> LOST) THEN
811 7 23:6 347 PLAYINDX := -1
812 7 23:5 347 ELSE
813 7 23:6 354 IF PLAYINDX = SCNTOC.RECPERDK[ ZCHAR] THEN
814 7 23:7 368 IF PLAYREC1.STATUS = LOST THEN
815 7 23:8 374 PLAYINDX := BASE04
816 7 23:4 374 END;
817 7 23:2 385 END;
818 7 23:1 385 IF (PLAYINDX = - 1) OR
819 7 23:1 391 (PLAYINDX = SCNTOC.RECPERDK[ ZCHAR]) OR
820 7 23:1 404 (COPY( SCNTOC.GAMENAME, 1, 10) <> 'THE LEGACY') THEN
821 7 23:2 437 TRANBAD
822 7 23:1 437 ELSE
823 7 23:2 441 TRANGOOD
This is the pcode I need to generate:
6192 9E 02 MVL. MOVELEFT
6194 B2 01 82 23 LDA. PUSH #ACTREC(-01).0223
6198 05 SLDC. PUSH #0005
6199 A4 01 IXA. PUSH #((TOS-1)[TOS]). ARRAY SIZE=01
619B F8 SIND. PUSH (TOS)^.0
619C CC 80 D2 STL. MP.D2 := (TOS)
619F CA 80 D3 LDL. PUSH MP.D3
61A2 C6 80 FE LLA. PUSH #MP.FE
61A5 0A SLDC. PUSH #000A
61A6 BE LDB. PUSH #00, PUSH (TOS-1)^.TOS BYTE
61A7 CB NEQI. PUSH ((TOS-1) <> (TOS))
61A8 C6 82 02 LLA. PUSH #MP.0202
61AB C6 81 FE LLA. PUSH #MP.01FE
61AE B7 04 NEQ. PUSH ((TOS-1) <> (TOS))--STRINGS
61B0 8D LOR. PUSH ((TOS-1) OR (TOS))
61B1 A1 4F UJP. IF NOT (TOS) THEN JUMP TO 6202
61B3 00 SLDC. PUSH #0000
61B4 AB 04 SRO. BASE.04 := (TOS)
61B6 B2 01 82 23 LDA. PUSH #ACTREC(-01).0223
61BA 05 SLDC. PUSH #0005
61BB A4 01 IXA. PUSH #((TOS-1)[TOS]). ARRAY SIZE=01
61BD F8 SIND. PUSH (TOS)^.0
61BE 01 SLDC. PUSH #0001
61BF 95 SBI. PUSH ((TOS-1) - (TOS))
61C0 CC 82 06 STL. MP.0206 := (TOS)
61C3 EB SLDO. PUSH BASE.04
61C4 CA 82 06 LDL. PUSH MP.0206
61C7 C8 LEQI. PUSH ((TOS-1) <= (TOS))
61C8 A1 38 UJP. IF NOT (TOS) THEN JUMP TO 6202
61CA C6 01 LLA. PUSH #MP.01
61CC EB SLDO. PUSH BASE.04
61CD AE 0B CIP. CALL INTERMEDIATE PROCEDURE: 0B
61CF C6 01 LLA. PUSH #MP.01
61D1 C6 69 LLA. PUSH #MP.69
61D3 AF 04 EQU. PUSH ((TOS-1) = (TOS))--STRINGS
61D5 CA 15 LDL. PUSH MP.15
61D7 07 SLDC. PUSH #0007
61D8 CB NEQI. PUSH ((TOS-1) <> (TOS))
61D9 84 LAND. PUSH ((TOS-1) AND (TOS))
61DA A1 07 UJP. IF NOT (TOS) THEN JUMP TO 61E3
61DC 01 SLDC. PUSH #0001
61DD 91 NGI. PUSH -(TOS) (2'S COMP)
61DE CC 80 D2 STL. MP.D2 := (TOS)
61E1 B9 18 UJP. JUMP TO 61FB
61E3 CA 80 D2 LDL. PUSH MP.D2
61E6 B2 01 82 23 LDA. PUSH #ACTREC(-01).0223
61EA 05 SLDC. PUSH #0005
61EB A4 01 IXA. PUSH #((TOS-1)[TOS]). ARRAY SIZE=01
61ED F8 SIND. PUSH (TOS)^.0
61EE C3 EQUI. PUSH ((TOS-1) = (TOS))
61EF A1 0A UJP. IF NOT (TOS) THEN JUMP TO 61FB
61F1 CA 15 LDL. PUSH MP.15
61F3 07 SLDC. PUSH #0007
61F4 C3 EQUI. PUSH ((TOS-1) = (TOS))
61F5 A1 04 UJP. IF NOT (TOS) THEN JUMP TO 61FB
61F7 EB SLDO. PUSH BASE.04
61F8 CC 80 D2 STL. MP.D2 := (TOS)
61FB EB SLDO. PUSH BASE.04
61FC 01 SLDC. PUSH #0001
61FD 82 ADI. PUSH ((TOS) + (TOS-1))
61FE AB 04 SRO. BASE.04 := (TOS)
6200 B9 F6 UJP. JUMP TO 61C3
6202 CA 80 D2 LDL. PUSH MP.D2
6205 01 SLDC. PUSH #0001
6206 91 NGI. PUSH -(TOS) (2'S COMP)
6207 C3 EQUI. PUSH ((TOS-1) = (TOS))
6208 CA 80 D2 LDL. PUSH MP.D2
620B B2 01 82 23 LDA. PUSH #ACTREC(-01).0223
620F 05 SLDC. PUSH #0005
6210 A4 01 IXA. PUSH #((TOS-1)[TOS]). ARRAY SIZE=01
6212 F8 SIND. PUSH (TOS)^.0
6213 C3 EQUI. PUSH ((TOS-1) = (TOS))
6214 8D LOR. PUSH ((TOS-1) OR (TOS))
6215 A1 04 UJP. IF NOT (TOS) THEN JUMP TO 621B
6217 CE 1A CLP. CALL CHILD PROCEDURE: 1A
6219 B9 02 UJP. JUMP TO 621D
621B CE 1B CLP. CALL CHILD PROCEDURE: 1B
621D AD 00 RNP. RETURN FROM NON-BASE PROCEDURE.
We need BASE.04 in this code. RANDNUM(?). Eventually I will rename the variables correclty so that BASE.204 is RANDNUM for Wiz1.
This code will do it:
793 7 23:0 0 BEGIN (* TRANSFER *)
794 7 23:1 0 IF RTNESC( 'MOVE CHARS BETWEEN SCENARIOS',
795 7 23:1 31 '') THEN
796 7 23:2 40 EXIT( TRANSFER);
797 7 23:1 44 RDSCNTOC( 'INSERT SCENARIO WITH CHAR(S) TO BE MOVED');
798 7 23:1 89 UNITREAD( DRIVE1, BL5BUFF, SIZEOF( BL5BUFF), SERIALBL, 0);
799 7 23:1 101 MPD3 := BL5BUFF[ 10];
800 7 23:1 109 MOVELEFT( BL5BUFF, SERIALFR, 7);
801 7 23:1 120 BL5BUFF[ 12] := CHR( (ORD( BL5BUFF[ 12]) + BASE204) MOD 256);
802 7 23:1 139 UNITWRITE( DRIVE1, BL5BUFF, SIZEOF( BL5BUFF), SERIALBL, 0);
803 7 23:1 151 FRMRNDID := BL5BUFF[ 12];
804 7 23:1 159 REMOVCHR;
805 7 23:1 161 PLAYFRMI := PLAYINDX;
806 7 23:1 167 FRMGAMNM := SCNTOC.GAMENAME;
807 7 23:1 176 RDSCNTOC( 'INSERT SCENARIO TO MOVE CHAR(S) TO');
808 7 23:1 215 UNITREAD( DRIVE1, BL5BUFF, SIZEOF( BL5BUFF), SERIALBL, 0);
809 7 23:1 227 MOVELEFT( BL5BUFF, SERIALTO, 7);
810 7 23:1 238 PLAYINDX := SCNTOC.RECPERDK[ ZCHAR];
811 7 23:1 249
812 7 23:1 249 IF (MPD3 <> BL5BUFF[ 10]) OR
813 7 23:1 258 (SERIALFR <> SERIALTO) THEN
814 7 23:2 269 BEGIN
815 7 23:3 269 FOR RANDNUM := 0 TO SCNTOC.RECPERDK[ ZCHAR] - 1 DO
816 7 23:4 292 BEGIN
817 7 23:5 292 RDCHARAC( PLAYREC1, RANDNUM);
818 7 23:5 297 IF (
PLAYREC1.NAME =
PLAYREC2.NAME) AND
819 7 23:5 303 (PLAYREC1.STATUS <> LOST) THEN
820 7 23:6 310 PLAYINDX := -1
821 7 23:5 310 ELSE
822 7 23:6 317 IF PLAYINDX = SCNTOC.RECPERDK[ ZCHAR] THEN
823 7 23:7 331 IF PLAYREC1.STATUS = LOST THEN
824 7 23:8 337 PLAYINDX := RANDNUM
825 7 23:4 337 END;
826 7 23:2 348 END;
827 7 23:2 348
828 7 23:1 348 IF (PLAYINDX = -1) OR
829 7 23:1 354 (PLAYINDX = SCNTOC.RECPERDK[ ZCHAR]) THEN
830 7 23:2 369 TRANBAD
831 7 23:1 369 ELSE
832 7 23:2 373 TRANGOOD
833 7 23:0 373 END; (* TRANSFER *)
P070118
Comparing the pcode from LOL with the pcode needed for Wiz1, most of it matched, but there was additional code in Wiz1 that they removed for LOL.
That code is the following, and occurs just after the "UNTIL PASSFROM = PLAYREC2.PASSWORD;" instruction:
5F19 01 SLDC. PUSH #0001
5F1A CC 2B STL. MP.2B := (TOS)
5F1C B6 01 80 86 LOD. PUSH ACTREC(-01).86
5F20 CC 2C STL. MP.2C := (TOS)
5F22 CA 2B LDL. PUSH MP.2B
5F24 CA 2C LDL. PUSH MP.2C
5F26 C8 LEQI. PUSH ((TOS-1) <= (TOS))
5F27 A1 19 UJP. IF NOT (TOS) THEN JUMP TO 5F42
5F29 B2 01 80 87 LDA. PUSH #ACTREC(-01).87
5F2D CA 2B LDL. PUSH MP.2B
5F2F 01 SLDC. PUSH #0001
5F30 95 SBI. PUSH ((TOS-1) - (TOS))
5F31 A4 04 IXA. PUSH #((TOS-1)[TOS]). ARRAY SIZE=04
5F33 FB SIND. PUSH (TOS)^.3
5F34 5D SLDC. PUSH #005D
5F35 C5 GRTI. PUSH ((TOS-1) > (TOS))
5F36 A1 02 UJP. IF NOT (TOS) THEN JUMP TO 5F3A
5F38 CE 19 CLP. CALL CHILD PROCEDURE: 19
5F3A CA 2B LDL. PUSH MP.2B
5F3C 01 SLDC. PUSH #0001
5F3D 82 ADI. PUSH ((TOS) + (TOS-1))
5F3E CC 2B STL. MP.2B := (TOS)
5F40 B9 EE UJP. JUMP TO 5F22
The following code will generate the pcode above:
FOR PLAYERI := 1 TO PLAYREC2.POSS.POSSCNT DO
BEGIN
IF PLAYREC2.POSS.POSSESS[ PLAYERI].EQINDEX > 93 THEN
P070119
END;
How did I produce that code? Devine inspiration? My notes from 2 weeks ago are not very clear, but by looking at the pcode from LOL, and looking at the other pcode generated in this routine, I could start to match things up.
For example, MP.02 was used earlier in the routine and I noticed the name I gave to that variable was PLAYERI. I did the same thing for other variables like actrec(-02).0206 with SCNTOC and actrec(-01).69 with PLAYREC2.
I also found I needed to change the message from "[RET]" to "[RETURN]".
P070119
This procedure is in Wiz1, but is not in LOL.
This is the pcode we want:
FILE: 7 SEG: 1 PROC: 25
JTAB FOR SUBROUTINE 25:
DATA SIZE: 0
PARAM SIZE: 0
EXIT AT: 5D74
ENTER AT: 5D36
PROC NUMBER: 25
LEXICAL LEVEL: 4
5D36 B6 05 03 LOD. PUSH ACTREC(-05).03
5D39 CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
5D3C B6 05 03 LOD. PUSH ACTREC(-05).03
5D3F A6 22 2A 2A 20 43 48 41 52 20 48 41 53 20 4E 4F 4E 2D 58 46 45 52 52 41 42 4C 45 20 49 54 45 4D 53 20 2A 2A
** CHAR HAS NON-XFERRABLE ITEMS **
LSA. PUSH #(PC+1) POINTER TO THE STRING
5D63 D7 NOP. NOP
5D64 00 SLDC. PUSH #0000
5D65 CD 00 13 CXP. CALL EXTERNAL PROCEDURE: 13 IN SEGMENT: 00
5D68 B6 05 03 LOD. PUSH ACTREC(-05).03
5D6B CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
5D6E AE 0E CIP. CALL INTERMEDIATE PROCEDURE: 0E
5D70 07 SLDC. PUSH #0007
5D71 17 SLDC. PUSH #0017
5D72 9E 04 EXIT. EXIT FROM PROCEDURE. (TOS)=PROC# (TOS-1)=SEG#
5D74 AD 00 RNP. RETURN FROM NON-BASE PROCEDURE.
Things to note:
"PROCEDURE: 16 IN SEGMENT: 0" is "WRITELN;"
"PROCEDURE: 13 IN SEGMENT: 0" is "WRITELN( Astring);"
INTERMEDIATE PROCEDURE: 0E" is "PRESSRET (* P07010E *) "
"EXIT( 07,017)" is "EXIT( TRANSFER)"
Notice that wicked use of EXIT() to exit P070119, then exit P070118, then exit P070117 back to its caller. It's wicked because if you look at P070118 or P070117 you would not know the code does anything more than call a PROCEDURE and then return to the next instruction.
P07011A
This is TRANBAD. Note the numbering is now slightly different between LOL and Wiz1.
pcode we want:
FILE: 7 SEG: 1 PROC: 26
JTAB FOR SUBROUTINE 26:
DATA SIZE: 0
PARAM SIZE: 0
EXIT AT: 6064
ENTER AT: 5F70
PROC NUMBER: 26
LEXICAL LEVEL: 3
5F70 B6 01 80 D3 LOD. PUSH ACTREC(-01).D3
5F74 B2 01 80 FE LDA. PUSH #ACTREC(-01).FE
5F78 0A SLDC. PUSH #000A
5F79 BE LDB. PUSH #00, PUSH (TOS-1)^.TOS BYTE
5F7A C3 EQUI. PUSH ((TOS-1) = (TOS))
5F7B B2 01 82 02 LDA. PUSH #ACTREC(-01).0202
5F7F B2 01 81 FE LDA. PUSH #ACTREC(-01).01FE
5F83 AF 04 EQU. PUSH ((TOS-1) = (TOS))--STRINGS
5F85 84 LAND. PUSH ((TOS-1) AND (TOS))
5F86 A1 2A UJP. IF NOT (TOS) THEN JUMP TO 5FB2
5F88 D7 NOP. NOP
5F89 A6 23 43 41 4E 54 20 43 4F 50 59 20 54 4F 20 42 41 43 4B 55 50 20 2D 20 50 55 54 20 49 4E 20 53 4F 55 52 43 45
CANT COPY TO BACKUP - PUT IN SOURCE
LSA. PUSH #(PC+1) POINTER TO THE STRING
5FAE AE 09 CIP. CALL INTERMEDIATE PROCEDURE: 09
5FB0 B9 51 UJP. JUMP TO 6003
5FB2 B6 01 80 D2 LOD. PUSH ACTREC(-01).D2
5FB6 01 SLDC. PUSH #0001
5FB7 91 NGI. PUSH -(TOS) (2'S COMP)
5FB8 C3 EQUI. PUSH ((TOS-1) = (TOS))
5FB9 A1 25 UJP. IF NOT (TOS) THEN JUMP TO 5FE0
5FBB A6 1E 44 55 50 4C 49 43 41 54 45 20 4E 41 4D 45 20 2D 20 50 55 54 20 49 4E 20 53 4F 55 52 43 45
DUPLICATE NAME - PUT IN SOURCE
LSA. PUSH #(PC+1) POINTER TO THE STRING
5FDB D7 NOP. NOP
5FDC AE 09 CIP. CALL INTERMEDIATE PROCEDURE: 09
5FDE B9 23 UJP. JUMP TO 6003
5FE0 D7 NOP. NOP
5FE1 A6 1E 41 4C 4C 20 53 4C 4F 54 53 20 55 53 45 44 20 2D 20 50 55 54 20 49 4E 20 53 4F 55 52 43 45
ALL SLOTS USED - PUT IN SOURCE
LSA. PUSH #(PC+1) POINTER TO THE STRING
6001 AE 09 CIP. CALL INTERMEDIATE PROCEDURE: 09
6003 04 SLDC. PUSH #0004
6004 B2 01 80 FE LDA. PUSH #ACTREC(-01).FE
6008 00 SLDC. PUSH #0000
6009 C7 00 02 LDCI. PUSH #0200
600C 05 SLDC. PUSH #0005
600D 00 SLDC. PUSH #0000
600E 9E 05 READ FROM VOL#
6010 B2 02 82 06 LDA. PUSH #ACTREC(-02).0206
6014 B2 01 80 D5 LDA. PUSH #ACTREC(-01).D5
6018 AF 04 EQU. PUSH ((TOS-1) = (TOS))--STRINGS
601A B6 01 80 D4 LOD. PUSH ACTREC(-01).D4
601E B2 01 80 FE LDA. PUSH #ACTREC(-01).FE
6022 0C SLDC. PUSH #000C
6023 BE LDB. PUSH #00, PUSH (TOS-1)^.TOS BYTE
6024 C3 EQUI. PUSH ((TOS-1) = (TOS))
6025 84 LAND. PUSH ((TOS-1) AND (TOS))
6026 A1 F6 UJP. IF NOT (TOS) THEN JUMP TO 5F70
6028 B2 01 01 LDA. PUSH #ACTREC(-01).01
602B B6 01 80 D1 LOD. PUSH ACTREC(-01).D1
602F AE 0B CIP. CALL INTERMEDIATE PROCEDURE: 0B
6031 B2 01 01 LDA. PUSH #ACTREC(-01).01
6034 B2 01 69 LDA. PUSH #ACTREC(-01).69
6037 AF 04 EQU. PUSH ((TOS-1) = (TOS))--STRINGS
6039 A1 F4 UJP. IF NOT (TOS) THEN JUMP TO 5F70
603B B2 01 69 LDA. PUSH #ACTREC(-01).69
603E B6 01 80 D1 LOD. PUSH ACTREC(-01).D1
6042 AE 0C CIP. CALL INTERMEDIATE PROCEDURE: 0C
6044 AE 0D CIP. CALL INTERMEDIATE PROCEDURE: 0D
6046 D7 NOP. NOP
6047 A6 17 43 48 41 52 20 48 41 53 20 42 45 45 4E 20 50 55 54 20 42 41 43 4B 2E
CHAR HAS BEEN PUT BACK.
LSA. PUSH #(PC+1) POINTER TO THE STRING
6060 AE 0F CIP. CALL INTERMEDIATE PROCEDURE: 0F
6062 AE 0E CIP. CALL INTERMEDIATE PROCEDURE: 0E
6064 AD 00 RNP. RETURN FROM NON-BASE PROCEDURE.
6066 F6 SLDO. PUSH BASE.0F
6067 00 SLDC. PUSH #0000
6068 F8 SIND. PUSH (TOS)^.0
6069 00 SLDC. PUSH #0000
LOL TRANBAD code:
745 7 25:D 1 PROCEDURE TRANBAD; (* P050119 *)
746 7 25:D 1
747 7 25:0 0 BEGIN
748 7 25:1 0 REPEAT
749 7 25:2 0 REPEAT
750 7 25:3 0 IF PLAYINDX = -1 THEN
751 7 25:4 9 RDSCNTOC( 'DUPLICATE NAME - PUT IN SOURCE')
752 7 25:3 42 ELSE IF PLAYINDX = SCNTOC.RECPERDK[ ZCHAR] THEN
753 7 25:5 61 RDSCNTOC( 'ALL SLOTS USED - PUT IN SOURCE')
754 7 25:4 94 ELSE IF TODSKERR THEN
755 7 25:6 104 RDSCNTOC( 'WRITE PROTECTED - PUT IN SOURCE')
756 7 25:5 138 ELSE
757 7 25:6 142 RDSCNTOC( 'NOT A LOL DISK - PUT IN SOURCE');
758 7 25:3 177 UNITREAD( DRIVE1, BL5BUFF, SIZEOF( BL5BUFF), SERIALBL, 0)
759 7 25:2 190 UNTIL (SCNTOC.GAMENAME = FRMGAMNM) AND (FRMRNDID = BL5BUFF[ 12]);
760 7 25:2 214
761 7 25:2 214 RDCHARAC( PLAYREC1, PLAYFRMI)
762 7 25:2 221
763 7 25:1 221 UNTIL
PLAYREC1.NAME =
PLAYREC2.NAME;
764 7 25:1 233 WRCHARAC( PLAYREC2, PLAYFRMI);
765 7 25:1 242 WRICACHE;
766 7 25:1 244 TITLESCR( 'CHAR HAS BEEN PUT BACK.');
767 7 25:1 272 PRESSRET
768 7 25:0 272 END;
FILE: 5 SEG: 1 PROC: 25
JTAB FOR SUBROUTINE 25:
DATA SIZE: 0
PARAM SIZE: 0
EXIT AT: 6000
ENTER AT: 5EEE
PROC NUMBER: 25
LEXICAL LEVEL: 3
5EEE B6 01 80 D2 LOD. PUSH ACTREC(-01).D2
5EF2 01 SLDC. PUSH #0001
5EF3 91 NGI. PUSH -(TOS) (2'S COMP)
5EF4 C3 EQUI. PUSH ((TOS-1) = (TOS))
5EF5 A1 25 UJP. IF NOT (TOS) THEN JUMP TO 5F1C
5EF7 A6 1E 44 55 50 4C 49 43 41 54 45 20 4E 41 4D 45 20 2D 20 50 55 54 20 49 4E 20 53 4F 55 52 43 45
DUPLICATE NAME - PUT IN SOURCE
LSA. PUSH #(PC+1) POINTER TO THE STRING
5F17 D7 NOP. NOP
5F18 AE 09 CIP. CALL INTERMEDIATE PROCEDURE: 09
5F1A B9 F6 UJP. JUMP TO 5F9F
5F1C B6 01 80 D2 LOD. PUSH ACTREC(-01).D2
5F20 B2 02 82 22 LDA. PUSH #ACTREC(-02).0222
5F24 05 SLDC. PUSH #0005
5F25 A4 01 IXA. PUSH #((TOS-1)[TOS]). ARRAY SIZE=01
5F27 F8 SIND. PUSH (TOS)^.0
5F28 C3 EQUI. PUSH ((TOS-1) = (TOS))
5F29 A1 25 UJP. IF NOT (TOS) THEN JUMP TO 5F50
5F2B A6 1E 41 4C 4C 20 53 4C 4F 54 53 20 55 53 45 44 20 2D 20 50 55 54 20 49 4E 20 53 4F 55 52 43 45
ALL SLOTS USED - PUT IN SOURCE
LSA. PUSH #(PC+1) POINTER TO THE STRING
5F4B D7 NOP. NOP
5F4C AE 09 CIP. CALL INTERMEDIATE PROCEDURE: 09
5F4E B9 4F UJP. JUMP TO 5F9F
5F50 B6 01 82 06 LOD. PUSH ACTREC(-01).0206
5F54 A1 26 UJP. IF NOT (TOS) THEN JUMP TO 5F7C
5F56 D7 NOP. NOP
5F57 A6 1F 57 52 49 54 45 20 50 52 4F 54 45 43 54 45 44 20 2D 20 50 55 54 20 49 4E 20 53 4F 55 52 43 45
WRITE PROTECTED - PUT IN SOURCE
LSA. PUSH #(PC+1) POINTER TO THE STRING
5F78 AE 09 CIP. CALL INTERMEDIATE PROCEDURE: 09
5F7A B9 23 UJP. JUMP TO 5F9F
5F7C D7 NOP. NOP
5F7D A6 1E 4E 4F 54 20 41 20 4C 4F 4C 20 44 49 53 4B 20 2D 20 50 55 54 20 49 4E 20 53 4F 55 52 43 45
NOT A LOL DISK - PUT IN SOURCE
LSA. PUSH #(PC+1) POINTER TO THE STRING
5F9D AE 09 CIP. CALL INTERMEDIATE PROCEDURE: 09
5F9F 04 SLDC. PUSH #0004
5FA0 B2 01 80 FE LDA. PUSH #ACTREC(-01).FE
5FA4 00 SLDC. PUSH #0000
5FA5 C7 00 02 LDCI. PUSH #0200
5FA8 05 SLDC. PUSH #0005
5FA9 00 SLDC. PUSH #0000
5FAA 9E 05 READ FROM VOL#
5FAC B2 02 82 05 LDA. PUSH #ACTREC(-02).0205
5FB0 B2 01 80 D5 LDA. PUSH #ACTREC(-01).D5
5FB4 AF 04 EQU. PUSH ((TOS-1) = (TOS))--STRINGS
5FB6 B6 01 80 D4 LOD. PUSH ACTREC(-01).D4
5FBA B2 01 80 FE LDA. PUSH #ACTREC(-01).FE
5FBE 0C SLDC. PUSH #000C
5FBF BE LDB. PUSH #00, PUSH (TOS-1)^.TOS BYTE
5FC0 C3 EQUI. PUSH ((TOS-1) = (TOS))
5FC1 84 LAND. PUSH ((TOS-1) AND (TOS))
5FC2 A1 F4 UJP. IF NOT (TOS) THEN JUMP TO 5EEE
5FC4 B2 01 01 LDA. PUSH #ACTREC(-01).01
5FC7 B6 01 80 D1 LOD. PUSH ACTREC(-01).D1
5FCB AE 0B CIP. CALL INTERMEDIATE PROCEDURE: 0B
5FCD B2 01 01 LDA. PUSH #ACTREC(-01).01
5FD0 B2 01 69 LDA. PUSH #ACTREC(-01).69
5FD3 AF 04 EQU. PUSH ((TOS-1) = (TOS))--STRINGS
5FD5 A1 F2 UJP. IF NOT (TOS) THEN JUMP TO 5EEE
5FD7 B2 01 69 LDA. PUSH #ACTREC(-01).69
5FDA B6 01 80 D1 LOD. PUSH ACTREC(-01).D1
5FDE AE 0C CIP. CALL INTERMEDIATE PROCEDURE: 0C
5FE0 AE 0D CIP. CALL INTERMEDIATE PROCEDURE: 0D
5FE2 D7 NOP. NOP
5FE3 A6 17 43 48 41 52 20 48 41 53 20 42 45 45 4E 20 50 55 54 20 42 41 43 4B 2E
CHAR HAS BEEN PUT BACK.
LSA. PUSH #(PC+1) POINTER TO THE STRING
5FFC AE 0F CIP. CALL INTERMEDIATE PROCEDURE: 0F
5FFE AE 0E CIP. CALL INTERMEDIATE PROCEDURE: 0E
6000 AD 00 RNP. RETURN FROM NON-BASE PROCEDURE.
6002 14 SLDC. PUSH #0014
6003 01 SLDC. PUSH #0001
6004 16 SLDC. PUSH #0016
6005 01 SLDC. PUSH #0001
6006 67 SLDC. PUSH #0067
6007 00 SLDC. PUSH #0000
ACTREC( -1).xxx refers to TRANSFER variables
674 7 23:D 1 PROCEDURE TRANSFER; (* P050117 *)
675 7 23:D 1
676 7 23:D 1 VAR
(-1).01 677 7 23:D 1 PLAYREC1 : TCHAR;
(-1).69 678 7 23:D 105 PLAYREC2 : TCHAR;
679 7 23:D 209 PLAYFRMI : INTEGER;
(-1).D2 680 7 23:D 210 PLAYINDX : INTEGER;
(-1).D3 681 7 23:D 211 MPD3 : CHAR;
(-1).D4 682 7 23:D 212 FRMRNDID : CHAR;
(-1).D5 683 7 23:D 213 FRMGAMNM : STRING;
(-1).FE 684 7 23:D 254 BL5BUFF : PACKED ARRAY[ 0..511] OF CHAR;
(-1).1FE 685 7 23:D 510 SERIALTO : STRING[ 7];
(-1).0202 686 7 23:D 514 SERIALFR : STRING[ 7];
687 7 23:D 518 TODSKERR : BOOLEAN;
Re-engineered TRANBAD (* P07011A *)
767 7 26:D 1 PROCEDURE TRANBAD; (* P07011A *)
768 7 26:D 1
769 7 26:0 0 BEGIN
770 7 26:1 0 REPEAT
771 7 26:2 0 REPEAT
772 7 26:3 0 IF (MPD3 = BL5BUFF[ 10]) AND
773 7 26:3 11 (SERIALFR = SERIALTO) THEN
774 7 26:4 24 RDSCNTOC( 'CANT COPY TO BACKUP - PUT IN SOURCE')
775 7 26:3 62 ELSE IF (PLAYINDX = -1) THEN
776 7 26:5 75 RDSCNTOC( 'DUPLICATE NAME - PUT IN SOURCE')
777 7 26:4 108 ELSE
778 7 26:5 112 RDSCNTOC( 'ALL SLOTS USED - PUT IN SOURCE');
779 7 26:3 147 UNITREAD( DRIVE1, BL5BUFF, SIZEOF( BL5BUFF), SERIALBL, 0)
780 7 26:2 160 UNTIL (SCNTOC.GAMENAME = FRMGAMNM) AND (FRMRNDID = BL5BUFF[ 12]);
781 7 26:2 184 RDCHARAC( PLAYREC1, PLAYFRMI)
782 7 26:1 191 UNTIL
PLAYREC1.NAME =
PLAYREC2.NAME;
783 7 26:1 203 WRCHARAC( PLAYREC2, PLAYFRMI);
784 7 26:1 212 WRICACHE;
785 7 26:1 214 TITLESCR( 'CHAR HAS BEEN PUT BACK.');
786 7 26:1 242 PRESSRET
787 7 26:0 242 END;
P07011B. In LOL this is P05011A.
The only difference is that LOL added a few more lines of code, otherwise identical.
771 7 26:D 1 PROCEDURE TRANGOOD; (* P05011A *)
772 7 26:D 1
773 7 26:0 0 BEGIN
remove 774 7 26:1 0 IF PLAYREC2.POSS.POSSCNT > 0 THEN
remove 775 7 26:2 8 IF PLAYREC2.POSS.POSSESS[ 1].EQINDEX < 1000 THEN
remove 776 7 26:3 24 PLAYREC2.POSS.POSSCNT := 0;
777 7 26:1 29 WRCHARAC( PLAYREC2, PLAYINDX);
778 7 26:1 38 WRICACHE;
779 7 26:1 40 TITLESCR( 'CHAR HAS BEEN MOVED');
780 7 26:1 64 PRESSRET
781 7 26:0 64 END;
P07011C (does not have an LOL equivalent)
P07011C has 3 child procedures
P07011D
P07011E
P07011F
This is the pcode we want:
FILE: 7 SEG: 1 PROC: 28
JTAB FOR SUBROUTINE 28:
DATA SIZE: 3800
PARAM SIZE: 0
EXIT AT: 6555
ENTER AT: 62B2
PROC NUMBER: 28
LEXICAL LEVEL: 2
62B2 D7 NOP. NOP
62B3 A6 1A 4D 41 4B 45 20 4E 45 57 20 53 43 45 4E 41 52 49 4F 20 44 49 53 4B 45 54 54 45
MAKE NEW SCENARIO DISKETTE
LSA. PUSH #(PC+1) POINTER TO THE STRING
62CF A6 00
W
LSA. PUSH #(PC+1) POINTER TO THE STRING
62D1 D7 NOP. NOP
62D2 00 SLDC. PUSH #0000
62D3 00 SLDC. PUSH #0000
62D4 AE 10 CIP. CALL INTERMEDIATE PROCEDURE: 10
62D6 A1 04 UJP. IF NOT (TOS) THEN JUMP TO 62DC
62D8 07 SLDC. PUSH #0007
62D9 1C SLDC. PUSH #001C
62DA 9E 04 EXIT. EXIT FROM PROCEDURE. (TOS)=PROC# (TOS-1)=SEG#
62DC D7 NOP. NOP
62DD A6 1A 4D 41 4B 45 20 4E 45 57 20 53 43 45 4E 41 52 49 4F 20 44 49 53 4B 45 54 54 45
MAKE NEW SCENARIO DISKETTE
LSA. PUSH #(PC+1) POINTER TO THE STRING
62F9 AE 0F CIP. CALL INTERMEDIATE PROCEDURE: 0F
62FB B6 03 03 LOD. PUSH ACTREC(-03).03
62FE D7 NOP. NOP
62FF A6 26 50 4C 41 43 45 20 4F 52 49 47 49 4E 41 4C 20 4D 41 53 54 45 52 20 53 43 45 4E 41 52 49 4F 20 53 49 44 45 20 49 4E
PLACE ORIGINAL MASTER SCENARIO SIDE IN
LSA. PUSH #(PC+1) POINTER TO THE STRING
6327 00 SLDC. PUSH #0000
6328 CD 00 13 CXP. CALL EXTERNAL PROCEDURE: 13 IN SEGMENT: 00
632B B6 03 03 LOD. PUSH ACTREC(-03).03
632E CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
6331 B6 03 03 LOD. PUSH ACTREC(-03).03
6334 D7 NOP. NOP
6335 A6 26 44 52 49 56 45 20 32 2C 20 20 41 4E 44 20 41 20 20 46 4F 52 4D 41 54 54 45 44 20 44 49 53 4B 45 54 54 45 20 49 4E
DRIVE 2, AND A FORMATTED DISKETTE IN
LSA. PUSH #(PC+1) POINTER TO THE STRING
635D 00 SLDC. PUSH #0000
635E CD 00 13 CXP. CALL EXTERNAL PROCEDURE: 13 IN SEGMENT: 00
6361 B6 03 03 LOD. PUSH ACTREC(-03).03
6364 CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
6367 B6 03 03 LOD. PUSH ACTREC(-03).03
636A D7 NOP. NOP
636B A6 08 44 52 49 56 45 20 31 2E
DRIVE 1.
LSA. PUSH #(PC+1) POINTER TO THE STRING
6375 00 SLDC. PUSH #0000
6376 CD 00 13 CXP. CALL EXTERNAL PROCEDURE: 13 IN SEGMENT: 00
6379 B6 03 03 LOD. PUSH ACTREC(-03).03
637C CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
637F B6 03 03 LOD. PUSH ACTREC(-03).03
6382 CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
6385 B6 03 03 LOD. PUSH ACTREC(-03).03
6388 D7 NOP. NOP
6389 A6 1C 52 45 4D 45 4D 42 45 52 20 3A 20 4F 52 49 47 49 4E 41 4C 3D 32 2C 20 4E 45 57 3D 31
REMEMBER : ORIGINAL=2, NEW=1
LSA. PUSH #(PC+1) POINTER TO THE STRING
63A7 00 SLDC. PUSH #0000
63A8 CD 00 13 CXP. CALL EXTERNAL PROCEDURE: 13 IN SEGMENT: 00
63AB B6 03 03 LOD. PUSH ACTREC(-03).03
63AE CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
63B1 AE 0E CIP. CALL INTERMEDIATE PROCEDURE: 0E
63B3 A6 20 4D 41 4B 49 4E 47 20 53 43 45 4E 41 52 49 4F 20 2D 20 44 4F 20 4E 4F 54 20 44 49 53 54 55 52 42
MAKING SCENARIO - DO NOT DISTURB
LSA. PUSH #(PC+1) POINTER TO THE STRING
63D5 D7 NOP. NOP
63D6 AE 0F CIP. CALL INTERMEDIATE PROCEDURE: 0F
63D8 05 SLDC. PUSH #0005
63D9 A6 0D 53 43 45 4E 41 52 49 4F 2E 44 41 54 41
SCENARIO.DATA
LSA. PUSH #(PC+1) POINTER TO THE STRING
63E8 D7 NOP. NOP
63E9 00 SLDC. PUSH #0000
63EA 00 SLDC. PUSH #0000
63EB AE 05 CIP. CALL INTERMEDIATE PROCEDURE: 05
63ED B8 01 82 03 STR. ACTREC(-01).0203 := TOS
63F1 B6 01 82 03 LOD. PUSH ACTREC(-01).0203
63F5 00 SLDC. PUSH #0000
63F6 C9 LESI. PUSH ((TOS-1) < (TOS))
63F7 A1 02 UJP. IF NOT (TOS) THEN JUMP TO 63FB
63F9 CE 1F CLP. CALL CHILD PROCEDURE: 1F
63FB 05 SLDC. PUSH #0005
63FC C6 86 6C LLA. PUSH #MP.066C
63FF 00 SLDC. PUSH #0000
6400 C7 00 02 LDCI. PUSH #0200
6403 05 SLDC. PUSH #0005
6404 00 SLDC. PUSH #0000
6405 9E 05 READ FROM VOL#
6407 9E 22 PUSH I/O ERROR STATUS
6409 00 SLDC. PUSH #0000
640A CB NEQI. PUSH ((TOS-1) <> (TOS))
640B A1 02 UJP. IF NOT (TOS) THEN JUMP TO 640F
640D CE 1E CLP. CALL CHILD PROCEDURE: 1E
640F C6 86 6C LLA. PUSH #MP.066C
6412 0A SLDC. PUSH #000A
6413 BE LDB. PUSH #00, PUSH (TOS-1)^.TOS BYTE
6414 00 SLDC. PUSH #0000
6415 CB NEQI. PUSH ((TOS-1) <> (TOS))
6416 A1 14 UJP. IF NOT (TOS) THEN JUMP TO 642C
6418 D7 NOP. NOP
6419 A6 0F 4E 4F 54 20 4D 41 53 54 45 52 20 49 4E 20 32
NOT MASTER IN 2
LSA. PUSH #(PC+1) POINTER TO THE STRING
642A CE 1D CLP. CALL CHILD PROCEDURE: 1D
642C C6 86 6C LLA. PUSH #MP.066C
642F 0B SLDC. PUSH #000B
6430 BE LDB. PUSH #00, PUSH (TOS-1)^.TOS BYTE
6431 01 SLDC. PUSH #0001
6432 82 ADI. PUSH ((TOS) + (TOS-1))
6433 CC 02 STL. MP.02 := (TOS)
6435 D9 SLDL. PUSH MP.02
6436 C7 00 01 LDCI. PUSH #0100
6439 C3 EQUI. PUSH ((TOS-1) = (TOS))
643A A1 03 UJP. IF NOT (TOS) THEN JUMP TO 643F
643C 01 SLDC. PUSH #0001
643D CC 02 STL. MP.02 := (TOS)
643F C6 86 6C LLA. PUSH #MP.066C
6442 0B SLDC. PUSH #000B
6443 D9 SLDL. PUSH MP.02
6444 BF STB. (TOS-2)^.(TOS-1) := TOS BYTE
6445 05 SLDC. PUSH #0005
6446 C6 86 6C LLA. PUSH #MP.066C
6449 00 SLDC. PUSH #0000
644A C7 00 02 LDCI. PUSH #0200
644D 05 SLDC. PUSH #0005
644E 00 SLDC. PUSH #0000
644F 9E 06 WRITE VOL#
6451 9E 22 PUSH I/O ERROR STATUS
6453 00 SLDC. PUSH #0000
6454 CB NEQI. PUSH ((TOS-1) <> (TOS))
6455 A1 02 UJP. IF NOT (TOS) THEN JUMP TO 6459
6457 CE 1E CLP. CALL CHILD PROCEDURE: 1E
6459 00 SLDC. PUSH #0000
645A CC 03 STL. MP.03 := (TOS)
645C 22 SLDC. PUSH #0022
645D CC 87 6C STL. MP.076C := (TOS)
6460 DA SLDL. PUSH MP.03
6461 CA 87 6C LDL. PUSH MP.076C
6464 C8 LEQI. PUSH ((TOS-1) <= (TOS))
6465 A1 61 UJP. IF NOT (TOS) THEN JUMP TO 64C8
6467 05 SLDC. PUSH #0005
6468 B2 01 01 LDA. PUSH #ACTREC(-01).01
646B 00 SLDC. PUSH #0000
646C C7 00 04 LDCI. PUSH #0400
646F 08 SLDC. PUSH #0008
6470 DA SLDL. PUSH MP.03
6471 8F MPI. PUSH ((TOS-1) * (TOS))
6472 00 SLDC. PUSH #0000
6473 9E 05 READ FROM VOL#
6475 9E 22 PUSH I/O ERROR STATUS
6477 00 SLDC. PUSH #0000
6478 CB NEQI. PUSH ((TOS-1) <> (TOS))
6479 A1 02 UJP. IF NOT (TOS) THEN JUMP TO 647D
647B CE 1E CLP. CALL CHILD PROCEDURE: 1E
647D 05 SLDC. PUSH #0005
647E C6 6C LLA. PUSH #MP.6C
6480 00 SLDC. PUSH #0000
6481 C7 00 0C LDCI. PUSH #0C00
6484 08 SLDC. PUSH #0008
6485 DA SLDL. PUSH MP.03
6486 8F MPI. PUSH ((TOS-1) * (TOS))
6487 02 SLDC. PUSH #0002
6488 82 ADI. PUSH ((TOS) + (TOS-1))
6489 00 SLDC. PUSH #0000
648A 9E 05 READ FROM VOL#
648C 9E 22 PUSH I/O ERROR STATUS
648E 00 SLDC. PUSH #0000
648F CB NEQI. PUSH ((TOS-1) <> (TOS))
6490 A1 02 UJP. IF NOT (TOS) THEN JUMP TO 6494
6492 CE 1E CLP. CALL CHILD PROCEDURE: 1E
6494 04 SLDC. PUSH #0004
6495 B2 01 01 LDA. PUSH #ACTREC(-01).01
6498 00 SLDC. PUSH #0000
6499 C7 00 04 LDCI. PUSH #0400
649C 08 SLDC. PUSH #0008
649D DA SLDL. PUSH MP.03
649E 8F MPI. PUSH ((TOS-1) * (TOS))
649F 00 SLDC. PUSH #0000
64A0 9E 06 WRITE VOL#
64A2 9E 22 PUSH I/O ERROR STATUS
64A4 00 SLDC. PUSH #0000
64A5 CB NEQI. PUSH ((TOS-1) <> (TOS))
64A6 A1 02 UJP. IF NOT (TOS) THEN JUMP TO 64AA
64A8 CE 1E CLP. CALL CHILD PROCEDURE: 1E
64AA 04 SLDC. PUSH #0004
64AB C6 6C LLA. PUSH #MP.6C
64AD 00 SLDC. PUSH #0000
64AE C7 00 0C LDCI. PUSH #0C00
64B1 08 SLDC. PUSH #0008
64B2 DA SLDL. PUSH MP.03
64B3 8F MPI. PUSH ((TOS-1) * (TOS))
64B4 02 SLDC. PUSH #0002
64B5 82 ADI. PUSH ((TOS) + (TOS-1))
64B6 00 SLDC. PUSH #0000
64B7 9E 06 WRITE VOL#
64B9 9E 22 PUSH I/O ERROR STATUS
64BB 00 SLDC. PUSH #0000
64BC CB NEQI. PUSH ((TOS-1) <> (TOS))
64BD A1 02 UJP. IF NOT (TOS) THEN JUMP TO 64C1
64BF CE 1E CLP. CALL CHILD PROCEDURE: 1E
64C1 DA SLDL. PUSH MP.03
64C2 01 SLDC. PUSH #0001
64C3 82 ADI. PUSH ((TOS) + (TOS-1))
64C4 CC 03 STL. MP.03 := (TOS)
64C6 B9 F6 UJP. JUMP TO 6460
64C8 C6 86 6C LLA. PUSH #MP.066C
64CB 0A SLDC. PUSH #000A
64CC C6 86 6C LLA. PUSH #MP.066C
64CF 0B SLDC. PUSH #000B
64D0 BE LDB. PUSH #00, PUSH (TOS-1)^.TOS BYTE
64D1 BF STB. (TOS-2)^.(TOS-1) := TOS BYTE
64D2 C6 86 6C LLA. PUSH #MP.066C
64D5 0B SLDC. PUSH #000B
64D6 00 SLDC. PUSH #0000
64D7 BF STB. (TOS-2)^.(TOS-1) := TOS BYTE
64D8 C6 86 6C LLA. PUSH #MP.066C
64DB 0C SLDC. PUSH #000C
64DC C6 86 6C LLA. PUSH #MP.066C
64DF 0C SLDC. PUSH #000C
64E0 BE LDB. PUSH #00, PUSH (TOS-1)^.TOS BYTE
64E1 B6 01 82 04 LOD. PUSH ACTREC(-01).0204
64E5 82 ADI. PUSH ((TOS) + (TOS-1))
64E6 C7 00 01 LDCI. PUSH #0100
64E9 8E MODI. PUSH ((TOS-1) MOD (TOS))
64EA BF STB. (TOS-2)^.(TOS-1) := TOS BYTE
64EB 04 SLDC. PUSH #0004
64EC C6 86 6C LLA. PUSH #MP.066C
64EF 00 SLDC. PUSH #0000
64F0 C7 00 02 LDCI. PUSH #0200
64F3 05 SLDC. PUSH #0005
64F4 00 SLDC. PUSH #0000
64F5 9E 06 WRITE VOL#
64F7 9E 22 PUSH I/O ERROR STATUS
64F9 00 SLDC. PUSH #0000
64FA CB NEQI. PUSH ((TOS-1) <> (TOS))
64FB A1 02 UJP. IF NOT (TOS) THEN JUMP TO 64FF
64FD CE 1E CLP. CALL CHILD PROCEDURE: 1E
64FF 04 SLDC. PUSH #0004
6500 D7 NOP. NOP
6501 A6 0D 53 43 45 4E 41 52 49 4F 2E 44 41 54 41
SCENARIO.DATA
LSA. PUSH #(PC+1) POINTER TO THE STRING
6510 00 SLDC. PUSH #0000
6511 00 SLDC. PUSH #0000
6512 AE 05 CIP. CALL INTERMEDIATE PROCEDURE: 05
6514 B8 01 82 03 STR. ACTREC(-01).0203 := TOS
6518 B6 01 82 03 LOD. PUSH ACTREC(-01).0203
651C 00 SLDC. PUSH #0000
651D C9 LESI. PUSH ((TOS-1) < (TOS))
651E A1 02 UJP. IF NOT (TOS) THEN JUMP TO 6522
6520 CE 1F CLP. CALL CHILD PROCEDURE: 1F
6522 AE 08 CIP. CALL INTERMEDIATE PROCEDURE: 08
6524 07 SLDC. PUSH #0007
6525 CC 18 STL. MP.18 := (TOS)
6527 00 SLDC. PUSH #0000
6528 CC 03 STL. MP.03 := (TOS)
652A B2 01 82 23 LDA. PUSH #ACTREC(-01).0223
652E 05 SLDC. PUSH #0005
652F A4 01 IXA. PUSH #((TOS-1)[TOS]). ARRAY SIZE=01
6531 F8 SIND. PUSH (TOS)^.0
6532 CC 87 6C STL. MP.076C := (TOS)
6535 DA SLDL. PUSH MP.03
6536 CA 87 6C LDL. PUSH MP.076C
6539 C8 LEQI. PUSH ((TOS-1) <= (TOS))
653A A1 0C UJP. IF NOT (TOS) THEN JUMP TO 6548
653C C6 04 LLA. PUSH #MP.04
653E DA SLDL. PUSH MP.03
653F AE 0C CIP. CALL INTERMEDIATE PROCEDURE: 0C
6541 DA SLDL. PUSH MP.03
6542 01 SLDC. PUSH #0001
6543 82 ADI. PUSH ((TOS) + (TOS-1))
6544 CC 03 STL. MP.03 := (TOS)
6546 B9 F4 UJP. JUMP TO 6535
6548 AE 0D CIP. CALL INTERMEDIATE PROCEDURE: 0D
654A D7 NOP. NOP
654B A6 04 4D 41 44 45
MADE
LSA. PUSH #(PC+1) POINTER TO THE STRING
6551 AE 0F CIP. CALL INTERMEDIATE PROCEDURE: 0F
6553 AE 0E CIP. CALL INTERMEDIATE PROCEDURE: 0E
6555 AD 00 RNP. RETURN FROM NON-BASE PROCEDURE.
6557 00 SLDC. PUSH #0000
6558 23 SLDC. PUSH #0023
6559 00 SLDC. PUSH #0000
655A FA SIND. PUSH (TOS)^.2
655B 00 SLDC. PUSH #0000
P07011C final rough draft:
843 7 28:D 1 PROCEDURE P07011C; (* P07011C *)
844 7 28:D 1
845 7 28:D 1 VAR
846 7 28:D 1 MP01 : INTEGER;
847 7 28:D 2 MP02 : INTEGER;
848 7 28:D 3 MP03 : INTEGER;
849 7 28:D 4 MP04 : TCHAR;
850 7 28:D 108 (* MP6C : INTEGER; *)
851 7 28:D 108 TEMP : PACKED ARRAY [ 0..3071] OF CHAR;
852 7 28:D 1644 MP066C : PACKED ARRAY [ 0..511] OF CHAR;
867 7 28:0 0 BEGIN (* P07011C *)
868 7 28:1 0 IF RTNESC( 'MAKE NEW SCENARIO DISKETTE', '') THEN
869 7 28:2 38 EXIT( P07011C);
870 7 28:1 42 TITLESCR( 'MAKE NEW SCENARIO DISKETTE');
871 7 28:1 73 WRITELN( 'PLACE ORIGINAL MASTER SCENARIO SIDE IN');
872 7 28:1 127 WRITELN( 'DRIVE 2, AND A FORMATTED DISKETTE IN');
873 7 28:1 181 WRITELN( 'DRIVE 1.');
874 7 28:1 205 WRITELN;
875 7 28:1 211 WRITELN( 'REMEMBER : ORIGINAL=2, NEW=1');
876 7 28:1 255 PRESSRET;
877 7 28:1 257 TITLESCR( 'MAKING SCENARIO - DO NOT DISTURB');
878 7 28:1 294 SCNTOCBL := FINDFILE( DRIVE2, 'SCENARIO.DATA');
879 7 28:1 319 IF SCNTOCBL < 0 THEN
880 7 28:2 327 P07011F;
881 7 28:1 329 UNITREAD( DRIVE2, MP066C, SIZEOF( MP066C), SERIALBL, 0);
882 7 28:1 341 IF IORESULT <> 0 THEN
883 7 28:2 347 P07011E;
884 7 28:1 349 IF MP066C[ 10] <> CHR( 0) THEN
885 7 28:2 358 P07011D( 'NOT MASTER IN 2');
886 7 28:1 378 MP02 := ORD( MP066C[ 11]) + 1;
887 7 28:1 387 IF MP02 = 256 THEN
888 7 28:2 394 MP02 := 1;
889 7 28:1 397 MP066C[ 11] := CHR( MP02);
890 7 28:1 403 UNITWRITE( DRIVE2, MP066C, SIZEOF( MP066C), SERIALBL, 0);
891 7 28:1 415 IF IORESULT <> 0 THEN
892 7 28:2 421 P07011E;
893 7 28:1 423 FOR MP03 := 0 TO 34 DO
894 7 28:2 437 BEGIN
895 7 28:3 437 UNITREAD( DRIVE2, IOCACHE, SIZEOF( IOCACHE), 8 * MP03, 0);
896 7 28:3 451 IF IORESULT <> 0 THEN
897 7 28:4 457 P07011E;
898 7 28:3 459 UNITREAD( DRIVE2, TEMP[ 0], 3072, 8 * MP03 + 2, 0);
899 7 28:3 474 IF IORESULT <> 0 THEN
900 7 28:4 480 P07011E;
901 7 28:3 482 UNITWRITE( DRIVE1, IOCACHE, SIZEOF( IOCACHE), 8 * MP03, 0);
902 7 28:3 496 IF IORESULT <> 0 THEN
903 7 28:4 502 P07011E;
904 7 28:3 504 UNITWRITE( DRIVE1, TEMP[ 0], 3072, 8 * MP03 + 2, 0);
905 7 28:3 519 IF IORESULT <> 0 THEN
906 7 28:4 525 P07011E;
907 7 28:2 527 END;
908 7 28:2 534
909 7 28:1 534 MP066C[ 10] := MP066C[ 11];
910 7 28:1 544 MP066C[ 11] := CHR( 0);
911 7 28:1 550
912 7 28:1 550 MP066C[ 12] := CHR( (ORD( MP066C[ 12]) + BASE204) MOD 256 );
913 7 28:1 569
914 7 28:1 569 UNITWRITE( DRIVE1, MP066C, SIZEOF( MP066C), SERIALBL, 0);
915 7 28:1 581 IF IORESULT <> 0 THEN
916 7 28:2 587 P07011E;
917 7 28:1 589 SCNTOCBL := FINDFILE( DRIVE1, 'SCENARIO.DATA');
918 7 28:1 614 IF SCNTOCBL < 0 THEN
919 7 28:2 622 P07011F;
920 7 28:1 624 RDSCNTC2;
921 7 28:1 626 MP04.STATUS := LOST;
922 7 28:1 629 FOR MP03 := 0 TO SCNTOC.RECPERDK[ ZCHAR] DO
923 7 28:2 650 WRCHARAC( MP04, MP03);
924 7 28:1 662 WRICACHE;
925 7 28:1 664 TITLESCR( 'MADE');
926 7 28:1 673 PRESSRET
927 7 28:0 673 END;
P07011D
JTAB FOR SUBROUTINE 29:
DATA SIZE: 82
PARAM SIZE: 2
EXIT AT: 6267
ENTER AT: 622C
PROC NUMBER: 29
LEXICAL LEVEL: 3
622C C6 02 LLA. PUSH #MP.02
622E D8 SLDL. PUSH MP.01
622F AA 50 SAS. TOS=CHAR::(TOS-1)^ := TOS CHAR
TOS=PTR ::(TOS-1)^ := (TOS)^ 50 CHARACTERS MAX
6231 A6 15 45 52 52 4F 52 20 4D 41 4B 49 4E 47 20 53 43 45 4E 41 52 49 4F
ERROR MAKING SCENARIO
LSA. PUSH #(PC+1) POINTER TO THE STRING
6248 D7 NOP. NOP
6249 AE 0F CIP. CALL INTERMEDIATE PROCEDURE: 0F
624B B6 04 03 LOD. PUSH ACTREC(-04).03
624E C6 02 LLA. PUSH #MP.02
6250 14 SLDC. PUSH #0014
6251 C6 02 LLA. PUSH #MP.02
6253 00 SLDC. PUSH #0000
6254 BE LDB. PUSH #00, PUSH (TOS-1)^.TOS BYTE
6255 02 SLDC. PUSH #0002
6256 86 DVI. PUSH ((TOS-1) / (TOS))
6257 82 ADI. PUSH ((TOS) + (TOS-1))
6258 CD 00 13 CXP. CALL EXTERNAL PROCEDURE: 13 IN SEGMENT: 00
625B B6 04 03 LOD. PUSH ACTREC(-04).03
625E CD 00 16 CXP. CALL EXTERNAL PROCEDURE: 16 IN SEGMENT: 00
6261 AE 0E CIP. CALL INTERMEDIATE PROCEDURE: 0E
6263 07 SLDC. PUSH #0007
6264 1C SLDC. PUSH #001C
6265 9E 04 EXIT. EXIT FROM PROCEDURE. (TOS)=PROC# (TOS-1)=SEG#
6267 AD 00 RNP. RETURN FROM NON-BASE PROCEDURE.
6269 00 SLDC. PUSH #0000
Note the #MP.02 compiler generated variable to hold the PASS BY VALUE of a STRING variable.
PROCEDURE F is: TITLESCR
Notice how LENGTH() function produces pcode.
Use MP01 even though pcode says #MP.02.
Final rough draft for P07011D
855 7 29:D 1 PROCEDURE P07011D( MP01 : STRING); (* P07011D *)
856 7 29:D 43
857 7 29:0 0 BEGIN (* P07011D *)
858 7 29:1 0 TITLESCR( 'ERROR MAKING SCENARIO');
859 7 29:1 31 WRITELN( MP01: (20 + LENGTH( MP01) DIV 2) );
860 7 29:1 53 PRESSRET;
861 7 29:1 55 EXIT( P07011C)
862 7 29:0 59 END;
P07011E
FILE: 7 SEG: 1 PROC: 30
JTAB FOR SUBROUTINE 30:
DATA SIZE: 0
PARAM SIZE: 0
EXIT AT: 6283
ENTER AT: 6274
PROC NUMBER: 30
LEXICAL LEVEL: 3
6274 D7 NOP. NOP
6275 A6 0A 44 49 53 4B 20 45 52 52 4F 52
DISK ERROR
LSA. PUSH #(PC+1) POINTER TO THE STRING
6281 AE 1D CIP. CALL INTERMEDIATE PROCEDURE: 1D
6283 AD 00 RNP. RETURN FROM NON-BASE PROCEDURE.
6285 00 SLDC. PUSH #0000
Final rough draft P07011E
865 7 30:D 1 PROCEDURE P07011E; (* P07011E *)
866 7 30:D 1
867 7 30:0 0 BEGIN
868 7 30:1 0 P07011D( 'DISK ERROR')
869 7 30:0 13 END;
P07011F
FILE: 7 SEG: 1 PROC: 31
JTAB FOR SUBROUTINE 31:
DATA SIZE: 0
PARAM SIZE: 0
EXIT AT: 62A6
ENTER AT: 6290
PROC NUMBER: 31
LEXICAL LEVEL: 3
6290 D7 NOP. NOP
6291 A6 11 4E 4F 54 20 53 43 45 4E 41 52 49 4F 20 44 49 53 4B
NOT SCENARIO DISK
LSA. PUSH #(PC+1) POINTER TO THE STRING
62A4 AE 1D CIP. CALL INTERMEDIATE PROCEDURE: 1D
62A6 AD 00 RNP. RETURN FROM NON-BASE PROCEDURE.
Final rough draft P07011F
872 7 31:D 1 PROCEDURE P07011F; (* P07011F *)
873 7 31:D 1
874 7 31:0 0 BEGIN
875 7 31:1 0 P07011D( 'NOT SCENARIO DISK')
876 7 31:0 20 END;
P070120 Data Size Paramaters
P070120 "STEP 2" 7798 0
P070121 "ERROR DURING UPDATE" 0 0
P070122 UPDATING 2 0
P070123 read/write 0 2
P070124 UPDATE DISK 0 0
JTAB FOR SUBROUTINE 32:
DATA SIZE: 7798
PARAM SIZE: 0
EXIT AT: 6A1F
ENTER AT: 6806
PROC NUMBER: 32
LEXICAL LEVEL: 2
Tons of DATA in P070120
Here is a table I constructed after looking briefly through the code:
P070001 P070120 P070120child
(-3).01
(-1).0203 SCNTOCBL
(-1).0204 BASE204
MP.01
MP.02 (-1).02
MP.03 array of size #$68 at this addr
$0820 = 2080
MP.0823
MP.083B
MP.093B (-1).093B (-2).093B 1536
MP.0F3B Looks like FOR LOOP control variable.
First rough draft after coding the first few instructions in P070120:
941 7 32:D 1 PROCEDURE P070120;
942 7 32:D 1
943 7 32:D 1 VAR
944 7 32:D 1 MP01 : INTEGER;
945 7 32:D 2 MP02 : INTEGER;
946 7 32:D 3 MP03 : ARRAY [ 0..2079] OF INTEGER;
947 7 32:D 2083 MP0823 : STRING[ 46];
948 7 32:D 2107 MP083B : PACKED ARRAY [ 0..511] OF CHAR;
949 7 32:D 2363 MP093B : PACKED ARRAY [ 0..1535] OF CHAR;
Procedure F is "TITLESCR".
Procedure E is "PRESSRET"
Procedure 5 is "FINDFILE"
Procedure 8 is "RDSCNTC2"
Procedure B is "RDCHARAC"
Procedure D is "WRICACHE"
#$04E2 = 1250
MP03 looks like an array of Wizardry Characters (TCHAR record) since we are going through a loop from 0 to 19 and calling WRCHARAC. Note, #$68 is 104, and 20 x 104 = 2080.
First rough draft complete for P070120
941 7 32:D 1 PROCEDURE P070120;
942 7 32:D 1
943 7 32:D 1 VAR
944 7 32:D 1 MP01 : INTEGER;
945 7 32:D 2 MP02 : INTEGER;
946 7 32:D 3 MP03 : ARRAY [ 0..19] OF TCHAR;
947 7 32:D 2083 MP0823 : STRING[ 46];
948 7 32:D 2107 MP083B : PACKED ARRAY [ 0..511] OF CHAR;
949 7 32:D 2363 MP093B : PACKED ARRAY [ 0..3071] OF CHAR;
968 7 32:0 0 BEGIN (* P070120 *)
969 7 32:1 0 P070124;
970 7 32:1 2 P070122;
971 7 32:1 4 UNITREAD( DRIVE1, MP083B, SIZEOF( MP083B), SERIALBL, 0);
972 7 32:1 16 IF IORESULT <> 0 THEN
973 7 32:2 22 P070121;
974 7 32:1 24 MOVELEFT( MP083B, MP0823, 7);
975 7 32:1 35 MP083B[ 10] := CHR( 0);
976 7 32:1 41 MP083B[ 11] := CHR( 1);
977 7 32:1 47 MP083B[ 12] := CHR( BASE204);
978 7 32:1 56 UNITWRITE( DRIVE1, MP083B, SIZEOF( MP083B), SERIALBL, 0);
979 7 32:1 68 IF IORESULT <> 0 THEN
980 7 32:2 74 P070121;
981 7 32:1 76 REPEAT
982 7 32:2 76 TITLESCR( 'STEP 2 - UPDATE SCENARIO SIDE');
983 7 32:2 110 WRITELN( 'NOW FLIP BOTH DISKETTES SO WE CAN COPY');
984 7 32:2 164 WRITELN( 'SCENARIO SIDES.');
985 7 32:2 195 PRESSRET;
986 7 32:2 197 SCNTOCBL := FINDFILE( DRIVE1, 'SCENARIO.DATA')
987 7 32:1 214 UNTIL SCNTOCBL >= 0;
988 7 32:1 230 RDSCNTC2;
989 7 32:1 232 FOR MP02 := 0 TO 19 DO
990 7 32:2 246 BEGIN
991 7 32:3 246 RDCHARAC( MP03[ MP02], MP02)
992 7 32:2 252 END;
993 7 32:1 261 P070122;
994 7 32:1 263 SCNTOCBL := FINDFILE( DRIVE1, 'SCENARIO.DATA');
995 7 32:1 288 RDSCNTC2;
996 7 32:1 290 FOR MP02 := 0 TO 19 DO
997 7 32:2 304 BEGIN
998 7 32:3 304 IF MP03[ MP02].AGE > 1250 THEN
999 7 32:4 317 MP03[ MP02].AGE := 1250;
1000 7 32:3 328 MP03[ MP02].INMAZE := FALSE;
1001 7 32:3 337 WRCHARAC( MP03[ MP02], MP02);
1002 7 32:2 345 END;
1003 7 32:1 352 WRICACHE;
1004 7 32:1 354 UNITREAD( DRIVE1, MP083B, SIZEOF( MP083B), SERIALBL, 0);
1005 7 32:1 366 IF IORESULT <> 0 THEN
1006 7 32:2 372 P070121;
1007 7 32:1 374 MOVELEFT( MP083B, MP0823, 7);
1008 7 32:1 385 MP083B[ 10] := CHR( 0);
1009 7 32:1 391 MP083B[ 11] := CHR( 1);
1010 7 32:1 397 MP083B[ 12] := CHR( BASE204);
1011 7 32:1 406 UNITWRITE( DRIVE1, MP083B, SIZEOF( MP083B), SERIALBL, 0);
1012 7 32:1 418 IF IORESULT <> 0 THEN
1013 7 32:2 424 P070121;
1014 7 32:1 426 TITLESCR( 'DISK UPDATED');
1015 7 32:1 443 WRITELN( 'REMEMBER TO PUT A WRITE-PROTECT TAB ON');
1016 7 32:1 497 WRITELN( 'THE NOTCH YOU PUNCHED!');
1017 7 32:1 535 PRESSRET
1018 7 32:0 535 END;
P070121 to P070124 to do.
Lets start with P070124 which is called first by P070120.
Procedure 10 is RTNESC
Very straight forward -- just TITLESCR, WRITELN(), and WRITELN;, and a few procedure calls.
965 7 36:D 1 PROCEDURE P070124;
966 7 36:D 1
967 7 36:0 0 BEGIN
968 7 36:1 0 IF RTNESC( 'UPDATE DISK',
969 7 36:1 14 'WARNING - FOLLOW DIRECTIONS CAREFULLY') THEN
970 7 36:2 60 EXIT( P070120);
971 7 36:1 64 TITLESCR( 'STEP 1 - UPDATE BOOT SIDE');
972 7 36:1 94 WRITELN( 'PUNCH WRITE-PROTECT NOTCH ON BOOT SIDE');
973 7 36:1 148 WRITELN( 'OF OLD DISKETTE.');
974 7 36:1 180 WRITELN;
975 7 36:1 186 WRITELN( 'PLACE NEW BOOT SIDE IN DRIVE 2');
976 7 36:1 232 WRITELN( ' OLD BOOT SIDE IN DRIVE 1');
977 7 36:1 278 WRITELN;
978 7 36:1 284 WRITELN( 'BE SURE : NEW=2, OLD=1; COPY 2 -> 1!');
979 7 36:1 336 WRITELN;
980 7 36:1 342 PRESSRET
981 7 36:0 342 END;
Let's do P070121 next (very short)
657E B6 04 03 LOD. PUSH ACTREC(-04).03
6581 A6 0E 55 50 44 41 54 45 20 41 42 4F 52 54 45 44
UPDATE ABORTED
LSA. PUSH #(PC+1) POINTER TO THE STRING
6591 D7 NOP. NOP
6592 1B SLDC. PUSH #001B
6593 CD 00 13 CXP. CALL EXTERNAL PROCEDURE: 13 IN SEGMENT: 00
Hmmm, #001B, what is that?
The following almost works, but generates PUSH #0000
952 7 33:D 1 PROCEDURE P070121;
953 7 33:D 1
954 7 33:0 0 BEGIN
955 7 33:1 0 TITLESCR( 'ERROR DURING UPDATE');
956 7 33:1 24 WRITELN( 'UPDATE ABORTED');
957 7 33:1 54 PRESSRET;
958 7 33:1 56 EXIT( P070120)
959 7 33:0 60 END;
Maybe use WRITELN( 'UPDATE ABORTED' : 27); ???????
Yes, that works.
P070122
970 7 34:0 0 BEGIN (* P070122 *)
971 7 34:1 0 TITLESCR( 'UPDATING');
972 7 34:1 13 UNITREAD( DRIVE2, MP093B, 5 * 512, 0, 0);
973 7 34:1 28 IF IORESULT <> 0 THEN
974 7 34:2 34 P070121;
975 7 34:1 36 UNITWRITE( DRIVE1, MP093B, 5 * 512, 0, 0);
976 7 34:1 51 IF IORESULT <> 0 THEN
977 7 34:2 57 P070121;
978 7 34:1 59 UNITREAD( DRIVE2, MP093B, 1024, 6, 0);
979 7 34:1 72 IF IORESULT <> 0 THEN
980 7 34:2 78 P070121;
981 7 34:1 80 UNITWRITE( DRIVE1, MP093B, 1024, 6, 0);
982 7 34:1 93 IF IORESULT <> 0 THEN
983 7 34:2 99 P070121;
984 7 34:1 101 FOR MP02 := 1 TO 34 DO
985 7 34:2 115 P070123( 8 * MP02)
986 7 34:0 120 END;
Found that I needed to remove MP01 from P070122. The variable is created by the FOR loop.
Last procedure for Startup is P070123
Very straight forward re-engineering:
965 7 35:D 1 PROCEDURE P070123( MP01 : INTEGER);
966 7 35:D 2
967 7 35:0 0 BEGIN
968 7 35:1 0 UNITREAD( DRIVE2, IOCACHE, SIZEOF( IOCACHE), MP01, 0);
969 7 35:1 12 IF IORESULT <> 0 THEN
970 7 35:2 18 P070121;
971 7 35:1 20 UNITREAD( DRIVE2, MP093B, SIZEOF( MP093B), MP01 + 2, 0);
972 7 35:1 35 IF IORESULT <> 0 THEN
973 7 35:2 41 P070121;
974 7 35:1 43 UNITWRITE( DRIVE1, IOCACHE, SIZEOF( IOCACHE), MP01, 0);
975 7 35:1 55 IF IORESULT <> 0 THEN
976 7 35:2 61 P070121;
977 7 35:1 63 UNITWRITE( DRIVE1, MP093B, SIZEOF( MP093B), MP01 + 2, 0);
978 7 35:1 78 IF IORESULT <> 0 THEN
979 7 35:2 84 P070121
980 7 35:0 84 END;
I think all of STARTUP.CODE (SYSTEM.STARTUP) is completed for the first rough draft.
To cleanly compile everything, first remove stuff from #4:SYSTEM.LIBRARY
DRAWLINE
PRPICCH
DRAWSCR
SCRNDATA
CHKKEYBD
RANDOM
Use LIBRARY.CODE and LIBMAP to remove those entries in SYSTEM.LIBRARY from long ago. Use LIBMAP to display contents of new SYSTEM.LIBRARY.
Copy SYSTEM.LIBRARY to all diskettes used while building STARTUP.CODE.
Remove all previously compiled *.CODE from diskettes.
WIZ1D: on #5
WIZ1E: on #12
Assemble P070002, p070003, p070005
Assemble what text?
#5:p070002
To what codefile?
#5:p070002
Output file for assembled listing:
Assemble what text?
#5:p070003
Output file for assembled listing:
Assemble what text?
#5:p070005
To what codefile?
#5:p070005
Output file for assembled listing:
Compiling...
Compile what text?
#12:STARTUP
To what codefile?
$
Linking...
Host file?
#12:STARTUP
Lib file?
#4:SYSTEM.LIBRARY
Lib file?
#5:P070002
Lib file?
#5:p070003
Lib file?
#5:P070005
Lib file?
Map file?
Reading WIZBOOT
Reading P070002
Reading P070003
Reading P070005
Output file?
#12:startup
Linking UTILS #7
Linking TITLELOA #8
Linking OPTIONS #9
Linking WIZBOOT #1
Copying proc P070002
Copying proc P070003
Copying proc P070005
#12:STARTUP.CODE should now match Wiz1 Boot diskette SYSTEM.STARTUP.
Move #12:STARTUP.CODE to a BLANK: diskette by itself.
Move Wiz1 SYSTEM.STARTUP to a BLANK: diskette by itself.
Run DeCompiler and answer "Y" for "PROCESS ALL?"
Save output for both.
Compare both using WinDiff.exe
They match.
Also compare the assembled code to make sure it matches.
It does.
All of STARTUP.CODE is completed.
So far we have completed 50 Procedures and Functions. There are 424 more to go.
Did I say this was going to be a long journey?
Next up is Wizardry.Code.
Tommy