Skip to content

Commit 84b1edc

Browse files
committed
2 parents 1b0c614 + f05138d commit 84b1edc

File tree

2 files changed

+47
-50
lines changed

2 files changed

+47
-50
lines changed

1-source-files/main-sources/elite-source-docked.asm

+16-18
Original file line numberDiff line numberDiff line change
@@ -1895,7 +1895,7 @@
18951895
\
18961896
\ Name: K%
18971897
\ Type: Workspace
1898-
\ Address: &0900 to &0CFF
1898+
\ Address: &0900 to &0ABB
18991899
\ Category: Workspaces
19001900
\ Summary: Ship data blocks and ship line heaps
19011901
\ Deep dive: Ship data blocks
@@ -5316,10 +5316,6 @@ ENDIF
53165316
\ drawing anything (as we need two points, i.e. two calls,
53175317
\ before we can draw a line)
53185318
\
5319-
\ K The circle's radius
5320-
\
5321-
\ K3(1 0) Pixel x-coordinate of the centre of the circle
5322-
\
53235319
\ K4(1 0) Pixel y-coordinate of the centre of the circle
53245320
\
53255321
\ K5(1 0) Screen x-coordinate of the previous point added to the
@@ -5328,8 +5324,6 @@ ENDIF
53285324
\ K5(3 2) Screen y-coordinate of the previous point added to the
53295325
\ ball line heap (if this is not the first point)
53305326
\
5331-
\ SWAP If non-zero, we swap (X1, Y1) and (X2, Y2)
5332-
\
53335327
\ ------------------------------------------------------------------------------
53345328
\
53355329
\ Returns:
@@ -5355,7 +5349,7 @@ ENDIF
53555349
STA K6+2 \
53565350
LDA K4+1 \ so K6(3 2) now contains the y-coordinate of the new
53575351
ADC T \ point on the circle but as a screen coordinate, to go
5358-
STA K6+3 \ along with the screen y-coordinate in K6(1 0)
5352+
STA K6+3 \ along with the screen x-coordinate in K6(1 0)
53595353

53605354
LDA FLAG \ If FLAG = 0, jump down to BL1
53615355
BEQ BL1
@@ -19662,7 +19656,8 @@ ENDIF
1966219656
ADC #0 \ now negated the y-coordinate in (T X)
1966319657
STA T
1966419658

19665-
CLC \ Clear the C flag so we can do some more addition below
19659+
CLC \ Clear the C flag so the addition at the start of BLINE
19660+
\ will work
1966619661

1966719662
.PL38
1966819663

@@ -24773,6 +24768,9 @@ ENDMACRO
2477324768
\
2477424769
\LDA #Y \ Set A = #Y + 1 (so this is the second row of the
2477524770
\ADC #1 \ two-pixel-high dot halfway down the screen)
24771+
\ \
24772+
\ \ The addition works as the Shpt routine clears the C
24773+
\ \ flag
2477624774
\
2477724775
\JSR Shpt \ Call Shpt with Y = 6 to set up bytes 5-8 in the ship
2477824776
\ \ lines space, aborting the call to LL9 if the dot is
@@ -24841,9 +24839,9 @@ ENDMACRO
2484124839
\ \ bytes define a horizontal 4-pixel dash, for either the
2484224840
\ \ top or the bottom of the ship's dot
2484324841
\
24844-
\STA (XX19),Y \ Store A in byte Y of the ship line heap
24842+
\STA (XX19),Y \ Store A in byte Y of the ship line heap (i.e. Y1)
2484524843
\
24846-
\INY \ Store A in byte Y+2 of the ship line heap
24844+
\INY \ Store A in byte Y+2 of the ship line heap (i.e. Y2)
2484724845
\INY
2484824846
\STA (XX19),Y
2484924847

@@ -24861,7 +24859,7 @@ ENDMACRO
2486124859

2486224860
\ --- Mod: Code removed for flicker-free ships: ------->
2486324861

24864-
\DEY \ Store A in byte Y+1 of the ship line heap
24862+
\DEY \ Store A in byte Y+1 of the ship line heap (i.e. X2)
2486524863
\STA (XX19),Y
2486624864
\
2486724865
\ADC #3 \ Set A = screen x-coordinate of the ship dot + 3
@@ -24877,7 +24875,7 @@ ENDMACRO
2487724875
\ \ nono will actually return us from the original call
2487824876
\ \ to LL9, thus aborting the entire drawing process
2487924877
\
24880-
\DEY \ Store A in byte Y-1 of the ship line heap
24878+
\DEY \ Store A in byte Y-1 of the ship line heap (i.e. X1)
2488124879
\DEY
2488224880
\STA (XX19),Y
2488324881
\
@@ -27512,7 +27510,7 @@ ENDMACRO
2751227510
STA XX15+4 \ from the XX3 heap into XX15+4
2751327511

2751427512
LDA XX3+3,X \ Fetch the y_hi coordinate of the edge's end vertex
27515-
STA XX12+1 \ from the XX3 heap into XX11+1
27513+
STA XX12+1 \ from the XX3 heap into XX12+1
2751627514

2751727515
LDA XX3+2,X \ Fetch the y_lo coordinate of the edge's end vertex
2751827516
STA XX12 \ from the XX3 heap into XX12
@@ -27793,10 +27791,10 @@ ENDMACRO
2779327791
.LL146
2779427792

2779527793
\ If we get here then we have clipped our line to the
27796-
\ (if we had to clip it at all), so we move the low
27797-
\ bytes from (x1, y1) and (x2, y2) into (X1, Y1) and
27798-
\ (X2, Y2), remembering that they share locations with
27799-
\ XX15:
27794+
\ screen edge (if we had to clip it at all), so we move
27795+
\ the low bytes from (x1, y1) and (x2, y2) into (X1, Y1)
27796+
\ and (X2, Y2), remembering that they share locations
27797+
\ with XX15:
2780027798
\
2780127799
\ X1 = XX15
2780227800
\ Y1 = XX15+1

1-source-files/main-sources/elite-source-flight.asm

+31-32
Original file line numberDiff line numberDiff line change
@@ -1872,7 +1872,7 @@
18721872
\
18731873
\ Name: K%
18741874
\ Type: Workspace
1875-
\ Address: &0900 to &0CFF
1875+
\ Address: &0900 to &0ABB
18761876
\ Category: Workspaces
18771877
\ Summary: Ship data blocks and ship line heaps
18781878
\ Deep dive: Ship data blocks
@@ -5068,10 +5068,6 @@ ENDIF
50685068
\ drawing anything (as we need two points, i.e. two calls,
50695069
\ before we can draw a line)
50705070
\
5071-
\ K The circle's radius
5072-
\
5073-
\ K3(1 0) Pixel x-coordinate of the centre of the circle
5074-
\
50755071
\ K4(1 0) Pixel y-coordinate of the centre of the circle
50765072
\
50775073
\ K5(1 0) Screen x-coordinate of the previous point added to the
@@ -5080,8 +5076,6 @@ ENDIF
50805076
\ K5(3 2) Screen y-coordinate of the previous point added to the
50815077
\ ball line heap (if this is not the first point)
50825078
\
5083-
\ SWAP If non-zero, we swap (X1, Y1) and (X2, Y2)
5084-
\
50855079
\ ------------------------------------------------------------------------------
50865080
\
50875081
\ Returns:
@@ -5107,7 +5101,7 @@ ENDIF
51075101
STA K6+2 \
51085102
LDA K4+1 \ so K6(3 2) now contains the y-coordinate of the new
51095103
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)
51115105

51125106
LDA FLAG \ If FLAG = 0, jump down to BL1
51135107
BEQ BL1
@@ -21207,7 +21201,7 @@ ENDIF
2120721201

2120821202
JSR PLS6 \ Call PLS6 to calculate:
2120921203
\
21210-
\ (X K) = (A P) / (z_sign z_hi z_lo)
21204+
\ (X K) = (A P+1 P) / (z_sign z_hi z_lo)
2121121205
\ = (x_sign x_hi x_lo) / (z_sign z_hi z_lo)
2121221206
\ = x / z
2121321207

@@ -21235,7 +21229,7 @@ ENDIF
2123521229

2123621230
JSR PLS6 \ Call PLS6 to calculate:
2123721231
\
21238-
\ (X K) = (A P) / (z_sign z_hi z_lo)
21232+
\ (X K) = (A P+1 P) / (z_sign z_hi z_lo)
2123921233
\ = -(y_sign y_hi y_lo) / (z_sign z_hi z_lo)
2124021234
\ = -y / z
2124121235

@@ -21868,8 +21862,9 @@ ENDIF
2186821862
LDX #0 \ Set CNT = 0
2186921863
STX CNT
2187021864

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
2187321868

2187421869
.PLL4
2187521870

@@ -23051,7 +23046,8 @@ ENDIF
2305123046
ADC #0 \ now negated the y-coordinate in (T X)
2305223047
STA T
2305323048

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
2305523051

2305623052
.PL38
2305723053

@@ -23765,13 +23761,13 @@ ENDIF
2376523761
\ Name: PLS6
2376623762
\ Type: Subroutine
2376723763
\ 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)
2376923765
\
2377023766
\ ------------------------------------------------------------------------------
2377123767
\
2377223768
\ Calculate the following:
2377323769
\
23774-
\ (X K) = (A P) / (z_sign z_hi z_lo)
23770+
\ (X K) = (A P+1 P) / (z_sign z_hi z_lo)
2377523771
\
2377623772
\ returning an overflow in the C flag if the result is >= 1024.
2377723773
\
@@ -24317,10 +24313,10 @@ ENDIF
2431724313
ADC (INF),Y
2431824314
STA P
2431924315

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
2432424320

2432524321
\ Now, we're ready to start looping through the ships
2432624322
\ we want to move, moving the slots, data blocks and
@@ -27079,10 +27075,9 @@ ENDIF
2707927075

2708027076
STA K%+NI%+8 \ Set the planet's z_sign to the high byte of the result
2708127077

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
2708627081

2708727082
STA MCNT \ Set the main loop counter to 1, so the next iteration
2708827083
\ through the main loop will potentially spawn ships
@@ -29090,6 +29085,9 @@ ENDMACRO
2909029085
\
2909129086
\LDA K4 \ Set A = y-coordinate of dot + 1 (so this is the second
2909229087
\ADC #1 \ row of the two-pixel-high dot)
29088+
\ \
29089+
\ \ The addition works as the Shpt routine clears the C
29090+
\ \ flag
2909329091
\
2909429092
\JSR Shpt \ Call Shpt with Y = 6 to set up bytes 5-8 in the ship
2909529093
\ \ lines space, aborting the call to LL9 if the dot is
@@ -29158,9 +29156,9 @@ ENDMACRO
2915829156
\ \ bytes define a horizontal 4-pixel dash, for either the
2915929157
\ \ top or the bottom of the ship's dot
2916029158
\
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)
2916229160
\
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)
2916429162
\INY
2916529163
\STA (XX19),Y
2916629164

@@ -29178,7 +29176,7 @@ ENDMACRO
2917829176

2917929177
\ --- Mod: Code removed for flicker-free ships: ------->
2918029178

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)
2918229180
\STA (XX19),Y
2918329181
\
2918429182
\ADC #3 \ Set A = screen x-coordinate of the ship dot + 3
@@ -29194,7 +29192,7 @@ ENDMACRO
2919429192
\ \ nono will actually return us from the original call
2919529193
\ \ to LL9, thus aborting the entire drawing process
2919629194
\
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)
2919829196
\DEY
2919929197
\STA (XX19),Y
2920029198
\
@@ -31854,7 +31852,7 @@ ENDMACRO
3185431852
STA XX15+4 \ from the XX3 heap into XX15+4
3185531853

3185631854
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
3185831856

3185931857
LDA XX3+2,X \ Fetch the y_lo coordinate of the edge's end vertex
3186031858
STA XX12 \ from the XX3 heap into XX12
@@ -32139,10 +32137,10 @@ ENDMACRO
3213932137
.LL146
3214032138

3214132139
\ 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:
3214632144
\
3214732145
\ X1 = XX15
3214832146
\ Y1 = XX15+1
@@ -34473,6 +34471,7 @@ ENDMACRO
3447334471
\ Category: Moving
3447434472
\ Summary: Rotate the planet or sun's location in space by the amount of
3447534473
\ pitch and roll of our ship
34474+
\ Deep dive: Rotating the universe
3447634475
\
3447734476
\ ------------------------------------------------------------------------------
3447834477
\

0 commit comments

Comments
 (0)