/[projet1]/users/chema/TINE/main.s
Defence Force logotype

Contents of /users/chema/TINE/main.s

Parent Directory Parent Directory | Revision Log Revision Log


Revision 181 - (show annotations)
Sun Dec 27 21:17:04 2009 UTC (10 years, 5 months ago) by Chema
File size: 2854 byte(s)
More bug hunting and adjustments. Added a loop based on a VIA timer to try to make the random generator more random (check main.s)

Pirates now target you or other ships randomly, creating more private encounters.

Changed the time HUD messages are on display.

Also added correct normals for splinters.
1 #include "main.h"
2
3
4 #define _hires $ec33
5 ;#define _text $ec21
6 ;#define _ping $fa9f
7 ;#define _shoot $fab5
8 ;#define _zap $fae1
9 ;#define _explode $facb
10 ;#define _kbdclick1 $fb14
11 ;#define _kbdclick2 $fb2a
12
13 ;#define _cls $ccce
14 ;#define _lores0 $d9ed
15 ;#define _lores1 $d9ea
16
17
18 .zero
19 ;*= $50
20
21 ;ap .dsb 2
22 ;fp .dsb 2
23 sp .dsb 2
24 tmp0 .dsb 2
25 tmp1 .dsb 2
26 tmp2 .dsb 2
27 tmp3 .dsb 2
28 tmp4 .dsb 2
29 tmp5 .dsb 2
30 tmp6 .dsb 2
31 tmp7 .dsb 2
32 op1 .dsb 2
33 op2 .dsb 2
34 tmp .dsb 2
35 ;reg0 .dsb 2
36 ;reg1 .dsb 2
37 ;reg2 .dsb 2
38 ;reg3 .dsb 2
39 ;reg4 .dsb 2
40 ;reg5 .dsb 2
41 ;reg6 .dsb 2
42 ;reg7 .dsb 2
43
44 #define via_t1cl $0304
45
46
47 .text
48
49 ; Main procedure.
50
51 _main
52 .(
53
54 jsr InitSound
55 lda #<osdk_stack
56 sta sp
57 lda #>osdk_stack
58 sta sp+1
59
60 jsr _switch_ovl ; Activate overlay ram
61 jsr _init_disk
62 jsr LoadOverlay
63
64 jsr _init_irq_routine
65 jsr _init_tine
66 jsr _init_print
67
68 restart
69 jsr _init_screen
70 jsr _init_screen2
71
72 ldx #$ff
73 stx player_in_control
74 stx _docked
75 stx _planet_dist
76
77 jsr InitPlayerPos
78 jsr InitPlayerShip
79
80 jsr _DoubleBuffOff
81
82 ; Loop for initialization of random numbers
83 ldy via_t1cl
84 looprnd
85 jsr _gen_rnd_number
86 dey
87 bne looprnd
88
89
90 lda #SCR_INFO
91 sta _current_screen
92 jsr _displayinfo
93
94
95 jsr _TineLoop
96
97 jsr _DoubleBuffOff
98 jsr save_frame
99
100 jmp restart
101 ;rts
102 .)
103
104 base0 .word $5a4a
105 base1 .word $0248
106 base2 .word $b753
107 galcount .byt 0
108
109
110 InitPlayerPos
111 .(
112 ; Update galaxy and planet based on player's position
113 ; Setup seed for galaxy 1
114 ldx #5
115 loop
116 lda base0,x
117 sta _base0,x
118 dex
119 bpl loop
120
121 ; Init seed
122 jsr _init_rand
123
124 ; Go to current galaxy
125 ldx _galaxynum
126 dex
127 beq donegal
128 stx galcount
129 ldx #1
130 stx _galaxynum
131 loop2
132 jsr _enter_next_galaxy
133 dec galcount
134 bne loop2
135 donegal
136
137 ; And now go to current planet
138 lda _currentplanet
139 sta _dest_num
140 jsr _infoplanet
141 jsr _makesystem
142 jmp _jump
143 ;rts
144 .)
145
146
147 #define OVERLAY_INIT 100
148
149 ;Number of sectors to read: Just the original tables and the models now
150
151 #define NUM_SECT_OVL 15+4+17
152
153 LoadOverlay
154 .(
155 ; Sector to read
156 lda #OVERLAY_INIT
157 ldy #0
158 sta (sp),y
159 tya
160 iny
161 sta (sp),y
162
163 ; Address of buffer
164 iny
165 lda #<$c000
166 sta (sp),y
167 lda #>$c000
168 iny
169 sta (sp),y
170
171 lda #NUM_SECT_OVL
172 sta tmp
173 loop
174 jsr _sect_read
175 jsr inc_disk_params
176
177 dec tmp
178 bne loop
179 rts
180 .)
181
182
183 ; Routine to increment disk reading/writting parameters
184 inc_disk_params
185 .(
186
187 ; Increment address in 256 bytes
188 ldy #3
189 lda (sp),y
190 clc
191 adc #1
192 sta (sp),y
193
194 ; Increment sector to read
195 ldy #0
196 lda (sp),y
197 clc
198 adc #1
199 sta (sp),y
200 iny
201 lda (sp),y
202 adc #0
203 sta (sp),y
204
205 rts
206
207 .)
208
209
210
211
212
213
214
215
216
217
218

  ViewVC Help
Powered by ViewVC 1.1.26