|
Subject: [stella] Games that do bad things to HMOVE... From: bwmott@xxxxxxxxxxxx Date: Thu, 23 Apr 1998 00:50:35 -0400 (EDT) |
I've been working on improving the TIA emulation for the next release
of Stella. One game that's given my TIA emulation trouble in the past
was He-man's title screen. Usually the text that's displayed is distorted
a lot. I started looking at a trace of the code that generates the
title screen and this is what I found out:
The upper part of the title screen (M Network Presents) is
generated by P0 and P1 with NUSIZx set to two close and VDELPx
turned on.
P0 and P1 are positioned using the following code:
PC=f622 IR=85 <$nn 2 STA> A= 7 X= 0 Y=ff PS=20 SP=fd Cyc=8284 0
PC=f624 IR=ea <implied 0 NOP> A= 7 X= 0 Y=ff PS=20 SP=fd Cyc=8286 2
PC=f625 IR=a8 <implied 0 TAY> A= 7 X= 0 Y= 7 PS=20 SP=fd Cyc=8288 4
PC=f626 IR=88 <implied 0 DEY> A= 7 X= 0 Y= 6 PS=20 SP=fd Cyc=8290 6
PC=f627 IR=d0 <$nn f628 BNE> A= 7 X= 0 Y= 6 PS=20 SP=fd Cyc=8293 9
PC=f626 IR=88 <implied 0 DEY> A= 7 X= 0 Y= 5 PS=20 SP=fd Cyc=8295 11
PC=f627 IR=d0 <$nn f628 BNE> A= 7 X= 0 Y= 5 PS=20 SP=fd Cyc=8298 14
PC=f626 IR=88 <implied 0 DEY> A= 7 X= 0 Y= 4 PS=20 SP=fd Cyc=8300 16
PC=f627 IR=d0 <$nn f628 BNE> A= 7 X= 0 Y= 4 PS=20 SP=fd Cyc=8303 19
PC=f626 IR=88 <implied 0 DEY> A= 7 X= 0 Y= 3 PS=20 SP=fd Cyc=8305 21
PC=f627 IR=d0 <$nn f628 BNE> A= 7 X= 0 Y= 3 PS=20 SP=fd Cyc=8308 24
PC=f626 IR=88 <implied 0 DEY> A= 7 X= 0 Y= 2 PS=20 SP=fd Cyc=8310 26
PC=f627 IR=d0 <$nn f628 BNE> A= 7 X= 0 Y= 2 PS=20 SP=fd Cyc=8313 29
PC=f626 IR=88 <implied 0 DEY> A= 7 X= 0 Y= 1 PS=20 SP=fd Cyc=8315 31
PC=f627 IR=d0 <$nn f628 BNE> A= 7 X= 0 Y= 1 PS=20 SP=fd Cyc=8318 34
PC=f626 IR=88 <implied 0 DEY> A= 7 X= 0 Y= 0 PS=22 SP=fd Cyc=8320 36
PC=f627 IR=d0 <$nn f628 BNE> A= 7 X= 0 Y= 0 PS=22 SP=fd Cyc=8322 38
PC=f629 IR=85 <$nn 10 STA> A= 7 X= 0 Y= 0 PS=22 SP=fd Cyc=8325 41
PC=f62b IR=85 <$nn 11 STA> A= 7 X= 0 Y= 0 PS=22 SP=fd Cyc=8328 44
STA RESP0 @ cycle 41 clock location 41 * 3 = 123 + 5 = 128 (60)
STA RESP0 @ cycle 44 clock location 44 * 3 = 132 + 5 = 137 (69)
Several lines of code down they finally do:
STA HMOVE (HMP0 = $80 HMP1 = $90) Motion registers were set before
position code above
So after the HMOVE I guessed the positions to be:
128 + 8 = 136
137 + 7 = 144
and the final pixel locations to be:
P0 = 136 - 68 = 68
P1 = 144 - 68 = 76
However, using these locations there doesn't seem to be anyway for
the text to work out since during the drawing of the text P0 and P1
are being hit at the wrong cycle times (i.e. while they're being
displayed). I thought about this and tried a few different approaches
to solve the problem but nothing worked :-( Then I realized that
after the position code above they hit HMOVE in a very strange way.
The code is:
PC=f62d IR=85 <$nn 2 STA> A= 7 X= 0 Y= 0 PS=22 SP=fd Cyc=8360
PC=f62f IR=a2 <#$nn f630 LDX> A= 7 X= 9 Y= 0 PS=20 SP=fd Cyc=8362
PC=f631 IR=ea <implied 0 NOP> A= 7 X= 9 Y= 0 PS=20 SP=fd Cyc=8364
PC=f632 IR=ca <implied 0 DEX> A= 7 X= 8 Y= 0 PS=20 SP=fd Cyc=8366
PC=f633 IR=10 <$nn f634 BPL> A= 7 X= 8 Y= 0 PS=20 SP=fd Cyc=8369
PC=f631 IR=ea <implied 0 NOP> A= 7 X= 8 Y= 0 PS=20 SP=fd Cyc=8371
PC=f632 IR=ca <implied 0 DEX> A= 7 X= 7 Y= 0 PS=20 SP=fd Cyc=8373
PC=f633 IR=10 <$nn f634 BPL> A= 7 X= 7 Y= 0 PS=20 SP=fd Cyc=8376
PC=f631 IR=ea <implied 0 NOP> A= 7 X= 7 Y= 0 PS=20 SP=fd Cyc=8378
PC=f632 IR=ca <implied 0 DEX> A= 7 X= 6 Y= 0 PS=20 SP=fd Cyc=8380
PC=f633 IR=10 <$nn f634 BPL> A= 7 X= 6 Y= 0 PS=20 SP=fd Cyc=8383
PC=f631 IR=ea <implied 0 NOP> A= 7 X= 6 Y= 0 PS=20 SP=fd Cyc=8385
PC=f632 IR=ca <implied 0 DEX> A= 7 X= 5 Y= 0 PS=20 SP=fd Cyc=8387
PC=f633 IR=10 <$nn f634 BPL> A= 7 X= 5 Y= 0 PS=20 SP=fd Cyc=8390
PC=f631 IR=ea <implied 0 NOP> A= 7 X= 5 Y= 0 PS=20 SP=fd Cyc=8392
PC=f632 IR=ca <implied 0 DEX> A= 7 X= 4 Y= 0 PS=20 SP=fd Cyc=8394
PC=f633 IR=10 <$nn f634 BPL> A= 7 X= 4 Y= 0 PS=20 SP=fd Cyc=8397
PC=f631 IR=ea <implied 0 NOP> A= 7 X= 4 Y= 0 PS=20 SP=fd Cyc=8399
PC=f632 IR=ca <implied 0 DEX> A= 7 X= 3 Y= 0 PS=20 SP=fd Cyc=8401
PC=f633 IR=10 <$nn f634 BPL> A= 7 X= 3 Y= 0 PS=20 SP=fd Cyc=8404
PC=f631 IR=ea <implied 0 NOP> A= 7 X= 3 Y= 0 PS=20 SP=fd Cyc=8406
PC=f632 IR=ca <implied 0 DEX> A= 7 X= 2 Y= 0 PS=20 SP=fd Cyc=8408
PC=f633 IR=10 <$nn f634 BPL> A= 7 X= 2 Y= 0 PS=20 SP=fd Cyc=8411
PC=f631 IR=ea <implied 0 NOP> A= 7 X= 2 Y= 0 PS=20 SP=fd Cyc=8413
PC=f632 IR=ca <implied 0 DEX> A= 7 X= 1 Y= 0 PS=20 SP=fd Cyc=8415
PC=f633 IR=10 <$nn f634 BPL> A= 7 X= 1 Y= 0 PS=20 SP=fd Cyc=8418
PC=f631 IR=ea <implied 0 NOP> A= 7 X= 1 Y= 0 PS=20 SP=fd Cyc=8420
PC=f632 IR=ca <implied 0 DEX> A= 7 X= 0 Y= 0 PS=22 SP=fd Cyc=8422
PC=f633 IR=10 <$nn f634 BPL> A= 7 X= 0 Y= 0 PS=22 SP=fd Cyc=8425
PC=f631 IR=ea <implied 0 NOP> A= 7 X= 0 Y= 0 PS=22 SP=fd Cyc=8427
PC=f632 IR=ca <implied 0 DEX> A= 7 X=ff Y= 0 PS=a0 SP=fd Cyc=8429
PC=f633 IR=10 <$nn f634 BPL> A= 7 X=ff Y= 0 PS=a0 SP=fd Cyc=8431
PC=f635 IR=85 <$nn 2a STA> A= 7 X=ff Y= 0 PS=a0 SP=fd Cyc=8434 74
So they waste 71 cycles and hit HMOVE ending on cycle 74. Thus they
are hitting HMOVE two cycles before HBLANK begins.
Now, the best I can figure is that by hitting HMOVE at this time it
reduces the amount of motion applied to the objects by 6 clocks.
So that instead of moving P0 by 8 pixels and P1 by 7 pixels it
moves them by 2 and 1 pixels.
So we have that because HMOVE occurs at cycle 74 we loose 6 color clocks
and the pixel locations are:
128 + 2 = 130 130 - 68 = 62
137 + 1 = 138 138 - 68 = 70
Using these pixel locations the drawing works out and the text is displayed
as it should be.
What do you all think? Is this what happens when you hit HMOVE near
the end of a scanline?
Does this mean that if you hit HMOVE during let's say the middle of a
scanline it would have no effect?
Finally, do you have any idea why they decided to do it this way?
I'm guessing that it somehow avoids the HMOVE BLANK lines and they
wanted this because they have a border around the title screen.
Oh well, it's bed time :-)
Brad
--------------------------------------------------------------------------
Bradford W. Mott (bwmott@xxxxxxx) Computer Science Department
http://www4.ncsu.edu/~bwmott/www North Carolina State University
--------------------------------------------------------------------------
--
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/stella.html
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: Re: Re: [stella] VCS simulator, Lee Seitz | Thread | Re: [stella] Games that do bad thin, Erik Mooney |
| Re: [stella] RESPx and player posit, bwmott | Date | [stella] 2600 internet terminal, Greg Troutman |
| Month |