;; home screen set up
6000 20 1B 08 JSR $081B ; PRINT routine in SUBS
6003 84 C2 CC CF C1 C4 A0 C1 81 CE C9 CD AC C1 A4 B4 B0 B0 B0 8D ^DBLOAD A^ANIM,A$4000^M
6017 84 C2 CC CF C1 C4 A0 C2 81 C7 CE C4 AC C1 A4 B7 C1 B0 B0 8D ^DBLOAD B^AGND,A$7A00^M
602B 00
602C 20 89 60 JSR $6089 ; ZERO OUT HIRES PAGE ONE
602F 2C 54 C0 BIT PAGE1 ; select text/graphics page1
6032 2C 57 C0 BIT SETHIRES ; select Hi-res
6035 2C 52 C0 BIT CLRMIXED ; clear mixed mode- enable full graphics
6038 2C 50 C0 BIT CLRTEXT ; display graphics
603B A9 70 LDA #$70 ; put #$70 in $10
603D 85 10 STA $10 ; .
603F A9 71 LDA #$71 ; put #$71 in $11
6041 85 11 STA $11 ; .
6043 A9 00 LDA #$00 ; put #$00 in $12
6045 85 12 STA $12 ; .
6047 A2 00 LDX #$00 ; put #$00 in A and X
6049 8A TXA ; ? not sure why needed
604A 9D 00 EE STA $EE00,X ; zero out $EE00-$EEFF
604D CA DEX ; .
604E D0 FA BNE $604A ; .
;; home screen main sequence
6050 20 9D 60 JSR $609D ; animate "Lord British" signature
6053 20 3B 62 JSR $623B ; wait-for-key-press with long timeout
6056 20 C8 60 JSR $60C8 ; animate "and"
6059 20 3B 62 JSR $623B ; wait-for-key-press with long timeout
605C 20 E5 60 JSR $60E5 ; draw a blue line from (0x40, 0x1F) to (0xD8, 0x1F)
605F 20 3B 62 JSR $623B ; wait-for-key-press with long timeout
6062 20 6C 64 JSR $646C ; "Origin Systems, Inc." scrolling up from blue line
6065 20 43 65 JSR $6543 ; "presents" scrolling down from blue line
6068 20 3B 62 JSR $623B ; wait-for-key-press with long timeout
606B 20 05 61 JSR $6105 ; animate "Ultima IV" @@@
606E 20 3B 62 JSR $623B ; wait-for-key-press with long timeout
6071 20 9F 65 JSR $659F ; animate "Quest of the Avatar"
6074 20 3B 62 JSR $623B ; wait-for-key-press with long timeout
6077 20 19 66 JSR $6619 ; animate unfolding of map
607A 20 73 66 JSR $6673 ; lower corner monsters, while animating map
607D 4C 4D 67 JMP $674D ; set up drive variables then show main menu
;; DATA
6080 30
6081 0D
6082 DA
6083 08
6084 DB
6085 20
6086 24
6087 38
6088 30
;; ZERO OUT HIRES PAGE ONE
6089 A2 20 LDX #$20 ; put #$2000
608B 86 81 STX $81 ; in $80-$81
608D A0 00 LDY #$00 ; #$20 in X
608F 84 80 STY $80 ; #$00 in Y
6091 98 TYA ; and #$00 in A
6092 91 80 STA ($80),Y ; zero out
6094 C8 INY ; 256-bytes of
6095 D0 FB BNE $6092 ; hires graphics
6097 E6 81 INC $81 ; next 256-bytes
6099 CA DEX ; X goes from #$20 to zero
609A D0 F6 BNE $6092 ;
609C 60 RTS ;
;; animate LB signature
; data is pairs of coordinates at $6257
609D A9 57 LDA #$57 ; put $6257 in $80/$81
609F 85 80 STA $80 ; .
60A1 A9 62 LDA #$62 ; .
60A3 85 81 STA $81 ; .
60A5 A2 00 LDX #$00 ; put #$00 in X
60A7 A1 80 LDA ($80,X) ; load the x-coordinate
60A9 F0 1C BEQ $60C7 ; return if zero
60AB 8D 80 60 STA $6080 ; store the x-coordinate in $6080
60AE 20 34 62 JSR $6234 ; increment $80/$81
60B1 A9 BF LDA #$BF ; load 0xBF
60B3 38 SEC ;
60B4 E1 80 SBC ($80,X) ; subtract y-coordinate from #$BF
60B6 8D 81 60 STA $6081 ; store new y-coordinate in $6081
60B9 20 34 62 JSR $6234 ; increment $80/$81
60BC 20 04 62 JSR $6204 ; draw pixel at x=$6080, y=$6081
60BF A9 40 LDA #$40 ; A = 0x40
60C1 20 46 62 JSR $6246 ; some kind of wait-for-key press with timeout given by A
60C4 4C A5 60 JMP $60A5 ; loop back to $60A5
60C7 60 RTS ;
;; "and"?
; because _61C0 is zero we skip some graphics and sound effects
60C8 A9 00 LDA #$00 ;
60CA 8D C0 61 STA $61C0 ; _61C0 = 0x00
60CD A9 13 LDA #$13 ;
60CF 8D 82 60 STA $6082 ; _6082 = 0x13 x-coordinate 1
60D2 8D 84 60 STA $6084 ; _6084 = 0x13 x-coordinate 2
60D5 A9 11 LDA #$11 ;
60D7 8D 83 60 STA $6083 ; _6083 = 0x11 y-coordinate 1
60DA 8D 85 60 STA $6085 ; _6085 = 0x11 y-coordinate 2
60DD A2 04 LDX #$04 ; X = 0x04 number of X byte columns to copy
60DF A0 04 LDY #$04 ; Y = 0x04 number of Y rows to copy
60E1 20 3E 61 JSR $613E ; copy rectangle from BGND to video RAM (6082-6085 and X, Y)
60E4 60 RTS ;
;; draw a blue line from (0x40, 0x1F) to (0xD8, 0x1F)
60E5 A9 40 LDA #$40 ; set x-coordinate = 0x40
60E7 8D 80 60 STA $6080 ; .
60EA A9 1F LDA #$1F ; set y-coordinate = 0x1F
60EC 8D 81 60 STA $6081 ;
60EF 20 0D 62 JSR $620D ; draw pixel at $6080, $6081
60F2 A9 30 LDA #$30 ; A = 0x30
60F4 20 46 62 JSR $6246 ; wait-for-key-press with timeout based on A
60F7 EE 80 60 INC $6080 ; increment x-coordinate by 2 (so only blue)
60FA EE 80 60 INC $6080 ; .
60FD AD 80 60 LDA $6080 ; if x-coordinate < 0xD9
6100 C9 D9 CMP #$D9 ;
6102 90 EB BCC $60EF ; loop back
6104 60 RTS ; otherwise return
;; animate "Ultima IV"
; effects parameters
6105 A9 FF LDA #$FF ; .
6107 8D C0 61 STA $61C0 ; _61C0 = 0xFF
610A A9 00 LDA #$00 ; .
610C 8D C1 61 STA $61C1 ; _61C1 = 0x00
; loop while _61C1 < 0x39
610F A9 05 LDA #$05 ;
6111 8D 82 60 STA $6082 ; _6082 = 0x05 (source x)
6114 8D 84 60 STA $6084 ; _6084 = 0x05 (dest x)
6117 A9 22 LDA #$22 ;
6119 8D 83 60 STA $6083 ; _6083 = 0x22 (source y)
611C 8D 85 60 STA $6085 ; _6084 = 0x22 (dest y)
611F 2C 00 C0 BIT $C000 ; if no keypress,
6122 10 05 BPL $6129 ; skip
6124 A9 38 LDA #$38 ; but if keypress,
6126 8D C1 61 STA $61C1 ; _61C1 = 0x38 (short cut the loop and do one last copy)
6129 A2 1E LDX #$1E ; copy 0x1E byte colums
612B A0 2D LDY #$2D ; copy 0x2D rows
612D 20 3E 61 JSR $613E ; copy rectangle from BGND to video RAM (6082-6085 and X, Y)
6130 AD C1 61 LDA $61C1 ; .
6133 18 CLC ; .
6134 69 01 ADC #$01 ; .
6136 8D C1 61 STA $61C1 ; _61C1++
6139 C9 39 CMP #$39 ;
613B 90 D2 BCC $610F ; if _61C1 < 0x39, loop back
613D 60 RTS ;
;; copy rectangle from BGND to video RAM
;
; _6082, _6083 are starting source x, y ($7A00-)
; _6084, _6085 are starting destination x, y ($2000-)
; X is how many byte column to copy
; Y is how many rows to copy
; _61C0 is something to do with the graphics and sound effects to do during copy
613E 8E BF 61 STX $61BF ; _61BF = X (initially 0x04)
6141 8C 86 60 STY $6086 ; _6086 = Y (initially 0x04)
; outer loops back here with incremented y-coordinates and decremented _6086
6144 AD BF 61 LDA $61BF ; A = _61BF (initially X, 0x04)
6147 8D 87 60 STA $6087 ; _6087 = A = _61BF (initially X, 0x04)
614A AC 83 60 LDY $6083 ; Y = _6083 (set by caller, initially 0x11)
614D B9 00 E0 LDA $E000,Y ; get LSB of base address for y-coordinate 1
6150 85 80 STA $80 ; store in $80
6152 B9 C0 E0 LDA $E0C0,Y ; get MSB of base address for y-coordinate 1
6155 18 CLC ; add 0x5A to it
6156 69 5A ADC #$5A ; .
6158 85 81 STA $81 ; and store it in $81
615A AC 85 60 LDY $6085 ; Y = _6083 (set by caller, initially 0x11)
615D B9 00 E0 LDA $E000,Y ; get LSB of base address for y-coordinate 2
6160 85 82 STA $82 ; store in $82
6162 B9 C0 E0 LDA $E0C0,Y ; get MSB of base address for y-coordinate 2
6165 85 83 STA $83 ; store in $83
6167 AC 84 60 LDY $6084 ; Y = _6084 (set by caller, initially 0x13)
; inner loops back here with incremented Y and decremented _6087
616A B1 80 LDA ($80),Y ; load value at the base address (from the y-coordinate 1) plus _6084
616C 29 7F AND #$7F ; add it with 0111111
616E F0 3B BEQ $61AB ; if zero, i.e. no pixels set, skip to $61AB
6170 2C C0 61 BIT $61C0 ; Z = $61C0 ^ A
6173 F0 34 BEQ $61A9 ; if zero, we can skip the whole next bit and just copy A
6175 48 PHA ; preserve A (what was loaded from _6083 / _6084)
6176 AD BD 61 LDA $61BD ; A = _61BD
6179 69 1D ADC #$1D ; A += 0x1D
617B AA TAX ; X = A
617C 6D BE 61 ADC $61BE ; A += _61BE
617F 8D BD 61 STA $61BD ; _61BD = original _61DB + 0x1D + _61BE
6182 8E BE 61 STX $61BE ; _61BE = original _61BD + 0x1D
6185 48 PHA ; preserve A
6186 29 07 AND #$07 ; _61C2 = A ^ 0000111
6188 8D C2 61 STA $61C2 ;
618B 68 PLA ; restore A (what was put in _61BD)
618C 18 CLC ;
618D 6D C1 61 ADC $61C1 ; add_61BD and _61C1
6190 90 03 BCC $6195 ; skip speaker toggle if carry clear
6192 2C 30 C0 BIT $C030 ; SPEAKER TOGGLE
6195 AD C1 61 LDA $61C1 ; A = _61C1
6198 18 CLC ;
6199 6D C2 61 ADC $61C2 ; A += _61C2
619C AA TAX ; X = A
619D BD C4 61 LDA $61C4,X ; A = _61C4[X]
61A0 8D C3 61 STA $61C3 ; _61C3 = A
61A3 68 PLA ; restore A (what was loaded from _6083 / _6084)
61A4 2D C3 61 AND $61C3 ; and with _C163
61A7 09 80 ORA #$80 ; and OR with 10000000
61A9 91 82 STA ($82),Y ; write new byte
61AB C8 INY ; increment Y (x-coordinate?)
61AC CE 87 60 DEC $6087 ; decrement the caller's X (initial 0x04)
61AF D0 B9 BNE $616A ; loop back if not zero
61B1 EE 83 60 INC $6083 ; increment y-coordinate 1
61B4 EE 85 60 INC $6085 ; increment y-coordinate 2
61B7 CE 86 60 DEC $6086 ; decrement caller's Y (initially 0x04)
61BA D0 88 BNE $6144 ;
61BC 60 RTS ;
;; wait-for-key-press with long timeout
623B A0 04 LDY #$04 ; Y = 0x04
623D A9 FF LDA #$FF ; A = 0xFF
623F 20 46 62 JSR $6246 ; wait-for-key-press with timeout based on A
6242 88 DEY ; decrease Y
6243 D0 F8 BNE $623D ; loop until zero
6245 60 RTS ;
;; wait-for-key-press with timeout based on A
6246 2C 00 C0 BIT $C000 ; if key press
6249 30 0B BMI $6256 ; return
624B 38 SEC ;
624C 48 PHA ; preserve A
624D E9 01 SBC #$01 ; reduce A by 1 (with borrow)
624F D0 FC BNE $624D ; if not zero, loop again
6251 68 PLA ; restore A
6252 E9 01 SBC #$01 ; reduce A by 1 (with borrow)
6254 D0 F6 BNE $624C ; if not zero, loop again
6256 60 RTS ;
;; DATA?
651A 8A 48
651C 18 A2 06 AD 42 65 7D 3B 65 9D 3B 65 CA 10 F7 A2
652C 07 FE 3B 65 D0 03 CA 10 F8 68 AA AD 3B 65 60 09
653C 0A 0B 0C 0D 0E 0F 10
;; "presents" scrolling down from blue line
6543 A9 00 LDA #$00 ;
6545 8D CD 64 STA $64CD ;
; loop 1: _64CD runs from 0x00 to 0x04 (inclusive)
6548 A9 00 LDA #$00 ;
654A 8D CE 64 STA $64CE ;
; loop 2: _64CE runs from 0x00 to _64CD (inclusive)
654D A9 10 LDA #$10 ;
654F 8D CF 64 STA $64CF ;
; loop 3: _64CF runs from 0x10 to 0x18 (inclusive)
6552 AD CF 64 LDA $64CF ; .
6555 8D 82 60 STA $6082 ; _6082 = _64CF (source x)
6558 8D 84 60 STA $6084 ; _6084 = _64CF (dest x)
655B A9 04 LDA #$04 ; .
655D 18 CLC ; .
655E 6D CE 64 ADC $64CE ; .
6561 38 SEC ; .
6562 ED CD 64 SBC $64CD ; .
6565 8D 83 60 STA $6083 ; _6083 = _64CE + 0x14 + 0x64CD (source x)
6568 A9 21 LDA #$21 ;
656A 18 CLC ;
656B 6D CE 64 ADC $64CE ;
656E 8D 85 60 STA $6085 ; _6085 = _64CE + 0x21 (dest y)
6571 20 D0 64 JSR $64D0 ; copy pixels byte from ($6082,$6083) on $7A00 to ($6084,$6065)
6574 EE CF 64 INC $64CF ; _64CF++
6577 AD CF 64 LDA $64CF ;
657A C9 18 CMP #$18 ;
657C 90 D4 BCC --- ; if _64CF <= 0x18
657E F0 D2 BEQ --- ;
6580 EE CE 64 INC $64CE ; _64CE++
6583 AD CE 64 LDA $64CE ;
6586 CD CD 64 CMP $64CD ;
6589 90 C2 BCC --- ; if _64CE <= _64CD,
658B F0 C0 BEQ --- ;
658D A9 C0 LDA #$C0 ; .
658F 20 46 62 JSR $6246 ; wait-for-key-press with timeout based on A = 0xC0
6592 EE CD 64 INC $64CD ; _64CD++
6595 AD CD 64 LDA $64CD ; .
6598 C9 04 CMP #$04 ; .
659A 90 AC BCC --- ; if _64CD <= 0x04
659C F0 AA BEQ --- ;
659E 60 RTS ; return
;; animate "Quest of the Avatar"
; we want to copy from $7A00 (redundant?)
659F A9 5A LDA #$5A ;
65A1 8D 88 60 STA $6088 ;
65A4 A9 00 LDA #$00 ;
65A6 8D CD 64 STA $64CD ;
; loop 1: _64CD runs from 0x00 to 0x05 (inclusive)
65A9 A9 00 LDA #$00 ;
65AB 8D CE 64 STA $64CE ;
; loop 2: _64CE runs from 0x00 to _64CD (inclusive)
65AE A9 03 LDA #$03 ;
65B0 8D CF 64 STA $64CF ;
; loop 3: _64CF runs from 0x03 to 0x24 (inclusive)
65B3 AD CF 64 LDA $64CF ;
65B6 8D 82 60 STA $6082 ; _6082 = _64CF (source x)
65B9 8D 84 60 STA $6084 ; _6084 = _64CF (dest x)
; first pixel
65BC A9 51 LDA #$51 ;
65BE 18 CLC ;
65BF 6D CE 64 ADC $64CE ;
65C2 8D 83 60 STA $6083 ; _6083 = _64CE + 0x51 (source y)
65C5 A9 56 LDA #$56 ;
65C7 18 CLC ;
65C8 6D CE 64 ADC $64CE ;
65CB 38 SEC ;
65CC ED CD 64 SBC $64CD ;
65CF 8D 85 60 STA $6085 ; _6085 = _64CE + 0x56 - 0x64CD (dest y)
65D2 20 D0 64 JSR $64D0 ; copy pixels byte from ($6082,$6083) on $7A00 to ($6084,$6065)
; second pixel
65D5 A9 5C LDA #$5C ;
65D7 18 CLC ;
65D8 6D CE 64 ADC $64CE ;
65DB 38 SEC ;
65DC ED CD 64 SBC $64CD ;
65DF 8D 83 60 STA $6083 ; _6083 = _64CE + 0x5C - 0x64DC (source y)
65E2 A9 57 LDA #$57 ;
65E4 18 CLC ;
65E5 6D CE 64 ADC $64CE ;
65E8 8D 85 60 STA $6085 ; _6085 = _64CE + 0x57
65EB 20 D0 64 JSR $64D0 ; copy pixels byte from ($6082,$6083) on $7A00 to ($6084,$6065)
65EE EE CF 64 INC $64CF ; _64CF++
65F1 AD CF 64 LDA $64CF ;
65F4 C9 24 CMP #$24 ;
65F6 90 BB BCC --- ; if _64CF <= 0x24
65F8 F0 B9 BEQ --- ;
65FA EE CE 64 INC $64CE ;
65FD AD CE 64 LDA $64CE ;
6600 CD CD 64 CMP $64CD ;
6603 90 A9 BCC --- ;
6605 F0 A7 BEQ --- ;
6607 A9 C0 LDA #$C0 ;
6609 20 46 62 JSR $6246 ; wait-for-key-press with timeout based on A = 0xC0
660C EE CD 64 INC $64CD ;
660F AD CD 64 LDA $64CD ;
6612 C9 05 CMP #$05 ; if _64CD <= 0x05
6614 90 93 BCC --- ;
6616 F0 91 BEQ --- ;
6618 60 RTS ;
;; animate unrolling of map
; we want to copy from $7A00 (redundant?)
6619 A9 5A LDA #$5A ;
661B 8D 88 60 STA $6088 ;
661E A9 00 LDA #$00 ;
6620 8D CE 64 STA $64CE ;
; loop 1: _64CE runs from 0x00 to 0x13 (inclusive)
6623 A9 60 LDA #$60 ;
6625 8D CF 64 STA $64CF ;
; loop 2: _64CF runs from 0x60 to 0xBF (inclusive)
6628 AD CF 64 LDA $64CF ;
662B 8D 83 60 STA $6083 ; _6083 = _64CF (source y)
662E 8D 85 60 STA $6085 ; _6085 = _64CF (dest y)
; first pixel
6631 A9 13 LDA #$13 ;
6633 38 SEC ;
6634 ED CE 64 SBC $64CE ;
6637 8D 82 60 STA $6082 ; _6082 = _64CE - 0x13 (source x)
663A A9 13 LDA #$13 ;
663C 38 SEC ;
663D ED CE 64 SBC $64CE ;
6640 8D 84 60 STA $6084 ; _6083 = _64CE - 0x13 (dest x)
6643 20 D0 64 JSR $64D0 ; copy pixels byte from ($6082,$6083) on $7A00 to ($6084,$6065)
; second pixel
6646 A9 14 LDA #$14 ;
6648 18 CLC ;
6649 6D CE 64 ADC $64CE ;
664C 8D 82 60 STA $6082 ; _6082 = _64CE + 0x14 (source x)
664F 8D 84 60 STA $6084 ; _6082 = _64CE + 0x14 (dest x)
6652 20 D0 64 JSR $64D0 ; copy pixels byte from ($6082,$6083) on $7A00 to ($6084,$6065)
6655 EE CF 64 INC $64CF ; _64CF++
6658 AD CF 64 LDA $64CF ;
665B C9 BF CMP #$BF ;
665D 90 C9 BCC --- ; if _64CF <= 0xBF
665F F0 C7 BEQ --- ;
6661 A9 C0 LDA #$C0 ; .
6663 20 46 62 JSR $6246 ; wait-for-key-press with timeout based on A = 0xC0
6666 EE CE 64 INC $64CE ; _64CE++
6669 AD CE 64 LDA $64CE ;
666C C9 13 CMP #$13 ;
666E 90 B3 BCC --- ; if _64CE <= 0x13
6670 F0 B1 BEQ --- ;
6672 60 RTS ;
;; lower corner monsters, while animating map ??
6673 A9 E1 LDA #$E1 ;
6675 8D 81 60 STA $6081 ; _6081 = 0xE1
6678 A9 1E LDA #$1E ;
667A 8D DB 6C STA $6CDB ; _6CDB = 0x1E
667D 8D DC 6C STA $6CDC ; _6CDB = 0x1E
; loop from _6081 is 0xE1 forward to 0x00 inclusive
6680 20 9D 66 JSR $669D ; lower the corner monsters?
6683 20 35 67 JSR $6735 ; do some bit-fiddling with _6CDB and _6CDC
6686 20 06 6E JSR $6E06 ; draw minimap on homescreen
6689 20 06 6E JSR $6E06 ; draw minimap on homescreen (not sure why done twice)
668C 2C 00 C0 BIT $C000 ; if no keypress,
668F 10 01 BPL $6692 ; continue
6691 60 RTS ; if keypress, return
6692 EE 81 60 INC $6081 ; _6081++
6695 AD 81 60 LDA $6081 ; .
6698 C9 01 CMP #$01 ; .
669A D0 E4 BNE $6680 ; if _6081 != 0x01, loop back
669C 60 RTS ;
;; lower the corner monsters?
669D AE DB 6C LDX $6CDB ; value of _6CDB
66A0 BC DD 6C LDY $6CDD,X ; is used as offset into _6CDD
66A3 B9 A7 6D LDA $6DA7,Y ; and value of item in _6CDD[] is used as offset into _6DA7
66A6 8D D0 66 STA $66D0 ; that is stored as ADC operand below
66A9 B9 95 6D LDA $6D95,Y ; and value in _6D95
66AC 8D DF 66 STA $66DF ; is stored as other ADC operand below
66AF AE DC 6C LDX $6CDC ; then, the value of _6CDC
66B2 BC 55 6D LDY $6D55,X ; is used as offset into the _6D55 array
66B5 B9 CB 6D LDA $6DCB,Y ; whose value is used as offset into _6DCB array
66B8 8D F7 66 STA $66F7 ; and that is stored as yet another ADC operand below
66BB B9 B9 6D LDA $6DB9,Y ; and value in _6DB9 array
66BE 8D 0D 67 STA $670D ; is stored as one more ADC operand below
66C1 A9 00 LDA #$00 ; .
66C3 8D CD 64 STA $64CD ; _64CD = 0x00
; loop 1: _64CD from 0x00 to 0x1F exclusive
66C6 A9 00 LDA #$00 ; .
66C8 8D CE 64 STA $64CE ; _64CE = 0x00
; loop 2: _64CE from 0x00 to 0x07 exclusive
66CB AD CE 64 LDA $64CE ; .
66CE 18 CLC ; .
66CF 69 FF ADC #$__ ; .
66D1 8D 82 60 STA $6082 ; start x = _64CE + _6DA7[_6CDD[_6CDB]]
66D4 AD CE 64 LDA $64CE ; .
66D7 8D 84 60 STA $6084 ; end x = _64CE
66DA AD CD 64 LDA $64CD ; .
66DD 18 CLC ; .
66DE 69 FF ADC #$__ ; .
66E0 8D 83 60 STA $6083 ; start y = _64CD + _6D95[_6CDD[_6CDB]]
66E3 AD CD 64 LDA $64CD ; .
66E6 18 CLC ; .
66E7 6D 81 60 ADC $6081 ; .
66EA 30 06 BMI $66F2 ; skip if high bit set
66EC 8D 85 60 STA $6085 ; end y = _6DCD + _6081
66EF 20 D5 64 JSR $64D5 ; copies ($6082,$6083) to ($6084,$6085) from $4000
66F2 AD CE 64 LDA $64CE ;
66F5 18 CLC ;
66F6 69 FF ADC #$__ ;
66F8 8D 82 60 STA $6082 ; start x = _64CE + _6DCB[_6D55[_6CDC]]
66FB AD CE 64 LDA $64CE ; .
66FE 18 CLC ; .
66FF 69 22 ADC #$22 ; .
6701 C9 28 CMP #$28 ;
6703 B0 1B BCS $6720 ; skip @@@
6705 8D 84 60 STA $6084 ; end x = _64CE + 0x22
6708 AD CD 64 LDA $64CD ; .
670B 18 CLC ; .
670C 69 FF ADC #$__ ; .
670E 8D 83 60 STA $6083 ; start y = _64CD + _6DB9[_6D55[_6CDC]]
6711 AD CD 64 LDA $64CD ; .
6714 18 CLC ; .
6715 6D 81 60 ADC $6081 ; .
6718 30 06 BMI $6720 ; skip if high bit set
671A 8D 85 60 STA $6085 ; end y = _64CD + _6081
671D 20 D5 64 JSR $64D5 ; copies ($6082,$6083) to ($6084,$6085) from $4000
6720 EE CE 64 INC $64CE ; loop 2
6723 AD CE 64 LDA $64CE ; .
6726 C9 07 CMP #$07 ; .
6728 90 A1 BCC $66CB ; .
672A EE CD 64 INC $64CD ; loop 1
672D AD CD 64 LDA $64CD ; .
6730 C9 1F CMP #$1F ; .
6732 90 92 BCC $66C6 ; .
6734 60 RTS ;
;; do some bit-fiddling with _6CDB and _6CDC
6735 EE DB 6C INC $6CDB ; _6CDB++
6738 AD DB 6C LDA $6CDB ;
673B 29 7F AND #$7F ;
673D 8D DB 6C STA $6CDB ; _6CDB ^= 01111111
6740 EE DC 6C INC $6CDC ; _6CDC++
6743 AD DC 6C LDA $6CDC ;
6746 29 3F AND #$3F ;
6748 8D DC 6C STA $6CDC ; _6CDC ^= 00111111
674B 60 RTS ;
;; something to do with Mockingboard card
674C 00
;; set up drive variables then show menu
674D A9 00 LDA #$00 ;
674F 85 0B STA $0B ; _0B = 0x00 ???
6751 85 D3 STA $D3 ; _D3 = 0x00 (disk number in drive 2)
6753 A9 01 LDA #$01 ;
6755 85 D1 STA $D1 ; _D1 = 0x01 (??? number of drives ???)
6757 85 D2 STA $D2 ; _D2 = 0x01 (disk number in drive 1)
6759 20 08 6C JSR $6C08 ; why?
;; 'R' pressed (Return to the view)
675C 20 09 6C JSR $6C09 ;
675F 08 PHP ;
6760 58 CLI ;
6761 A5 82 LDA $82 ; _81 = _82
6763 85 81 STA $81 ; .
6765 28 PLP ;
6766 20 C4 6F JSR $6FC4 ; clear lower-half window on home page
;; MAIN MENU
6769 A9 10 LDA #$10 ; store 0x10
676B 8D 15 6B STA $6B15 ; in (secondary) text row
676E A9 17 LDA #$17 ; store 0x17
6770 8D 14 6B STA $6B14 ; in (secondary) text column
6773 A2 02 LDX #$02 ; X = 0x02 (text column)
6775 A0 0E LDY #$0E ; Y = 0x0E (text row)
6777 20 1E 08 JSR $081E ; PRINT
677A C9 CE A0 C1 CE CF D4 C8 C5 D2 A0 D7 CF D2 CC C4 AC A0 IN ANOTHER WORLD,
678C C9 CE A0 C1 A0 D4 C9 CD C5 A0 D4 CF A0 C3 CF CD C5 AE 00 IN A TIME TO COME.^@
679F A2 0F LDX #$0F ; X = 0x0F (text column)
67A1 A0 10 LDY #$10 ; Y = 0x10 (text row)
67A3 20 1E 08 JSR $081E ; PRINT
67A6 CF D0 D4 C9 CF CE D3 BA 00 OPTIONS:^@
67AF A2 0B LDX #$0B ; X = 0x0B (text column)
67B1 A0 11 LDY #$11 ; Y = 0x11 (text row)
67B3 20 1E 08 JSR $081E ; PRINT
67B6 D2 E5 F4 F5 F2 EE A0 F4 EF A0 F4 E8 E5 A0 F6 E9 E5 F7 00 Return to the view^@
67B9 A2 0B LDX #$0B ; X = 0x0B (text column)
67BB A0 12 LDY #$12 ; Y = 0x12 (text row)
67BD 20 1E 08 JSR $081E ; PRINT
; $67E1 is the number 1
67CC CE F5 ED E2 E5 F2 A0 EF E6 A0 E4 F2 E9 F6 E5 F3 AD B1 00 Number of drives-1^@
67E3 A2 0D LDX #$0D ; X = 0x0D (text column)
67E5 A0 13 LDY #$13 ; Y = 0x13 (text row)
67E7 20 1E 08 JSR $081E ; PRINT
67EA CA EF F5 F2 EE E5 F9 A0 EF EE F7 E1 F2 E4 00 Journey onward^@
67F9 A2 0B LDX #$0B ; X = 0x0B (text column)
67FB A0 14 LDY #$14 ; Y = 0x14 (text row)
67FD 20 1E 08 JSR $081E ; PRINT
6800 C9 EE E9 F4 E9 E1 F4 E5 A0 EE E5 F7 A0 E7 E1 ED E5 00 Initiate new game^@
6812 2C 4C 67 BIT $674C ; if high bit of _674C is set (something to do with Mockingboard card)
6815 30 1D BMI $6834 ; skip
6817 A2 09 LDX #$09 ; X = 0x09 (text column)
6819 A0 15 LDY #$15 ; Y = 0x15 (text row)
681B 20 1E 08 JSR $081E ; PRINT
681E C1 E3 F4 E9 F6 E1 F4 E5 A0 CD EF E3 EB E9 EE E7 E2 EF E1 F2 E4 00 Activate Mockingboard^@
6834 20 F4 6A JSR $6AF4 ; prompt for a character and return it in A
6837 C9 B0 CMP #$B0 ; if key < 0xB0
6839 90 F9 BCC $6834 ; prompt again
683B C9 BA CMP #$BA ; if key >= 0xBA
683D B0 09 BCS $6848 ; skip
; key a number between 0 and 9
683F 38 SEC ;
6840 E9 B0 SBC #$B0 ; convert key code to actual number
6842 20 74 6A JSR $6A74 ; ???
6845 4C 34 68 JMP $6834 ; jump back to prompt for a character
6848 C9 D4 CMP #$D4 ; if key == 'T'
684A F0 10 BEQ $685C ; go to $685C
684C C9 CF CMP #$CF ; if key == 'O'
684E F0 0C BEQ $685C ; go to $685C
6850 C9 C4 CMP #$C4 ; if key == 'D'
6852 F0 08 BEQ $685C ; go to $685C
6854 C9 C2 CMP #$C2 ; if key == 'B'
6856 F0 04 BEQ $685C ; go to $685C
6858 C9 C3 CMP #$C3 ; if key != 'C'
685A D0 06 BNE $6862 ; skip to $6862
685C 20 74 6A JSR $6A74 ; ???
685F 4C 34 68 JMP $6834 ; jump back to prompt for a character
; not T, O, D, B, or C
6862 C9 D2 CMP #$D2 ; if key != 'R'
6864 D0 03 BNE $6869 ; skip
6866 4C 5C 67 JMP $675C ; 'R' pressed (Return to the view)
6869 C9 CE CMP #$CE ; if key != 'N'
686B D0 03 BNE $6870 ; skip
686D 4C DD 6F JMP $6FDD ; 'N' pressed (Number of drives-1)
69ED 20 1B 08 JSR $081B ;
69F0 84 C2 CC CF C1 C4 A0 CD 81 C2 D3 CD AC C1 A4 C6 B0 B0 B0 8D ^DBLOAD M^ABSM,A$F000^M
6A04 84 C2 CC CF C1 C4 A0 CD 81 C2 D3 C9 AC C1 A4 B8 B0 B0 B0 8D 00 ^DBLOAD M^ABSI,A$8000^M^@
6A19 20 00 80 JSR $8000 ;
6A1C 90 16 BCC #6A34 ;
6A1E A9 4C LDA #$4C ;
6A20 8D 20 03 STA $0320 ;
6A23 A9 00 LDA #$00 ;
6A25 85 82 STA $82 ;
6A27 A9 D4 LDA #$D4 ;
6A29 20 74 6A JSR $6A74 ; ???
6A2C A9 01 LDA #$01 ;
6A2E 20 74 6A JSR $6A74 ; ???
6A31 CE 4C 67 DEC $674C ; (something to do with Mockingboard card)
6A34 4C 66 67 JMP $6766 ;
6A37 A0 0E LDY #$0E ;
6A39 A2 08 LDX #$08 ;
6A3B A5 B0 LDA $B0 ;
6A3D 10 1B BPL $6A5A ;
6A3F 29 02 AND #$02 ;
6A41 D0 18 BNE $6A5B ;
6A43 20 1E 08 JSR $081E ;
6A46 C6 E9 F2 F3 F4 A0 CD EF E3 EB E9 EE E7 E2 EF E1 F2 E4 BA 00 First Mockingboard:^@
6A5A 60 RTS ;
6A5B 20 1E 08 JSR $081E ;
6A5E D3 E5 E3 EF EE E4 A0 CD EF E3 EB E9 EE E7 E2 EF E1 F2 E4 BA 00 Second Mockingboard:^@
6A73 60 RTS ;
;;
6A74 AA TAX ; X = A
6A75 10 0B BPL $6A82 ; if >= 0, skip to $6A82
6A77 8D 89 6A STA $6A89 ; _6A89 = A
6A7A A2 01 LDX #$01 ; X = 0x01
6A7C 8E 88 6A STX $6A88 ; _6A88 = 0x01
6A7F 4C 20 03 JMP $0320 ; some to do with SEL?
6A82 8D 88 6A STA $6A88 ; _6A88 = A
6A85 4C 20 03 JMP $0320 ; some to do with SEL?
;; prompt for a character and return it in A
6AF4 AE 14 6B LDX $6B14 ; X = (secondary) text column
6AF7 AC 15 6B LDY $6B15 ; Y = (secondary) text row
6AFA 20 39 08 JSR $0839 ; set $CE/$CF, rotate cursor, print it, dec column
6AFD 20 25 6C JSR $6C25 ; ??? animation ???
6B00 20 4E 08 JSR $084E ; generate random number?
6B03 20 EE 6F JSR $6FEE ; fixed length timer
6B06 AD 00 C0 LDA $C000 ; load keypress
6B09 10 E9 BPL $6AF4 ; if no key press, go back to start of subroutine
6B0B 2C 10 C0 BIT $C010 ; clear keyboard
6B0E 48 PHA ; preserve keypress on stack
6B0F 20 24 08 JSR $0824 ; display character (in-game graphics)
6B12 68 PLA ; restore keypress from stack into A
6B13 60 RTS ; return
;; used for temporarily preserving text column and row outside of zeropage
6B14 00
6B15 00
;; 'J' pressed (Journey onward)
6B16 A9 00 LDA #$00 ;
6B18 85 0F STA $0F ; _0F = 0x00
6B1A 85 B8 STA $B8 ; _B8 = 0x00
6B1C A9 00 LDA #$00 ;
6B1E 20 74 6A JSR $6A74 ; ???
6B21 20 1B 08 JSR $081B ; PRINT (to run UALT4 file)
6B24 84 C2 D2 D5 CE A0 D5 81 CC D4 B4 AC C1 A4 B4 B0 B0 B0 8D 00 ^DBRUN U^ALT4,A$4000^M^@
;;
6B28 A9 00 LDA #$00 ;
6B2A 20 74 6A JSR $6A74 ; ???
6B2D A5 D1 LDA $D1 ; number of drives?
6B2F C9 01 CMP #$01 ; if one drive
6B31 F0 09 BEQ $6B3C ; skip disk request
6B33 A9 02 LDA #$02 ; otherwise, request disk 2 (in drive 2)
6B35 20 1C 70 JSR $701C ; .
;; 'I' pressed (Initiate new game)
6B38 A9 01 LDA #$01 ; set disk number loaded
6B3A 85 D0 STA $D0 ; to 1
6B3C 20 C4 6F JSR $6FC4 ; clear lower-half window on home page
6B3F A2 04 LDX #$04 ; X = 0x04 (text column)
6B41 A0 10 LDY #$10 ; Y = 0x10 (text row)
6B43 20 1E 08 JSR $081E ; PRINT
6B56 C2 F9 A0 F7 E8 E1 F4 By what
6B5C A0 EE E1 ED E5 A0 F3 E8 E1 EC F4 A0 F4 E8 EF F5 name shalt thou
6B6C A0 E2 E5 A0 EB EE EF F7 EE 00 be known^@
6B77 A2 04 LDX #$04 ; X = 0x04 (text column)
6B79 A0 11 LDY #$11 ; Y = 0x11 (text row)
6B7B 20 1E 08 JSR $081E ; PRINT
6B7E E9 EE A0 F4 E8 E9 F3 A0 F7 EF F2 EC E4 A0 in this world
6B8C E1 EE E4 A0 F4 E9 ED E5 BF A0 00 and time? ^@
6B97 A9 13 LDA #$13 ; text row = 0x13
6B99 85 CF STA $CF ; .
6B9B A9 0C LDA #$0C ; text column = 0x0C
6B9D 85 CE STA $CE ; .
6B9F 20 51 6F JSR $6F51 ; take input (in $300 buffer)
6BA2 20 C4 6F JSR $6FC4 ; clear lower-half window on home page
6BA5 A2 04 LDX #$04 ; X = 0x04 (text column)
6BA7 A0 11 LDY #$11 ; Y = 0x11 (text row)
6BA9 20 1E 08 JSR $081E ; PRINT
6BAC C1 F2 F4 A0 F4 E8 EF F5 A0 CD E1 EC E5 A0 EF F2 Art thou Male or
6BBC A0 C6 E5 ED E1 EC E5 BF A0 00 Female? ^@
6BC6 A5 CE LDA $CE ; store text column
6BC8 8D 14 6B STA $6B14 ; in _6B14
6BCB A5 CF LDA $CF ; store text row
6BCD 8D 15 6B STA $6B15 ; in _6B15
6BD0 20 F4 6A JSR $6AF4 ; prompt for a character and return it in A
6BD3 C9 CD CMP #$CD ; if 'M'
6BD5 F0 08 BEQ $6BDF ; go to $6BDF
6BD7 C9 C6 CMP #$C6 ; if not 'F'
6BD9 D0 F5 BNE $6BD0 ; go to back to prompt
6BDB A9 7B LDA #$7B ; A = 0x7B
6BDD D0 02 BNE $6BE1 ; BRAnch to $6BE1
6BDF A9 5C LDA #$5C ; A = 0x5C
6BE1 85 BC STA $BC ; _BC = 0x5C for Male and 0x7B for Female
6BE3 20 C4 6F JSR $6FC4 ; clear lower-half window on home page
6BE6 A9 00 LDA #$00 ; A = 0x00
6BE8 20 74 6A JSR $6A74 ; ??? something to do with SEL
6BEB 20 1B 08 JSR $081B ; PRINT
6BEE 84 C2 D2 D5 CE A0 CE 81 C5 D7 C7 C1 CD C5 AC C1 A4 B6 B4 B0 B0 AC C4 B1 8D 00 ^DBRUN N^AEWGAME,A$6400,D1^M^@
6C08 60 RTS ;
;;
6C09 20 18 6C JSR $6C18 ;
6C0C 20 A5 6A JSR $6AA5 ;
6C0F AD 00 C0 LDA $C000 ; load a key
6C12 10 F5 BPL $6C09 ; if not key pressed, look back
6C14 2C 10 C0 BIT $C010 ; otherwise clear keyboard
6C17 60 RTS ; and return with key in A
;;
6C18 20 06 6E JSR $6E06 ; draw minimap on homescreen
6C1B AD D5 6C LDA $6CD5 ; .
6C1E 49 FF EOR #$FF ; .
6C20 8D D5 6C STA $6CD5 ; . invert _6CD5 bit-wise
6C23 10 F3 BPL $6C18 ; on no high-bit, loop back
;; ??? animation ???
6C25 A9 00 LDA #$00 ; .
6C27 8D D6 6C STA $6CD6 ; _6CD6 = 0x00
6C2A EE DB 6C INC $6CDB ; _6CDB++
6C2D AD DB 6C LDA $6CDB ; .
6C30 29 7F AND #$7F ; .
6C32 AA TAX ; .
6C33 BC DD 6C LDY $6CDD,X ; .
6C36 B9 95 6D LDA $6D95,Y ; .
6C39 8D D9 6C STA $6CD9 ; _6CD9 = _6D95[_6CDD[_6CDB ^ 0111111]]
6C3C B9 A7 6D LDA $6DA7,Y ; .
6C3F 8D DA 6C STA $6CDA ; _6CDA = _6DA7[_6CDD[_6CDB ^ 0111111]]
; loop 1: 6CD6 from 0x00 to 0x20
6C42 AE D6 6C LDX $6CD6 ; .
6C45 BD 00 E0 LDA $E000,X ; .
6C48 85 FE STA $FE ; _FE = _E000[_6CD6]
6C4A BD C0 E0 LDA $E0C0,X ; .
6C4D 85 FF STA $FF ; _FF = _E0C0[_6CD6]
6C4F 18 CLC ; .
6C50 AD D9 6C LDA $6CD9 ; .
6C53 6D D6 6C ADC $6CD6 ; .
6C56 AA TAX ; .
6C57 BD C0 E0 LDA $E0C0,X ; .
6C5A 18 CLC ; .
6C5B 69 20 ADC #$20 ; .
6C5D 85 FD STA $FD ; _FD = _E0C0[_6CD9 + _6CD6] + 0x20
6C5F BD 00 E0 LDA $E000,X ; .
6C62 18 CLC ; .
6C63 6D DA 6C ADC $6CDA ; .
6C66 85 FC STA $FC ; _FC = _E000[_6CD9 + _6CD6] + _6CDA
6C68 A0 06 LDY #$06 ; Y = 0x06
; loop 2: Y from 0x06 to 0x00 inclusive
6C6A B1 FC LDA ($FC),Y ; copy byte from address at $FC/$FD + Y
6C6C 91 FE STA ($FE),Y ; to address at $FE/$FF + Y
6C6E 88 DEY ;
6C6F 10 F9 BPL $6C6A ;
; end loop 2
6C71 EE D6 6C INC $6CD6 ; _6CD6++
6C74 AD D6 6C LDA $6CD6 ; A = _6CD6
6C77 C9 20 CMP #$20 ;
6C79 90 C7 BCC $6C42 ;
; end loop 1
6C7B A9 00 LDA #$00 ; .
6C7D 8D D6 6C STA $6CD6 ; _6CD6 = 0x00
6C80 EE DC 6C INC $6CDC ; _6CDC++
6C83 AD DC 6C LDA $6CDC ; .
6C86 29 3F AND #$3F ; .
6C88 AA TAX ; .
6C89 BC 55 6D LDY $6D55,X ; Y = _6D55[_6CDC + 0x3F]
6C8C B9 B9 6D LDA $6DB9,Y ;
6C8F 8D D9 6C STA $6CD9 ;
6C92 B9 CB 6D LDA $6DCB,Y ;
6C95 8D DA 6C STA $6CDA ;
; loop
6C98 AE D6 6C LDX $6CD6 ;
6C9B BD 00 E0 LDA $E000,X ;
6C9E 18 CLC ;
6C9F 69 22 ADC #$22 ;
6CA1 85 FE STA $FE ;
6CA3 BD C0 E0 LDA $E0C0,X ;
6CA6 85 FF STA $FF ;
6CA8 18 CLC ;
6CA9 AD D9 6C LDA $6CD9 ;
6CAC 6D D6 6C ADC $6CD6 ;
6CAF AA TAX ;
6CB0 BD C0 E0 LDA $E0C0,X ;
6CB3 18 CLC ;
6CB4 69 20 ADC #$20 ;
6CB6 85 FD STA $FD ;
6CB8 BD 00 E0 LDA $E000,X ;
6CBB 18 CLC ;
6CBC 6D DA 6C ADC $6CDA ;
6CBF 85 FC STA $FC ;
6CC1 A0 05 LDY #$05 ;
6CC3 B1 FC LDA ($FC),Y ;
6CC5 91 FE STA ($FE),Y ;
6CC7 88 DEY ;
6CC8 10 F9 BPL $6CC3 ;
6CCA EE D6 6C INC $6CD6 ;
6CCD AD D6 6C LDA $6CD6 ;
6CD0 C9 20 CMP #$20 ;
6CD2 90 C4 BCC $6C98 ;
6CD4 60 RTS ;
;; set up initial 19 x 5 default map in $0200 then override some cells based on $EEXX
; set up initial $0200 - $025E based on $6E73
6DDD A2 5E LDX #$5E ; 19 x 5 - 1
6DDF BD 73 6E LDA $6E73,X ;
6DE2 9D 00 02 STA $0200,X ;
6DE5 CA DEX ;
6DE6 10 F7 BPL $6DDF ;
; loop from X = 0x00 to 0x1F
6DE8 A2 00 LDX #$00 ;
6DEA BD 00 EE LDA $EE00,X ; .
6DED F0 11 BEQ $6E00 ; if _EE00[X] is zero, skip, otherwise...
6DEF BC 40 EE LDY $EE40,X ; .
6DF2 B9 6E 6E LDA $6E6E,Y ; .
6DF5 18 CLC ; .
6DF6 7D 20 EE ADC $EE20,X ; .
6DF9 A8 TAY ; .
6DFA BD 00 EE LDA $EE00,X ; .
6DFD 99 00 02 STA $0200,Y ; _0200[_6E6E[_EE40[X]] + _EE20[X]] = _EE00[X]
6E00 E8 INX ; X++
6E01 E0 20 CPX #$20 ; .
6E03 D0 E5 BNE $6DEA ; if X != 0x20 loop back
6E05 60 RTS ;
;; draw minimap on homescreen
6E06 20 D2 6E JSR $6ED2 ; set up some stuff in $EEXX based on $7170 ($10,$11,$12 set up already)
6E09 20 6C 08 JSR $086C ;
6E0C 20 DD 6D JSR $6DDD ; set up initial 19 x 5 default map in $0200 then override some cells based on $EEXX
6E0F A9 00 LDA #$00 ;
6E11 85 F2 STA $F2 ; _F2 = 0x00
6E13 8D 38 6E STA $6E38 ; _6E38 = 0x00; _6E38 is offset into $02XX (which tile to use in which cell)
; loop over _F2
6E16 A4 F2 LDY $F2 ; $F2 is row number?
6E18 B9 68 E0 LDA $E068,Y ; look up base address (LSB) for row Y/_F2
6E1B 8D 41 6E STA $6E41 ; low byte base address of video ram to write to (left-half of shape)
6E1E 8D 4B 6E STA $6E4B ; low byte base address of video ram to write to (right-half of shape)
6E21 B9 28 E1 LDA $E128,Y ; look up base address (MSB) for row Y/_F2
6E24 8D 42 6E STA $6E42 ; high byte base address of video ram to write to (left-half of shape)
6E27 8D 4C 6E STA $6E4C ; high byte base address of video ram to write to (right-half of shape)
6E2A 98 TYA ; A = Y
6E2B 29 0F AND #$0F ; A ^= 00001111
6E2D 09 D0 ORA #$D0 ; A |= 11010000
; so shape base is D_00 where _ is the low nibble of the row number _F2
6E2F 8D 3F 6E STA $6E3F ; half-shape page
6E32 8D 49 6E STA $6E49 ; half-shape page
6E35 A2 01 LDX #$01 ; X = 0x01
; loop from X = 0x01 to 0x27 exclusive (X = byte column on screen)
; this writes one pixel row of map
6E37 AC 00 02 LDY $02__ ; Y = tile to use for next cell
6E3A 2C 8B C0 BIT $C08B ; bank switch
6E3D B9 00 FF LDA __00,Y ; get half-shape
6E40 9D FF FF STA $____,X ; and put it on screen
6E43 E8 INX ; X++
6E44 2C 83 C0 BIT $C083 ; bank switch
6E47 B9 00 FF LDA $__00,Y ; get other half-shape
6E4A 9D FF FF STA $____,X ; and put it on screen
6E4D EE 38 6E INC $6E38 ; increment the cell offset into $02XX
6E50 E8 INX ; X++
6E51 E0 27 CPX #$27 ; .
6E53 90 E2 BCC $6E37 ; if X < 0x27, loop back to $6E37
; _F2 is the pixel row number so the high nibble is the cell row and the low nibble is the pixel row within that cell
6E55 E6 F2 INC $F2 ; _F2++
6E57 A5 F2 LDA $F2 ; .
6E59 C9 50 CMP #$50 ; .
6E5B F0 10 BEQ $6E6D ; if _F2 == 0x50, return
6E5D 29 0F AND #$0F ; otherwise, A ^= 00001111
6E5F F0 B5 BEQ $6E16 ; if _F2 had zero low nibble, loop back to $6E16
; 0x13 is the "width" of the map so subtracting 0x13 goes to the "previous" cell row
6E61 AD 38 6E LDA $6E38 ; the cell offset into $02XX
6E64 38 SEC ;
6E65 E9 13 SBC #$13 ; subtract 0x13 from it
6E67 8D 38 6E STA $6E38 ; and store it
6E6A 4C 16 6E JMP $6E16 ; loop back to loop over _F2
;;
; reading and manipulating $12
; reading and manipulating $10,$11 (used as start of array, starting at $7170)
; arrays in $EE00, $EE20, $EE40, $EE60
; data array in $6F42
6ED2 C6 12 DEC $12 ; _12--
6ED4 10 19 BPL $6EEF ; if non-negative, return
6ED6 A0 00 LDY #$00 ; Y = 0x00
;
6ED8 B1 10 LDA ($10),Y ;
6EDA 10 1E BPL $6EFA ; if _10[Y] non-negative, branch to $6EFA
6EDC AA TAX ; preserve A in X
6EDD 29 F0 AND #$F0 ; A ^= 11110000 (high nibble)
6EDF C9 80 CMP #$80 ;
6EE1 D0 0D BNE $6EF0 ; if A != 0x80, reset _10/_11 to 0x70, 0x71
6EE3 8A TXA ; restore A from X
6EE4 29 0F AND #$0F ; A ^= 00001111 (low nibble)
6EE6 0A ASL A ; double it
6EE7 85 12 STA $12 ; _12 = A
; increment _10/_11 with wrap
6EE9 E6 10 INC $10 ; _10++
6EEB D0 02 BNE $6EEF ; if not zero, return
6EED E6 11 INC $11 ; if zero (wrapped) _11++
6EEF 60 RTS ; return
;;
6EF0 A9 70 LDA #$70 ; .
6EF2 85 10 STA $10 ; _10 = 0x70
6EF4 A9 71 LDA #$71 ; .
6EF6 85 11 STA $11 ; _11 = 0x71
6EF8 D0 DE BNE $6ED8 ; go back
6EFA 48 PHA ; .
6EFB 29 0F AND #$0F ; .
6EFD AA TAX ; X = low nibble of A
6EFE 68 PLA ; .
6EFF 29 F0 AND #$F0 ; A = high nibble of A
6F01 4A LSR A ; shifted down to low nibble
6F02 4A LSR A ; .
6F03 4A LSR A ; .
6F04 4A LSR A ; .
6F05 C9 07 CMP #$07 ; .
6F07 F0 2B BEQ $6F31 ; if A == 0x7, go to $6F31
6F09 9D 40 EE STA $EE40,X ;
6F0C 20 E9 6E JSR $6EE9 ; increment _10/_11 with wrap
6F0F B1 10 LDA ($10),Y ; A = _10[Y]
6F11 48 PHA ; .
6F12 29 1F AND #$1F ; .
6F14 9D 20 EE STA $EE20,X ; _EE20[X] = A ^ 0x1F
6F17 68 PLA ; .
6F18 4A LSR A ; shift A right 5 times (/32)
6F19 4A LSR A ; .
6F1A 4A LSR A ; .
6F1B 4A LSR A ; .
6F1C 4A LSR A ; .
6F1D 18 CLC ; .
6F1E 7D 42 6F ADC $6F42,X ; .
6F21 9D 00 EE STA $EE00,X ; _EE00[X] = A + _6F42[X]
6F24 E0 01 CPX #$01 ; .
6F26 D0 03 BNE $6F2B ; .
6F28 BD 42 6F LDA $6F42,X ; if X == 1, A = _6F42[X]
6F2B 9D 60 EE STA $EE60,X ; _EE60[X] = A
6F2E 20 E9 6E JSR $6EE9 ; increment _10/_11 with wrap
6F31 4C D8 6E JMP $6ED8 ;
6F34 A9 00 LDA #$00 ; .
6F36 9D 00 EE STA $EE00,X ; _EE00[X] = 0x00
6F39 9D 60 EE STA $EE60,X ; _EE60[X] = 0x00
6F3C 20 E9 6E JSR $6EE9 ; increment _10/_11 with wrap
6F3F 4C D8 6E JMP $6ED8 ;
;; DATA
6F42 40 80 10 38 38 C8 C8 24 20 88 F0 F8 4D 4F 4E
;; take input
6F51 A9 00 LDA #$00 ; .
6F53 85 EA STA $EA ; _EA = 0x00
6F55 A6 CE LDX $CE ; X = $CE (text column)
6F57 A4 CF LDY $CF ; Y = $CF (text row)
6F59 20 39 08 JSR $0839 ; set $CE/$CF, rotate cursor, print it, dec column
6F5C 20 25 6C JSR $6C25 ; ??? animation ???
6F5F A9 00 LDA #$00 ;
6F61 85 13 STA $13 ;
6F63 E6 13 INC $13 ;
6F65 30 EE BMI $6F55 ; if enough time has passed, go back and rotate cursor and animate
6F67 A0 00 LDY #$00 ; wait a short time
6F69 88 DEY ; .
6F6A D0 FD BNE $6F69 ; .
6F6C AD 00 C0 LDA $C000 ; load keypress
6F6F 10 F2 BPL $6F63 ; if no key, go back to loop and increment $13
6F71 2C 10 C0 BIT $C010 ; clear keyboard
6F74 C9 FF CMP #$FF ; compare to 0xFF (del?)
6F76 D0 02 BNE $6F7A ; if not, skip
6F78 A9 88 LDA #$88 ; but if del, treat as ^H
6F7A C9 8D CMP #$8D ; if ^M
6F7C F0 32 BEQ $6FB0 ; go to $6FB0
6F7E C9 88 CMP #$88 ; if ^H
6F80 F0 15 BEQ $6F97 ; go to $6F97
6F82 C9 A0 CMP #$A0 ; if < 0xA0
6F84 90 DD BCC $6F63 ; ignore and go back to $6F63
6F86 A6 EA LDX $EA ; X = _EA (initially 0x00)
6F88 E0 0F CPX #$0F ; if X == 0xF
6F8A F0 D7 BEQ $6F63 ; ignore and go back to $6F63
6F8C 9D 00 03 STA $0300,X ; store in the input buffer
6F8F 20 24 08 JSR $0824 ; display character (in-game graphics)
6F92 E6 EA INC $EA ; increment character buffer pointer
6F94 4C 63 6F JMP $6F63 ; back for more characters
; ^H
6F97 A5 EA LDA $EA ; load the character buffer pointer
6F99 F0 C8 BEQ $6F63 ; if zero, ignore and go back to $6F63
6F9B C6 EA DEC $EA ; otherwise decrement
6F9D A9 A0 LDA #$A0 ; display space
6F9F 20 24 08 JSR $0824 ; .
6FA2 C6 CE DEC $CE ; move cursor two left
6FA4 C6 CE DEC $CE ; .
6FA6 A9 A0 LDA #$A0 ; display space
6FA8 20 24 08 JSR $0824 ; .
6FAB C6 CE DEC $CE ; move cursor one left
6FAD 4C 63 6F JMP $6F63 ; back for more characters
; ^M
6FB0 A6 EA LDX $EA ; X = character buffer pointer
6FB2 F0 AF BEQ $6F63 ; if zero, back for more characters
6FB4 A9 00 LDA #$00 ; otherwise, store null
6FB6 9D 00 03 STA $0300,X ; at end of character buffer
6FB9 E8 INX ; X++
6FBA E0 10 CPX #$10 ; if X < 0x10
6FBC 90 F8 BCC $6FB6 ; go back and null out more
6FBE A9 8D LDA #$8D ; print a new line
6FC0 20 24 08 JSR $0824 ; .
6FC3 60 RTS ; RETURN
;; clear lower-half window on home page
6FC4 A2 4F LDX #$4F ; X = 0x4F
; loop 1: loop from X = 0x4F to 0x00 inclusive
6FC6 BD 68 E0 LDA $E068,X ; _FE = E068[0x4F] initially 0x50
6FC9 85 FE STA $FE ; .
6FCB BD 28 E1 LDA $E128,X ; _FF = E128[0x4F] initially 0x3F
6FCE 85 FF STA $FF ; .
6FD0 A0 26 LDY #$26 ; Y = 0x26
6FD2 A9 00 LDA #$00 ; A = 0x00
; loop 2: loop from Y = 0x26 to 0x00 (exclusive)
6FD4 91 FE STA ($FE),Y ; (_FE)[Y] = 0x00 initially $3F76 (on hires screen)
6FD6 88 DEY ; Y--
6FD7 D0 FB BNE $6FD4 ; repeat
6FD9 CA DEX ; X--
6FDA 10 EA BPL $6FC6 ;
6FDC 60 RTS ;
;; 'N' pressed (Number of drives-1)
;; 01 EOR 03 == 10
;; 10 EOR 03 == 01
6FDD A5 D1 LDA $D1 ; toggle _D1
6FDF 49 03 EOR #$03 ; between 1 and 2
6FE1 85 D1 STA $D1 ; .
6FE3 AD E1 67 LDA $67E1 ; toggle _67E1
6FE6 49 03 EOR #$03 ; between 1 and 2
6FE8 8D E1 67 STA $67E1 ; .
6FEB 4C 69 67 JMP $6769 ; jump to MAIN MENU
;; request disk switch
; A = desired disk number
; 1 = ULTIMA
; 2 = BRITANNIA
; 3 = TOWN
; 4 = DUNGEON
701C 85 DE STA $DE ; store A in $DE (desired disk number)
701E 20 C4 6F JSR $6FC4 ; clear lower-half window on home page
7021 A9 10 LDA #$10 ;
7023 85 CF STA $CF ; _CF = 0x10 (text row)
7025 A5 DE LDA $DE ; A = $DE (desired disk number)
7027 C9 02 CMP #$02 ; if 2 (BRITANNIA)
7029 F0 6C BEQ $7097 ; go to $7097 (request insert in drive 2)
702B C9 04 CMP #$04 ; if 4 (DUNGEON)
702D F0 68 BEQ $7097 ; go to $7097 (request insert in drive 2)
702F A9 01 LDA #$01 ;
7031 85 DF STA $DF ; _DF = 0x01
7033 A5 DE LDA $DE ;
7035 C5 D2 CMP $D2 ; if _D2 == _DE (if disk in drive 1 is the desired one)
7037 F0 5B BEQ $7094 ; go to $7094
7039 A4 CF LDY $CF ; Y = _CF (text row)
703B A2 0B LDX #$0B ; X = 0x0B
703D 20 1E 08 JSR $081E ; PRINT
7040 D0 CC C5 C1 D3 C5 A0 D0 CC C1 C3 C5 A0 D4 C8 C5 00 PLEASE PLACE THE^@
7051 E6 CF INC $CF ; increment text row
7053 20 08 71 JSR $7108 ; display name of desired disk (in $DE)
7056 A4 CF LDY $CF ; Y = $CF
7058 A2 0D LDX #$0D ; X = 0xD
705A 20 1E 08 JSR $081E ; PRINT
705D C9 CE D4 CF A0 C4 D2 C9 D6 C5 A0 B1 00 INTO DRIVE 1^@
706A E6 CF INC $CF ; increment text row
706C A4 CF LDY $CF ; Y = $CF
706E A2 0B LDX #$0B ; X = 0xB
7070 20 1E 08 JSR $081E ; PRINT
7073 C1 CE C4 A0 D0 D2 C5 D3 D3 A0 DB C5 D3 C3 DD 00 AND PRESS [ESC]^@
7083 A5 CE LDA $CE ; store text column
7085 8D 14 6B STA $6B14 ; in _6B14
7088 A5 CF LDA $CF ; store text row
708A 8D 15 6B STA $6B15 ; in _6B15
708D 20 F4 6A JSR $6AF4 ; prompt for a character and return it in A
7090 C9 9B CMP #$9B ; if not ESC
7092 D0 F9 BNE $708D ; go back and prompt again
7094 4C DB 70 JMP $70DB ; but if ESC go to $70DB
;;
7097 A5 D1 LDA $D1 ;
7099 C9 02 CMP #$02 ;
709B 90 92 BCC --- ;
709D A9 02 LDA #$02 ;
709F 85 DF STA $DF ;
70A1 A5 DE LDA $DE ;
70A3 C5 D3 CMP $D3 ;
70A5 F0 34 BEQ --- ;
70A7 A4 CF LDY $CF ;
70A9 A2 0B LDX #$0B ;
70AB 20 1E 08 JSR $081E ;
70AE D0 CC C5 C1 D3 C5 A0 D0 CC C1 C3 C5 A0 D4 C8 C5 00 PLEASE PLACE THE^@
70BF E6 CF INC $CF ; increment text row
70C1 20 08 71 JSR $7108 ; display name of desired disk (in $DE)
70C4 A4 CF LDY $CF ; Y = $CF (text row)
70C6 A2 0D LDX #$0D ; X = 0x0D
70C8 20 1E 08 JSR $081E ; PRINT
70CB C9 CE D4 CF A0 C4 D2 C9 D6 C5 A0 B2 00 INTO DRIVE 2^@
70D8 4C 6A 70 JMP $706A ; back to drive 1 case
;;
70DB A5 DF LDA $DF ; A = _DF (drive number)
70DD 18 CLC ;
70DE 69 B0 ADC #$B0 ; added B0 to it to convert to character code
70E0 8D F3 70 STA $70F3 ; change drive number in DOS command
70E3 20 1B 08 JSR $081B ; PRINT
; $70F3 is the 1
70E6 84 C2 CC CF C1 C4 A0 C4 C9 D3 CB AC C4 B1 8D 00 ^DBLOAD DISK,D1^M^@
; the disk number gets loaded into _D0
70F6 A6 DF LDX $DF ; X = _DF (drive number)
70F8 A5 D0 LDA $D0 ; A = _D0 (disk number as declared in DISK file)
70FA 95 D1 STA $D1,X ; put the disk number in _D2 (if drive 1) or _D3 (if drive 2)
70FC C5 DE CMP $DE ; if loaded disk == _DE (desired disk)
70FE F0 07 BEQ $7107 ; return
7100 C6 CF DEC $CF ; decrement row by two
7102 C6 CF DEC $CF ; .
7104 4C 1E 70 JMP $701E ; go back and request disk switch again
7107 60 RTS ;
;;
; display the name of the desired disk (stored in $DE)
; 1 = ULTIMA
; 2 = BRITANNIA
; 3 = TOWN
; 4 = DUNGEON
7108 A6 DE LDX $DE ; load desired disk number
710A CA DEX ; X--
710B D0 16 BNE $7123 ; if not zero, skip to next section, otherwise
710D A4 CF LDY $CF ; Y = $CF (text row)
710F A2 0D LDX #$0D ; X = 0x0D (text column)
7111 20 1E 08 JSR $081E ; PRINT
7114 D5 CC D4 C9 CD C1 A0 C4 C9 D3 CB 00 ULTIMA DISK^@
7120 E6 CF INC $CF ; increment text row
7122 60 RTS ; return
7123 CA DEX ; X--
7124 D0 19 BNE $713F ; if not zero, skip to next section, otherwise
7126 A4 CF LDY $CF ; Y = $CF (text row)
7128 A2 0C LDX #$0C ; X = 0x0C (text column)
712A 20 1E 08 JSR $081E ; PRINT
712D C2 D2 C9 D4 C1 CE CE C9 C1 A0 C4 C9 D3 CB 00 BRITANNIA DISK^@
713C E6 CF INC $CF ; increment text row
713E 60 RTS ; return
713F CA DEX ; X--
7140 D0 14 BNE $7156 ; if not zero, skip to next section, otherwise
7142 A4 CF LDY $CF ; Y = $CF (text row)
7144 A2 0E LDX #$0E ; X = 0x0E (text column)
7146 20 1E 08 JSR $081E ; PRINT
7149 D4 CF D7 CE A0 C4 C9 D3 CB 00 TOWN DISK^@
7153 E6 CF INC $CF ; increment text row
7155 60 RTS ; return
7156 CA DEX ; X--
7157 D0 16 BNE $716F ; if not zero, skip and return, otherwise
7159 A4 CF LDY $CF ; Y = $CF (text row)
715B A2 0D LDX #$0D ; X = 0x0D (text column)
715D 20 1E 08 JSR $081E ; PRINT
7160 C4 D5 CE C7 C5 CF CE A0 C4 C9 D3 CB 00 DUNGEON DISK^@
716D E6 CF INC $CF ; increment text row
716F 60 RTS ;