Loading...
 

HMP1

HMP1 = $21

Write horizontal motion value into the horizontal motion register for Player 1

WRITE
D7
D6
D5
D4
D3
D2
D1
D0
$21
HMP1
D7
D6
D5
D4
X
X
X
X

Horizontal Motion

Horizontal motion allows the programmer to move any of the 5 graphics objects relative to their current horizontal position. Each object has a 4 bit horizontal motion register (HMP0, HMP1, HMM0, HMM1, HMBL) that can be loaded with a value in the range of +7 to -8 (negative values are expressed in two’s complement from). This motion is not executed until the
HMOVE register is written to, at which time all motion registers move their respective objects. Objects can be moved repeatedly by simply executing HMOVE. Any object that is not to move must have a 0 in its motion register. The horizontal motion registers will cause horizontal motion only when commanded to do so by the horizontal move command HMOVE. With the horizontal positioning command confined to positioning objects at 15 colour clock intervals, the motion registers fills in the gaps by moving objects +7 to -8 colour clocks. Objects can not be placed at any colour clock position across the screen. All 5 motion registers can be set to zero simultaneously by writing to the horizontal motion clear register HMCLR.

There are timing constraints for the HMOVE command. The HMOVE command must immediately follow a WSYNC (Wait for SYNC) to insure the HMOVE operation occurs during horizontal blanking. This is to allow sufficient time for the motion registers to do their thing before the electron beam starts drawing the next scan line.

The Stella Programmer's Guide advise that "Also, for mysterious internal hardware considerations, the motion registers should not be modified for at least 24 machine cycles after an HMOVE command." — these days the hardware is understood (see TIA Hardware Notes.
The horizontal motion addresses write data (horizontal motion values) into the horizontal motion registers. These registers will cause horizontal motion only when commanded to do so by the horizontal move command HMOVE.

Horizontal Motion Values

The motion values are coded as shown below:

D7
D6
D5
D4
Offset
Action
0
1
1
1
+7
0
1
1
0
+6
0
1
0
1
+5
Move left
0
1
0
0
+4
indicated number
0
0
1
1
+3
of clocks
0
0
1
0
+2
0
0
0
1
+1
0
0
0
0
0
No Motion
1
1
1
1
-1
1
1
1
0
-2
1
1
0
1
-3
1
1
0
0
-4
move right
1
0
1
1
-5
indicated number
1
0
1
0
-6
of clocks
1
0
0
1
-7
1
0
0
0
-8


Stella Programmer's Guide advises "WARNING : These motion registers should not be modified during the 24 computer cycles immediately following an HMOVE command. Unpredictable motion values may result."

See TIA Hardware Notes for a thorough analysis of exactly what would happen.

see TIA