PAGE 01 DAI FIRMWARE 2EDF6-2EFFF V1.1 002 ORG :EDF6 003 * 004 * 005 * 006 **************** 007 * CURSOR RIGHT * 008 **************** 009 * 010 * Moves cursor right one position. 011 * 012 * Exit: ABCDEHL preserved. 013 * CY=0: Cursor not moved. 014 * CY=1: Cursor moved. 015 * 016 EDF6 D5 ECRT PUSH D 017 EDF7 E5 PUSH H 018 EDF8 F5 PUSH PSW 019 EDF9 3AA800 LDA :00A8 Get offset of left side 020 of window 021 EDFC C63B ADI :3B Calc end of window 022 EDFE 6F MOV L,A Result in L 023 EDFF 3AAB00 LDA :00AB Get X-offset of cursor 024 in document 025 EE02 FEFF CPI :FF Max nr char/line reached ? 026 EE04 CADAEC JZ :ECDA Then quit with CY=0 027 EE07 BD CMP L End of window reached ? 028 EE08 CCF8EC CZ :ECF8 Then window right 029 EE0B 3C INR A Incr cursor pos on line 030 EE0C 32AB00 STA :00AB Store X-offset of cursor 031 in document 032 EE0F AF XRA A 033 EE10 32AF00 STA :00AF Clear cursor pos in buffer 034 EE13 2A7200 LHLD :0072 Get cursor pos addr 035 EE16 CD6BE3 CALL :E36B Delete old cursor 036 EE19 C36FED JMP :ED6F Put new cursor on screen; 037 quit with CY=1 038 * 039 ***************************** 040 * SKIP LINES IN EDIT BUFFER * 041 ***************************** 042 * 043 * Entry: HL: Number of lines to be skipped. 044 * Exit: HL: Points to 1st not skipped line. 045 * CY=1: O.K. 046 * CY=0: End of text reached before count 047 * is zero. 048 * ABCDE preserved. 049 * 050 EE1C D5 L2E191 PUSH D 051 EE1D F5 PUSH PSW 052 EE1E EB XCHG Count in DE 053 EE1F 2AA200 LHLD :00A2 Get startaddr editbuf 054 EE22 7A L2E192 MOV A,D ) 055 EE23 B3 ORA E ) Abort with CY=1 if ready 056 EE24 CA33EE JZ :EE33 ) 057 EE27 CD38EE CALL :EE38 Next line 058 EE2A 00 NOP 059 EE2B B7 ORA A 060 EE2C CA34EE JZ :EE34 Abort with CY=0 if end of 061 buffer reached before DE=0 062 EE2F 1B DCX D Count -1 063 EE30 C322EE JMP :EE22 Skip next line PAGE 02 DAI FIRMWARE 2EDF6-2EFFF V1.1 064 EE33 37 L2E193 STC 065 EE34 D1 L2E194 POP D 066 EE35 7A MOV A,D 067 EE36 D1 POP D 068 EE37 C9 RET 069 * 070 ************* 071 * NEXT LINE * 072 ************* 073 * 074 * Entry: HL: points to text, each line ended by 075 * a car.ret, last line followed by 0. 076 * Exit: HL: Points to next line. 077 * A: 0 if end of text reached, else CR. 078 * BCDE preserved. 079 * 080 EE38 7E L2E195 MOV A,M Get char from text 081 EE39 B7 ORA A 082 EE3A CA43EE JZ :EE43 Ready if end of text reached 083 EE3D 23 INX H 084 EE3E FE0D CPI :0D Car.ret ? 085 EE40 C238EE JNZ :EE38 Loop till end of line found 086 EE43 C9 L2E196 RET 087 * 088 **************************************** 089 * FIND CURRENT POSITION IN EDIT BUFFER * 090 **************************************** 091 * 092 * Exit: CY=1: HL: (00AF/AE) = cursor position in 093 * buffer. 094 * CY=0: HL: Points to cursor line in the 095 * edit buffer. 096 * ABCDE preserved. 097 * 098 EE44 2AAE00 L2E197 LHLD :00AE Get pntr to cursor pos 099 in buffer 100 EE47 25 DCR H 101 EE48 24 INR H 102 EE49 37 STC 103 EE4A C0 RNZ Quit (CY=1) if (AF) <> 0 104 EE4B D5 PUSH D 105 EE4C C5 PUSH B 106 EE4D F5 PUSH PSW 107 EE4E 2AAC00 LHLD :00AC Get Y-offset of cursor 108 in document (no lines to 109 be skipped) 110 EE51 54 MOV D,H ) in DE 111 EE52 5D MOV E,L ) 112 EE53 CD1CEE CALL :EE1C Skip lines 113 EE56 22B200 SHLD :00B2 Store pntr to start cursor 114 line in buffer 115 EE59 E5 PUSH H and preserve it 116 EE5A 2AA900 LHLD :00A9 Get offset of top of window 117 EE5D CDF2E6 CALL :E6F2 Calc difference 118 EE60 3E86 MVI A,:86 Length one line 119 EE62 CD46EB CALL :EB46 Calc total length 120 EE65 EB XCHG Result in DE 121 EE66 2A8A00 LHLD :008A Get startaddr char area 122 EE69 19 DAD D Add offset 123 EE6A 22B000 SHLD :00B0 Preserve pntr to start 124 cursor line on screen 125 EE6D E1 POP H Get pntr to start cursor PAGE 03 DAI FIRMWARE 2EDF6-2EFFF V1.1 126 line in buffer 127 EE6E 3AAB00 LDA :00AB Get X-offset of cursor 128 in document 129 EE71 47 MOV B,A in B 130 EE72 CD7BEE CALL :EE7B Skip to Bth pos on line 131 exit: HL pnts to cursor pos 132 EE75 C1 POP B 133 EE76 78 MOV A,B 134 EE77 C1 POP B 135 EE78 D1 POP D 136 EE79 3F CMC Abort with CY=0 137 EE7A C9 RET 138 * 139 ************************************* 140 * SKIP TO Bth POSITION ON TEXT LINE * 141 ************************************* 142 * 143 * Looks through a textline until Bth position is 144 * found. On exit, character on this position is 145 * in A. 146 * 147 * Entry: HL: Start text line. 148 * B: Number of position in line. 149 * Exit: CY=0: Position found: 150 * A: Character on that position. 151 * HL: Points to Bth position. 152 * BCDE preserved. 153 * CY=1: Bth position is beyond car.ret, 154 * tab or end of text. 155 * HL: Points to CR, tab or 0. 156 * A: Space. 157 * 158 EE7B C5 L2E198 PUSH B 159 EE7C D5 PUSH D 160 EE7D 0E00 MVI C,:00 Init count 161 EE7F C3FDD1 L2E199 JMP :D1FD Evaluate character 162 EE82 CAA3EE L2E200 JZ :EEA3 Abort if Bth pos reached 163 EE85 B7 ORA A Set flags on char 164 EE86 CAA0EE JZ :EEA0 Jump if end of text reached 165 EE89 FE0D CPI :0D 166 EE8B CAA0EE JZ :EEA0 Jump if char is car.ret 167 EE8E FE09 CPI :09 168 EE90 CA98EE JZ :EE98 Jump if char is tab 169 EE93 0C INR C Incr count 170 EE94 23 L2E201 INX H Pnts to next pos on line 171 EE95 C37FEE JMP :EE7F Loop untill ready 172 173 * If character is tab: 174 175 EE98 CDA6EE L2E202 CALL :EEA6 Tabulate 176 EE9B 78 MOV A,B Reqd pos in A 177 EE9C B9 CMP C Compare with tab stops 178 EE9D D294EE JNC :EE94 Continu if not past tab 179 180 * If end of line or end of text reached or if 181 * past tab: 182 183 EEA0 3E20 L2E203 MVI A,:20 Set char is space 184 EEA2 37 STC Abort with CY=1 185 EEA3 D1 L2E204 POP D 186 EEA4 C1 POP B 187 EEA5 C9 RET PAGE 04 DAI FIRMWARE 2EDF6-2EFFF V1.1 188 * 189 ************ 190 * TABULATE * 191 ************ 192 * 193 * Routine goes through tab-table for 1st 194 * tab-stop > C. 195 * 196 * Entry: 00B4/B5: Pointer to tab-table. 197 * C: Line position. 198 * Exit: If found: Tab in C. 199 * Else: C = C + 1. 200 * AFBDEHL preserved. 201 * 202 EEA6 F5 L2E205 PUSH PSW 203 EEA7 C5 PUSH B 204 EEA8 E5 PUSH H 205 EEA9 2AB400 LHLD :00B4 Get addr tab table 206 EEAC 41 L2E206 MOV B,C Line pos in B 207 EEAD 04 INR B +1 208 EEAE 7E MOV A,M Get tab from table 209 EEAF B7 ORA A 210 EEB0 CABAEE JZ :EEBA If end tab table reached 211 EEB3 23 INX H Pnts to next tab 212 EEB4 47 MOV B,A Tab in B 213 EEB5 79 MOV A,C Line pos in A 214 EEB6 B8 CMP B 215 EEB7 D2ACEE JNC :EEAC Get next tab if line 216 pos > tab stop 217 EEBA 48 L2E207 MOV C,B Replace line pos by tab stop 218 or by line pos +1 if no tab 219 found 220 EEBB E1 POP H 221 EEBC F1 POP PSW 222 EEBD 47 MOV B,A 223 EEBE F1 POP PSW 224 EEBF C9 RET 225 * 226 ******************************** 227 * PRINT LINE OF TEXT IN WINDOW * 228 ******************************** 229 * 230 * Entry: HL: Address of textline in buffer. 231 * DE: Line control byte of screen line 232 * to print text on. 233 * 00A8: Number of non-printing positions. 234 * 235 * During execution loop: 236 * B: Nr of non-printing pos left +1. 237 * C: Nr of screen line pos left. 238 * D: Current text line position. 239 * E: Count of blanks inserted. 240 * HL: Points to text. 241 * TOS: Points to screen. 242 * 243 EEC0 C5 L2E208 PUSH B 244 EEC1 EB XCHG 245 EEC2 01F8FF LXI B,:FFF8 246 EEC5 09 DAD B 1st printable pos on screen 247 EEC6 EB XCHG in DE 248 EEC7 3AA800 LDA :00A8 Get offset of left side 249 of window PAGE 05 DAI FIRMWARE 2EDF6-2EFFF V1.1 250 EECA 3C INR A 251 EECB 47 MOV B,A B is offset +1 252 EECC 0E3C MVI C,:3C 60 visible characters 253 EECE D5 PUSH D Preserve start screen line 254 EECF 1600 MVI D,:00 ) Init current text pos 255 EED1 5A MOV E,D ) and blanks count 256 257 * Loop: 258 259 EED2 3E20 L2E209 MVI A,:20 Space 260 EED4 1D DCR E 261 EED5 1C INR E 262 EED6 C2ECEE JNZ :EEEC E<>0: Update screen pos pntr 263 EED9 7E MOV A,M Else: Get char from buffer 264 EEDA B7 ORA A Set flags on char 265 EEDB C3D1D1 JMP :D1D1 Test character 266 EEDE FE0D L2E210 CPI :0D 267 EEE0 CAECEE JZ :EEEC Skip tab-handling if CR 268 EEE3 1E00 MVI E,:00 Reset blanks count 269 EEE5 23 INX H Pnts to next char in text 270 EEE6 FE09 CPI :09 Tab ? 271 EEE8 CA08EF JZ :EF08 Then tab-handling 272 EEEB 1C L2E211 INR E 273 EEEC 1D L2E212 DCR E Update blanks count 274 EEED 14 INR D Update line position 275 EEEE 05 DCR B and nr of pos left in window 276 EEEF C2D2EE JNZ :EED2 No printing, cont with 277 next char 278 EEF2 04 INR B 279 EEF3 E3 XTHL Screen pos in HL 280 EEF4 77 MOV M,A Display char on screen 281 EEF5 2B DCX H 282 EEF6 2B DCX H Next screen pos 283 EEF7 E3 XTHL Preserve it 284 EEF8 0D DCR C End of screen line reached ? 285 EEF9 C2D2EE JNZ :EED2 Next char if not 286 EEFC CD38EE CALL :EE38 Else: next line 287 EEFF E3 XTHL HL is screen pos 288 EF00 11FAFF LXI D,:FFFA 289 EF03 19 DAD D HL is 1st useable pos 290 on next line 291 EF04 EB XCHG into DE 292 EF05 E1 POP H 293 EF06 C1 POP B 294 EF07 C9 RET 295 296 * Tab-handling: 297 298 EF08 C5 L2E213 PUSH B 299 EF09 4A MOV C,D C is pos on current line 300 EF0A CDA6EE CALL :EEA6 Tabulate 301 EF0D 79 MOV A,C Next tab stop in A 302 EF0E 92 SUB D ) Calc blanks to be inserted 303 EF0F 3D DCR A ) 304 EF10 5F MOV E,A Update blanks count 305 EF11 C1 POP B 306 EF12 3E09 MVI A,:09 Restore tab char in A 307 EF14 C3EBEE JMP :EEEB 308 * 309 *************************** 310 * PRINT A COMPLETE WINDOW * 311 *************************** PAGE 06 DAI FIRMWARE 2EDF6-2EFFF V1.1 312 * 313 * Text is printed in window from (DE) to bottom 314 * text screen if text ends. A ASCII 0 (vertical 315 * bar) is printed at the beginning of all 316 * following lines. 317 * 318 * Entry: HL: Points to text. 319 * DE: Points to line control byte screen line 320 * Exit: HL: Points to next line to print. 321 * DE: Bottom text screen. 322 * AF corrupted, BC preserved. 323 * 324 EF17 E5 L2E214 PUSH H 325 EF18 2A8C00 LHLD :008C Get bottom text screen 326 EF1B CDFBE6 CALL :E6FB Compare HL-DE 327 EF1E E1 POP H 328 EF1F CA28EF JZ :EF28 Quit if window full 329 EF22 CDC0EE CALL :EEC0 Print a textline 330 EF25 C317EF JMP :EF17 Loop until ready 331 EF28 C9 L2E215 RET 332 * 333 *************************************** 334 * PRINT A TEXT LINE POINTED BY (00B2) * 335 * ON SCREEN POSITION (00B0) IN WINDOW * 336 *************************************** 337 * 338 * Exit: All registers preserved. 339 * 340 EF29 F5 L2E216 PUSH PSW 341 EF2A C5 PUSH B 342 EF2B D5 PUSH D 343 EF2C E5 PUSH H 344 EF2D 2AB000 LHLD :00B0 Get pntr to start cursor 345 line on screen 346 EF30 EB XCHG in DE 347 EF31 2AB200 LHLD :00B2 Get pntr to start cursor 348 line in buffer 349 EF34 CDC0EE CALL :EEC0 Print a text line 350 EF37 C338E1 JMP :E138 Popall, ret 351 * 352 ********************* 353 * PRINT FULL SCREEN * 354 ********************* 355 * 356 * Prints from Nth line in full screen window. 357 * N is the offset of the top of the window from 358 * the start of the edit buffer. 359 * 360 * Exit: All registers preserved. 361 * 362 EF3A F5 L2E217 PUSH PSW 363 EF3B C5 PUSH B 364 EF3C D5 PUSH D 365 EF3D E5 PUSH H 366 EF3E 2A8A00 LHLD :008A Get startaddr char area 367 EF41 EB XCHG in DE 368 EF42 2AA900 LHLD :00A9 Get offset of top of window 369 EF45 CD1CEE CALL :EE1C Skip lines 370 EF48 C385CE JMP :CE85 Print complete window 371 * 372 * 373 * PAGE 07 DAI FIRMWARE 2EDF6-2EFFF V1.1 374 ****************************** 375 * INSERT CHARACTER IN BUFFER * 376 ****************************** 377 * 378 * Entry: Character in A. 379 * Exit: ABCDEHL preserved. 380 * CY=0: Buffer full, no action. 381 * CY=1: Character inserted. 382 * 383 EF4B C5 EINCH PUSH B 384 EF4C F5 PUSH PSW 385 EF4D D5 PUSH D 386 EF4E E5 PUSH H 387 EF4F 47 MOV B,A Char in B 388 EF50 2AA600 LHLD :00A6 Get end available space 389 EF53 EB XCHG in DE 390 EF54 2AA400 LHLD :00A4 Get input pointer 391 EF57 CDFBE6 CALL :E6FB Compare HL-DE 392 EF5A EB XCHG Input pntr in E 393 EF5B 78 MOV A,B Char in A 394 EF5C DC44EE CC :EE44 Space available: Find 395 current pos in buffer 396 EF5F D296EF JNC :EF96 Buffer full: quit, char in A 397 EF62 E5 PUSH H Preserve end available space 398 EF63 2A7200 LHLD :0072 Get cursor pos addr 399 EF66 E3 XTHL Put it on stack 400 EF67 E5 PUSH H 401 EF68 CD6BE3 CALL :E36B Delete cursor 402 EF6B EB XCHG Old input pntr in HL 403 EF6C 00 NOP 404 EF6D 23 INX H +1 405 EF6E 22A400 SHLD :00A4 Update input pointer 406 EF71 2B DCX H 407 EF72 44 MOV B,H ) Old input pntr in BC 408 EF73 4D MOV C,L ) 409 EF74 2B DCX H 410 EF75 EB XCHG Old input pntr -1 in DE 411 EF76 E1 POP H Get end available space 412 EF77 2B DCX H -1 413 EF78 CDC2E6 CALL :E6C2 Move screen area 1 pos 414 EF7B 23 INX H 415 EF7C 77 MOV M,A Insert char in buffer 416 EF7D 23 INX H 417 EF7E 22AE00 SHLD :00AE Preserve pntr to cursor 418 in buffer 419 EF81 E1 POP H Get end available space 420 EF82 FE0D CPI :0D 421 EF84 CA9CEF JZ :EF9C Jump if char is car.ret 422 EF87 CD29EF CALL :EF29 Reprint text line in window 423 EF8A CD30E3 CALL :E330 Put cursor on screen 424 EF8D FE09 CPI :09 425 EF8F CAB9EF JZ :EFB9 Jump if char is tab 426 EF92 CDF6ED CALL :EDF6 Move cursor right 1 pos 427 EF95 37 L2E218 STC 428 EF96 E1 L2E219 POP H 429 EF97 D1 POP D 430 EF98 C1 POP B 431 EF99 78 MOV A,B 432 EF9A C1 POP B 433 EF9B C9 RET 434 435 * If car.ret: PAGE 08 DAI FIRMWARE 2EDF6-2EFFF V1.1 436 437 EF9C AF L2E220 XRA A 438 EF9D 32A800 STA :00A8 ) 439 EFA0 32AB00 STA :00AB ) Reset pointers 440 EFA3 32AF00 STA :00AF ) 441 EFA6 CD3AEF CALL :EF3A Reprint full screen 442 EFA9 2AB000 LHLD :00B0 Get pntr to start cursor 443 line on screen 444 EFAC 11F8FF LXI D,:FFF8 445 EFAF 19 DAD D New cursor addr 446 EFB0 CD30E3 CALL :E330 Put cursor on screen 447 EFB3 CDABED CALL :EDAB Move cursor down 448 EFB6 C395EF JMP :EF95 Quit with CY=1 449 450 * If tab: 451 452 EFB9 CDF6ED L2E230 CALL :EDF6 Move cursor right 453 EFBC 3AAB00 LDA :00AB Get X-offset of cursor 454 in document 455 EFBF 47 MOV B,A in B 456 EFC0 2AB200 LHLD :00B2 Get pntr to start cursor 457 line in buffer 458 EFC3 CD7BEE CALL :EE7B Skip to Bth pos on line 459 EFC6 DAB9EF JC :EFB9 Again 460 EFC9 C395EF JMP :EF95 Abort with CY=1 461 * 462 ****************************** 463 * DELETE CHARACTER IN BUFFER * 464 ****************************** 465 * 466 * Deletes character at cursor position and moves 467 * the text above this position. No action if past 468 * car.ret, tab or at or beyond end of text. 469 * 470 * Exit: ABCDEHL preserved. 471 * CY=1: O.K. 472 * CY=0: If past car.ret, tab or beyond 0. 473 * 474 EFCC C5 EDLCH PUSH B 475 EFCD F5 PUSH PSW 476 EFCE D5 PUSH D 477 EFCF E5 PUSH H 478 EFD0 CD44EE CALL :EE44 Find current pos in buffer 479 EFD3 D296EF JNC :EF96 Quit if past CR, tab 480 or 0 with CY=0 481 EFD6 7E MOV A,M Get char 482 EFD7 B7 ORA A 483 EFD8 CA96EF JZ :EF96 If at end of text: 484 quit with CY=0 485 EFDB 00 NOP 486 EFDC 00 NOP 487 EFDD 00 NOP 488 EFDE E5 PUSH H 489 EFDF 2A7200 LHLD :0072 Get cursor pos addr 490 EFE2 E3 XTHL preserve it on stack 491 EFE3 CD6BE3 CALL :E36B Delete cursor 492 EFE6 EB XCHG Original HL in DE 493 EFE7 2AA400 LHLD :00A4 Get input pointer 494 EFEA 2B DCX H Decrement it 495 EFEB 22A400 SHLD :00A4 And store update input pntr 496 EFEE 44 MOV B,H ) Move updated pointer 497 EFEF 4D MOV C,L ) into BC PAGE 09 DAI FIRMWARE 2EDF6-2EFFF V1.1 498 EFF0 0B DCX B Decrement it once again 499 EFF1 EB XCHG restore original HL 500 EFF2 CDC2E6 CALL :E6C2 Move screen area above 501 downwards 502 EFF5 FE0D CPI :0D Deleted car.ret ? 503 EFF7 C429EF CNZ :EF29 If not: reprint text line 504 EFFA CC3AEF CZ :EF3A Else: reprint full screen 505 EFFD C3F2CE JMP :CEF2 Put cursor on screen, abort 506 with CY=1 507 * 508 * 509 * 510 F000 END *************************** * S Y M B O L T A B L E * *************************** ECRT EDF6 EDLCH EFCC EINCH EF4B L2E191 EE1C L2E192 EE22 L2E193 EE33 L2E194 EE34 L2E195 EE38 L2E196 EE43 L2E197 EE44 L2E198 EE7B L2E199 EE7F L2E200 EE82 L2E201 EE94 L2E202 EE98 L2E203 EEA0 L2E204 EEA3 L2E205 EEA6 L2E206 EEAC L2E207 EEBA L2E208 EEC0 L2E209 EED2 L2E210 EEDE L2E211 EEEB L2E212 EEEC L2E213 EF08 L2E214 EF17 L2E215 EF28 L2E216 EF29 L2E217 EF3A L2E218 EF95 L2E219 EF96 L2E220 EF9C L2E230 EFB9