PAGE 01 DAI FIRMWARE 0EA40-0EC15 V1.1 002 ORG :EA40 003 * 004 * 005 * 006 **************************** 007 * part of RUN TALK (0E67B) * 008 **************************** 009 * 010 * Sets oscillator volumes. 011 * 012 * Entry: A: New volume. 013 * HL: Address POROM/POR1M. 014 * 015 EA40 77 MPT48 MOV M,A Update POR0M/POR1M 016 EA41 1170FA LXI D,:FA70 017 EA44 19 DAD D HL= POR0/POR1 018 EA45 77 MOV M,A Update osc.volume 019 EA46 E1 POP H Get parameter pntr 020 EA47 23 RTK55 INX H Pnts to next code 021 EA48 C367CD JMP :CD67 Handle next code 022 * 023 EA4B FF DATA :FF 024 EA4C FF DATA :FF 025 EA4D FF DATA :FF 026 EA4E FF DATA :FF 027 EA4F FF DATA :FF 028 * 029 ************************* 030 * RUN basicfunction ABS * 031 ************************* 032 * 033 EA50 E7 RABS RST 4 MFABS 034 EA51 18 DATA :18 035 EA52 C9 RET 036 * 037 ************************** 038 * RUN basicfunction ALOG * 039 ************************** 040 * 041 EA53 E7 RALOG RST 4 MALOG 042 EA54 30 DATA :30 043 EA55 C9 RET 044 * 045 ************************* 046 * RUN basicfunction EXP * 047 ************************* 048 * 049 EA56 E7 REXP RST 4 MEXP 050 EA57 2A DATA :2A 051 EA58 C9 RET 052 * 053 ************************** 054 * RUN basicfunction FRAC * 055 ************************** 056 * 057 EA59 E7 RFRAC RST 4 MFRAC 058 EA5A 21 DATA :21 059 EA5B C9 RET 060 * 061 ************************* 062 * RUN basicfunction LOG * 063 ************************* PAGE 02 DAI FIRMWARE 0EA40-0EC15 V1.1 064 * 065 EA5C E7 RLOG RST 4 MLOG 066 EA5D 27 DATA :27 067 EA5E C9 RET 068 * 069 ************************** 070 * RUN basicfunction LOGT * 071 ************************** 072 * 073 EA5F E7 RLOGT RST 4 MLOGT 074 EA60 2D DATA :2D 075 EA61 C9 RET 076 * 077 ************************* 078 * RUN basicfunction SQR * 079 ************************* 080 * 081 EA62 E7 RSQR RST 4 MSQR 082 EA63 33 DATA :33 083 EA64 C9 RET 084 * 085 ************************* 086 * RUN basicfunction SIN * 087 ************************* 088 * 089 EA65 E7 RSIN RST 4 MSIN 090 EA66 36 DATA :36 091 EA67 C9 RET 092 * 093 ************************* 094 * RUN basicfunction COS * 095 ************************* 096 * 097 EA68 E7 RCOS RST 4 MCOS 098 EA69 39 DATA :39 099 EA6A C9 RET 100 * 101 ************************* 102 * RUN basicfunction TAN * 103 ************************* 104 * 105 EA6B E7 RTAN RST 4 MTAN 106 EA6C 3C DATA :3C 107 EA6D C9 RET 108 * 109 ************************** 110 * RUN basicfunction ASIN * 111 ************************** 112 * 113 EA6E E7 RASIN RST 4 MASIN 114 EA6F 3F DATA :3F 115 EA70 C9 RET 116 * 117 ************************** 118 * RUN basicfunction ACOS * 119 ************************** 120 * 121 EA71 E7 RACOS RST 4 MACOS 122 EA72 42 DATA :42 123 EA73 C9 RET 124 * 125 * PAGE 03 DAI FIRMWARE 0EA40-0EC15 V1.1 126 ************************** 127 * RUN basicfunction ATAN * 128 ************************** 129 * 130 EA74 E7 RATN RST 4 MATAN 131 EA75 45 DATA :45 132 EA76 C9 RET 133 * 134 ************************** 135 * RUN basicfunction STR$ * 136 ************************** 137 * 138 * Converts a FPT number into a string. 139 * 140 EA77 CD9BCE RSTR CALL :CE9B Convert MACC for FPT output 141 string in DECBUF 142 EA7A 00 NOP 143 EA7B 00 NOP 144 EA7C 00 NOP 145 EA7D 2A33C0 RST20 LHLD :C033 Get addr DECBUF 146 EA80 1E01 MVI E,:01 Pretend it is a variable 147 EA82 C9 RET 148 * 149 ************************** 150 * RUN basicfunction HEX$ * 151 ************************** 152 * 153 * Converts a INT number into an equivalent string. 154 * 155 EA83 CD08E8 RHEX CALL :E808 Eval expr, result in MACC 156 EA86 CD2DC0 CALL :C02D Conv. MACC to HEX for output 157 EA89 C37DEA JMP :EA7D Get addr DECBUF, pretend it 158 is a variable 159 * 160 ************************* 161 * RUN basicfunction SPC * 162 ************************* 163 * 164 * Returns a string of a number of spaces. 165 * From SPC10 used by TAB if DOUTC<>0. 166 * 167 EA8C CD1DE7 RSPC CALL :E71D Get nr of spaces in A 168 169 * Entry from RTAB: 170 171 EA8F CD8BD1 SPC10 CALL :D18B Get place in heap for string 172 of spaces 173 EA92 E5 PUSH H Save pntr to heap 174 EA93 B7 SPC20 ORA A 175 EA94 CA9EEA JZ :EA9E Jump if ready 176 EA97 23 INX H 177 EA98 3620 MVI M,:20 Space into heap 178 EA9A 3D DCR A 179 EA9B C393EA JMP :EA93 Next space 180 EA9E E1 SPC30 POP H HL pnts to start string 181 EA9F C3DFEA JMP :EADF Pretend it is a temp string 182 * 183 ************************* 184 * RUN basicfunction TAB * 185 ************************* 186 * 187 * Returns a string of spaces to move cursor to a PAGE 04 DAI FIRMWARE 0EA40-0EC15 V1.1 188 * given character position (only to the right). 189 * Works only if output switch DOUTC=0, else it 190 * returns one space only. 191 * 192 EAA2 CD60CE RTAB CALL :CE60 Get nr of tabs in L, 193 DOUTC in A 194 * 195 *********** 196 * RUN TAB * 197 *********** 198 * 199 * The old routine worked only for DOUTC=0. Now 200 * DOUTC is not checked anymore, but the Z-flag 201 * set by CE60 is evaluated. If Z=1 (all O.K.), 202 * the TAB-instruction is executed. If Z=0, then 203 * the number of tab's is not correct. Then only 204 * one space is printed. 205 * 206 EAA5 1F RAR ] Dummy to preserve Z-flag 207 EAA6 3E01 MVI A,:01 Init 1 space 208 EAA8 C28FEA JNZ :EA8F Jump if DOUTC<>0 209 EAAB 7D MOV A,L Get nr of tabs 210 EAAC 00 NOP 211 EAAD 00 NOP 212 EAAE EF RST 5 Ask cursor pos and size 213 EAAF 0C DATA :0C char screen 214 EAB0 95 SUB L Calc nr of spaces reqd 215 EAB1 D28FEA JNC :EA8F Run SPC if not past tab pos 216 EAB4 AF XRA A If past TAB: 217 EAB5 C38FEA JMP :EA8F Run SPC for no spaces 218 * 219 ************************** 220 * RUN basicfunction CURX * 221 ************************** 222 * 223 EAB8 EF RCURX RST 5 Ask cursor pos and size 224 EAB9 0C DATA :0C char screen 225 EABA 7D MOV A,L X-coord in A 226 EABB C37CEB JMP :EB7C and into MACC 227 * 228 ************************** 229 * RUN basicfunction CURY * 230 ************************** 231 * 232 EABE EF RCURY RST 5 Ask cursor pos and size 233 EABF 0C DATA :0C char screen 234 EAC0 7C MOV A,H Y-coord in A 235 EAC1 C37CEB JMP :EB7C and in MACC 236 * 237 ************************* 238 * RUN basicfunction LEN * 239 ************************* 240 * 241 * Given a string, returns length of the string. 242 * 243 EAC4 CD91E7 RLEN CALL :E791 Eval string expr 244 EAC7 7E RLE10 MOV A,M Get length in A 245 EAC8 C37CEB JMP :EB7C and into MACC 246 * 247 ************************* 248 * RUN basicfunction ASC * 249 ************************* PAGE 05 DAI FIRMWARE 0EA40-0EC15 V1.1 250 * 251 * Given a string, returns ASCII value of 1st char. 252 * 253 EACB CD91E7 RASC CALL :E791 Eval string expr 254 EACE 7E MOV A,M Get length in A 255 EACF C37ECF JMP :CF7E Check if length is 0; get 256 1st char in MACC if not 257 * 258 ************************** 259 * RUN basicfunction CHR$ * 260 ************************** 261 * 262 EAD2 CD1DE7 RCHR CALL :E71D Get argument value in A 263 EAD5 F5 PUSH PSW Save it 264 EAD6 3E01 MVI A,:01 265 EAD8 CD8BD1 CALL :D18B Find place in heap for 266 a 1-byte string 267 EADB F1 POP PSW Get argument 268 EADC 23 INX H 269 EADD 77 MOV M,A Store it in Heap 270 EADE 2B DCX H Pnts to length byte 271 272 * Entry from 'SPC': 273 274 EADF 1E02 RCR10 MVI E,:02 Status: temporary 275 EAE1 C9 RET 276 * 277 *************************** 278 * RUN basicfunction LEFT$ * 279 *************************** 280 * 281 * Given a string, returns a number of characters 282 * from the left end. 283 * 284 EAE2 CD9DE7 RLEFT CALL :E79D Eval string expr 285 EAE5 E5 PUSH H Save string pntr 286 EAE6 D5 PUSH D 287 EAE7 CD1DEB CALL :EB1D Reqd length in A 288 EAEA 1600 MVI D,:00 289 EAEC 5F RLF10 MOV E,A Length in DE 290 EAED CD4FD1 RLF20 CALL :D14F Extract substring 291 EAF0 D215DA JNC :DA15 Evt. run error 'NUMBER OUT 292 OF RANGE' 293 EAF3 D1 POP D 294 EAF4 E3 XTHL 295 EAF5 7B MOV A,E Get status 296 EAF6 FE02 CPI :02 Temporary? 297 EAF8 CC87D1 CZ :D187 Then clear heap entry 298 EAFB E1 POP H 299 EAFC 1E02 MVI E,:02 Status temporary 300 EAFE C9 RET 301 * 302 **************************** 303 * RUN basicfunction RIGHT$ * 304 **************************** 305 * 306 * Extracts a number of characters from the 307 * right end of a given string. 308 * 309 EAFF CD9DE7 RRIGHT CALL :E79D Eval string expr 310 EB02 E5 PUSH H Save string pntr 311 EB03 D5 PUSH D PAGE 06 DAI FIRMWARE 0EA40-0EC15 V1.1 312 EB04 CD1DEB CALL :EB1D Get length substring 313 EB07 5F MOV E,A in E 314 EB08 7E MOV A,M Get total string length 315 EB09 93 SUB E 316 EB0A 57 MOV D,A Startposition in D 317 EB0B C3EDEA JMP :EAED Extract substring 318 * 319 ************************** 320 * RUN basicfunction MID$ * 321 ************************** 322 * 323 EB0E CD9DE7 RMID CALL :E79D Eval string expr 324 EB11 E5 PUSH H Save string pntr 325 EB12 D5 PUSH D 326 EB13 CD1DEB CALL :EB1D Get startposition 327 EB16 57 MOV D,A in D 328 EB17 CD1DE7 CALL :E71D Get length in A 329 EB1A C3ECEA JMP :EAEC Extract substring 330 * 331 ****************************** 332 * GET VALUE OF ARGUMENT IN A * 333 ****************************** 334 * 335 * Exit: DEHL preserved. 336 * 337 EB1D E5 REXIK PUSH H 338 EB1E D5 PUSH D 339 EB1F CD1DE7 CALL :E71D Get value of argument in A 340 EB22 D1 POP D 341 EB23 E1 POP H 342 EB24 C9 RET 343 * 344 ************************* 345 * RUN basicfunction VAL * 346 ************************* 347 * 348 * Takes a string and converts it to a FPT number. 349 * 350 EB25 CD91E7 RVAL CALL :E791 Eval string expr 351 EB28 C5 PUSH B 352 EB29 7E SUEPT MOV A,M Length of string in A 353 EB2A 323401 STA :0134 and in EFECT 354 EB2D 23 INX H HL pnts to 1st string byte 355 EB2E 223201 SHLD :0132 Addr into EFEPT 356 EB31 0E00 MVI C,:00 Char count 357 EB33 213501 LXI H,:0135 358 EB36 3601 MVI M,:01 Input from string 359 EB38 CD1EC0 CALL :C01E encode FPT number into MACC 360 EB3B 35 DCR M Input from keyboard 361 EB3C 3E0A MVI A,:0A If over/underflow: run 362 EB3E D2F5D9 JNC :D9F5 error 'INVALID NUMBER' 363 EB41 C1 POP B 364 EB42 C9 RET 365 * 366 ************************* 367 * RUN basicfunction FRE * 368 ************************* 369 * 370 * Returns a INT given size of free RAM space. 371 * Result in MACC. 372 * FR2BY: Also used to copy HL into MACC. 373 * PAGE 07 DAI FIRMWARE 0EA40-0EC15 V1.1 374 * Exit: BC preserved, AFDEHL corrupted. 375 * 376 EB43 CD51EB RFRE CALL :EB51 Calc free RAM space in HL 377 EB46 AF FR2BY XRA A 378 EB47 C5 PUSH B 379 EB48 D5 PUSH D 380 EB49 4C MOV C,H ) Free space in CD 381 EB4A 55 MOV D,L ) 382 EB4B 47 MOV B,A A,B=0 383 EB4C E7 RST 4 Copy reg A,B,C,D into MACC 384 EB4D 12 DATA :12 385 EB4E D1 POP D 386 EB4F C1 POP B 387 EB50 C9 RET 388 * 389 **************************** 390 * CALCULATE FREE RAM SPACE * 391 **************************** 392 * 393 * Exit: HL: Free RAM space. 394 * DE: STBUSE. 395 * ABC preserved, F corrupted. 396 * 397 EB51 2AA302 SIZE LHLD :02A3 Get end symtab 398 EB54 EB XCHG in DE 399 EB55 2AA502 LHLD :02A5 Get bottom screen RAM 400 EB58 CD1ADE CALL :DE1A Calc. free space in HL 401 EB5B C9 RET 402 * 403 ************************** 404 * RUN basicfunction FREQ * 405 ************************** 406 * 407 * Given a frequency in Hz, returns a period in 408 * 'oscillator cycles' (INT). 409 * 410 * Entry: MACC: Value for freq. 411 * Exit: BC preserved, AFDEHL corrupted. 412 * 413 EB5C 212901 RFREQ LXI H,:0129 Startaddr scratch area for 414 expression evaluation 415 EB5F E7 RST 4 Copy reqd freq to scratch 416 EB60 0F DATA :0F area 417 EB61 E5 PUSH H Save startaddr scratch area 418 EB62 21EDD0 LXI H,:D0ED Addr sound constant 419 EB65 E7 RST 4 Sound constant into MACC 420 EB66 0C DATA :0C 421 EB67 E1 POP H Get start scratch area 422 EB68 E7 RST 4 Calc sound const/reqd freq 423 EB69 09 DATA :09 424 EB6A E7 RST 4 Change it to INT 425 EB6B 48 DATA :48 426 EB6C C5 PUSH B 427 EB6D E7 RST 4 Copy result to reg A,B,C,D 428 EB6E 15 DATA :15 429 EB6F B0 ORA B > 64K ? Then run error 430 EB70 C215DA JNZ :DA15 'NUMBER OUT OF RANGE' 431 EB73 C1 POP B 432 EB74 C9 RET 433 * 434 ************ 435 * RUN GETC * PAGE 08 DAI FIRMWARE 0EA40-0EC15 V1.1 436 ************ 437 * 438 * Better entry to keyboard scan routine to 439 * avoid keybounce. 440 * 441 EB75 AF XRA A ] 442 EB76 32B902 STA :02B9 ] Clear breakflag 443 EB79 CDBED6 CALL :D6BE ] Run GETC 444 EB7C 6F FR1BY MOV L,A Result in L 445 EB7D 2600 MVI H,:00 446 EB7F C346EB JMP :EB46 Result into MACC 447 * 448 ************************* 449 * RUN basicfunction INP * 450 ************************* 451 * 452 * Reads a byte from a Real World address (DCE-bus). 453 * 454 EB82 CD1DE7 RINP CALL :E71D Get RW addr in A 455 EB85 57 MOV D,A and in D 456 EB86 CDE0D8 CALL :D8E0 Get input from DCE-bus 457 EB89 7B MOV A,E Result in A 458 EB8A C37CEB JMP :EB7C Result into MACC 459 * 460 ************************* 461 * RUN basicfunction INT * 462 ************************* 463 * 464 * Returns a integer FPT value, just less than the 465 * FPT argument given. 466 * REMARK: Routine is wrong if -1 < nr < 0. Then 467 * the result is -1 ! 468 * 469 EB8D C5 RINT PUSH B 470 EB8E E7 RST 4 Copy MACC to reg A,B,C,D 471 EB8F 15 DATA :15 472 * 473 *********** 474 * RUN INT * 475 *********** 476 * 477 * Running INT on a number with value 0 gave as 478 * result: -1. Now this failure is corrected. 479 * 480 EB90 212901 LXI H,:0129 ] 481 EB93 E7 RST 4 ] Copy MACC to WORKE 482 EB94 0F DATA :0F ] 483 EB95 C1 POP B ] 484 EB96 E7 RST 4 ] MACC = INT (MACC) 485 EB97 1E DATA :1E ] for FPT number 486 EB98 B7 ORA A ] Set flags on exp byte 487 EB99 F0 RP ] Ready if nr positive 488 EB9A C3C5CE JMP :CEC5 ] 489 * 490 ********************* 491 * DATA - (not used) * 492 ********************* 493 * 494 EB9D 81 L0E240 DATA :81 FPT (-1) 495 EB9E 80 DATA :80 496 EB9F 00 DATA :00 497 EBA0 00 DATA :00 PAGE 09 DAI FIRMWARE 0EA40-0EC15 V1.1 498 * 499 **************************** 500 * RUN basicfunction VARPTR * 501 **************************** 502 * 503 EBA1 CD63E9 RVPT CALL :E963 Get varptr in HL, T/L in A 504 EBA4 C346EB JMP :EB46 Varptr into MACC 505 * 506 ************************** 507 * RUN basicfunction XMAX * 508 ************************** 509 * 510 EBA7 CDB4EB RXMAX CALL :EBB4 Get max Y,X-coord graph area 511 EBAA EB XCHG Max X-coord in HL 512 EBAB C346EB JMP :EB46 and into MACC 513 * 514 ************************** 515 * RUN basicfunction YMAX * 516 ************************** 517 * 518 EBAE CDB4EB RYMAX CALL :EBB4 Get max Y,X-coord graph area 519 EBB1 C37CEB JMP :EB7C Max Y-coord into MACC 520 * 521 ****************************************** 522 * GET MAX. Y,X-COORDINATES GRAPHICS AREA * 523 ****************************************** 524 * 525 * Exit: DE: Max. X-coordinate. 526 * A: Max. Y-coordinate. 527 * BC preserved. 528 * 529 EBB4 210000 L0E245 LXI H,:0000 ) Coord dot 0,0 530 EBB7 C5 PUSH B ) 531 EBB8 4C MOV C,H ) 532 EBB9 EF RST 5 Ask colour of point and 533 EBBA 27 DATA :27 size graphics screen 534 EBBB DA02E6 JC :E602 Evt run screen error 535 EBBE 78 MOV A,B Max Y-coord in A 536 EBBF C1 POP B 537 EBC0 C9 RET 538 * 539 ************************* 540 * RUN basicfunction PDL * 541 ************************* 542 * 543 * A given paddle channel is enabled. Counter 0 is 544 * set to FFFF. The counter is read over and over 545 * until it is counted out. 546 * 547 * Exit: BC updated, AFDEHL corrupted. 548 * 549 EBC1 3E05 RPDL MVI A,:05 550 EBC3 CD43E7 CALL :E743 Get paddle select (0-5) 551 EBC6 57 MOV D,A into D 552 EBC7 3A4000 LDA :0040 Get POROM 553 EBCA E6F8 ANI :F8 ROM/cass.select only 554 EBCC B2 ORA D OR with paddle select 555 EBCD F608 ORI :08 Paddle enable 556 EBCF CD08D8 CALL :D808 Load PORO/POROM 557 EBD2 C5 PUSH B 558 EBD3 3E30 MVI A,:30 559 EBD5 0106FC LXI B,:FC06 Addr 8253 cmd word PAGE 10 DAI FIRMWARE 0EA40-0EC15 V1.1 560 EBD8 02 STAX B Select ch.0, mode 0, 2 byte 561 EBD9 21FFFF LXI H,:FFFF 562 EBDC 2200FC SHLD :FC00 Load counter ch.0 563 EBDF 3A01FD LDA :FD01 Get pdl timer trig impulse 564 (Useless: A is cleared in 565 0EBE3) 566 EBE2 EB PDL10 XCHG DE = FFFF 567 EBE3 3E00 MVI A,:00 568 EBE5 02 STAX B (FC06)=00: counter 0, latch 569 operation 570 EBE6 2A00FC LHLD :FC00 Get contents counter 0 571 EBE9 CD14DE CALL :DE14 Compare HL-DE 572 EBEC DAE2EB JC :EBE2 Again if DE > HL 573 EBEF CD26DE CALL :DE26 HL = 2-compl. of HL 574 EBF2 11CEFF LXI D,:FFCE ) Substract 49 575 EBF5 19 DAD D ) 576 EBF6 DAFCEB JC :EBFC If result negative 577 EBF9 210000 LXI H,:0000 578 EBFC 7C PDL20 MOV A,H 579 EBFD B7 ORA A 580 EBFE CA06EC JZ :EC06 581 EC01 2EFF MVI L,:FF 582 EC03 00 NOP 583 EC04 00 NOP 584 EC05 00 NOP 585 EC06 3E36 PDL30 MVI A,:36 586 EC08 02 STAX B (FC06)=#36: Chan 0, mode 3 587 EC09 3A4000 LDA :0040 Get PORO/POROM 588 EC0C E6F0 ANI :F0 Disable paddle operation 589 EC0E CD06D8 CALL :D806 Load PORO/POROM 590 EC11 C1 POP B 591 EC12 7D MOV A,L A=0 if result negative, 592 else FF 593 EC13 C37CEB JMP :EB7C Move A into MACC 594 * 595 * 596 * 597 EC16 END *************************** * S Y M B O L T A B L E * *************************** FR1BY EB7C FR2BY EB46 L0E240 EB9D L0E245 EBB4 MPT48 EA40 PDL10 EBE2 PDL20 EBFC PDL30 EC06 RABS EA50 RACOS EA71 RALOG EA53 RASC EACB RASIN EA6E RATN EA74 RCHR EAD2 RCOS EA68 RCR10 EADF RCURX EAB8 RCURY EABE REXIK EB1D REXP EA56 RFRAC EA59 RFRE EB43 RFREQ EB5C RHEX EA83 RINP EB82 RINT EB8D RLE10 EAC7 RLEFT EAE2 RLEN EAC4 RLF10 EAEC RLF20 EAED RLOG EA5C RLOGT EA5F RMID EB0E RPDL EBC1 RRIGHT EAFF RSIN EA65 RSPC EA8C RSQR EA62 RST20 EA7D RSTR EA77 RTAB EAA2 RTAN EA6B RTK55 EA47 RVAL EB25 RVPT EBA1 RXMAX EBA7 RYMAX EBAE SIZE EB51 SPC10 EA8F SPC20 EA93 SPC30 EA9E SUEPT EB29