[Coco] Why do we need a CoCo 4? (Long irrelevant rant)
Steve
6809er at bjork-huffman.net
Wed Dec 31 02:41:57 EST 2008
Without an U register none of games would run at all. But first a
little coding history ...
Back in the 70's, I create a form of Object Oriented Code (OCC) in
assemble language. Every thing from the player's ship to the shot
fire at him were control by uniformed data-blocks of information. To
create a new object in the game all I need was to setup a new
data-block filled with the data for that element of the game.
The first byte was the control flags with bits that would let the
system know if the data-block was in use (alive) or should be display
on the screen and so on. That was followed by bytes would hold other
information like the display image type, movement type and position.
Every bit of information that the object needed was stored in that
block of data.
What made this system work so well on the Z-80 (and 6809) was their
16-bit index registers with an 8-bit offset. I would load the Index
pointer with the address of the first Data-Block and call that would
work on the data. Once the call was done, I move to the data-block
till all the data-blocks were worked on.
Each call knew just where to find the information they needed because
the data-blocks had the same layout. The data at located at 4 bytes
in was the movement type for the object so an MOVETYPE,IX would get
that movement code to run on this object.
The bottom line was this data-block system created very tight code
since all the calls used the same data format. Also, there was very
little chance of having a runtime error do to pulling the data from
the wrong location.
Getting back to why I used the U register for my pointer and not the
X or the Y registers. First, the X & Y registers can be used for
more than index registers, like 16-bit counters since they set the
zero flag when the LEA -1,X hits zero. Besides, I had no need for a
user stack since all my data for an object was stored in the data-block.
Steve (Zaxxon) Bjork
At 07:22 PM 12/30/2008, you wrote:
>Joel
>
>That is what I said. if the HC12 had the U pointer register then it
>would be the CPU for the next Coco. Infact I told one of the
>managers of the HC11 line that one the HC11's biggest defects
>was it lacked that U pointer register and he agreed with me.
>
>The HC12 is about 80% source code compatible. Object code is not
>compatible. 6809 code would have to be reassembled. You do have to
>deal with the PSH*/PUL* instructions.
>
>james
More information about the Coco
mailing list