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