-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSYSTEM.X68
267 lines (212 loc) · 4.72 KB
/
SYSTEM.X68
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
*-----------------------------------------------------------
* Title :
* Written by :
* Date :
* Description:
*-----------------------------------------------------------
SYSTEM_INIT:
;INT OFF
ORI.W #%0000011100000000, SR
;INSTALL
MOVE.L #UPDATE_KEYS, (TRAPBASE+(4*TKEYS))
MOVE.L #UPDRNG, (TRAPBASE+(4*TRNG))
MOVE.L #ISRSCREEN, (INTBASE+(4*7))
MOVE.L #RESETPRIO, (INTBASE+(4*6))
MOVE.L #HEARTBSV, (INTBASE+(4*5))
MOVE.L #EXCADDRES, ($0C)
MOVE.L #IRQTRACE, ($24)
;CONFIGURE
;ISRSCREEN
MOVE.B #32, D0
MOVE.B #6, D1
MOVE.B #$87, D2
MOVE.L #SCREEN_UPTIME, D3
TRAP #15
;RESETPRIO
MOVE.B #$86, D2
MOVE.L #RESETPRIOMS, D3
TRAP #15
;HEARTBSV
MOVE.B #$85, D2
MOVE.L #HBEATRATE, D3
TRAP #15
;INT ON
IFNE DGBTRACE
ORI.W #$8000, SR ;TRACE
ENDC
ANDI.W #%1111100011111111, SR
;ENABLE
MOVE.B #32, D0
MOVE.B #5, D1
TRAP #15
;CIERRA ARCHIVOS BUGFIX?
JSR CLOSEFILES
;ESTABLECE LA SEMILLA
MOVE.B #8, D0
TRAP #15
MOVE.L D1, (RNGVAL)
;CONFIGURE SCREEN
MOVE.B #33, D0
MOVE.L #SCREEN_WIDTH*$10000+SCREEN_HEIGHT, D1
TRAP #15
IFEQ DGB_NODBUF
MOVE.B #92, D0 ;dbuf
MOVE.B #17, D1
TRAP #15
ENDC
BSR SET_SCROLL_TEXT
JSR LOAD_SAVE
JSR START_CLIENT
;CIERRA ARCHIVOS BUGFIX?
JSR CLOSEFILES
MOVE.W #-1, (CURRENTTXTID)
MOVE.W SR, -(SP) ;PASA A USUARIO
ANDI.W #$DFFF, (SP) ;D8FF
RTE
UPDRNG:
;ACTUALIZA RNGVAL
;UTILIZA UN LFSR
;TRAP #14
MOVEM.L D0-D2, -(SP)
MOVE.L (RNGVAL), D0
MOVE.L D0, D1
MOVE.L D0, D2
LSR.L #2, D2
EOR.L D2, D1
MOVE.L D0, D2
LSR.L #3, D2
EOR.L D2, D1
MOVE.L D0, D2
LSR.L #5, D2
EOR.L D2, D1
LSR.L #1, D0
BTST.L #0, D1
BEQ .SB
BSET.L #31, D0
.SB:
MOVE.L D0, (RNGVAL)
MOVEM.L (SP)+, D2-D0
RTE
SET_SCROLL_TEXT:
MOVEM.L D0-D2, -(SP)
MOVE.B #21, D0
MOVE.L #WHITE, D1
;MOVE.L #$04060000, D2 ;Example: D2.L = $01090005 is Fixedsys, 9 point, Bold Underline 8px
MOVE.L #$04100000, D2
TRAP #15
MOVEM.L (SP)+, D2-D0
RTS
SET_COLOR_TEXT:
; 16(SP).L COLOR
MOVEM.L D0-D2, -(SP)
MOVE.B #21, D0
MOVE.L 16(SP), D1
MOVE.L #$04100000, D2
TRAP #15
MOVEM.L (SP)+, D2-D0
RTS
HEARTBSV:
;HEART BEAT SERVER
;ENVIA PERIODICAMENTE SEÑALES AL SERVER
TST.B (HASBGMSRV)
BNE .END
MOVE.W #CDMHBEAT, -(SP)
JSR SEND_DATA
ADDQ.L #2, SP
.END:
RTE
RESETPRIO:
;REINICIA LA PRIO DE SFX
CLR.B (CURRPRIO)
RTE
EXCADDRES:
MOVEM.L A7-D0, -(SP)
;CLS
MOVE.B #11, D0
MOVE.W #$FF00, D0
TRAP #15
MOVE.B #94, D0
TRAP #15
LEA .EXCADDRESTXT, A0
MOVE.B #13, D0
MOVE.L (A0)+, A1
TRAP #15
MOVE.B #94, D0
TRAP #15
MOVE.B #23, D0
MOVE.L #150, D1
TRAP #15
MOVE.B #16, D2
MOVE.W #15, D7
.REGLOOP:
MOVE.B #14, D0
MOVE.L (A0)+, A1
TRAP #15
ADDQ.B #1, D0
MOVE.L (SP)+, D1
TRAP #15
SUBQ.B #1, D0
LEA .LFCR, A1
TRAP #15
DBRA D7, .REGLOOP
;SP
MOVE.L (A0)+, A1
MOVE.L A1, A2
MOVE.W #6, D7
.SPLOOP:
MOVE.B #14, D0
MOVE.L A2, A1
TRAP #15
ADDQ.B #1, D0
MOVE.W (SP)+, D1
EXT.L D1
TRAP #15
SUBQ.B #1, D0
LEA .LFCR, A1
TRAP #15
DBRA D7, .SPLOOP
MOVE.B #94, D0
TRAP #15
;NO HAY NADA QUE PODAMOS HACER
;SI NO ES UNA "BONUS" ROOM...
SIMHALT
.EXCADDRESTXT: DC.L .ERR, .D0, .D1, .D2, .D3, .D4, .D5, .D6, .D7
DC.L .A0, .A1, .A2, .A3, .A4, .A5, .A6, .A7, .SP
.ERR: DC.B 'ADDRESS ERROR',0
.D0: DC.B 'D0: ',0
.D1: DC.B 'D1: ',0
.D2: DC.B 'D2: ',0
.D3: DC.B 'D3: ',0
.D4: DC.B 'D4: ',0
.D5: DC.B 'D5: ',0
.D6: DC.B 'D6: ',0
.D7: DC.B 'D7: ',0
.A0: DC.B 'A0: ',0
.A1: DC.B 'A1: ',0
.A2: DC.B 'A2: ',0
.A3: DC.B 'A3: ',0
.A4: DC.B 'A4: ',0
.A5: DC.B 'A5: ',0
.A6: DC.B 'A6: ',0
.A7: DC.B 'A7: ',0
.AD: DC.B 'AC AD: ',0
.IR: DC.B 'IR: ',0
.PC: DC.B 'PC: ',0
.SP: DC.B 'SP: ',0
.LFCR: DC.B LF,CR,0
DS.W 0
.LASTPC: DS.L 1
IRQTRACE:
MOVE.L .PCTRACE3, .PCTRACE4
MOVE.L .PCTRACE2, .PCTRACE3
MOVE.L .PCTRACE1, .PCTRACE2
MOVE.L 2(SP), .PCTRACE1
RTE
.PCTRACE1: DS.L 1
.PCTRACE2: DS.L 1
.PCTRACE3: DC.L 1
.PCTRACE4: DC.L 1
*~Font name~Courier New~
*~Font size~10~
*~Tab type~1~
*~Tab size~4~