
PAGE 01    DAI FIRMWARE 2E316-2E406  V1.0  Rev.1

002                         ORG   :E316
003                 *
004                 *
005                 *
006                 *******************
007                 * SET CURSOR MODE *
008                 *******************
009                 *
010                 * The format of cursor info is 1 byte cursor type
011                 * and 1 byte of information.
012                 * If the type = 0, the cursor flashes in colour.
013                 * The info is a mask which is exored with the
014                 * colour byte for that character to flash it.
015                 * If the type = 1, the cursor alternates between
016                 * the actual character and the one in the info.
017                 *
018                 * If flash entry is never called, cursor will be
019                 * steady in the alternate colour (type 0) or per-
020                 * manently the alternate character (type 1).
021                 *
022                 * Entry: HL points to new cursor info.
023                 * Exit:  All registers preserved.
024                 *
025 E316 F5         SCURM   PUSH  PSW
026 E317 C5                 PUSH  B
027 E318 D5                 PUSH  D
028 E319 E5                 PUSH  H
029 E31A 3A9D00             LDA   :009D     Get current screen mode
030 E31D 1F                 RAR             Char mode ?
031 E31E DC6BE3             CC    :E36B     Then delete current cursor
032 E321 7E                 MOV   A,M       Get new cursor type
033 E322 327400             STA   :0074     Store it in pointer
034 E325 23                 INX   H
035 E326 7E                 MOV   A,M       Get new cursor info
036 E327 327500             STA   :0075     Store it in pointer
037                             
038                 * Entry from CURSET:
039                             
040 E32A DC44E3     SCM10   CC    :E344     Flash cursor once if in
041                                         char mode
042 E32D C338E1             JMP   :E138     Popall, ret
043                 *
044                 **************
045                 * SET CURSOR *
046                 **************
047                 *
048                 * Sets some cursor on the screen. Does not delete
049                 * a previous cursor. The screen must already be
050                 * in a character mode.
051                 * Gets the contents of the cursor position address
052                 * and stores it in the pointers.
053                 *
054                 * Entry: HL: Address new cursor position.
055                 * Exit:  All registers preserved.
056                 *
057 E330 F5         CURSET  PUSH  PSW
058 E331 C5                 PUSH  B
059 E332 D5                 PUSH  D
060 E333 E5                 PUSH  H
061 E334 E5                 PUSH  H
062 E335 56                 MOV   D,M       Get contents addr pointed at
063                                         by new cursor

PAGE 02    DAI FIRMWARE 2E316-2E406  V1.0  Rev.1

064 E336 2B                 DCX   H
065 E337 2B                 DCX   H
066 E338 2B                 DCX   H
067 E339 5E                 MOV   E,M       Get colour byte of this addr
068 E33A E1                 POP   H
069 E33B CD8DD6             CALL  :D68D     Store contents and colour
070                                         byte in cursor pointers
071 E33E 00                 NOP 
072 E33F 00                 NOP 
073 E340 37                 STC             CY=1
074 E341 C32AE3             JMP   :E32A     Flash cursor, popall, ret
075                 *
076                 ****************
077                 * FLASH CURSOR *
078                 ****************
079                 *
080                 * Flashes the cursor once if in char mode,
081                 * otherwise does nothing.
082                 *
083                 * Entry: None.
084                 * Exit:  All registers preserved.
085                 *
086                 *SCURI
087 E344 F5         CURFL   PUSH  PSW
088 E345 E5                 PUSH  H
089 E346 2A7200             LHLD  :0072     Get cursor pos addr
090 E349 7C                 MOV   A,H
091 E34A B5                 ORA   L         Check if addr is 0000
092 E34B CA5DE3             JZ    :E35D     Abort if no cursor
093 E34E 3A7400             LDA   :0074     Get cursor type
094 E351 B7                 ORA   A         Check type
095 E352 3A7500             LDA   :0075     Get cursor info
096 E355 C260E3             JNZ   :E360     Jump if char type
097                             
098                 * If 'colour' type:
099                             
100 E358 2B                 DCX   H         )
101 E359 2B                 DCX   H         ) Get addr colour byte
102 E35A 2B                 DCX   H         )
103 E35B AE                 XRA   M         Exor mask with colour byte
104 E35C 77         CFL05   MOV   M,A       And reload colour byte
105 E35D E1         CFL10   POP   H
106 E35E F1                 POP   PSW
107 E35F C9                 RET 
108                             
109                 * If 'char' type:
110                             
111 E360 BE         CFL20   CMP   M         Check contents screen loc
112 E361 77         CFL30   MOV   M,A       Move cursor info in loc
113 E362 C25DE3             JNZ   :E35D     Abort if contents screen
114                                         loc is changed now
115 E365 3A7700             LDA   :0077     Else: get contents scrn loc
116 E368 C35CE3             JMP   :E35C     Store it in this loc
117                 *
118                 *****************
119                 * DELETE CURSOR *
120                 *****************
121                 *
122                 * Deletes the current cursor. Loads the address
123                 * pointed at by the cursor with the data stored
124                 * in RAM (0076/77).
125                 * Routine valid for character modes only.

PAGE 03    DAI FIRMWARE 2E316-2E406  V1.0  Rev.1

126                 *
127                 * Entry: None.
128                 * Exit:  All registers preserved.
129                 *
130 E36B F5         CURDEL  PUSH  PSW
131 E36C C5                 PUSH  B
132 E36D D5                 PUSH  D
133 E36E E5                 PUSH  H
134 E36F 2A7600             LHLD  :0076     Get contents cursor loc
135 E372 EB                 XCHG            in DE
136 E373 2A7200             LHLD  :0072     Get cursor pos addr
137 E376 E5                 PUSH  H         Save it on stack
138 E377 210000             LXI   H,:0000
139 E37A 227200             SHLD  :0072     Move cursor to addr 0000
140 E37D E1                 POP   H         Restore cursor pos addr
141 E37E 7C                 MOV   A,H
142 E37F B5                 ORA   L         Check if addr is 0000
143 E380 CA88E3             JZ    :E388     Abort if no cursor
144 E383 72                 MOV   M,D       Load data into screen loc
145                                         pointed at by cursor
146 E384 2B                 DCX   H
147 E385 2B                 DCX   H
148 E386 2B                 DCX   H
149 E387 73                 MOV   M,E       Load colourbyte into loc
150                                         pointed at
151 E388 C338E1     CDL10   JMP   :E138     Popall, ret
152                 *
153                 ***************************
154                 * GET CHARACTER FROM LINE *
155                 ***************************
156                 *
157                 * Returns a character from some position on
158                 * the current line.
159                 *
160                 * Entry: C: Line position of required character.
161                 *           (max. legal value = 219).
162                 * Exit:  A: Required character (car.ret if at
163                 *           or past cursor).
164                 *        BCDEHLF preserved.
165                 *
166 E38B C5         SFETC   PUSH  B
167 E38C D5                 PUSH  D
168 E38D E5                 PUSH  H
169 E38E F5                 PUSH  PSW
170 E38F 218600             LXI   H,:0086   Total nr. of bytes/line
171 E392 3A7B00             LDA   :007B     Get number extended lines
172 E395 CD46EB             CALL  :EB46     Calc total nr of bytes
173                                         (HL=A*HL)
174 E398 EB                 XCHG            in DE
175 E399 2A7800             LHLD  :0078     Get addr line mode byte
176                                         current line
177 E39C 19                 DAD   D         Calc start of line on screen
178 E39D 11EAFF             LXI   D,:FFEA
179 E3A0 19                 DAD   D         End indent area
180 E3A1 EB                 XCHG            in DE
181 E3A2 3EF9               MVI   A,:F9     1st bytes on line not
182                                         useable
183 E3A4 81                 ADD   C         Add pos of required char on
184                                         line
185 E3A5 F5                 PUSH  PSW
186 E3A6 0600               MVI   B,:00
187 E3A8 D2B2E3             JNC   :E3B2     Jump if in 1st 7 positions

PAGE 04    DAI FIRMWARE 2E316-2E406  V1.0  Rev.1

188 E3AB 05                 DCR   B
189 E3AC D635       SFC10   SUI   :35       60 useable positions/line
190 E3AE 04                 INR   B         Count nr of extended lines
191 E3AF D2ACE3             JNC   :E3AC     Jump if not on this line
192 E3B2 78         SFC20   MOV   A,B       Nr of extensions in A
193 E3B3 21E4FF             LXI   H,:FFE4   Nr of not used bytes/line
194 E3B6 CD46EB             CALL  :EB46     ) Add-ons for line ends
195 E3B9 19                 DAD   D         )
196 E3BA F1                 POP   PSW       Restore pos of char on line
197 E3BB 5F                 MOV   E,A       into E
198 E3BC 3F                 CMC 
199 E3BD 9F                 SBB   A
200 E3BE 57                 MOV   D,A       D=char.count - nr of idents
201 E3BF EB                 XCHG
202 E3C0 29                 DAD   H         Pos *2 due to colour bytes
203 E3C1 EB                 XCHG
204 E3C2 CDF2E6             CALL  :E6F2     Calc pos of reqd char
205 E3C5 EB                 XCHG            Addr in DE
206 E3C6 2A7200             LHLD  :0072     Get cursor pos addr
207 E3C9 CDFBE6             CALL  :E6FB     Compare it with addr of char
208 E3CC 3E0D               MVI   A,:0D     Car.ret in A
209 E3CE D2D2E3             JNC   :E3D2     If on or after cursor
210 E3D1 1A                 LDAX  D         Get character from line
211 E3D2 67         SFC30   MOV   H,A       Save it temporarily
212 E3D3 F1                 POP   PSW       Restore flags
213 E3D4 7C                 MOV   A,H       Get character in A
214 E3D5 E1                 POP   H
215 E3D6 D1                 POP   D
216 E3D7 C1                 POP   B
217 E3D8 C9                 RET 
218                 *
219                 ***************
220                 * CHANGE MODE *
221                 ***************
222                 *
223                 * Change the mode of the screen.
224                 *
225                 * Entry: A: Code new mode.
226                 * Exit:  ABCDEHL preserved.
227                 *        CY=0: OK.
228                 *        CY=1: Insufficient room for mode.
229                 *
230 E3D9 37         SSETM   STC             CY=1
231 E3DA F5                 PUSH  PSW
232 E3DB C5                 PUSH  B
233 E3DC D5                 PUSH  D
234 E3DD E5                 PUSH  H
235 E3DE FEFF               CPI   :FF       Mode 0 ?
236 E3E0 CC07E4             CZ    :E407     Then set up mode 0 screen
237 E3E3 C43EE4             CNZ   :E43E     Else: Set up screen for
238                                         other modes
239 E3E6 DA04E4             JC    :E404     Jump if no room available
240 E3E9 2A8E00             LHLD  :008E     Get end of screen
241 E3EC D5                 PUSH  D
242 E3ED 111000             LXI   D,:0010   Nr of bytes in trailer
243 E3F0 19                 DAD   D         Get 1st addr trailer area
244 E3F1 D1                 POP   D         Get addr 1st colour
245 E3F2 060F               MVI   B,:0F     Depth of blank
246 E3F4 CDFCE5             CALL  :E5FC     Init trailer area
247 E3F7 2A8400             LHLD  :0084     Get 1st free byte
248 E3FA B7                 ORA   A         Set flags on scrn mode byte
249 E3FB CDA6E5             CALL  :E5A6     Perform mem. management

PAGE 05    DAI FIRMWARE 2E316-2E406  V1.0  Rev.1

250 E3FE 329D00             STA   :009D     Store current screen mode
251 E401 C32EE1             JMP   :E12E     Popall (CY=0), ret
252                             
253                 * If error:
254                             
255 E404 C338E1     STM10   JMP   :E138     Popall (CY=1), ret
256                 *
257                 *
258                 *
262 E407                    END 
 
***************************
* S Y M B O L   T A B L E *
***************************
 
CDL10  E388   CFL05  E35C   CFL10  E35D   CFL20  E360   
CFL30  E361   CURDEL E36B   CURFL  E344   CURSET E330   
SCM10  E32A   SCURI  E344   SCURM  E316   SFC10  E3AC   
SFC20  E3B2   SFC30  E3D2   SFETC  E38B   SSETM  E3D9   
STM10  E404
