CASA ::

Adventure forum
It is currently Tue Sep 26, 2017 11:05 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 97 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7
Author Message
 Post subject: Re: Another Classic Ported to TRS-80 MC-10
PostPosted: Sun Sep 03, 2017 1:44 am 
Offline
User avatar

Joined: Sat Aug 17, 2013 1:25 pm
Posts: 129
Location: Nova Scotia
Pippa

The crown is mine!

What does these POKEs do? You say you don't know much about the MC-10 but it seems that you have figured out how to reset the RESTORE point for use by the READ command. Have I got that right? If so, this is a very useful set of POKEs.

75 RD=PEEK(173)+256*PEEK(174):FOR I=1TO5*NR:READ J:NEXT:OD=PEEK(173)+256*PEEK(174)
5110 POKE174,INT(RD/256):POKE173,RD-256*PEEK(174):FORI=1TO R:READ N,E,S,W,M:NEXT

Thanks so much.

Jim

pippa wrote:
A couple of warnings. First: first I'm not a very good programmer and I don't know much about the MC10 or the BBC Micro, so I've probably introduced loads of bugs. Second, it's not a very good game (only 4 locations but three ways to die), so it's probably not worth playing even without bugs.

But I enjoyed converting it anyway. :thumb:


Top
 Profile  
 
 Post subject: Re: Another Classic Ported to TRS-80 MC-10
PostPosted: Sun Sep 03, 2017 4:59 pm 
Offline
User avatar

Joined: Sun Jan 16, 2005 3:28 am
Posts: 55
Location: London
jgerrie wrote:
Pippa

The crown is mine!

What does these POKEs do? You say you don't know much about the MC-10 but it seems that you have figured out how to reset the RESTORE point for use by the READ command. Have I got that right? If so, this is a very useful set of POKEs.

75 RD=PEEK(173)+256*PEEK(174):FOR I=1TO5*NR:READ J:NEXT:OD=PEEK(173)+256*PEEK(174)
5110 POKE174,INT(RD/256):POKE173,RD-256*PEEK(174):FORI=1TO R:READ N,E,S,W,M:NEXT

Thanks so much.

Jim


Yes. Those addresses hold the READ/DATA pointer. The original program made heavy use of the BBC's RESTORE line-number command, but that doesn't seem to work on the MC-10, so I had to use an ugly kludge to get round it.

With hindsight, it might've been simpler to just read everything into an array, but I wanted to follow the original program as closely as possible, to reduce the chance of mistakes! Luckily the emulator came with a complete ROM disassembly amongst the documentation, so it was easy to find the READ/DATA pointer. (Just open the file, hit ctrl-F and search for "data" until I found the right one!)

RD=PEEK(173)+256*PEEK(174) stores the start of room data. I then use a FOR/NEXT loop to READ through all the room data, then OD=PEEK(173)+256*PEEK(174) stores the start of the object data. These get POKEd back later when I need to read the room data or object data again.

(I don't know whether the MC-10's processor stores addresses big byte first or little byte first, but it turned out that didn't matter because even if I'm peeking them the wrong way round, it gets cancelled out when I poke them back the same way round again later!)

_________________
~~ Pippa ~~


Top
 Profile  
 
 Post subject: Re: Another Classic Ported to TRS-80 MC-10
PostPosted: Tue Sep 05, 2017 8:16 pm 
Offline

Joined: Sun Mar 18, 2012 7:33 pm
Posts: 23
pippa wrote:
Those addresses hold the READ/DATA pointer. The original program made heavy use of the BBC's RESTORE line-number command, but that doesn't seem to work on the MC-10, so I had to use an ugly kludge to get round it.

Interesting! The only BASIC I really know is BBC BASIC, so I didn't realise that other BASICs didn't have a RESTORE command, which is kind of surprising because you'd think it'd be very useful. E.g. a similar hack (or the same one?!) seems to be deployed in the following book about writing text adventures in TRS-80 BASIC:


_________________

My guide to Xanadu Adventure


Last edited by ahope1 on Tue Sep 05, 2017 10:59 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Another Classic Ported to TRS-80 MC-10
PostPosted: Tue Sep 05, 2017 8:40 pm 
Offline
User avatar

Joined: Sun Jan 16, 2005 3:28 am
Posts: 55
Location: London
ahope1 wrote:
Interesting! The only BASIC I really know is BBC BASIC, so I didn't realise that other BASICs didn't have a RESTORE command, which is kind of surprising because you'd think it'd be very useful. E.g. a similar hack (or the same one?!) seems to be needed in the following book about writing text adventures in TRS-80 BASIC:



Jim can probably give you more details, but AIUI the MC-10 BASIC does have a simple RESTORE command to go back to the start of the DATA list, but can't do RESTORE <<line-number>> to somewhere in the middle of it.

Thanks for the link. Interesting. It looks like this is a standard hack to get round the problem.

ETA: It looks like that book uses a slightly more sophisticated approach, scanning the program's line numbers and noting the address of any it might want to restore to later. Clever.

_________________
~~ Pippa ~~


Top
 Profile  
 
 Post subject: Re: Another Classic Ported to TRS-80 MC-10
PostPosted: Fri Sep 08, 2017 10:28 pm 
Offline
User avatar

Joined: Sat Aug 17, 2013 1:25 pm
Posts: 129
Location: Nova Scotia
RESTORE, as Pippa said, just returns to the beginning. Normally you either load arrays or simply do a number of "dummy" reads to get back to where you want. Alternatively, sine the MC-10 is a machine in the same vein as as the ZX81 and memory is at a premium, you load data directly into arrays from a tape file after running the program. That way, arrays get loaded but without needing redundant DATA statements in the program code.

I told the folks on the MC-10 groups about the game and have put it in my basic compilation (pretty sure I added a REM with "Pippa" in it). Hope that's okay. And the POKES have already been put to use streamlining a couple of old programs. Thanks so much.


Top
 Profile  
 
 Post subject: Re: Another Classic Ported to TRS-80 MC-10
PostPosted: Mon Sep 11, 2017 7:09 pm 
Offline
User avatar

Joined: Sun Jan 16, 2005 3:28 am
Posts: 55
Location: London
jgerrie wrote:
RESTORE, as Pippa said, just returns to the beginning. Normally you either load arrays or simply do a number of "dummy" reads to get back to where you want. Alternatively, sine the MC-10 is a machine in the same vein as as the ZX81 and memory is at a premium, you load data directly into arrays from a tape file after running the program. That way, arrays get loaded but without needing redundant DATA statements in the program code.

I told the folks on the MC-10 groups about the game and have put it in my basic compilation (pretty sure I added a REM with "Pippa" in it). Hope that's okay. And the POKES have already been put to use streamlining a couple of old programs. Thanks so much.


Yes, crediting me as "Pippa" is fine. (It's not actually my real name. When I started on the internet I chose the pseudonym Pippa's Ghost as a pun on Pepper's Ghost, a sort of illusion. I later dropped the "Ghost" bit because people thought it looked silly.)

I'm still surprised you think my idea is that impressive. Maybe it shows the advantage of a newcomer bringing a fresh eye, spotting things that more experienced people take for granted.
:wink:

_________________
~~ Pippa ~~


Top
 Profile  
 
 Post subject: Re: Another Classic Ported to TRS-80 MC-10
PostPosted: Mon Sep 11, 2017 11:33 pm 
Offline
User avatar

Joined: Sat Aug 17, 2013 1:25 pm
Posts: 129
Location: Nova Scotia
Ta.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 97 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group