Re: ti-emu: Re: new emulator
[Prev][Next][Index][Thread]
Re: ti-emu: Re: new emulator
Number 1, it appears that your numbering is off, and I can't quite follow
what you're talking about ($695F to $6952?) Ok, LD ($8000), A shouldn't be
writing to ROM unless a ROM page is loaded into page 3... But basicly, not
checking for writablity can often cause problems, the best thing I can
suggest is from my own code, I kept track of 4 boolean values determining if
pages were writable, one for each page (since every byte across a page
carries the same writablity) And I just check this for writes (don't need it
for reads, and by far you do more reads than writes) You could probably get
a pretty decent ROM protection this way, and it doesn't take up TOO much
more cycle time. There's another way, in which I keep track of the base
address for a page in real memory, one for reads, one for writes, the read
always points to the right address, and the write- if writablity is
disabled- points to a free-use page. From this you can calculate the
address of the proper byte, and just read or write to it in one cycle, and
the load falls into the page switching logic, which while being called A LOT
by the ROM, logically doesn't get called a significant amount.
As for cycle emulation, really? No, you don't need the interrupts to
function exactly properly, in truth an interrupt can interrupt an LDIR in
mid execution, but most emulators can ignore this fact, because you- like
you've said- are not looking to write a PERFECT emulator (like you said,
you'll never get it to suffient speed anyways) So I say, cycle emulation
_CAN_ be avoided with little to no noticable effect overall. (Especially if
you're using just the ROM) As for using a 256 byte array, it'll probably
barf on $FDFDFDFDFDFDFDFDFDFDFDFDFD210000 which is LD IY, $nnnn's T-states
+ 48 T-states, and it's also LD IY, $nnnn's cycle count + 12 cycles. (Each
$FD is just a 4 T-state, one cycle command that wears off the next
instruction) BTW, my emulator does correctly handle this, and accurately
counts T-states under all conditions (even undocumented ones) All this goes
to say, don't worry about it.
>From: "Liyang Hu" <liyang@liyang.freeserve.co.uk>
>Reply-To: ti-emulator@lists.ticalc.org
>To: "TI-Emu ML" <ti-emulator@lists.ticalc.org>,"TI-86 Asm ML"
><assembly-86@lists.ticalc.org>
>Subject: ti-emu: Re: new emulator
>Date: Thu, 23 Dec 1999 21:26:04 -0000
>
>
>hmm... thanks for prompting me to look at my code again - after messing
>with
>TI86Emu for a while, I managed to find the bit of code that's messing my
>emulator up. It gets here straight after a keypress...
>Around 0x6960, ROM page 0x0a, we see this chunk of code:
>
>6957 IN A,($06)
>6959 PUSH AF
>695A LD A,$80
>695C OUT ($06),A
>695E LD A,D
>695F LD ($8000),A
>6952 POP AF
>
>that's definitely writing to the ROM... (unless bit 7 of port 6 actually
>does something... I was under the impression that this bit was ignored,
>ne?)
>My emu crashes at 6960, just as it attempts the write.
>I can see TI86Emu going through this bit of code as well, but it ignores
>the
>write, as far as I can tell. Now, my question is: WTF is it doing writing
>to
>the ROM ?!?!?!? That's just going to make my code a lot more complicated...
>(I'm not checking whether the mem is writable or not, for speed reasons. I
>suppose I could always patch the ROM? What do you guys think?)
>
> > At what address in the ROM does it do this? Some devices will
> > use writes to
> > ROM as hardware control registers, but the calc doesn't do this.
> >
> > > Should the ROM (program) be trying to write to the ROM (memory)
> > during its
> > > execution?
>
>sayoonara!
>--
> /*\-------------------------. .----------------------------.
>| Liyang Hu aka DenseBoy \ / __pikachu ICQ # 39391385 \
>| http://www.nerv.cx/ | <denseboy@41t4v¡5t4.n3t> |
>+------------------------------+--------------------------------+
>| When you say "I wrote a program that crashed Windows", |
>| people just stare at you blankly and say: |
>| "Hey, I got those with the system, *for free*". |
>| -----------------------------------------------------------/
> \*/ /* get my public key at http://www.nerv.cx/liyang.asc */
> /* decode the l33t-speak in my address to email me! */
>
>
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com