]> git.sur5r.net Git - cc65/blob - asminc/telestrat.inc
Merge pull request #834 from jedeoric/master
[cc65] / asminc / telestrat.inc
1 ;
2 ; Oric TELEMON definition
3 ; TELEMON 2.4 & TELEMON 3.x
4 ; For TELEMON 3.x check http://orix.oric.org
5 ;
6
7 ; ---------------------------------------------------------------------------
8 ; Constants
9
10 SCREEN_XSIZE    = 40            ; Screen columns
11 SCREEN_YSIZE    = 28            ; Screen rows
12
13 FUNCTKEY        = $A5
14
15 FNAME_LEN       = 11            ; Maximum length of file-name
16
17 ; ---------------------------------------------------------------------------
18 ; I/O Identifier
19 ; Theses identifers are used for channel management
20
21
22 XKBD            = $80           ; Keyboard
23 XRSE            = $83           ; RS232 in
24 XSCR            = $88           ; Screen
25 XRSS            = $90           ; RS232 out
26
27 ; ---------------------------------------------------------------------------
28 ; Zero page
29
30 ; ---------------------------------------------------------------------------
31 ; Page 00
32 RES             := $00
33 RESB            := $02
34
35 DECDEB          := $04
36 DECFIN          := $06
37 DECCIB          := $08
38 DECTRV          := $0A
39
40 TR0             := $0C
41 TR1             := $0D
42 TR2             := $0E
43 TR3             := $0F
44 TR4             := $10
45 TR5             := $11
46 TR6             := $12
47 TR7             := $13
48
49 DEFAFF          := $14
50
51 IRQSVA          := $21           ; Used to save A when a BRK call occurs
52 IRQSVX          := $22           ; Used to save X when a BRK call occurs
53 IRQSVY          := $23           ; Used to save Y when a BRK call occurs
54 IRQSVP          := $24           ; Used to save P when a BRK call occurs
55
56 ADSCR           := $26
57 SCRNB           := $28           ; Id of the current window
58
59 ADKBD           := $2A           ; Address ASCII conversion table
60
61
62 PTR_READ_DEST   := $2C           ; Used for XFREAD and XWRITE only in TELEMON 3.x
63
64 ADCLK           := $40           ; Address for clock display
65 TIMEUS          := $42
66 TIMEUD          := $44 
67
68
69 HRSX            := $46
70 HRSY            := $47
71
72 XLPRBI          := $48           ; Printer flag (b7)
73
74 HRSX40          := $49
75 HRSX6           := $4A
76
77 ADHRS           := $4B           ; Hires screen address (word)
78
79 HRS1            := $4D
80 HRS2            := $4F
81 HRS3            := $51
82 HRS4            := $53
83 HRS5            := $55
84
85 HRSFB           := $57
86
87 VABKP1          := $58
88
89 ; RS232T
90 ; b0-b3 : speed 
91 ;         1111 => 19200 bps  (please note that telestrat can't handle this speed without stopping all IRQ except ACIA's one)
92 ;         1100 =>  9600 bps  (default from TELEMON)
93 ;         1110 =>  4800 bps 
94 ;         1010 =>  2400 bps 
95 ;         1000 =>  1200 bps 
96 ;         0111 =>   600 bps 
97 ;         0110 =>   300 bps 
98 ;         0101 =>   150 bps 
99 ;         0010 =>    75 bps 
100
101 ; b4    : 0 external clock, 1 internal clock
102 ; b6-b5 : 00 8 bits
103 ;         01 7 bits
104 ;         10 6 bits
105 ;         11 5 bits
106 ; b7    : 0  a stop  
107
108 RS232T          := $59
109
110 ; RS232C 
111 ; b0-b3 : 0
112 ; b4    : 1 if echo
113 ; b5    : 1 if parity
114 ; b7-b6 : 00 in/out parity odd
115 ;       : 01 on/out parity even
116 ;       : 10 parity sent, answer not tested
117 ;       : 11 SPACE SENT, reception not tested
118
119 RS232C          := $5A
120 INDRS           := $5B
121
122 ACC1E           := $60
123 ACC1M           := $61
124
125 ACC1S           := $65
126
127 FLGMEN          := $68
128 ADMEN           := $69
129
130 FLSVS           := $89
131 FLERR           := $8B
132
133 VARLNG          := $8C
134 VARAPL          := $D0
135
136 ; ---------------------------------------------------------------------------
137 ; Low memory
138 IRQVec          := $02FB        ; "fast" interrupt vector
139
140 ; ---------------------------------------------------------------------------
141 ; I/O locations
142
143 ; 6522
144 .struct VIA                     ; Versatile Interface Adapter
145         .res    $0300
146 PRB     .byte                   ; Port Register B
147 PRA     .byte                   ; Port Register A
148 DDRB    .byte                   ; Data Direction Register B
149 DDRA    .byte                   ; Data Direction Register A
150 T1      .word                   ; Timer 1
151 T1L     .word                   ; Timer 1 Latch
152 T2      .word                   ; Timer 2
153 SR      .byte                   ; Shift Register
154 ACR     .byte                   ; Auxiliary Control Register
155 PCR     .byte                   ; Peripheral Control Register
156 IFR     .byte                   ; Interrupt Flags Register
157 IER     .byte                   ; Interrupt Enable Register
158 PRA2    .byte                   ; Port Register A without handshaking
159 .endstruct
160
161
162 .struct VIA2                    ; Versatile Interface Adapter
163         .res    $0320
164 PRB     .byte                   ; Port Register B
165 PRA     .byte                   ; Port Register A
166 DDRB    .byte                   ; Data Direction Register B
167 DDRA    .byte                   ; Data Direction Register A
168 T1      .word                   ; Timer 1
169 T1L     .word                   ; Timer 1 Latch
170 T2      .word                   ; Timer 2
171 SR      .byte                   ; Shift Register
172 ACR     .byte                   ; Auxiliary Control Register
173 PCR     .byte                   ; Peripheral Control Register
174 IFR     .byte                   ; Interrupt Flags Register
175 IER     .byte                   ; Interrupt Enable Register
176 PRA2    .byte                   ; Port Register A without handshaking
177 .endstruct
178
179 ; 6551
180 .struct ACIA                    ; Asynchronous Communications Interface Adapter
181         .res    $031C
182 DATA    .byte
183 STATUS  .byte
184 CMD     .byte                   ; Command register
185 CTRL    .byte                   ; Control register
186 .endstruct
187
188 SCREEN          := $BB80
189
190
191 ; ---------------------------------------------------------------------------
192 ; ROM entries
193
194 ; TELEMON primitives (2.4 & 3.x)
195
196 ; all values are used to call bank 7 of telestrat cardridge. It works with 'brk value' 
197 XOP0             = $00          ; Open device on channel 0
198 XOP1             = $01          ; Open device on channel 1
199 XOP2             = $02          ; Open device on channel 2
200 XOP3             = $03          ; Open device on channel 3
201
202 XCL0             = $04          ; Close channel 0
203 XCL1             = $05          ; Close channel 1
204 XCL2             = $06          ; Close channel 2
205 XCL3             = $07          ; Close channel 3
206
207 XRD0             = $08
208 XRDW0            = $0C
209
210 XWR0             = $10          ; Write a char in channel 0
211 XWR1             = $11          ; Write a char in channel 1
212 XWR2             = $12          ; Write a char in channel 2
213 XWR3             = $13          ; Write a char in channel 3
214
215 XWSTR0           = $14          ; Write a string in text mode channel 0
216 XWSTR1           = $15          ; Write a string in text mode channel 1
217 XWSTR2           = $16          ; Write a string in text mode channel 2
218 XWSTR3           = $17          ; Write a string in text mode channel 3
219
220 XDECAL           = $18
221
222 XTEXT            = $19
223 XHIRES           = $1A
224 XEFFHI           = $1B          ; Clear hires screen
225 XFILLM           = $1C
226 XMINMA           = $1F
227 XVARS            = $24          ; Only in TELEMON 3.x, in TELEMON 2.4, it's XNOMFI ($24)
228 XCRLF            = $25          ; Jump a line and return to the beginning of the line
229 XDECAY           = $26
230 XFREAD           = $27          ; Only in TELEMON 3.x (bank 7 of Orix)
231 XBINDX           = $28          ; Convert a number into hex and displays on channel 0
232 XDECIM           = $29
233 XHEXA            = $2A          ; Convert a number into hex
234
235 XEDT             = $2D          ; Launch editor
236 XINSER           = $2E
237
238 XSCELG           = $2F          ; Search a line in editor mode
239 XOPEN            = $30          ; Only in TELEMON 3.x (bank 7 of Orix)
240 XECRPR           = $33          ; Displays prompt
241 XCOSCR           = $34          ; Switch off cursor
242 XCSSCR           = $35          ; Switch on cursor
243 XSCRSE           = $36
244 XSCRNE           = $39          ; Load charset from rom to ram
245 XCLOSE           = $3A          ; Only in TELEMON 3.x close file (bank 7 of Orix)
246 XFWRITE          = $3B          ; Only in TELEMON 3.x write file (bank 7 of Orix)
247
248 ; Clock primitive
249 XRECLK           = $3C          ; Reset clock
250 XCLCL            = $3D          ; Close clock
251 XWRCLK           = $3E          ; Displays clock in the adress in A & Y registers
252
253 XSONPS           = $40          ; Send data to PSG register (14 values)
254 XOUPS            = $42          ; Send Oups sound into PSG
255 XPLAY            = $43          ; Play a sound
256 XSOUND           = $44 
257 XMUSIC           = $45 
258 XZAP             = $46          ; Send Zap sound to PSG
259 XSHOOT           = $47
260 XMKDIR           = $4B          ; Create a folder. Only available in TELEMON 3.x (bank 7 of Orix)
261 XRM              = $4D          ; Remove a folder or a file. Only available in TELEMON 3.x (bank 7 of Orix)
262 XGOKBD           = $52
263
264 ; Buffer management
265 XECRBU           = $54          ; Write A or AY in the buffer
266 XLISBU           = $55          ; Read A or AY in the buffer
267 XTSTBU           = $56
268 XVIDBU           = $57          ; Flush the buffer 
269 XINIBU           = $58          ; Initialize the buffer X
270 XDEFBU           = $59          ; Reset all value of the buffer
271 XBUSY            = $5A          ; Test if the buffer is empty
272
273 XMALLOC          = $5B          ; Only in TELEMON 3.x (bank 7 of Orix)
274 XFREE            = $62          ; Only in TELEMON 3.x (bank 7 of Orix)
275 XSOUT            = $67          ; Send accumulator value (A) to RS232, available in TELEMON 2.4 & 3.x : if RS232 buffer is full, the Oric Telestrat freezes
276 XHRSSE           = $8C          ; Set hires position cursor
277 XDRAWA           = $8D          ; Draw a line absolute
278 XDRAWR           = $8E          ; Draw a line (relative)
279 XCIRCL           = $8F          ; Draw a circle
280 XCURSE           = $90          ; Plot a pixel 
281 XCURMO           = $91          ; Move to x,y pos in Hires
282 XPAPER           = $92
283 XINK             = $93
284 XBOX             = $94          ; Draw a box
285 XABOX            = $95
286 XFILL            = $96
287 XCHAR            = $97          ; Display a char on the screen in Hires
288 XSCHAR           = $98          ; Draw a string in hires
289 XEXPLO           = $9C          ; Send Explode sound to PSG
290 XPING            = $9D          ; Send Ping sound to PSG
291
292 ; ---------------------------------------------------------------------------
293 ; ROM entries variables
294
295 PWD_PTR          = $00
296
297 ; ---------------------------------------------------------------------------
298
299 BUFTRV          := $100         
300
301
302 ; ---------------------------------------------------------------------------
303 ; Page $200
304 BNKST            := $200        ; Used to store signature of 8 bank (length : 8 bytes)
305 TABDRV           := $208
306
307 DRVDEF           := $20C
308 FLGTEL           := $20D
309 KOROM            := $20E        ; Used to compute the size of all rom bank. The result is store here. The value is in KB
310 KORAM            := $20F        ; Used to compute the size of all ram bank. The result is store here. The value is in KB
311 ; Time management
312 TIMED            := $210
313 TIMES            := $211
314 TIMEM            := $212
315 TIMEH            := $213
316 FLGCLK           := $214
317 FLGCLK_FLAG      := $215 
318 FLGCUR           := $216        ; Cursor management flag
319 ; screens position managements
320
321 FLGCUR_STATE     := $217        ; Cursor state flag
322
323 ADSCRL           := $218
324 ADSCRH           := $21C
325 SCRX             := $220
326 SCRY             := $224
327
328 SCRDX            := $228
329 SCRFX            := $22C
330 SCRDY            := $230
331 SCRFY            := $234
332 SCRBAL           := $238
333 SCRBAH           := $23C
334 SCRCT            := $240
335 SCRCF            := $244
336 FLGSCR           := $248
337 CURSCR           := $24C
338
339 HARD_COPY_HIRES  := $250        ; Hard copy vector
340
341 SCRTXT           := $256
342 SCRHIR           := $25C
343 SCRTRA           := $262        ; 6 bytes lenfth
344
345 ; Keyboard management
346 KBDCOL           := $268        ; 8 bytes length
347 KBDFLG_KEY       := $270        ; 0 if no key pressed
348 KBDVRR           := $272
349
350 KBDVRL           := $273
351 FLGKBD           := $275
352 KBDFCT           := $276
353 KBDSHT           := $278
354
355 KBDKEY           := $279
356 KBDCTC           := $27E
357 LPRX             := $286
358 LPRY             := $287
359 LPRFX            := $288
360 LPRFY            := $289
361 FLGLPR           := $28A
362
363 ; Joysticks management
364 FLGJCK           := $28C
365 JCGVAL           := $28D
366 JCDVAL           := $28E
367 JCKTAB           := $29D
368
369
370 HRSPAT           := $2AA        ; Hires pattern : it's used to draw pattern for a line or a circle
371 HRSERR           := $2AB
372
373 IOTAB0           := $2AE
374 IOTAB1           := $2B2
375 IOTAB2           := $2B6
376 IOTAB3           := $2BA
377 ADIOB            := $2BE        ; 48 bytes length
378 FLGRST           := $2EE
379 CSRND            := $2EF
380 VNMI             := $2F4
381 ADIODB_VECTOR    := $2f7        ; 3 bytes length
382
383 IRQVECTOR        := $2FA
384 VAPLIC           := $2FD
385
386 ; ---------------------------------------------------------------------------
387 ; Page $400
388 EXBNK            := $40C
389 VEXBNK           := $414
390 BNKCIB           := $417
391
392 ; ---------------------------------------------------------------------------
393 ; Page $500
394
395 DRIVE            := $500
396 ERRNB            := $512
397 SAVES            := $513
398 BUFNOM           := $517
399 VSALO0           := $528
400 VSALO1           := $529
401 FTYPE            := $52C        ; File type
402 DESALO           := $52D
403 FISALO           := $52F
404 EXSALO           := $531
405 EXTDEF           := $55D        ; Default extension. At the start of telemon, it's set to ".COM"
406 BUFEDT           := $590        ; Buffer edition 
407
408 MAX_BUFEDT_LENGTH=110
409
410 ; ---------------------------------------------------------------------------
411 ; Hardware
412 CH376_DATA       := $340
413 CH376_COMMAND    := $341
414
415 ; RAM overlays buffer
416 BUFBUF           := $c080
417
418 ; ---------------------------------------------------------------------------
419 ; Stratsed vectors
420 ; Stratsed is the main OS for Telestrat 
421 XMERGE           := $FF0E
422 XFST             := $FF11
423 XSPUT            := $FF14
424 XSTAKE           := $FF17
425 XTAKE            := $FF20
426 XOPENS           := $FF1A       ; XOPEN from Stratsed
427 XCLOSES          := $FF1D       ; XCLOSE from Stratsed
428 XPUT             := $FF23
429 XREWIN           := $FF29
430 XJUMP            := $FF2C
431 XLGBUF           := $FF2F
432 XERVEC           := $FF32
433 XESAVE           := $FF35
434 XCOPY            := $FF38
435 XDNAME           := $FF3B
436 XSTATU           := $FF3E
437 XUPDAT           := $FF41
438 XFORMA           := $FF44
439 XDELBK           := $FF4A
440 XDELN            := $FF4D
441 XPROT            := $FF50
442 XUNPRO           := $FF53
443 XDIRN            := $FF56
444 XBKP             := $FF59
445 XINITI           := $FF5C
446 XERREU           := $FF5F
447 XLOAD            := $FF62
448 XDEFSA           := $FF65
449 XDEFLO           := $FF68
450 XSAVE            := $FF6B
451 XNOMDE           := $FF6E
452 XCREAY           := $FF71
453 XDETSE           := $FF74
454 XLIBSE           := $FF77
455 XTRVCA           := $FF7A
456 XTRVNM           := $FF7D
457 XTRVNX           := $FF80
458 XBUCA            := $FF86
459 XVBUF1           := $FF89
460 XSVSEC           := $FF8C
461 XSAY             := $FF8F
462 XSBUF1           := $FF92
463 XSBUF2           := $FF95
464 XSBUF3           := $FF98
465 XSCAT            := $FF9B
466 XPRSEC           := $FFA1
467 XPBUF1           := $FFA4
468 XPMAP            := $FFA7
469 XRWTS            := $FFAA
470
471 ; ---------------------------------------------------------------------------
472 ; MACRO 
473
474 .macro  BRK_TELEMON   value
475         .byte $00,value
476 .endmacro