
PAGE 01    DAI FIRMWARE 2E000-2E1FC  V1.0  Rev.1

002                         ORG   :E000
003                 *
004                 *
005                 *
006                 *   ======================
007                 *** SCREEN DRIVING PACKAGE ***
008                 *   ======================
009                 *
010                 * Called by RST 5; DATA XX. XX indicates the
011                 * offset of E000 for the different entrypoints.
012                 *
013                 ***************
014                 * ENTRYPOINTS *
015                 ***************
016                 *
017                 * Screen functions:
018                             
019 E000 C3C3E0     ZSINIT  JMP   :E0C3     Initialise screen
020 E003 C302E1     ZSOUTC  JMP   :E102     Output one character
021 E006 C337E2     ZSCLT   JMP   :E237     Set text colours
022 E009 C379E2     ZSCUS   JMP   :E279     Set cursor position
023 E00C C3CCE2     ZSCUA   JMP   :E2CC     Ask cursor position and
024                                         size character screen
025 E00F C316E3     ZSCUM   JMP   :E316     Set cursor mode
026 E012 C344E3     ZSCUI   JMP   :E344     Flash cursor
027 E015 C38BE3     ZSFETC  JMP   :E38B     Get character from line
028 E018 C3D9E3     ZSMODE  JMP   :E3D9     Change mode
029 E01B C3A4E6     ZSCLG   JMP   :E6A4     Set graphics colours
030 E01E C310E7     ZSDOT   JMP   :E710     Draw a dot on the screen
031 E021 C31BE7     ZSDRAW  JMP   :E71B     Draw a line on the screen
032 E024 C318E8     ZSFILL  JMP   :E818     Fill a rectangular area
033 E027 C384E8     ZSCRN   JMP   :E884     Ask colour of a point on the
034                                         screen and the size of the
035                                         graphics screen
036                 * Edit functions:
037                             
038 E02A C3F4EB     ZEDIT   JMP   :EBF4     Initialise editor
039 E02D C31EEC     ZEDOB   JMP   :EC1E     Run edit command
040                 *
041                 *************************
042                 * CONSTANT TABLE MODE 0 *
043                 *************************
044                 *
045                 * These constant tables are moved into the screen
046                 * variables in RAM (0084-0098) when the appropriate
047                 * mode is entered.
048                 *
049                 * Except the last 4 data blocks, all values
050                 * are offset from the screen top address (BFFF for
051                 * a 48K machine). This is valid for all modes.
052                 *
053 E030 B00C       CON0    DBL   :0CB0     First free RAM byte
054 E032 0000               DBL   :0000     Top of rolled area
055 E034 0000               DBL   :0000     End graphics area
056 E036 1000               DBL   :0010     Start character area
057 E038 A00C               DBL   :0CA0     End character area
058 E03A B00C               DBL   :0CB0     End screen
059 E03C 0000               DBL   :0000     End area used splitting mode
060 E03E 0000               DBL   :0000     Start archive save area
061                 *
062 E040 0000               DBL   :0000     Number of blobs horizontally
063 E042 00                 DATA  :00       Number of lines of graphics

PAGE 02    DAI FIRMWARE 2E000-2E1FC  V1.0  Rev.1

064 E043 00                 DATA  :00       Number saved graphics lines
065 E044 00                 DATA  :00       Number of bytes/line
066                 *
067                 ****************************
068                 * CONSTANT TABLE MODES 1/2 *
069                 ****************************
070                 *
071 E045 3806       CON1    DBL   :0638     First free RAM byte
072 E047 3001               DBL   :0130     Top area rolled up for mode
073 E049 2806               DBL   :0628     End graphics area
074 E04B 2806               DBL   :0628     CHS (dummy)
075 E04D 6008               DBL   :0860     End character area
076 E04F 3806               DBL   :0638     End screen
077 E051 4807               DBL   :0748     End area used splitting mode
078 E053 4007               DBL   :0740     Start graphic archive area
079                 *
080 E055 4800               DBL   :0048     Number of blobs horizontally
081 E057 41                 DATA  :41       Number of lines of graphics
082 E058 0C                 DATA  :0C       Number archive area lines
083 E059 18                 DATA  :18       Number of bytes/line
084                 *
085                 ******************************
086                 * CONSTANT TABLE MODES 1A/2A *
087                 ******************************
088                 *
089 E05A 6008       CON1A   DBL   :0860     First free RAM byte
090 E05C 3001               DBL   :0130     Top of rolled area
091 E05E 0805               DBL   :0508     End graphics area
092 E060 1805               DBL   :0518     Start character area
093 E062 3007               DBL   :0730     End character area
094 E064 4007               DBL   :0740     End screen
095 E066 4807               DBL   :0748     End area used splitting mode
096 E068 2806               DBL   :0628     Start graph temp save area
097                 *
098 E06A 4800               DBL   :0048     Number of blobs horizontally
099 E06C 41                 DATA  :41       Number of lines of graphics
100 E06D 0C                 DATA  :0C       Number saved graphics lines
101 E06E 18                 DATA  :18       Number of bytes/line
102                 *
103                 ****************************
104                 * CONSTANT TABLE MODES 3/4 *
105                 ****************************
106                 *
107 E06F 7C17       CON3    DBL   :177C     First free RAM byte
108 E071 6004               DBL   :0460     Top area rolled up
109 E073 6C17               DBL   :176C     End graphics area
110 E075 6C17               DBL   :176C     CHS (dummy)
111 E077 A419               DBL   :19A4     End character area
112 E079 7C17               DBL   :177C     End screen
113 E07B BC1B               DBL   :1BBC     End area used splitting mode
114 E07D 5415               DBL   :1554     Start graph archive area
115                 *
116 E07F A000               DBL   :00A0     Number of blobs horizontally
117 E081 82                 DATA  :82       Number of lines of graphics
118 E082 18                 DATA  :18       Number archive area lines
119 E083 2E                 DATA  :2E       Number of bytes/line
120                 *
121                 ******************************
122                 * CONSTANT TABLE MODES 3A/4A *
123                 ******************************
124                 *
125 E084 A419       CON3A   DBL   :19A4     First free RAM byte

PAGE 03    DAI FIRMWARE 2E000-2E1FC  V1.0  Rev.1

126 E086 6004               DBL   :0460     Top of rolled area
127 E088 1C13               DBL   :131C     End graphics area
128 E08A 2C13               DBL   :132C     Start character area
129 E08C 4415               DBL   :1544     End character area
130 E08E 5415               DBL   :1554     End screen
131 E090 BC1B               DBL   :1BBC     End area used splitting mode
132 E092 6C17               DBL   :176C     Start graph temp save area
133                 *
134 E094 A000               DBL   :00A0     Number of blobs horizontally
135 E096 82                 DATA  :82       Number of lines of graphics
136 E097 18                 DATA  :18       Number saved graphics lines
137 E098 2E                 DATA  :2E       Number of bytes/line
138                 *
139                 ****************************
140                 * CONSTANT TABLE MODES 5/6 *
141                 ****************************
142                 *
143 E099 205A       CON5    DBL   :5A20     First free RAM byte
144 E09B 880F               DBL   :0F88     Top area rolled up
145 E09D 105A               DBL   :5A10     End graphics area
146 E09F 105A               DBL   :5A10     CHS (dummy)
147 E0A1 485C               DBL   :5C48     End character area
148 E0A3 205A               DBL   :5A20     End screen
149 E0A5 8869               DBL   :6988     End area used splitting mode
150 E0A7 D04C               DBL   :4CD0     Start graph archive area
151                 *
152 E0A9 5001               DBL   :0150     Number of blobs horizontally
153 E0AB 00                 DATA  :00       Number of lines of graphics
154 E0AC 2C                 DATA  :2C       Number saved graphics lines
155 E0AD 5A                 DATA  :5A       Number of bytes/line
156                 *
157                 ******************************
158                 * CONSTANT TABLE MODES 5A/6A *
159                 ******************************
160                 *
161 E0AE 485C       CON5A   DBL   :5C48     First free RAM byte
162 E0B0 880F               DBL   :0F88     Top of rolled area
163 E0B2 984A               DBL   :4A98     End graphics area
164 E0B4 A84A               DBL   :4AA8     Start character area
165 E0B6 C04C               DBL   :4CC0     End character area
166 E0B8 D04C               DBL   :4CD0     End screen
167 E0BA 8869               DBL   :6988     End area used splitting mode
168 E0BC 105A               DBL   :5A10     Start graph temp save area
169                 *
170 E0BE 5001               DBL   :0150     Number of blobs horizontally
171 E0C0 00                 DATA  :00       Number of lines of graphics
172 E0C1 2C                 DATA  :2C       Number saved graphics lines
173 E0C2 5A                 DATA  :5A       Number of bytes/line
174                 *
175                 *********************
176                 * INITIALISE SCREEN *
177                 *********************
178                 *
179                 * The screen is initialised into all character
180                 * format (mode 0), and the cursor mode is set
181                 * and it is positioned in the top left corner.
182                 * The normal mode set routine is used (memory
183                 * management routine).
184                 *
185                 * This is the only time the package is told the
186                 * startaddress of the screen. The colour format
187                 * is as for SCOLT, SCOLG. The cursor format is

PAGE 04    DAI FIRMWARE 2E000-2E1FC  V1.0  Rev.1

188                 * as for SCURM.
189                 *
190                 * Entry: HL: Top location screen RAM.
191                 *        DE: Points to list with initialisation
192                 *            parameters (start at C7E0).
193                 * Exit:  All registers maybe corrupted.
194                 *
195 E0C3 228000     SINIT   SHLD  :0080     Store startaddr screen
196 E0C6 D5                 PUSH  D
197 E0C7 11F0FF             LXI   D,:FFF0
198 E0CA 19                 DAD   D
199 E0CB 228200             SHLD  :0082     Set top of screen
200 E0CE E1                 POP   H
201 E0CF AF                 XRA   A
202 E0D0 329D00             STA   :009D     Select mode 1
203 E0D3 CD16E3             CALL  :E316     Set cursor type + info
204 E0D6 23                 INX   H
205 E0D7 23                 INX   H
206 E0D8 CD37E2             CALL  :E237     Init. colours COLORT
207 E0DB 3D                 DCR   A
208 E0DC 329D00             STA   :009D     Select mode 0
209 E0DF 110400             LXI   D,:0004
210 E0E2 19                 DAD   D         Get addr COLORG parameters
211 E0E3 CDA4E6             CALL  :E6A4     Init. colours COLORG
212 E0E6 19                 DAD   D         Get addr screen management
213                                         parameters
214 E0E7 5E                 MOV   E,M       )
215 E0E8 23                 INX   H         ) Get addr screen management
216 E0E9 56                 MOV   D,M       ) routine
217 E0EA 23                 INX   H
218 E0EB EB                 XCHG
219 E0EC 22C400             SHLD  :00C4     Store addr SMKRM
220 E0EF EB                 XCHG
221 E0F0 5E                 MOV   E,M       ) Get addr emergency
222 E0F1 23                 INX   H         ) stop routine
223 E0F2 56                 MOV   D,M       )
224 E0F3 EB                 XCHG
225 E0F4 22C600             SHLD  :00C6     Store addr em.stop routine
226 E0F7 3E10               MVI   A,:10
227 E0F9 329D00             STA   :009D     Select init. screen mode
228                                         (no text, no graphics)
229 E0FC 3EFF               MVI   A,:FF
230 E0FE CDD9E3             CALL  :E3D9     Set up screen for mode 0
231 E101 C9                 RET 
232                 *
233                 ********************************
234                 * OUTPUT A CHARACTER TO SCREEN *
235                 ********************************
236                 *
237                 * Displays one character on the screen.
238                 *
239                 * Entry: A: Character to be displayed.
240                 * Exit:  ABCDEHL preserved.
241                 *        CY=1: Character ignored.
242                 *
243 E102 37         SOUTC   STC             CY=1
244 E103 F5                 PUSH  PSW
245 E104 C5                 PUSH  B
246 E105 D5                 PUSH  D
247 E106 E5                 PUSH  H
248 E107 CD1CE2             CALL  :E21C     Change to char mode if
249                                         not yet done

PAGE 05    DAI FIRMWARE 2E000-2E1FC  V1.0  Rev.1

250 E10A 2A7200             LHLD  :0072     Get cursor position
251 E10D CD6BE3             CALL  :E36B     Delete cursor
252 E110 FE0D               CPI   :0D       Car.ret ?
253 E112 CA3DE1             JZ    :E13D     Then print it
254 E115 FE0C               CPI   :0C       Form feed ?
255 E117 CA59E1             JZ    :E159     Then clear screen
256 E11A FE08               CPI   :08       Backspace ?
257 E11C CA66E1             JZ    :E166     Then cancell last character
258 E11F F5                 PUSH  PSW
259 E120 3A7A00             LDA   :007A     Get addr last byte on line
260 E123 BD                 CMP   L         Reached ?
261 E124 CAA9E1             JZ    :E1A9     Then extend lines
262 E127 F1         OTC05   POP   PSW
263 E128 77                 MOV   M,A       Put char on screen
264 E129 2B                 DCX   H
265 E12A 2B                 DCX   H         Points to next screen loc
266 E12B CD30E3     OTC10   CALL  :E330     Put cursor on screen
267                 *
268                 *OTC20
269 E12E E1         XRCC    POP   H
270 E12F D1                 POP   D
271 E130 C1                 POP   B
272 E131 F1                 POP   PSW
273 E132 3F                 CMC             CY=0: char accepted
274 E133 C9                 RET 
275                             
276                 * If character not accepted:
277                             
278 E134 F1         OTC25   POP   PSW
279 E135 CD30E3     OTC26   CALL  :E330     Put cursor on screen
280 E138 E1         XRET    POP   H
281 E139 D1                 POP   D
282 E13A C1                 POP   B
283 E13B F1                 POP   PSW       CY=1: char ignored
284 E13C C9                 RET 
285                             
286                 * If carriage return:
287                             
288 E13D 2A7800     OTC30   LHLD  :0078     Get startaddr current line
289 E140 EB                 XCHG            in DE
290 E141 217AFF             LXI   H,:FF7A
291 E144 19                 DAD   D         Get startaddr next line
292 E145 EB                 XCHG            in DE
293 E146 2A8C00             LHLD  :008C     Get end char area
294 E149 CDFBE6             CALL  :E6FB     Check if end is reached
295 E14C EB                 XCHG            Next line mode byte in HL
296 E14D CCCBE1             CZ    :E1CB     If end reached: scroll up
297                                         one line
298 E150 CCFDE1             CZ    :E1FD     and init. this line with
299                                         blanks
300 E153 CD87E6     OTC35   CALL  :E687     Cursor on begin next line
301 E156 C32EE1             JMP   :E12E     Quit; char accepted
302                             
303                 * If form feed:
304                             
305 E159 2A8C00     OTC40   LHLD  :008C     Get end character area
306 E15C EB                 XCHG            in DE
307 E15D 2A8A00             LHLD  :008A     Get start character area
308 E160 CDFDE1             CALL  :E1FD     Init screen with spaces
309 E163 C353E1             JMP   :E153     Cursor top left corner of
310                                         char area; popall; ret
311                             

PAGE 06    DAI FIRMWARE 2E000-2E1FC  V1.0  Rev.1

312                 * If backspace:
313                             
314 E166 EB         OTC50   XCHG            Cursor position in DE
315 E167 2A7800             LHLD  :0078     Get startaddr current line
316 E16A 01F8FF             LXI   B,:FFF8   Left border width
317 E16D 09                 DAD   B         Get addr 1st char on line
318 E16E CDFBE6             CALL  :E6FB     Cursor at begin of line?
319 E171 EB                 XCHG
320 E172 CA35E1             JZ    :E135     Then ignore char; abort
321 E175 23                 INX   H         ) Cursor one location
322 E176 23                 INX   H         ) backwards
323 E177 3620               MVI   M,:20     Load space in this location
324 E179 3A7B00             LDA   :007B     Get number of extended lines
325 E17C B7                 ORA   A
326 E17D CA2BE1             JZ    :E12B     If no cont line: put cursor
327                                         on screen
328 E180 FA2BE1             JM    :E12B     If char accepted: put
329                                         cursor on screen
330                             
331                 * Backspace on a continuation line:
332                             
333 E183 D5                 PUSH  D         Save addr 1st byte on line
334                                         on stack
335 E184 EB                 XCHG            HL is cursor position
336 E185 01F2FF             LXI   B,:FFF2
337 E188 09                 DAD   B         HL = end indent area
338 E189 CDFBE6             CALL  :E6FB     Compare DE-HL
339 E18C EB                 XCHG
340 E18D D1                 POP   D
341 E18E C22BE1             JNZ   :E12B     If not there: put cursor on
342                                         screen; quit, char accepted
343 E191 EB                 XCHG
344 E192 3620               MVI   M,:20     Else cancel cont char (C)
345 E194 217B00             LXI   H,:007B
346 E197 35                 DCR   M         Decr. number extended lines
347 E198 2A7800             LHLD  :0078     Get startaddr current line
348 E19B 118600             LXI   D,:0086
349 E19E 19                 DAD   D         Pnts to start previous line
350 E19F CD98E6             CALL  :E698     Store addr line mode byte as
351                                         current one and set last
352                                         byte on that line
353 E1A2 1180FF             LXI   D,:FF80
354 E1A5 19                 DAD   D
355 E1A6 C32BE1             JMP   :E12B     Put cursor on screen; quit,
356                                         char accepted
357                             
358                 * If end of line is reached:
359                             
360 E1A9 3A7B00     OTC80   LDA   :007B     Get number extended lines
361 E1AC FE03               CPI   :03       Max (3) reached ?
362 E1AE D234E1             JNC   :E134     Then put cursor on screen,
363                                         ret
364 E1B1 3C                 INR   A         Incr. number ext. lines
365 E1B2 47                 MOV   B,A       Store it in B
366 E1B3 3E0D               MVI   A,:0D
367 E1B5 CD02E1             CALL  :E102     Output car.ret
368 E1B8 78                 MOV   A,B
369 E1B9 327B00             STA   :007B     Update nr ext. lines
370 E1BC 2A7200             LHLD  :0072     Get cursor position addr
371 E1BF CD6BE3             CALL  :E36B     Delete cursor
372 E1C2 3643               MVI   M,:43     Print 'C' at left of line
373 E1C4 11F2FF             LXI   D,:FFF2

PAGE 07    DAI FIRMWARE 2E000-2E1FC  V1.0  Rev.1

374 E1C7 19                 DAD   D         Indent 6 pos
375 E1C8 C327E1             JMP   :E127     Store char on new pos; put
376                                         cursor on screen
377                 *
378                 *************
379                 * SCROLLING *
380                 *************
381                 *
382                 * Scrolls up text area. Moves the character area of
383                 * the screen up one line.
384                 * Only the characters are moved, not the control and
385                 * colour bytes.
386                 *
387                 * Entry: None.
388                 * Exit:  AF preserved, BC corrupted.
389                 *        DE: End of bottom line.
390                 *        HL: Start of bottom line.
391                 *
392 E1CB 017AFF     SCROLL  LXI   B,:FF7A   -86 (length one line)
393                             
394                 * Entry from Edit:
395                 * Scroll screen for number of positions given in
396                 * BC (-2 = 1 position left):
397                             
398 E1CE F5         SCR10   PUSH  PSW
399 E1CF 2A8A00             LHLD  :008A     Get startaddr character area
400 E1D2 54                 MOV   D,H       ) and store it in DE
401 E1D3 5D                 MOV   E,L       )
402 E1D4 09                 DAD   B         Get addr line mode byte
403                                         next line
404 E1D5 EB                 XCHG            in DE
405 E1D6 01F8FF     SCR20   LXI   B,:FFF8
406 E1D9 09                 DAD   B         Get 1st useable location
407                                         on 1st line
408 E1DA EB                 XCHG            in DE
409 E1DB 09                 DAD   B         Get 1st useable location
410                                         on 2nd line
411 E1DC EB                 XCHG            in DE; 1st line in HL
412 E1DD 063C               MVI   B,:3C     max 60 characters
413 E1DF 1A         SCR30   LDAX  D         Get char from 2nd line
414 E1E0 77                 MOV   M,A       and move it to 1st line
415 E1E1 1B                 DCX   D
416 E1E2 1B                 DCX   D         Next char 2nd line
417 E1E3 2B                 DCX   H
418 E1E4 2B                 DCX   H         Next loc 1st line
419 E1E5 05                 DCR   B
420 E1E6 C2DFE1             JNZ   :E1DF     Next char to be moved 1 line
421 E1E9 01FAFF             LXI   B,:FFFA
422 E1EC 09                 DAD   B         Get addr line mode byte
423                                         2nd line
424 E1ED EB                 XCHG            in DE
425 E1EE 09                 DAD   B         Get addr line mode byte
426                                         3rd line
427 E1EF EB                 XCHG            in DE; 2nd line in HL
428 E1F0 E5                 PUSH  H
429 E1F1 2A8C00             LHLD  :008C     Get addr end character area
430 E1F4 CDFBE6             CALL  :E6FB     Check if end reached
431 E1F7 E1                 POP   H
432 E1F8 DAD6E1             JC    :E1D6     If not at end: scroll next
433                                         line
434 E1FB F1                 POP   PSW
435 E1FC C9                 RET 

PAGE 08    DAI FIRMWARE 2E000-2E1FC  V1.0  Rev.1

436                 *
437                 *
438                 *
442 E1FD                    END 
 
***************************
* S Y M B O L   T A B L E *
***************************
 
CON0   E030   CON1   E045   CON1A  E05A   CON3   E06F   
CON3A  E084   CON5   E099   CON5A  E0AE   OTC05  E127   
OTC10  E12B   OTC20  E12E   OTC25  E134   OTC26  E135   
OTC30  E13D   OTC35  E153   OTC40  E159   OTC50  E166   
OTC80  E1A9   SCR10  E1CE   SCR20  E1D6   SCR30  E1DF   
SCROLL E1CB   SINIT  E0C3   SOUTC  E102   XRCC   E12E   
XRET   E138   ZEDIT  E02A   ZEDOB  E02D   ZSCLG  E01B   
ZSCLT  E006   ZSCRN  E027   ZSCUA  E00C   ZSCUI  E012   
ZSCUM  E00F   ZSCUS  E009   ZSDOT  E01E   ZSDRAW E021   
ZSFETC E015   ZSFILL E024   ZSINIT E000   ZSMODE E018   
ZSOUTC E003
