Repton 3: Emulator/RNG issue

reminisce about classic bbc micro and acorn electron games here
Related forum: adventures


User avatar
Diminished
Posts: 280
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Repton 3: Emulator/RNG issue

Post by Diminished » Sun Apr 05, 2020 12:55 pm

Yeah, I realised yesterday that -- because I'm a dummy -- I'd been comparing a disc version (Bill Carr v1) to a tape version (bbcmicro.co.uk), which certainly explains some of the wilder differences I found. ("Why is this OSFILE stuff so starkly different? Ohhhh ...") Provided the level editor is intact, an easy way to tell tape/disc versions apart is just to load up the editor and look at the save/load icons ...

So I started again with Bill's full-price v1 and v2 versions. I haven't finished, but the striking change is a switch from running a timer using an OS hook (IRQ2V) to instead programming the User VIA directly and then using a raw interrupt handler to service it. Not sure why this change was made, but it's interesting.

Michael Brown
Posts: 2291
Joined: Sat Apr 03, 2010 1:54 pm
Location: Nottingham
Contact:

Re: Repton 3: Emulator/RNG issue

Post by Michael Brown » Sun Apr 05, 2020 1:13 pm

Here is D045 with the amended REPTON2 file that now matches the code of the other 3 Repton 3 games.
Could someone please play test this game and see if it works Ok.
The fungus test seems Ok, but you never know if by changing the code, something else happens?

regards,
Mick.
Disc045.zip
(195.83 KiB) Downloaded 8 times

User avatar
billcarr2005
Posts: 1509
Joined: Fri Sep 09, 2005 4:01 pm
Location: UK
Contact:

Re: Repton 3: Emulator/RNG issue

Post by billcarr2005 » Sun Apr 05, 2020 2:16 pm

Michael Brown wrote:
Sun Apr 05, 2020 1:13 pm
Here is D045 with the amended REPTON2 file that now matches the code of the other 3 Repton 3 games.
Could someone please play test this game and see if it works Ok.
The fungus test seems Ok, but you never know if by changing the code, something else happens?
Apart from the fact there is a documented change between Repton 3 and the expansion packs regarding spirits, ergo not ALL of the code will match?
If the code from the disc version of Repton 3 is used, then it would be logical that the game will play exactly as Repton 3 was expected to play? :?

Triax
Posts: 59
Joined: Fri Aug 25, 2006 4:21 am
Location: Wiltshire, England
Contact:

Re: Repton 3: Emulator/RNG issue

Post by Triax » Mon Apr 06, 2020 5:43 am

Have you tried using the cassette version? I found that, for example, on one of the ‘Now’ screens of Repton Thru Time, it was only possible to reach the time bomb in time on the cassette version... so in my Repton YouTube videos, that’s the version I always used..?

Michael Brown
Posts: 2291
Joined: Sat Apr 03, 2010 1:54 pm
Location: Nottingham
Contact:

Re: Repton 3: Emulator/RNG issue

Post by Michael Brown » Mon Apr 06, 2020 10:25 am

Hi All,
I may have jumped the gun quite a bit changing RTT as my original copy on D045 may have been OK to start with.
Sure I could not load the FUNGTST file to test it and yes the code is different, but I assumed it was original and had the bug, when now I read RTT was released last, so surely must have been fixed.
Checking the code, although in different places, the &85 and &86 routines seem to match all the other Repton 3 games.

Now, if you take the FUNGTST file and rename it FUTURE then it loads into RTT and yes the test screen appears and no fungus spreads.
I now believe the copy I have was fixed all along.

Just to be 100% certain, could I ask Bill C if he could please post his original copy of RTT here so I can check the code against mine, unless he has the time to do it.

regards,
Mick.
Disc045.zip
(195.89 KiB) Downloaded 6 times
Edit. I meant Repton Thru Time and not Life of Repton, sorry, I have amended this post.
Last edited by Michael Brown on Mon Apr 06, 2020 1:11 pm, edited 1 time in total.

User avatar
leenew
Posts: 4088
Joined: Wed Jul 04, 2012 4:27 pm
Location: Doncaster, Yorkshire
Contact:

Re: Repton 3: Emulator/RNG issue

Post by leenew » Mon Apr 06, 2020 10:42 am

Hi,
l would say we should go back to basics and create new versions from BillC's originals....

OK,
Having dug through some magazine reviews of these games, the release timeline was as follows:

Repton 3: December 1986.
Reviewed in Micro User Dec '86, Computer Gamer Dec '86, and A&B Computing Jan '87

Around the world in 40 screens: August 1987.
Reviewed in A&B Computing Sept '87, and Micro User 'Aug '87

Life of Repton: January 1988.
Reviewed in A&B Computing Jan '88, Acorn User Feb '88, and Micro User Feb '88

Play it again Sam 2, June 1988.
Reviewed in Micro User June '88.

Repton Thru Time: August 1988.
Reviewed in Electron User August '88, A&B Computing Sept. '88, Acorn User, Sept. 88 and Micro User Sept. '88.

The latest releases were:
Play it again Sam 08 in xx 1989 which contained Around the World in 40 screens...
Play it again Sam 09 in July 1989 which contained The life of Repton.
Play it again Sam 10 in August 1989 which contained Repton thru time.

I hope this helps.

Lee.

User avatar
Diminished
Posts: 280
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Repton 3: Emulator/RNG issue

Post by Diminished » Mon Apr 06, 2020 12:07 pm

So, it seems there has been some confusion, most of which is probably my fault.

The only version that we have found so far with the bug is the very first Repton 3 stand-alone full-price disc release (which we've been calling "v1"). This seems to be the version that's on Stairway to Hell (or at least a de-protected hack of it).

Every other disc version we've seen, including the second Repton 3 stand-alone full-price disc release we've been calling "v2" (the one that Bill described as having a black write-protect sticker rather than a golden one) was fixed. This includes every expansion pack. It also includes the version on bbcmicro.co.uk (which is a tape version, anyway).

I am pretty sure that all of Mick's versions were actually 100% bug-free in the first place, before I started muddying the waters and confusing everybody.

We know basically nothing about tape versions yet, apart from the fact that at least one good tape version was released at some point.
Last edited by Diminished on Mon Apr 06, 2020 12:14 pm, edited 1 time in total.

User avatar
Diminished
Posts: 280
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Repton 3: Emulator/RNG issue

Post by Diminished » Mon Apr 06, 2020 12:12 pm

leenew wrote:
Mon Apr 06, 2020 10:42 am
Hi,
l would say we should go back to basics and create new versions from BillC's originals....

OK,
Having dug through some magazine reviews of these games, the release timeline was as follows:

Repton 3: December 1986.
Reviewed in Micro User Dec '86, Computer Gamer Dec '86, and A&B Computing Jan '87

Around the world in 40 screens: August 1987.
Reviewed in A&B Computing Sept '87, and Micro User 'Aug '87

Life of Repton: January 1988.
Reviewed in A&B Computing Jan '88, Acorn User Feb '88, and Micro User Feb '88

Play it again Sam 2, June 1988.
Reviewed in Micro User June '88.

Repton Thru Time: August 1988.
Reviewed in Electron User August '88, A&B Computing Sept. '88, Acorn User, Sept. 88 and Micro User Sept. '88.

The latest releases were:
Play it again Sam 08 in xx 1989 which contained Around the World in 40 screens...
Play it again Sam 09 in July 1989 which contained The life of Repton.
Play it again Sam 10 in August 1989 which contained Repton thru time.

I hope this helps.

Lee.
This is great, thank you.

This is interesting because (thanks to the inlay card that Bill found) it means that they were still selling full-price copies of vanilla R3 alongside Around the World and Life Of. Presumably they finally pulled this full-price version sometime in the first half of 1988 before the release of PIAS2.

User avatar
billcarr2005
Posts: 1509
Joined: Fri Sep 09, 2005 4:01 pm
Location: UK
Contact:

Re: Repton 3: Emulator/RNG issue

Post by billcarr2005 » Mon Apr 06, 2020 1:09 pm

Michael Brown wrote:
Mon Apr 06, 2020 10:25 am
Just to be 100% certain, could I ask Bill C if he could please post his original copy of LOR here so I can check the code against mine, unless he has the time to do it.
Find attached the unadulterated 80 track images of Around the World in 40 Screens, Life of Repton and Repton Thru Time :)
Attachments
REPTON 3 EXPANSION PACKS.zip
ATWIFS, LOR, RTT
(168.19 KiB) Downloaded 18 times

Michael Brown
Posts: 2291
Joined: Sat Apr 03, 2010 1:54 pm
Location: Nottingham
Contact:

Re: Repton 3: Emulator/RNG issue

Post by Michael Brown » Tue Apr 07, 2020 8:07 am

Thanks Bill,
The code to Thru Time matches mine so that clears that up.

regards,
Mick.

User avatar
Kecske Bak
Posts: 708
Joined: Wed Jul 13, 2005 8:03 am
Location: Treddle's Wharf, Chigley
Contact:

Re: Repton 3: Emulator/RNG issue

Post by Kecske Bak » Wed Apr 08, 2020 8:32 am

Just checked. There's an easy way of seeing the change in the spirits' behaviour. Load the original version of Repton 3. Then load the "PREHIST" level set from Repton Thru Time. Two spirits at the start of the level will circle for ever as the behaviour of spirits has been changed.

If you load the PREHIST level set into Around the World. Repton Thru Time or Life of Repton, it'll work fine.

User avatar
Diminished
Posts: 280
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Repton 3: Emulator/RNG issue

Post by Diminished » Fri Apr 10, 2020 4:09 am

Righto, here are the v1 -> v2 changes. I think this is comprehensive, but hey, I screw up a lot. Obviously there are a ton of other binary differences between the two executables, but to the best of my observation everything not mentioned here is just reassembled addresses.

The addresses at the start of each line are in the form v1/v2.

Some of these changes are trivial byte-savers (removing redundant code, shortening a few sequences). There is the change from using the MOS timer hook to using IRQ2V I mentioned before (anyone have any theories as to why this was done? ROM problems perhaps?) There are also maybe four other changes which look plausibly like bug fixes and might be interesting to investigate a little further.

&0413/&0413: removed NOP
&04A0/&04A1: inserted sub call, JSR &0CB8 (not sure what this does, further research needed)
&0680/&0682: INC &78 / RTS inline code replaced with BEQ &0618 to similar piece of code higher up, saves one byte
&068D/&068E: CMP &10,X replaced with EOR &10,X
&0693/&0694: similarly, CMP &14,X replaced with EOR &14,X
&0707/&0708: removed SEC, presumably redundant, saves one byte
&1E4F/&1E4F: LDX #&D replaced with INX, saves one byte
&1E6D/&1E6C: removed JSR &296F which was the subroutine that set up the MOS timer hook, replaced with inline code that sets up IRQ2V
&1ED2/&1EC3: brand new IRQ2V interrupt handler inserted; 30 bytes
&2DEF/&2DEF: JSR &296F removed here, again
&2EAC/&2EA4: short routine that called OSWORD &4 (write interval timer) replaced with short routine to set up user VIA timer instead (writes to SHEILA)
&2F01/&2F01: LDA &31A0,X / LDA #&C sequence replaced with CPY #&A0 / AND (&A9),Y / ASL A; purpose unknown
^^ took another look at this, and decided it was probably data and not code; certainly "JSR &A25C" just above it makes very little sense
&2FAB/&2FAB: that famous fungal fix: inserted LDA #&FF / STA &86
&59C6/&59C6: LDA #&00 / STA &6F pair inserted; purpose unknown, but interesting
&5A96/&5A9A: ASL A / ASL A / ORA #&1 replaced with ASL A / SEC / ROL A, saving a byte
&5AC6/&5AC9: and again, ASL/ASL/ORA replaced with ASL/SEC/ROL, saving a byte
Last edited by Diminished on Fri Apr 10, 2020 7:48 pm, edited 3 times in total.

User avatar
Diminished
Posts: 280
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Repton 3: Emulator/RNG issue

Post by Diminished » Fri Apr 10, 2020 12:56 pm

Just quickly, I took a RAM dump of the PIAS2 version and ran it through my diffing process. The PIAS2 version seems to be identical to v2 (as predicted by Bill's Cheat It Again, Joe research and observation that CIAJ only supported two versions total).

The next targets, then, are the expansion pack versions.

skipchris
Posts: 9
Joined: Mon Mar 30, 2020 9:42 am
Contact:

Re: Repton 3: Emulator/RNG issue

Post by skipchris » Tue Apr 28, 2020 10:43 am

I have been meaning to check back on this thread for a couple of weeks now — can’t believe what I’ve spawned! I, too was a bit troubled by a bug like that lurking 'unnoticed' but just reconciled it as "Repton 3 was pretty hard, and we were less-connected then, so the handful people who did notice it didn’t pass the information on efficiently".

I’ve really enjoyed reading the follow-ons. Amazing archeology, and thanks for being so persistent.

User avatar
Diminished
Posts: 280
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Repton 3: Emulator/RNG issue

Post by Diminished » Wed Apr 29, 2020 12:49 am

skipchris wrote:
Tue Apr 28, 2020 10:43 am
I have been meaning to check back on this thread for a couple of weeks now — can’t believe what I’ve spawned! I, too was a bit troubled by a bug like that lurking 'unnoticed' but just reconciled it as "Repton 3 was pretty hard, and we were less-connected then, so the handful people who did notice it didn’t pass the information on efficiently".

I’ve really enjoyed reading the follow-ons. Amazing archeology, and thanks for being so persistent.
You know, we live in a boring age where the globe has been completely explored and there aren't really frontiers left to investigate, and in which the concept of mystery has been almost completely destroyed by instant access to information. But there's a lot of old code out there that still retains its secrets. This kind of research is weirdly compelling; you don't know what buried treasure there might be.

I'd still like to investigate those other v1 -> v2 changes and work out what the v1 bugs were that mandated those fixes. I think these four are the interesting ones:

&04A0/&04A1: inserted sub call, JSR &0CB8 (not sure what this does, further research needed)
&068D/&068E: CMP &10,X replaced with EOR &10,X
&0693/&0694: similarly, CMP &14,X replaced with EOR &14,X
&59C6/&59C6: LDA #&00 / STA &6F pair inserted; purpose unknown, but interesting

joachim
Posts: 162
Joined: Wed Jun 21, 2006 2:20 am
Contact:

Re: Repton 3: Emulator/RNG issue

Post by joachim » Thu Apr 30, 2020 10:56 am

Diminished wrote:
Fri Apr 10, 2020 4:09 am
&2F01/&2F01: LDA &31A0,X / LDA #&C sequence replaced with CPY #&A0 / AND (&A9),Y / ASL A; purpose unknown
^^ took another look at this, and decided it was probably data and not code; certainly "JSR &A25C" just above it makes very little sense
Looks as if you decompiled with the wrong frame.

JSR &A25C / LDA &31A0,X / LDA #&C
can be read as
EQUW &5C20 / LDX #&BD / LDY #&31 / LDA #&C

JSR &A25C / CPY #&A0 / AND (&A9),Y / ASL A
can be read as
EQUW &5C20 / LDX #&C0 / LDY #&31 / LDA #&A

both of which make much more sense. (I manually disassembled these so there are probably transcription errors, but the point stands.)

User avatar
Diminished
Posts: 280
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Repton 3: Emulator/RNG issue

Post by Diminished » Thu Apr 30, 2020 4:22 pm

joachim wrote:
Thu Apr 30, 2020 10:56 am
Looks as if you decompiled with the wrong frame.

JSR &A25C / LDA &31A0,X / LDA #&C
can be read as
EQUW &5C20 / LDX #&BD / LDY #&31 / LDA #&C

JSR &A25C / CPY #&A0 / AND (&A9),Y / ASL A
can be read as
EQUW &5C20 / LDX #&C0 / LDY #&31 / LDA #&A

both of which make much more sense. (I manually disassembled these so there are probably transcription errors, but the point stands.)
Yes, I looked at this again, and you're correct.

Here's what this piece of code actually looks like when disassembled properly:
Screenshot_20200430_160755.png
I think &2F00 is actually the game's entrypoint, and so this is actually the very first piece of initialisation code that gets run.

In v2, the LDX/LDY pair forms a 16-bit pointer to &31C0, which is then passed to tr_print_string, with a string length of 10. At &31C0, we find this:

17 01 00 00 00 00 00 00 00 00

which is a VDU 23 character redefinition.

However, in v1, the LDX/LDY pair forms a 16-bit pointer to &31BD, which is also passed to tr_print_string, but this time the string length is increased to 12. At &31BD, there is this:

16 05 17 01 00 00 00 00 00 00 00 00

This contains the same VDU 23 sequence, but prior to this there is a VDU 22,5 which changes needlessly to MODE 5. So this is indeed another v1->v2 difference, but it's a trivial one.

Thanks for helping clear that up.

Post Reply

Return to “8-bit acorn software: classic games”