-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathelite-source-common.asm
6373 lines (4647 loc) · 205 KB
/
elite-source-common.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
; ******************************************************************************
;
; NES ELITE GAME SOURCE (COMMON VARIABLES)
;
; NES Elite was written by Ian Bell and David Braben and is copyright D. Braben
; and I. Bell 1991/1992
;
; The code in this file has been reconstructed from a disassembly of the version
; released on Ian Bell's personal website at http://www.elitehomepage.org/
;
; The commentary is copyright Mark Moxon, and any misunderstandings or mistakes
; in the documentation are entirely my fault
;
; The terminology and notations used in this commentary are explained at
; https://elite.bbcelite.com/terminology
;
; The deep dive articles referred to in this commentary can be found at
; https://elite.bbcelite.com/deep_dives
;
; ------------------------------------------------------------------------------
;
; This source file contains variables, macros and addresses that are shared by
; all eight ROM banks in NES Elite.
;
; ******************************************************************************
INCLUDE "1-source-files/main-sources/elite-build-options.asm"
_NTSC = (_VARIANT = 1)
_PAL = (_VARIANT = 2)
; ******************************************************************************
;
; Configuration variables
;
; ******************************************************************************
CODE% = $8000 ; The address where the code will be run
LOAD% = $8000 ; The address where the code will be loaded
Q% = _MAX_COMMANDER ; Set Q% to TRUE to max out the default commander, FALSE
; for the standard default commander
NOST = 20 ; The number of stardust particles in normal space (this
; goes down to 3 in witchspace)
NOSH = 8 ; The maximum number of ships in our local bubble of
; universe
NTY = 33 ; The number of different ship types
MSL = 1 ; Ship type for a missile
SST = 2 ; Ship type for a Coriolis space station
ESC = 3 ; Ship type for an escape pod
PLT = 4 ; Ship type for an alloy plate
OIL = 5 ; Ship type for a cargo canister
AST = 7 ; Ship type for an asteroid
SPL = 8 ; Ship type for a splinter
SHU = 9 ; Ship type for a Shuttle
CYL = 11 ; Ship type for a Cobra Mk III
ANA = 14 ; Ship type for an Anaconda
HER = 15 ; Ship type for a rock hermit (asteroid)
COPS = 16 ; Ship type for a Viper
SH3 = 17 ; Ship type for a Sidewinder
KRA = 19 ; Ship type for a Krait
ADA = 20 ; Ship type for an Adder
WRM = 23 ; Ship type for a Worm
CYL2 = 24 ; Ship type for a Cobra Mk III (pirate)
ASP = 25 ; Ship type for an Asp Mk II
THG = 29 ; Ship type for a Thargoid
TGL = 30 ; Ship type for a Thargon
CON = 31 ; Ship type for a Constrictor
COU = 32 ; Ship type for a Cougar
DOD = 33 ; Ship type for a Dodecahedron ("Dodo") space station
JL = ESC ; Junk is defined as starting from the escape pod
JH = SHU+2 ; Junk is defined as ending before the Cobra Mk III
;
; So junk is defined as the following: escape pod,
; alloy plate, cargo canister, asteroid, splinter,
; Shuttle or Transporter
PACK = SH3 ; The first of the eight pack-hunter ships, which tend
; to spawn in groups. With the default value of PACK the
; pack-hunters are the Sidewinder, Mamba, Krait, Adder,
; Gecko, Cobra Mk I, Worm and Cobra Mk III (pirate)
POW = 15 ; Pulse laser power in the NES version is POW + 9,
; rather than just POW in the other versions (all other
; lasers are the same)
Mlas = 50 ; Mining laser power
Armlas = INT(128.5 + 1.5*POW) ; Military laser power
NI% = 38 ; The number of bytes in each ship's data block (as
; stored in INWK and K%)
NIK% = 42 ; The number of bytes in each block in K% (as each block
; contains four extra bytes)
X = 128 ; The centre x-coordinate of the space view
Y = 72 ; The centre y-coordinate of the space view
RE = $3E ; The obfuscation byte used to hide the recursive tokens
; table from crackers viewing the binary code
VE = $57 ; The obfuscation byte used to hide the extended tokens
; table from crackers viewing the binary code
LL = 29 ; The length of lines (in characters) of justified text
; in the extended tokens system
W2 = 3 ; The horizontal character spacing in the scroll text
; (i.e. the difference in x-coordinate between the
; left edges of adjacent characters in words)
WY = 1 ; The vertical spacing between points in the scroll text
; grid for each character
W2Y = 3 ; The vertical line spacing in the scroll text (i.e. the
; difference in y-coordinate between the tops of the
; characters in adjacent lines)
YPAL = 6 AND _PAL ; A margin of 6 pixels that is applied to a number of
; y-coordinates for the PAL version only (as the PAL
; version has a taller screen than NTSC)
; ******************************************************************************
;
; NES PPU registers
;
; ******************************************************************************
PPU_CTRL = $2000 ; The PPU control register, which allows us to choose
; which nametable and pattern table is being displayed,
; and to toggle the NMI interrupt at VBlank
PPU_MASK = $2001 ; The PPU mask register, which controls how sprites and
; the tile background are displayed
PPU_STATUS = $2002 ; The PPU status register, which can be checked to see
; whether VBlank has started, and whether sprite 0 has
; been hit (so we can detect when the icon bar is being
; drawn)
OAM_ADDR = $2003 ; The OAM address port (this is not used in Elite)
OAM_DATA = $2004 ; The OAM data port (this is not used in Elite)
PPU_SCROLL = $2005 ; The PPU scroll position register, which is used to
; scroll the leftmost tile on each row around to the
; right
PPU_ADDR = $2006 ; The PPU address register, which is used to set the
; destination address within the PPU when sending data
; to the PPU
PPU_DATA = $2007 ; The PPU data register, which is used to send data to
; the PPU, to the address specified in PPU_ADDR
OAM_DMA = $4014 ; The OAM DMA register, which is used to initiate a DMA
; transfer of sprite data to the PPU
PPU_PATT_0 = $0000 ; The address of pattern table 0 in the PPU
PPU_PATT_1 = $1000 ; The address of pattern table 1 in the PPU
PPU_NAME_0 = $2000 ; The address of nametable 0 in the PPU
PPU_ATTR_0 = $23C0 ; The address of attribute table 0 in the PPU
PPU_NAME_1 = $2400 ; The address of nametable 1 in the PPU
PPU_ATTR_1 = $27C0 ; The address of attribute table 1 in the PPU
; ******************************************************************************
;
; NES CPU registers (I/O and sound)
;
; ******************************************************************************
SQ1_VOL = $4000 ; The APU duty cycle and volume register for square wave
; channel 1
SQ1_SWEEP = $4001 ; The APU sweep control register for square wave channel
; 1
SQ1_LO = $4002 ; The APU period register (low byte) for square wave
; channel 1
SQ1_HI = $4003 ; The APU period register (high byte) for square wave
; channel 1
SQ2_VOL = $4004 ; The APU duty cycle and volume register for square wave
; channel 2
SQ2_SWEEP = $4005 ; The APU sweep control register for square wave channel
; 2
SQ2_LO = $4006 ; The APU period register (low byte) for square wave
; channel 2
SQ2_HI = $4007 ; The APU period register (high byte) for square wave
; channel 2
TRI_LINEAR = $4008 ; The APU linear counter register for the triangle wave
; channel
TRI_LO = $400A ; The APU period register (low byte) for the triangle
; wave channel
TRI_HI = $400B ; The APU period register (high byte) for the triangle
; wave channel
NOISE_VOL = $400C ; The APU volume register for the noise channel
NOISE_LO = $400E ; The APU period register (low byte) for the noise
; channel
NOISE_HI = $400F ; The APU period register (high byte) for the noise
; channel
DMC_FREQ = $4010 ; Controls the IRQ flag, loop flag and frequency of the
; DMC channel (this is not used in Elite)
DMC_RAW = $4011 ; Controls the DAC on the DMC channel (this is not used
; in Elite)
DMC_START = $4012 ; Controls the start adddress on the DMC channel (this
; is not used in Elite)
DMC_LEN = $4013 ; Controls the sample length on the DMC channel (this is
; not used in Elite)
SND_CHN = $4015 ; The APU sound channel register, which enables
; individual sound channels to be enabled or disabled
JOY1 = $4016 ; The joystick port, with controller 1 mapped to JOY1
; and controller 2 mapped to JOY1 + 1
APU_FC = $4017 ; The APU frame counter control register, which controls
; the triggering of IRQ interrupts for sound generation,
; and the sequencer step mode
; ******************************************************************************
;
; Name: ZP
; Type: Workspace
; Address: $0000 to $00FF
; Category: Workspaces
; Summary: Lots of important variables are stored in the zero page workspace
; as it is quicker and more space-efficient to access memory here
;
; ******************************************************************************
ORG $0000
.ZP
SKIP 2 ; These bytes appear to be unused
.RAND
SKIP 4 ; Four 8-bit seeds for the random number generation
; system implemented in the DORND routine
.T1
SKIP 1 ; Temporary storage, used in a number of places
.SC
SKIP 1 ; Screen address (low byte)
;
; Elite draws on-screen by poking bytes directly into
; screen memory, and SC(1 0) is typically set to the
; address of the character block containing the pixel
; we want to draw
.SCH
SKIP 1 ; Screen address (high byte)
.XX1
SKIP 0 ; This is an alias for INWK that is used in the main
; ship-drawing routine at LL9
.INWK
SKIP 36 ; The zero-page internal workspace for the current ship
; data block
;
; As operations on zero page locations are faster and
; have smaller opcodes than operations on the rest of
; the addressable memory, Elite tends to store oft-used
; data here. A lot of the routines in Elite need to
; access and manipulate ship data, so to make this an
; efficient exercise, the ship data is first copied from
; the ship data blocks at K% into INWK (or, when new
; ships are spawned, from the blueprints at XX21)
.NEWB
SKIP 1 ; The ship's "new byte flags" (or NEWB flags)
;
; Contains details about the ship's type and associated
; behaviour, such as whether they are a trader, a bounty
; hunter, a pirate, currently hostile, in the process of
; docking, inside the hold having been scooped, and so
; on. The default values for each ship type are taken
; from the table at E%
SKIP 1 ; This byte appears to be unused
.P
SKIP 3 ; Temporary storage, used in a number of places
.XC
SKIP 1 ; The x-coordinate of the text cursor (i.e. the text
; column), which can be from 0 to 32
;
; A value of 0 denotes the leftmost column and 32 the
; rightmost column, but because the top part of the
; screen (the space view) has a border box that
; clashes with columns 0 and 32, text is only shown
; in columns 1-31
.hiddenColour
SKIP 1 ; Contains the colour to use for pixels that are hidden
; in palette 0, e.g. $0F for black
;
; See the SetPaletteForView routine for details
.visibleColour
SKIP 1 ; Contains the colour to use for pixels that are visible
; in palette 0, e.g. $2C for cyan
;
; See the SetPaletteForView routine for details
.paletteColour2
SKIP 1 ; Contains the colour to use for palette entry 2 in the
; current (non-space) view
;
; See the SetPaletteForView routine for details
.paletteColour3
SKIP 1 ; Contains the colour to use for palette entry 3 in the
; current (non-space) view
;
; See the SetPaletteForView routine for details
.fontStyle
SKIP 1 ; The font style to use when printing text:
;
; * 1 = normal font
;
; * 2 = highlight font
;
; * 3 = green text on a black background (colour 3 on
; background colour 0)
;
; Style 3 is used when printing characters into 2x2
; attribute blocks where printing the normal font would
; result in the wrong colour text being shown
.nmiTimer
SKIP 1 ; A counter that gets decremented each time the NMI
; interrupt is called, starting at 50 and counting down
; to zero, at which point it jumps back up to 50 again
; and triggers an increment of (nmiTimerHi nmiTimerLo)
;
; On PAL system there are 50 frames per second, so this
; means nmiTimer ticks down from 50 once a second, so
; (nmiTimerHi nmiTimerLo) counts up in seconds
;
; On NTSC there are 60 frames per second, so nmiTimer
; counts down in 5/6 of a second, or 0.8333 seconds,
; so (nmiTimerHi nmiTimerLo) counts up every 0.8333
; seconds
.nmiTimerLo
SKIP 1 ; Low byte of a counter that's incremented by 1 every
; time nmiTimer wraps
;
; On PAL systems (nmiTimerHi nmiTimerLo) counts seconds
;
; On NTSC it increments up every 0.8333 seconds
.nmiTimerHi
SKIP 1 ; High byte of a counter that's incremented by 1 every
; time nmiTimer wraps
;
; On PAL systems (nmiTimerHi nmiTimerLo) counts seconds
;
; On NTSC it increments up every 0.8333 seconds
.YC
SKIP 1 ; The y-coordinate of the text cursor (i.e. the text
; row), which can be from 0 to 23
;
; The screen actually has 31 character rows if you
; include the dashboard, but the text printing routines
; only work on the top part (the space view), so the
; text cursor only goes up to a maximum of 23, the row
; just before the screen splits
;
; A value of 0 denotes the top row, but because the
; top part of the screen has a border box that clashes
; with row 0, text is always shown at row 1 or greater
.QQ17
SKIP 1 ; Contains a number of flags that affect how text tokens
; are printed, particularly capitalisation:
;
; * If all bits are set (255) then text printing is
; disabled
;
; * Bit 7: 0 = ALL CAPS
; 1 = Sentence Case, bit 6 determines the
; case of the next letter to print
;
; * Bit 6: 0 = print the next letter in upper case
; 1 = print the next letter in lower case
;
; * Bits 0-5: If any of bits 0-5 are set, print in
; lower case
;
; So:
;
; * QQ17 = 0 means case is set to ALL CAPS
;
; * QQ17 = %10000000 means Sentence Case, currently
; printing upper case
;
; * QQ17 = %11000000 means Sentence Case, currently
; printing lower case
;
; * QQ17 = %11111111 means printing is disabled
.K3
SKIP 0 ; Temporary storage, used in a number of places
.XX2
SKIP 14 ; Temporary storage, used to store the visibility of the
; ship's faces during the ship-drawing routine at LL9
.K4
SKIP 2 ; Temporary storage, used in a number of places
.XX16
SKIP 18 ; Temporary storage for a block of values, used in a
; number of places
.XX0
SKIP 2 ; Temporary storage, used to store the address of a ship
; blueprint. For example, it is used when we add a new
; ship to the local bubble in routine NWSHP, and it
; contains the address of the current ship's blueprint
; as we loop through all the nearby ships in the main
; flight loop
.INF
SKIP 2 ; Temporary storage, typically used for storing the
; address of a ship's data block, so it can be copied
; to and from the internal workspace at INWK
.V
SKIP 2 ; Temporary storage, typically used for storing an
; address pointer
.XX
SKIP 2 ; Temporary storage, typically used for storing a 16-bit
; x-coordinate
.YY
SKIP 2 ; Temporary storage, typically used for storing a 16-bit
; y-coordinate
.BETA
SKIP 1 ; The current pitch angle beta, which is reduced from
; JSTY to a sign-magnitude value between -8 and +8
;
; This describes how fast we are pitching our ship, and
; determines how fast the universe pitches around us
;
; The sign bit is also stored in BET2, while the
; opposite sign is stored in BET2+1
.BET1
SKIP 1 ; The magnitude of the pitch angle beta, i.e. |beta|,
; which is a positive value between 0 and 8
.QQ22
SKIP 2 ; The two hyperspace countdown counters
;
; Before a hyperspace jump, both QQ22 and QQ22+1 are
; set to 15
;
; QQ22 is an internal counter that counts down by 1
; each time TT102 is called, which happens every
; iteration of the main game loop. When it reaches
; zero, the on-screen counter in QQ22+1 gets
; decremented, and QQ22 gets set to 5 and the countdown
; continues (so the first tick of the hyperspace counter
; takes 15 iterations to happen, but subsequent ticks
; take 5 iterations each)
;
; QQ22+1 contains the number that's shown on-screen
; during the countdown. It counts down from 15 to 1, and
; when it hits 0, the hyperspace engines kick in
.ECMA
SKIP 1 ; The E.C.M. countdown timer, which determines whether
; an E.C.M. system is currently operating:
;
; * 0 = E.C.M. is off
;
; * Non-zero = E.C.M. is on and is counting down
;
; The counter starts at 32 when an E.C.M. is activated,
; either by us or by an opponent, and it decreases by 1
; in each iteration of the main flight loop until it
; reaches zero, at which point the E.C.M. switches off.
; Only one E.C.M. can be active at any one time, so
; there is only one counter
.ALP1
SKIP 1 ; Magnitude of the roll angle alpha, i.e. |alpha|,
; which is a positive value between 0 and 31
.ALP2
SKIP 2 ; Bit 7 of ALP2 = sign of the roll angle in ALPHA
;
; Bit 7 of ALP2+1 = opposite sign to ALP2 and ALPHA
.XX15
SKIP 0 ; Temporary storage, typically used for storing screen
; coordinates in line-drawing routines
;
; There are six bytes of storage, from XX15 TO XX15+5.
; The first four bytes have the following aliases:
;
; X1 = XX15
; Y1 = XX15+1
; X2 = XX15+2
; Y2 = XX15+3
;
; These are typically used for describing lines in terms
; of screen coordinates, i.e. (X1, Y1) to (X2, Y2)
;
; The last two bytes of XX15 do not have aliases
.X1
SKIP 1 ; Temporary storage, typically used for x-coordinates in
; the line-drawing routines
.Y1
SKIP 1 ; Temporary storage, typically used for y-coordinates in
; line-drawing routines
.X2
SKIP 1 ; Temporary storage, typically used for x-coordinates in
; the line-drawing routines
.Y2
SKIP 1 ; Temporary storage, typically used for y-coordinates in
; line-drawing routines
SKIP 2 ; The last two bytes of the XX15 block
.XX12
SKIP 6 ; Temporary storage for a block of values, used in a
; number of places
.K
SKIP 4 ; Temporary storage, used in a number of places
.iconBarKeyPress
SKIP 1 ; The button number of an icon bar button if an icon bar
; button has been chosen
;
; This gets set along with the key logger, copying the
; value from iconBarChoice (the latter gets set in the
; NMI handler with the icon bar button number, so
; iconBarKeyPress effectively latches the value from
; iconBarChoice)
.QQ15
SKIP 6 ; The three 16-bit seeds for the selected system, i.e.
; the one in the crosshairs in the Short-range Chart
.K5
SKIP 0 ; Temporary storage used to store segment coordinates
; across successive calls to BLINE, the ball line
; routine
.XX18
SKIP 4 ; Temporary storage used to store coordinates in the
; LL9 ship-drawing routine
.K6
SKIP 5 ; Temporary storage, typically used for storing
; coordinates during vector calculations
.BET2
SKIP 2 ; Bit 7 of BET2 = sign of the pitch angle in BETA
;
; Bit 7 of BET2+1 = opposite sign to BET2 and BETA
.DELTA
SKIP 1 ; Our current speed, in the range 1-40
.DELT4
SKIP 2 ; Our current speed * 64 as a 16-bit value
;
; This is stored as DELT4(1 0), so the high byte in
; DELT4+1 therefore contains our current speed / 4
.U
SKIP 1 ; Temporary storage, used in a number of places
.Q
SKIP 1 ; Temporary storage, used in a number of places
.R
SKIP 1 ; Temporary storage, used in a number of places
.S
SKIP 1 ; Temporary storage, used in a number of places
.T
SKIP 1 ; Temporary storage, used in a number of places
.XSAV
SKIP 1 ; Temporary storage for saving the value of the X
; register, used in a number of places
.YSAV
SKIP 1 ; Temporary storage for saving the value of the Y
; register, used in a number of places
.XX17
SKIP 1 ; Temporary storage, used in BPRNT to store the number
; of characters to print, and as the edge counter in the
; main ship-drawing routine
.QQ11
SKIP 1 ; This contains the type of the current view (or, if
; we are changing views, the type of the view we are
; changing to)
;
; The low nibble determines the view, as follows:
;
; 0 = $x0 = Space view
; 1 = $x1 = Title screen
; 2 = $x2 = Mission 1 briefing: rotating ship
; 3 = $x3 = Mission 1 briefing: ship and text
; 4 = $x4 = Game Over screen
; 5 = $x5 = Text-based mission briefing
; 6 = $x6 = Data on System
; 7 = $x7 = Inventory
; 8 = $x8 = Status Mode
; 9 = $x9 = Equip Ship
; 10 = $xA = Market Price
; 11 = $xB = Save and Load
; 12 = $xC = Short-range Chart
; 13 = $xD = Long-range Chart
; 14 = $xE = Unused
; 15 = $xF = Start screen
;
; The high nibble contains four configuration bits, as
; follows:
;
; * Bit 4 clear = do not load the normal font
; Bit 4 set = load the normal font into patterns
; 66 to 160 (or 68 to 162 for views
; $9D and $DF)
;
; * Bit 5 clear = do not load the highlight font
; Bit 5 set = load the highlight font into
; patterns 161 to 255
;
; * Bit 6 clear = icon bar
; Bit 6 set = no icon bar (rows 27-28 are blank)
;
; * Bit 7 clear = dashboard (icon bar on row 20)
; Bit 7 set = no dashboard (icon bar on row 27)
;
; The normal font is colour 1 on background colour 0
; (typically white or cyan on black)
;
; The highlight font is colour 3 on background colour 1
; (typically green on white)
;
; Most views have the same configuration every time
; the view is shown, but $x0 (space view), $xB (Save and
; load), $xD (Long-range Chart) and $xF (Start screen)
; can have different configurations at different times
;
; Note that view $FF is an exception, as no fonts are
; loaded for this view, despite bits 4 and 5 being set
; (this view represents the blank screen between the end
; of the Title screen and the start of the demo scroll
; text)
;
; Also, view $BB (Save and load with the normal and
; highlight fonts loaded) displays the normal font as
; colour 1 on background colour 2 (white on red)
;
; Finally, views $9D (Long-range Chart) and $DF (Start
; screen) load the normal font into patterns 68 to 162,
; rather than 66 to 160
;
; The complete list of view types is therefore:
;
; $00 = Space view
; No fonts loaded, dashboard
;
; $10 = Space view
; Normal font loaded, dashboard
;
; $01 = Title screen
; No fonts loaded, dashboard
;
; $92 = Mission 1 briefing: rotating ship
; Normal font loaded, no dashboard
;
; $93 = Mission 1 briefing: ship and text
; Normal font loaded, no dashboard
;
; $C4 = Game Over screen
; No fonts loaded, no dashboard or icon bar
;
; $95 = Text-based mission briefing
; Normal font loaded, no dashboard
;
; $96 = Data on System
; Normal font loaded, no dashboard
;
; $97 = Inventory
; Normal font loaded, no dashboard
;
; $98 = Status Mode
; Normal font loaded, no dashboard
;
; $B9 = Equip Ship
; Normal and highlight fonts loaded, no
; dashboard
;
; $BA = Market Price
; Normal and highlight fonts loaded, no
; dashboard
;
; $8B = Save and Load
; No fonts loaded, no dashboard
;
; $BB = Save and Load
; Normal and highlight fonts loaded, special
; colours for the normal font, no dashboard
;
; $9C = Short-range Chart
; Normal font loaded, no dashboard
;
; $8D = Long-range Chart
; No fonts loaded, no dashboard
;
; $9D = Long-range Chart
; Normal font loaded, no dashboard
;
; $CF = Start screen
; No fonts loaded, no dashboard or icon bar
;
; $DF = Start screen
; Normal font loaded, no dashboard or icon bar
;
; $FF = Segue screen from Title screen to Demo
; No fonts loaded, no dashboard or icon bar
;
; In terms of fonts, then, these are the only options:
;
; * No font is loaded
;
; * The normal font is loaded
;
; * The normal and highlight fonts are loaded
;
; * The normal and highlight fonts are loaded, with
; special colours for the normal font
.QQ11a
SKIP 1 ; Contains the old view type when changing views
;
; When we change view, QQ11 gets set to the new view
; number straight away while QQ11a stays set to the old
; view type, only updating to the new view type once
; the new view has appeared
.ZZ
SKIP 1 ; Temporary storage, typically used for distance values
.XX13
SKIP 1 ; Temporary storage, typically used in the line-drawing
; routines
.MCNT
SKIP 1 ; The main loop counter
;
; This counter determines how often certain actions are
; performed within the main loop
.TYPE
SKIP 1 ; The current ship type
;
; This is where we store the current ship type for when
; we are iterating through the ships in the local bubble
; as part of the main flight loop. See the table at XX21
; for information about ship types
.ALPHA
SKIP 1 ; The current roll angle alpha, which is reduced from
; JSTX to a sign-magnitude value between -31 and +31
;
; This describes how fast we are rolling our ship, and
; determines how fast the universe rolls around us
;
; The sign bit is also stored in ALP2, while the
; opposite sign is stored in ALP2+1
.QQ12
SKIP 1 ; Our "docked" status
;
; * 0 = we are not docked
;
; * $FF = we are docked
.TGT
SKIP 1 ; Temporary storage, typically used as a target value
; for counters when drawing explosion clouds and partial
; circles
.FLAG
SKIP 1 ; A flag that's used to define whether this is the first
; call to the ball line routine in BLINE, so it knows
; whether to wait for the second call before storing
; segment data in the ball line heap
.CNT
SKIP 1 ; Temporary storage, typically used for storing the
; number of iterations required when looping
.CNT2
SKIP 1 ; Temporary storage, used in the planet-drawing routine
; to store the segment number where the arc of a partial
; circle should start
.STP
SKIP 1 ; The step size for drawing circles
;
; Circles in Elite are split up into 64 points, and the
; step size determines how many points to skip with each
; straight-line segment, so the smaller the step size,
; the smoother the circle. The values used are:
;
; * 2 for big planets and the circles on the charts
; * 4 for medium planets and the launch tunnel
; * 8 for small planets and the hyperspace tunnel
;
; As the step size increases we move from smoother
; circles at the top to more polygonal at the bottom.
; See the CIRCLE2 routine for more details
.XX4
SKIP 1 ; Temporary storage, used in a number of places
.XX20
SKIP 1 ; Temporary storage, used in a number of places
.XX14
SKIP 1 ; This byte appears to be unused
.RAT
SKIP 1 ; Used to store different signs depending on the current
; space view, for use in calculating stardust movement
.RAT2
SKIP 1 ; Temporary storage, used to store the pitch and roll
; signs when moving objects and stardust
.widget
SKIP 1 ; Temporary storage, used to store the original argument
; in A in the logarithmic FMLTU and LL28 routines
.halfScreenHeight
SKIP 1 ; Half the height of the drawable part of the screen in
; pixels (can be 72, 77 or 104 pixels)
.screenHeight
SKIP 1 ; The height of the drawable part of the screen in
; pixels (can be 144, 154 or 208 pixels)
.Yx2M1