99 .ORG ;load the following code at this address H ;halt: prevent previous prog from running into this ; ; Initialize. ; 6 PAGE ;seven active pages of memory: pp. 2-7 to 2-13 0 DI ;turn off display of disc location SCM ;set chapter mode CLD ;clear display, all 12 lines CGE ;character generator enable 22 SC ;clear screen by searching to 1st frame of Venus ; ; Display the instruction screen. ; 12 GET ;r4 = number of lines to go 4 PUT I GET ;r5 = address of 0th char in 0th line 5 PUT L1: 12 GET ;r0 = total number of lines to display 4 ARG SUB ;r0 = number of next line to display 5 RC ;activate r5 0 ARG SUD ;set user display 5 ARG GET ;r5 = address of next line 20 ADD 5 PUT 4 DR ;decrement r4 L1 BR ;branch back to top of loop if r4 still > 0 ; ; Erase the instructions. ; W JMP ;wait till user presses 0 CLD ;clear all 12 lines of display ; ; Display and hide rotating earth when we see big word "ROTATION" ; W JMP ;wait till user presses 0 7 SC ;start playing chapter 7 (earth rotating) P W JMP ;wait till user presses 0 B JMP ;blacken the screen ; ; Display and hide day and night when Indy uses melon ; to explain rotation of earth ("facing away from the sun"). ; W JMP ;wait till user presses 0 12 SC ;start playing chapter 12 (day and night) P W JMP ;wait till user presses 0 B JMP ;blacken the screen ; ; Glimpse the Sun. ; ("Pay attention because we're going to move fast.") ; W JMP ;wait till user presses 0 25 SC ;start playing chapter 25 (Sun) P ; ; Glimpse Mercury, Venus, Earth, Mars, (skip the asteroids,) Jupiter, Saturn. ; 6 GET ;r9 = number of planets to visit 9 PUT L2: W JMP ;wait till user presses 0 B JMP ;blacken the screen 3451 GET ;# of register holding chapter # of Saturn - 1 9 ARG ADD ;r0 = # of register holding chapter # of planet 0 ARG ARG SC ;start playing the planet's chapter P 9 DR ;decrement r9 L2 BR ;branch back to top of loop if r9 still > 0 ; ; End of program ; W JMP ;wait till user presses 0 B JMP ;blacken the screen to erase Saturn H ;halt the program; return to manual mode ; ; Subroutine to wait for keystroke ; ; On entry: r1 = return address ; On exit: no register changed. ; W: 1 IN ;wait for input 1 ARG BR ;return from subroutine when 0 is pressed W BR ;keep looping until digit received ; ; Chapter numbers ; 240 .ORG 0x0015 .DW ;Chap 21, reg 3457 = INT((7155 - 240) / 2) Mercury 0x0016 .DW ;Chap 22, reg 3456 Venus 0x0008 .DW ;Chap 8, reg 3455 Earth 0x0017 .DW ;Chap 23, reg 3454 Mars 0x001B .DW ;Chap 27, reg 3453 Jupiter 0x001C .DW ;Chap 28, reg 3452 = INT((7155 - 250) / 2) Saturn ; ; Instruction screen ; The top line is used by the player, leaving us with 11 lines of 20 chars, ; I: ; 01234567890123456789 " " .DS "-OUR PLACE IN SPACE-" .DS "Disc 4.Keep pressing" .DS "0 on LD remote.The 0" .DS "after Saturn halts " .DS "the program,leavingU" .DS "@Chap22.4early halt," .DS "CLR/HALT; if text or" .DS "black overlay per- " .DS "sist,power LD down &" .DS "up. Occupies100-861," .DS "overwrites6896-7155." .DS ; 01234567890123456789 ; ; Subroutine to fill the display with "black blocks" ; Simple version. ; ; On entry: r1 = return address ; On exit: destroys r0, r3, r4, r5, r6, active reg ptr ; B: 1 ARG GET ;save the return address 6 PUT 10 RC ;activate lowest numbered reg in overwrite area 120 GET ;r0 = # of pairs of chars to go: 12 * 20 / 2 L3: 8224 ST ;store 0x2020 into active reg; inc active reg ptr DR ;decrement r0 L3 BR ;branch if not zero 120 GET 5 PUT ;r5 = # of pairs of chars to go: 12 * 20 / 2 L4: ; ; Get random pair of numbers, each in range 0 to 12 * 20 / 2 - 1 inclusive. ; 5 ARG GET 3217 ADD ;lowest numbered reg in random area - 1 0 ARG ARG GET 256 DIV ;quotient in r0, remainder in r3 4 PUT ;save quotient 129 GET ;highest numbered reg in overwrite area 4 ARG SUB 0 ARG RC 32382 ST ;0x7E7E: pair of black blocks (16705 for 0x4141) 129 GET ;highest numbered reg in overwrite area 3 ARG SUB 0 ARG RC 32382 ST ;0x7E7E: pair of black blocks (16705 for 0x4141) ; Save line number in r4 3 ARG GET 10 DIV 4 PUT ; Compute address of 0th character on line 20 MUL 6896 ADD ;address of 0th character in overwrite area ; ; Display the line. ; 0 RC ;activate r0 4 ARG SUD ;set user display NE ;no entry: 1/60 sec NE ;no entry: 1/60 sec 5 DR ;decrement and branch L4 BR 6 ARG BR ;return from subroutine ; ; Random permutation of the integers in the range 0 to 12*20/2-1 inclusive. ; Occupies addresses 602 to 721 inclusive (regs 3276 to 3217 inclusive). ; Each pair of numbers is on the same line. ; ; 3276 = INT((7155 - 602) / 2) ; 3217 = INT((7155 - 721) / 2) ; 602 .ORG 110 117 44 41 45 40 1 6 36 38 .DB 31 32 78 76 118 111 22 23 71 79 .DB 77 72 35 30 26 25 65 66 2 0 .DB 85 83 116 113 80 87 88 81 28 21 .DB 49 43 10 12 42 47 56 58 95 97 .DB 48 46 7 9 59 52 50 51 54 57 .DB 16 13 67 63 55 53 104 103 74 73 .DB 37 33 70 75 8 4 98 93 96 90 .DB 39 34 92 94 91 99 19 14 5 3 .DB 64 61 100 106 68 60 18 11 108 101 .DB 86 82 84 89 109 107 29 20 112 115 .DB 119 114 105 102 27 24 69 62 15 17 .DB ; ; Subroutine to fill the display with "black blocks" ; Next-to-simplest version. ; ; On entry: r1 = return address ; On exit: destroys r0, r3, r4, r5, r6, r7, r8, active reg ptr ; C: 1 ARG GET ;save the return address 6 PUT 10 RC ;activate lowest numbered reg in overwrite area 120 GET ;r0 = # of pairs of chars to go: 12 * 20 / 2 L7: 8224 ST ;store 0x2020 into active reg; inc active reg ptr DR ;decrement r0 L7 BR ;branch if not zero 120 GET 5 PUT ;r5 = # of pairs of chars to go: 12 * 20 / 2 L8: ; ; Get random pair of numbers, each in range 0 to 12 * 20 / 2 - 1 inclusive. ; 5 ARG GET 3089 ADD ;lowest numbered reg in random area - 1 0 ARG ARG GET 256 DIV ;quotient in r0, remainder in r3 7 PUT ;save quotient 3 ARG GET 8 PUT ;save remainder 129 GET ;highest numbered reg in overwrite area 7 ARG SUB 0 ARG RC 32382 ST ;0x7E7E: pair of black blocks (16705 for 0x4141) ; Save line number in r4 7 ARG GET 10 DIV 4 PUT ; Compute address of 0th character on line 20 MUL 6896 ADD ;address of 0th character in overwrite area ; ; Display the line. ; 0 RC ;activate r0 4 ARG SUD ;set user display 129 GET ;highest numbered reg in overwrite area 8 ARG SUB 0 ARG RC 32382 ST ;0x7E7E: pair of black blocks (16705 for 0x4141) ; Save line number in r4 8 ARG GET 10 DIV 4 PUT ; Compute address of 0th character on line 20 MUL 6896 ADD ;address of 0th character in overwrite area ; ; Display the line. ; 0 RC ;activate r0 4 ARG SUD ;set user display NE ;no entry: 1/60 sec NE ;no entry: 1/60 sec 5 DR ;decrement and branch L8 BR 6 ARG BR ;return from subroutine ; ; Random permutation of the integers in the range 0 to 12*20/2-1 inclusive. ; Occupies addresses 858 to 977 inclusive (regs 3148 to 3089 inclusive). ; ; 3148 = INT((7155 - 858) / 2) ; 3089 = INT((7155 - 977) / 2) ; 858 .ORG 93 18 58 48 24 59 63 10 80 115 .DB 101 20 40 104 31 81 9 6 30 92 .DB 72 98 36 27 47 83 100 114 86 11 .DB 29 21 3 4 110 84 22 67 74 102 .DB 87 41 105 46 52 39 19 75 103 33 .DB 94 7 88 50 61 70 116 107 77 15 .DB 42 78 53 118 68 111 14 55 76 51 .DB 96 91 117 106 71 25 64 89 99 35 .DB 34 44 85 56 28 66 95 112 73 113 .DB 5 12 119 23 2 37 90 38 0 79 .DB 62 32 65 60 43 13 82 16 108 69 .DB 109 17 26 49 45 57 8 1 54 97 .DB ; ; Subroutine to fill the display with "black blocks" ; ; Hide the video picture by filling the text display (12 lines of 20 charrs) ; with black blocks (p. D-1, code 0x7E) in a random order. ; There's no other way for a program to fade out the picture. ; Then search to the first frame of chapter 22 (Venus), which is all black, ; and clear the text. ; ; On entry: r1 = return address ; On exit: destroys r0, r1, r3, r4, r5, r6, r7, r8, active register pointer ; D: 1 ARG GET ;save the return address 6 PUT 10 RC ;activate lowest numbered reg in overwrite area 120 GET ;r0 = # of pairs of chars to go: 12 * 20 / 2 L5: 8224 ST ;store 0x2020 into active reg; inc active reg ptr DR ;decrement r0 L5 BR ;branch if not zero 120 GET ;r7 = # of pairs of chars to go: 12 * 20 / 2 7 PUT L6: 7 ARG GET ;r0 = # of pairs of chars to go 3031 ADD ;add lowest numbered reg in random area - 1 0 ARG ARG GET ;get two random numbers 256 DIV ;r0 = quotient, r3 = remainder 8 PUT ;save quotent 3 ARG GET ;get remainder OV JMP ;overwrite one blank 8 ARG GET ;get quotient OV JMP ;overwrite one blank NE ;no entry: 1/60 sec 7 DR ;decrement r7 L6 BR ;branch if not zero 22 SC ;search to first frame of Venus (all black) CLD ;clear display 6 ARG BR ;return from subroutine ; ; Subroutine to change one blank (0x20) to a black block (0x7E, p. D-1) ; in the overwrite area by adding 0x7E - 0x20 = 0x5E. ; ; On entry: r0 = character index (0 to 12 * 20 - 1 inclusive) ; On exit: r1 = return address ; OV: 4 PUT ;save character index 2 DIV ;r5 = word index 5 PUT 129 GET ;highest numbered reg in overwrite area 5 ARG SUB ;r0 = # of register holding affected char 5 PUT ;save in r5 3 ARG GET ;fetch remainder (0 or 1) 23970 MUL ;multiply by 0x5E00 - 0x005E; use 08415 for 'A' 94 ADD ;add 0x5E; use 33 for 'A' 5 ARG ARG ADD ;add existing pair of characters 5 ARG PUT ;overwrite existing pair of characters 4 ARG GET ;r5 = line number 20 DIV 5 PUT 20 MUL ;r0 = address of 0th char in modified line 6896 ADD 0 RC ;activate r0 5 ARG SUD ;set user display 1 ARG BR ;return from subroutine ; ; Random permutation of the integers in the range 0 to 12 * 20 - 1 inclusive. ; Occupies addresses 1114 to 1353 inclusive (regs 3020 to 2901 inclusive). ; 3020 = INT((7155 - 1114) / 2) ; 2901 = INT((7155 - 1353) / 2) ; 1114 .ORG 91 189 36 103 155 209 104 206 175 181 .DB 220 39 53 86 18 203 114 211 75 27 .DB 239 235 23 205 118 123 4 140 67 73 .DB 197 147 183 54 192 9 105 20 80 133 .DB 98 153 190 224 151 6 164 97 132 32 .DB 108 92 110 162 145 194 182 100 178 129 .DB 165 42 49 85 142 101 109 131 3 174 .DB 31 221 99 5 208 43 230 66 226 61 .DB 30 11 34 68 168 216 83 125 62 169 .DB 186 60 227 198 149 146 116 90 28 172 .DB 199 176 24 177 161 166 46 236 81 229 .DB 63 152 219 159 33 84 12 124 188 96 .DB 196 202 179 93 173 45 160 223 0 215 .DB 71 207 115 14 106 47 167 113 122 136 .DB 48 218 38 139 137 88 232 10 15 141 .DB 128 89 217 64 58 65 222 158 13 102 .DB 127 77 138 16 37 57 8 17 135 204 .DB 157 130 25 213 79 225 44 119 29 212 .DB 35 87 150 154 2 184 214 121 111 200 .DB 78 51 7 40 82 1 94 126 19 72 .DB 170 21 234 59 180 237 120 107 22 56 .DB 112 191 228 201 41 233 143 95 171 195 .DB 231 148 55 76 210 26 193 144 156 187 .DB 185 50 238 163 70 69 117 74 134 52 .DB ; ; Overwrite area, 12 lines of 20 characters. ; Located at the end of memory immediately before the registers. ; ; Line 0 occupies registers 129 (addr 6896-6897) to 120 (addr 6914-6915). ; Line 11 occupies registers 19 (addr 7116-7117) to 10 (addr 7134-7135). ; ; ; Registers ; ; Register 9 occupies addresses 7136-7137. ; Register 8 occupies addresses 7138-7139. ; Register 7 occupies addresses 7140-7141. ; Register 6 occupies addresses 7142-7143. ; Register 5 occupies addresses 7144-7145. ; Register 4 occupies addresses 7146-7147. ; Register 3 occupies addresses 7148-7149. ; Register 2 occupies addresses 7150-7151. ; Register 1 occupies addresses 7152-7153. ; Register 0 occupies addresses 7154-7155 (the end of memory). ;