1872
1872
\
1873
1873
\ Name: K%
1874
1874
\ Type: Workspace
1875
- \ Address: &0900 to &0CFF
1875
+ \ Address: &0900 to &0ABB
1876
1876
\ Category: Workspaces
1877
1877
\ Summary: Ship data blocks and ship line heaps
1878
1878
\ Deep dive: Ship data blocks
@@ -5068,10 +5068,6 @@ ENDIF
5068
5068
\ drawing anything (as we need two points, i.e. two calls,
5069
5069
\ before we can draw a line)
5070
5070
\
5071
- \ K The circle's radius
5072
- \
5073
- \ K3(1 0) Pixel x-coordinate of the centre of the circle
5074
- \
5075
5071
\ K4(1 0) Pixel y-coordinate of the centre of the circle
5076
5072
\
5077
5073
\ K5(1 0) Screen x-coordinate of the previous point added to the
@@ -5080,8 +5076,6 @@ ENDIF
5080
5076
\ K5(3 2) Screen y-coordinate of the previous point added to the
5081
5077
\ ball line heap (if this is not the first point)
5082
5078
\
5083
- \ SWAP If non-zero, we swap (X1, Y1) and (X2, Y2)
5084
- \
5085
5079
\ ------------------------------------------------------------------------------
5086
5080
\
5087
5081
\ Returns:
@@ -5107,7 +5101,7 @@ ENDIF
5107
5101
STA K6+2 \
5108
5102
LDA K4+1 \ so K6(3 2) now contains the y-coordinate of the new
5109
5103
ADC T \ point on the circle but as a screen coordinate, to go
5110
- STA K6+3 \ along with the screen y -coordinate in K6(1 0)
5104
+ STA K6+3 \ along with the screen x -coordinate in K6(1 0)
5111
5105
5112
5106
LDA FLAG \ If FLAG = 0, jump down to BL1
5113
5107
BEQ BL1
@@ -21207,7 +21201,7 @@ ENDIF
21207
21201
21208
21202
JSR PLS6 \ Call PLS6 to calculate:
21209
21203
\
21210
- \ (X K) = (A P) / (z_sign z_hi z_lo)
21204
+ \ (X K) = (A P+1 P ) / (z_sign z_hi z_lo)
21211
21205
\ = (x_sign x_hi x_lo) / (z_sign z_hi z_lo)
21212
21206
\ = x / z
21213
21207
@@ -21235,7 +21229,7 @@ ENDIF
21235
21229
21236
21230
JSR PLS6 \ Call PLS6 to calculate:
21237
21231
\
21238
- \ (X K) = (A P) / (z_sign z_hi z_lo)
21232
+ \ (X K) = (A P+1 P ) / (z_sign z_hi z_lo)
21239
21233
\ = -(y_sign y_hi y_lo) / (z_sign z_hi z_lo)
21240
21234
\ = -y / z
21241
21235
@@ -21868,8 +21862,9 @@ ENDIF
21868
21862
LDX #0 \ Set CNT = 0
21869
21863
STX CNT
21870
21864
21871
- DEX \ Set FLAG = &FF to reset the ball line heap in the call
21872
- STX FLAG \ to the BLINE routine below
21865
+ DEX \ Set FLAG = &FF to start a new line in the ball line
21866
+ STX FLAG \ heap when calling BLIN below, so the crater or
21867
+ \ meridian is separate from any previous ellipses
21873
21868
21874
21869
.PLL4
21875
21870
@@ -23051,7 +23046,8 @@ ENDIF
23051
23046
ADC #0 \ now negated the y-coordinate in (T X)
23052
23047
STA T
23053
23048
23054
- CLC \ Clear the C flag so we can do some more addition below
23049
+ CLC \ Clear the C flag so the addition at the start of BLINE
23050
+ \ will work
23055
23051
23056
23052
.PL38
23057
23053
@@ -23765,13 +23761,13 @@ ENDIF
23765
23761
\ Name: PLS6
23766
23762
\ Type: Subroutine
23767
23763
\ Category: Drawing planets
23768
- \ Summary: Calculate (X K) = (A P) / (z_sign z_hi z_lo)
23764
+ \ Summary: Calculate (X K) = (A P+1 P ) / (z_sign z_hi z_lo)
23769
23765
\
23770
23766
\ ------------------------------------------------------------------------------
23771
23767
\
23772
23768
\ Calculate the following:
23773
23769
\
23774
- \ (X K) = (A P) / (z_sign z_hi z_lo)
23770
+ \ (X K) = (A P+1 P ) / (z_sign z_hi z_lo)
23775
23771
\
23776
23772
\ returning an overflow in the C flag if the result is >= 1024.
23777
23773
\
@@ -24317,10 +24313,10 @@ ENDIF
24317
24313
ADC (INF),Y
24318
24314
STA P
24319
24315
24320
- INY \ And next we add A and address in INF+34, with any
24321
- LDA (INF),Y \ from the previous addition, to get the high byte of
24322
- ADC #0 \ the top of the heap, which we store in P+1, so P(1 0)
24323
- STA P+1 \ points to the top of this ship's heap
24316
+ INY \ And next we add A and the address in INF+34, with any
24317
+ LDA (INF),Y \ carry from the previous addition, to get the high byte
24318
+ ADC #0 \ of the top of the heap, which we store in P+1, so
24319
+ STA P+1 \ P(1 0) points to the top of this ship's heap
24324
24320
24325
24321
\ Now, we're ready to start looping through the ships
24326
24322
\ we want to move, moving the slots, data blocks and
@@ -27079,10 +27075,9 @@ ENDIF
27079
27075
27080
27076
STA K%+NI%+8 \ Set the planet's z_sign to the high byte of the result
27081
27077
27082
- LDA #1 \ These instructions have no effect, as the call to
27083
- STA QQ11 \ LOOK1 below starts by setting QQ11 to 0; instead they
27084
- \ just set the current view type in QQ11 to 1 for the
27085
- \ duration of the next three instructions
27078
+ LDA #1 \ Temporarily set the view type to a non-zero value, so
27079
+ STA QQ11 \ the call to LOOK1 below clears the screen before
27080
+ \ switching to the space view
27086
27081
27087
27082
STA MCNT \ Set the main loop counter to 1, so the next iteration
27088
27083
\ through the main loop will potentially spawn ships
@@ -29090,6 +29085,9 @@ ENDMACRO
29090
29085
\
29091
29086
\LDA K4 \ Set A = y-coordinate of dot + 1 (so this is the second
29092
29087
\ADC #1 \ row of the two-pixel-high dot)
29088
+ \ \
29089
+ \ \ The addition works as the Shpt routine clears the C
29090
+ \ \ flag
29093
29091
\
29094
29092
\JSR Shpt \ Call Shpt with Y = 6 to set up bytes 5-8 in the ship
29095
29093
\ \ lines space, aborting the call to LL9 if the dot is
@@ -29158,9 +29156,9 @@ ENDMACRO
29158
29156
\ \ bytes define a horizontal 4-pixel dash, for either the
29159
29157
\ \ top or the bottom of the ship's dot
29160
29158
\
29161
- \STA (XX19),Y \ Store A in byte Y of the ship line heap
29159
+ \STA (XX19),Y \ Store A in byte Y of the ship line heap (i.e. Y1)
29162
29160
\
29163
- \INY \ Store A in byte Y+2 of the ship line heap
29161
+ \INY \ Store A in byte Y+2 of the ship line heap (i.e. Y2)
29164
29162
\INY
29165
29163
\STA (XX19),Y
29166
29164
@@ -29178,7 +29176,7 @@ ENDMACRO
29178
29176
29179
29177
\ --- Mod: Code removed for flicker-free ships: ------->
29180
29178
29181
- \DEY \ Store A in byte Y+1 of the ship line heap
29179
+ \DEY \ Store A in byte Y+1 of the ship line heap (i.e. X2)
29182
29180
\STA (XX19),Y
29183
29181
\
29184
29182
\ADC #3 \ Set A = screen x-coordinate of the ship dot + 3
@@ -29194,7 +29192,7 @@ ENDMACRO
29194
29192
\ \ nono will actually return us from the original call
29195
29193
\ \ to LL9, thus aborting the entire drawing process
29196
29194
\
29197
- \DEY \ Store A in byte Y-1 of the ship line heap
29195
+ \DEY \ Store A in byte Y-1 of the ship line heap (i.e. X1)
29198
29196
\DEY
29199
29197
\STA (XX19),Y
29200
29198
\
@@ -31854,7 +31852,7 @@ ENDMACRO
31854
31852
STA XX15+4 \ from the XX3 heap into XX15+4
31855
31853
31856
31854
LDA XX3+3,X \ Fetch the y_hi coordinate of the edge's end vertex
31857
- STA XX12+1 \ from the XX3 heap into XX11 +1
31855
+ STA XX12+1 \ from the XX3 heap into XX12 +1
31858
31856
31859
31857
LDA XX3+2,X \ Fetch the y_lo coordinate of the edge's end vertex
31860
31858
STA XX12 \ from the XX3 heap into XX12
@@ -32139,10 +32137,10 @@ ENDMACRO
32139
32137
.LL146
32140
32138
32141
32139
\ If we get here then we have clipped our line to the
32142
- \ (if we had to clip it at all), so we move the low
32143
- \ bytes from (x1, y1) and (x2, y2) into (X1, Y1) and
32144
- \ (X2, Y2), remembering that they share locations with
32145
- \ XX15:
32140
+ \ screen edge (if we had to clip it at all), so we move
32141
+ \ the low bytes from (x1, y1) and (x2, y2) into (X1, Y1)
32142
+ \ and (X2, Y2), remembering that they share locations
32143
+ \ with XX15:
32146
32144
\
32147
32145
\ X1 = XX15
32148
32146
\ Y1 = XX15+1
@@ -34473,6 +34471,7 @@ ENDMACRO
34473
34471
\ Category: Moving
34474
34472
\ Summary: Rotate the planet or sun's location in space by the amount of
34475
34473
\ pitch and roll of our ship
34474
+ \ Deep dive: Rotating the universe
34476
34475
\
34477
34476
\ ------------------------------------------------------------------------------
34478
34477
\
0 commit comments