Talk:83Plus:Ports:2E

From WikiTI
Revision as of 08:29, 7 March 2006 by CoBB (Talk | contribs)

Jump to: navigation, search

Okay I did more research into port 2e, it does not affect the CPU clock speed at all. It still runs at either 6mhz or 15mhz. The effects of this port makes it appear that the clock has slowed down, rather reads and writes to the memory have slowed. Please bare with me, it's rather difficult to explain.

On whim I decided to test the accuracy of opcodes tstates. I set up the SE timers to run on the CPU clock. Between setting the clock and reading the clock I would be able to calculate the tstates of any given opcode. Here is the code.

   xor a          ;clear
   out ($30),a
   out ($31),a
   ld a,$80       ;cpu clock
   out ($30),a
   xor a          ;no looping, no interrupt
   out ($31),a
   ld a,100       ;countdown from 100.
   out ($32),a
   ;---OP CODES HERE!!!---
   in a,($32)     ;read ticks since write
   ld l,a
   ld a,90
   sub l          ;from writing to reading is 10 clocks
   ld l,a         ;I adjust so the output gives me only the tstates of the opcodes
   ld h,0
   bcall(_disphl)

The code above simply display the number of tstates in the given space. 'Nothing' renders an answer of 0, NOP renders 4, ld a,($8000) renders 13, jp c,$ when NO CARRY renders 10. I've tested enough to assume that this working correctly.

I will state my findings based on my inputs.


For the 83+SE the default value of port 2E is 44. The default value of port 29 is 14. Port 2E and the LCD delay ports are linked. I used only a range of a few opcodes on each test. They were:

   ld (ix+0),0            ;ix=ramaddress
   ld (ramaddress),a
   ld a,(ramaddress)
   ldi                    ;hl=ramaddress, de=ramaddress, bc=1
   out (1),a              ;a=100
   "NULL"                 ;NO OPCODE!!


Here is a table of the tested opcodes, and some of the trials. I excluded most due to the fact they did not show relevant info. The values under ports 29 and 2e are the contents of the ports at given trial. the values under the opcodes are the return TStates. NOTE: Although no opcode should always return a value of 0, the difference is probably because of writing to port 32 prior and reading port 32 after. So take that into consideration when you look at the other tstates in the given trial.

Port 29

Port 2E

ld (ix+0),0

ld (*),a

ld a,(*)

ldi

out (1),a

NO OPCODE

14

44

19

13

13

16

11

0

14

CF

19

13

13

16

11

0

16

44

20

14

13

17

11

0

16

54

23

16

15

20

13

1

16

64

23

17

17

19

13

1

16

75

26

19

19

22

15

2

17

FF

26

19

19

22

15

2


When bit 1 of port 29 is set and 2e is default, all writes to the ram take 1 extra tstate per byte.

When bit 1 of port 29 is set and 2e contains 74, all reads and writes to the ram take 1 extras tstate per bytes.

The other information on seems rather confusing...

Also my test only occurred on an 83+SE, at 6mhz, and all other ports at default. I made no tests for the 84+SE yet. Also I'd like to note that i believe timers based on the cpu clock are correct, I timed these instructions be hand to verify that. Finally all code occurred in the ram, as did reads and writes.

So I post this on the discussion page due to the fact I lack a certain bit of knowledge on how memory is access on this system. What exactly goes on between the micro controller and the cpu? (though the SE cpu is in the micro controller) Is there a memory clock or is it based on the cpu clocks? I really don't the info to explain the effects when port 2e contains 54 or 64. I'd hope some one else can shed some more light on the subject.

....sigh... I have a feeling that I am the only one in the world that would actually care about this.--Jim e 05:02, 7 Mar 2006 (PST)

Just remember that someone has to implement all this, and that someone wouldn't want to backtrack after realising that the implementation is based on a fundamentally wrong model. ;) CoBB 07:29, 7 Mar 2006 (PST)