<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Wed, 01 May 2002 13:47:26 +0100
From   : "Richard Gellman" <r.gellman@...>
Subject: Re: Completely stuck on tube emulation

>Acornsoft *may* have assumed that it's running with OS1.20 and that
>some useful routine in the OS is at C881.Certainly DFS1.20 reads and
>writes variables in page 2 by just peaking and poking rather than by
>OSByte.
>That would be odd.

Nope, as I said before, I checked it with a genuine Master 128 with a second
processor connected :)

>Can we not change back to trying BASIC,then at least I have something to
>refer to.

Could have done, but BDSIC just hangs..

>Sounds like pushing the 2 byte address of the routine to handle the given
>keyword before an RTS.

Yup.

"jim" pointed out something for me to check, which turned out to be the
problem.
This is actually a problem with the original processor code too, and anyone
who can compile BeebEm themselves may wish to fix this one...

Basically, the fault was within the ASL / LSR instructions (althought LSR A
was in fact "fixed" in the following manner). These instructed are coded to
work by shifting the byte in the required direction, and then storing the
result back to memory. The problem was the byte being shifted was a 16-bit
integer, so what should have just become the carry was in fact becoming bit
8 of the memory location. The memory array uses 8-bit elements, so I can
only presume that attempting to write back a 9-bit value caused a type
overflow, and corrupted a few things internal to the emulator itself there.
Anyways, the solution was to and "newVal" (the variable used to hold the
value of the memory location/accumulator after shifting) with 255.

After fixing this in both processor sources, everything started working...
(DOH!)

The tinyest things eh? :)

-- Richard Gellman

<Serious bit>
This email is sent to you as personal communication or to a specific mailing
list ONLY, and does not contain any form of comercial advertsing (spam). By
replying to this email you legally agree that you will honour this in a
similar fashion, and you will not send any commercial email to this email
address, or subscribe this email address to any mailing list without prior
permission. Failure to adhere to this may result in criminal prosecution
under the misuse of information laws applicable in all countries.
<end of serious bit>
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>