I'm - slowly - looking at why Eagle Empire doesn't work in BeebEm. As part of that I'm going back to square one and working out how it works from the ground up (as a learning experience, and getting back into the swing of Acorn things!)
A lot of the below is incidential to the question - just putting it all here in case anyone asks - what's that missing bit do?
So, to begin - part of the loading process loads & runs EAG#1:
EAG#1 0700 070A 00A0
Code:
0700 45 41 47 23 32 0D 0D 59 22 0D AD 0E 02 85 70 AD EAG#2..Y".....p.
0710 0F 02 85 71 A9 85 8D 0E 02 A9 07 8D 0F 02 A9 00 ...q............
0720 85 80 85 82 85 86 A9 07 85 81 A9 30 85 83 A2 80 ...........0....
0730 A0 00 A9 03 8D 58 02 A9 FF 20 DD FF A5 70 8D 0E .....X... ...p..
0740 02 A5 71 8D 0F 02 A9 00 85 72 A9 30 85 73 A9 00 ..q......r.0.s..
0750 85 70 A9 30 85 71 A9 03 8D 58 02 A2 2B A0 00 B1 .p.0.q...X..+...
0760 70 49 0E 91 72 88 D0 F7 E6 71 E6 73 CA D0 EE A9 pI..r....q.s....
0770 03 8D 58 02 A9 00 85 81 85 83 85 85 85 87 A9 04 ..X.............
0780 85 86 4C 21 5A C9 3F D0 02 A9 20 6C 70 00 00 00 ..L!Z.?... lp...
0790 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
Execution starts at 070A
The first thing we do is preserve the existing OSWRCH vectors, and then we set up our own OSWRCH routine, at &0785:
Code:
070A AD 0E 02 LDA 020E
070D 85 70 STA 70
070F AD 0F 02 LDA 020F
0712 85 71 STA 71
0714 A9 85 LDA #85
0716 8D 0E 02 STA 020E
0719 A9 07 LDA #07
071B 8D 0F 02 STA 020F
We load EAG#2 ... (not relevant to this discussion)
Code:
071E A9 00 LDA #00
0720 85 80 STA 80
0722 85 82 STA 82
0724 85 86 STA 86
0726 A9 07 LDA #07
0728 85 81 STA 81
072A A9 30 LDA #30
072C 85 83 STA 83
072E A2 80 LDX #80
0730 A0 00 LDY #00
0732 A9 03 LDA #03
0734 8D 58 02 STA 0258
0737 A9 FF LDA #FF
0739 20 DD FF JSR FFDD
We then restore the original OSWRCH vector, so our routine only during the OSFILE operation.
Code:
073C A5 70 LDA 70
073E 8D 0E 02 STA 020E
0741 A5 71 LDA 71
0743 8D 0F 02 STA 020F
The next chunk is decoding the loaded file (not relevant here.)
Code:
0746 A9 00 LDA #00
0748 85 72 STA 72
074A A9 30 LDA #30
074C 85 73 STA 73
074E A9 00 LDA #00
0750 85 70 STA 70
0752 A9 30 LDA #30
0754 85 71 STA 71
0756 A9 03 LDA #03
0758 8D 58 02 STA 0258
075B A2 2B LDX #2B
075D A0 00 LDY #00
075F B1 70 LDA (70),Y
0761 49 0E EOR #0E
0763 91 72 STA (72),Y
0765 88 DEY
0766 D0 F7 BNE 075F
0768 E6 71 INC 71
076A E6 73 INC 73
076C CA DEX
076D D0 EE BNE 075D
076F A9 03 LDA #03
0771 8D 58 02 STA 0258
0774 A9 00 LDA #00
0776 85 81 STA 81
0778 85 83 STA 83
077A 85 85 STA 85
077C 85 87 STA 87
077E A9 04 LDA #04
0780 85 86 STA 86
... and then we jump to the decoded game ...
Code:
0782 4C 21 5A JMP 5A21
After the JMP is our new OSWRCH routine
Code:
0785 C9 3F CMP #3F
0787 D0 02 BNE 078B
0789 A9 20 LDA #20
078B 6C 70 00 JMP (0070)
So - if I read that OSWRCH routine correctly - if the character requested for write is &3f (?) then convert to &20 (space). But WHY would you do that?
I wondered if it was loading from a tape and you got question marks in the status messages, they'd be blanked out ... but again ... why?
Or have I misread what is going on - it's been a long time!
(As I type this - I wonder - maybe the original game had some sort of copy protection that has been removed and now this code makes no sense? Have I answered my own question?)