PAGE 01 DAI FIRMWARE D790-D8FA V1.1 002 ORG :D790 003 * 004 * 005 * 006 ************************ 007 * CHECK FREE RAM SPACE * 008 ************************ 009 * 010 * Entry: DE: Startaddress. 011 * HL: 1st not useable address. 012 * Exit: HL: Useable RAM space. 013 * ABCDE preserved. 014 * 015 D790 CD1ADE MPT25 CALL :DE1A Calculate free space 016 D793 2B DCX H 017 D794 C9 RET 018 * 019 ********************************** 020 * TRANSFER DATA/CASSETTE VECTORS * 021 ********************************** 022 * 023 * Transfer data/cassette switching vectors from 024 * ROM to RAM vector area. 025 * 026 * Exit: AFBC preserved. DEHL corrupted. 027 * 028 *MPT01 029 D795 C5 CASIN PUSH B 030 D796 21CBD7 LXI H,:D7CB Highest source address 031 D799 11A4D7 LXI D,:D7A4 Lowest source address 032 D79C 01C502 LXI B,:02C5 Lowest destination address 033 D79F CD4FDE CALL :DE4F Transfer cassette vectors 034 D7A2 C1 POP B 035 D7A3 C9 RET 036 * 037 *********************************** 038 * DATA/CASSETTE SWITCHING VECTORS * 039 *********************************** 040 * 041 * This data block is moved into the RAM area 042 * #02C5-#02EB during system initialisation. 043 * 044 D7A4 C3B8D2 CINTB JMP :D2B8 WOPEN 045 D7A7 C3F1D2 JMP :D2F1 WBLK 046 D7AA C327D4 JMP :D427 WCLOSE 047 D7AD C325D3 JMP :D325 ROPEN 048 D7B0 C340D3 JMP :D340 RBLK 049 D7B3 C345D4 JMP :D445 RCLOSE 050 D7B6 C3A2D3 JMP :D3A2 MBLK 051 D7B9 C9 RET RESET 052 D7BA 00 NOP 053 D7BB 00 NOP 054 D7BC C9 RET DOUTC 055 D7BD 00 NOP 056 D7BE 00 NOP 057 D7BF C3B4DD JMP :DDB4 DINC 058 D7C2 C9 RET 059 D7C3 00 NOP 060 D7C4 00 NOP 061 D7C5 2424 DATA :24,:24 TAPSL 062 D7C7 243C DATA :24,:3C TAPSD 063 D7C9 2418 DATA :24,:18 TAPST PAGE 02 DAI FIRMWARE D790-D8FA V1.1 064 * 065 ************************************ 066 * WAIT FOR SPACEBAR, PRINT CAR.RET * 067 ************************************ 068 * 069 * Exit: BCDEHL preserved. 070 * CY=1: Break pressed. 071 * 072 *CINTE 073 D7CB CDDAD6 WPT CALL :D6DA Wait for spacebar 074 D7CE DA0CC8 JC :C80C If BREAK pressed: into 075 Basic monitor 076 D7D1 C35EDD JMP :DD5E Print car.ret; ret 077 * 078 D7D4 FF DATA :FF 079 D7D5 FF DATA :FF 080 D7D6 FF DATA :FF 081 D7D7 FF DATA :FF 082 * 083 ********************************* 084 * WRITE BLOCK + TRAILER ON TAPE * 085 ********************************* 086 * 087 * Entry: DE: Length block. 088 * HL: Startaddress block. 089 * Exit: A=0, BCDE preserved. 090 * HL points past block written. 091 * 092 D7D8 CDC802 MPT10 CALL :02C8 Write block 093 D7DB C3CB02 JMP :02CB Write trailer 094 * 095 ************************ 096 * FAILURE DURING ROPEN * 097 ************************ 098 * 099 D7DE 0D RPN20 DCR C 100 D7DF 0C INR C Load during program ? 101 D7E0 C45EDD CNZ :DD5E Print car.ret if not 102 D7E3 C329D3 JMP :D329 Back to read file leader 103 * 104 ***************************** 105 * PRINT MESSAGE ON NEW LINE * 106 ***************************** 107 * 108 * New routine. It moves the cursor to a new line 109 * before a message is printed. Used for printing 110 * 'STOPPED IN LINE ...' and 'END PROGRAM'. 111 * 112 D7E6 CD55DD CALL :DD55 ] Cursor to column 0 113 D7E9 C3FFDA JMP :DAFF ] Print message 114 * 115 ***************** 116 * FAST PRINTING * 117 ***************** 118 * 119 * Instruction only moved. 120 * 121 D7EC E5 PUSH H 122 D7ED 2A7200 LHLD :0072 Get cursor position address 123 D7F0 77 MOV M,A Write byte on screen 124 D7F1 2B DCX H ) Update cursor addr 125 D7F2 2B DCX H ) PAGE 03 DAI FIRMWARE D790-D8FA V1.1 126 D7F3 227200 SHLD :0072 Save new cursor address 127 D7F6 E1 POP H 128 D7F7 C9 RET 129 * 130 *************************** 131 * SAVE: WRITE NAME LENGTH * 132 *************************** 133 * 134 * Entry: HL: Addr. length byte of name. 135 * Exit: DE: Length of name. 136 * HL: Points past string. 137 * BC: Preserved. 138 * A: Checksum on string. 139 * 140 D7F8 5E MPT22 MOV E,M Get name length 141 D7F9 1600 MVI D,:00 142 D7FB 23 INX H HL to 1st byte of name 143 D7FC C3F1D2 JMP :D2F1 Write name length 144 * 145 ******************************** 146 * INITIALISE LOADING FROM TAPE * 147 ******************************** 148 * 149 * Entry: HL: Points to length byte of name requested 150 * Exit: DE: Length requested name. 151 * HL: Points to first byte of name. 152 * AFBC preserved. 153 * 154 D7FF 5E MPT23 MOV E,M Get length requested name 155 D800 1600 MVI D,:00 in DE 156 D802 23 INX H HL points to 1st byte name 157 D803 C32ED4 JMP :D42E Cassette motors on; ret 158 * 159 ********************* 160 * UPDATE POROM/PORO * 161 ********************* 162 * 163 * Entry: MPT52: Byte for ROM/cassette select in A. 164 * MPT53: New POROM byte. 165 * 166 D806 E6F0 MPT52 ANI :F0 Enable ROM/cassette select 167 D808 324000 MPT53 STA :0040 Load POROM 168 D80B 3206FD STA :FD06 and PORO 169 D80E C9 RET 170 * 171 ***************** 172 * part of 2EAC1 * 173 ***************** 174 * 175 * If pointer is off top visible screen: 176 * 177 D80F 7A PCK40 MOV A,D 178 D810 FED0 CPI :D0 179 D812 DAEFEA JC :EAEF (2) if <= CF (no overflow 180 below 0) 181 D815 E5 PUSH H ) if > CF: 182 D816 C5 PUSH B ) Exchange BC and HL 183 D817 E1 POP H ) 184 D818 C1 POP B ) 185 D819 C3EFEA JMP :EAEF (2) 186 * 187 D81C FF DATA :FF PAGE 04 DAI FIRMWARE D790-D8FA V1.1 188 * 189 ********************** 190 * RUN basiccmd SAVEA * 191 ********************** 192 * 193 D81D CD3BD8 RSAVA CALL :D83B Evaluate array type to be 194 saved 195 D820 F5 PUSH PSW Save type array 196 D821 C226D8 JNZ :D826 Jump if INT/FPT array 197 D824 E7 RST 4 Move stringarray into one 198 D825 75 DATA :75 string in free RAM 199 D826 F1 LD99 POP PSW Get type array 200 D827 E5 PUSH H 201 D828 D5 PUSH D 202 D829 F5 PUSH PSW 203 D82A CD91E7 CALL :E791 (0) Evaluate program name 204 D82D 3E32 MVI A,:32 File type byte '2' 205 D82F CDC502 CALL :02C5 WOPEN 206 D832 F1 POP PSW Get type array 207 D833 213E01 LXI H,:013E Startaddr EBUF 208 D836 77 MOV M,A Type into EBUF 209 D837 C368D6 JMP :D668 Write 2 blocks + trailer 210 * 211 D83A 00 NOP 212 * 213 ****************************************** 214 * EVALUATE ARRAY TYPE TO BE SAVED/LOADED * 215 ****************************************** 216 * 217 * Exit: A: Array type. 218 * DE: Length all array elements. 219 * HL: Beginaddr. 1st array element. 220 * Z=1: String array. 221 * Z=0: INT/FPT array. 222 * 223 D83B CD5AE9 RLSAS CALL :E95A (0) Get array addr in HL 224 D83E E630 ANI :30 Allow any type array 225 D840 F5 PUSH PSW Save type 226 D841 5E MOV E,M ) 227 D842 23 INX H ) Get array pntr in DE 228 D843 56 MOV D,M ) 229 D844 7B MOV A,E 230 D845 B2 ORA D 231 D846 CA90E9 JZ :E990 (0) Undef. array if no addr 232 D849 EB XCHG Pointer to array in HL 233 D84A 2B DCX H 234 D84B 2B DCX H 235 D84C 56 MOV D,M Get 1st length byte 236 D84D 23 INX H 237 D84E 7E MOV A,M Get 2nd length byte 238 D84F 23 INX H 239 D850 96 SUB M Minus nr of dim. bytes 240 D851 5F MOV E,A 241 D852 7A MOV A,D 242 D853 DE00 SBI :00 Update hibyte if borrow 243 D855 57 MOV D,A 244 D856 1B DCX D DE is length all array elem. 245 D857 CD39DE CALL :DE39 HL is beginaddr 1st element 246 D85A F1 POP PSW Get type in A 247 D85B FE20 CPI :20 Set Z-flag on type 248 D85D C9 RET 249 * PAGE 05 DAI FIRMWARE D790-D8FA V1.1 250 ********************** 251 * RUN basiccmd LOADA * 252 ********************** 253 * 254 D85E CD3BD8 RLODA CALL :D83B Evaluate array type to be 255 loaded 256 D861 E5 PUSH H Save startaddr array elem. 257 D862 F5 PUSH PSW Save type 258 D863 CD78D6 CALL :D678 Evaluate requested program 259 name; prep. select ROM bank 260 D866 CD08D8 CALL :D808 Select ROM bank 1 261 D869 F1 POP PSW Get type 262 D86A C30FEE JMP :EE0F (1) Read block from tape and 263 store it in array 264 * 265 ************************************ 266 * INITIALISE 'EDIT': EMPTY HEAP, * 267 * CLEAR SYMBOL TABLE, MOVE PROGRAM * 268 ************************************ 269 * 270 * Part of 'Init. EDIT' (0E265). 271 * 272 * Entry: CY=1: Not sufficient memory available. 273 * 274 D86D DA10DA MPT33 JC :DA10 Evt. run error 'OUT OF 275 MEMORY' 276 D870 C323CB JMP :CB23 Empty heap, move 277 program, clear symtab 278 * 279 ****************************************** 280 * LIST CURRENT LINE IF LINENR IS CORRECT * 281 ****************************************** 282 * 283 * Part of 'run LIST ' (0E1B6). 284 * 285 * Entry: CY=0 if linenr. <= 0 or > FFFF. 286 * 287 D873 D215DA MPT3A JNC :DA15 Evt. run error 'NUMBER 288 OUT OF RANGE' 289 D876 C3ABEC JMP :ECAB (0) List current line 290 * 291 ************************** 292 * INPUT FROM EDIT BUFFER * 293 ************************** 294 * 295 * Part of 'restart interpreter' (C823). 296 * 297 D879 E5 MPT05 PUSH H 298 D87A CD91E2 CALL :E291 (0) Input from editbuffer 299 D87D E1 POP H 300 D87E C9 RET 301 * 302 ******************************* 303 * part of RUN 'CLEAR' (0E6B5) * 304 ******************************* 305 * 306 * Checks for heap too big. 307 * 308 D87F E1 MPT42 POP H ] Get difference 309 D880 09 DAD B ] Add textpntr 310 D881 44 MOV B,H ] New textpntr in BC 311 D882 4D MOV C,L ] PAGE 06 DAI FIRMWARE D790-D8FA V1.1 312 D883 B7 ORA A ] No special action 313 D884 C9 RET ] 314 D885 FF DATA :FF ] 315 * 316 ************************************ 317 * EVT. INITIALISE 4 COLOUR ANIMATE * 318 ************************************ 319 * 320 * Part of 2E9C3. 321 * 322 D886 FE14 SPT04 CPI :14 323 D888 D0 RNC Abort if A >= 14 324 D889 32C100 STA :00C1 Set for 4-colour animate 325 D88C C9 RET 326 * 327 ******** 328 * DATA * 329 ******** 330 * 331 D88D 20 LD221 DATA :20 Space 332 D88E 8C72 DATA :8C,:72 Pntr. to 'MODE' 333 D890 00 DATA :00 334 * 335 ****************************** 336 * part of 1EE0B - (not used) * 337 ****************************** 338 * 339 D891 F5 LD105 PUSH PSW 340 D892 CD91E7 CALL :E791 (1) 341 D895 F1 POP PSW 342 D896 C9 RET 343 * 344 ******************************************* 345 * READ BLOCK FROM TAPE, EVT. ERROR REPORT * 346 ******************************************* 347 * 348 * Part of LOADA (1EE0F). 349 * 350 D897 CDD102 MPT19 CALL :02D1 Read block from tape 351 * 352 ************************ 353 * READ BLOCK FROM TAPE * 354 ************************ 355 * 356 * Now cassette motors are switched off directly 357 * after reading is finished. 358 * Especially in LOADA, switching off the cassette 359 * motors after re-arranging all data was very 360 * annoying. 361 * 362 D89A C365D2 JMP :D265 Evt. run 'LOADING ERROR' 363 D89D C9 RET 364 * 365 ************************************** 366 * LIST ARRAY NAME, SPACE, EXPRESSION * 367 ************************************** 368 * 369 * Used in listing 'Savea/Loada' textlines. 370 * 371 D89E CDF7EE SCN30 CALL :EEF7 (0) List array name 372 D8A1 C365ED JMP :ED65 (0) List space, expression 373 * PAGE 07 DAI FIRMWARE D790-D8FA V1.1 374 D8A4 FF DATA :FF 375 D8A5 FF DATA :FF 376 * 377 ****************************** 378 * INITIALISE SOUND GENERATOR * 379 ****************************** 380 * 381 * All sound channels are switched off. 382 * 383 * Exit: AB preserved, CDEHLF corrupted. 384 * 385 D8A6 2106FC SNDINI LXI H,:FC06 386 D8A9 3636 MVI M,:36 ) Load 3 timers 387 D8AB 3676 MVI M,:76 ) 388 D8AD 36B6 MVI M,:B6 ) 389 D8AF 210000 LXI H,:0000 390 D8B2 2204FD SHLD :FD04 Volume 4 channels off 391 D8B5 229402 SHLD :0294 and remember it 392 D8B8 21C201 LXI H,:01C2 Start 1st SCB 393 D8BB 110E00 LXI D,:000E Length SCB 394 D8BE 0E04 MVI C,:04 4 blocks (3 SCB, 1 NCB) 395 D8C0 36FF SNI10 MVI M,:FF FF in 1st byte SCB (= off) 396 D8C2 19 DAD D Calc start next block 397 D8C3 0D DCR C 398 D8C4 C2C0D8 JNZ :D8C0 Next block if not ready 399 D8C7 C9 RET 400 * 401 ********************* 402 * OUTPUT TO DCE-BUS * 403 ********************* 404 * 405 * 'Real World' output. Writes a byte to a given 406 * Real World address. 407 * 408 * Entry: D: Busaddress. 409 * E: Data for output. 410 * 411 D8C8 F5 RWOP PUSH PSW 412 D8C9 E5 PUSH H 413 D8CA 2103FE LXI H,:FE03 GIC control address 414 D8CD 3680 MVI M,:80 All ports output 415 D8CF 2B DCX H Port C addr. in HL 416 D8D0 36FE MVI M,:FE Clear bus expand signal 417 D8D2 EB XCHG Data in L, busaddr. in H 418 D8D3 2200FE SHLD :FE00 Data in PA, busaddr. in PB 419 D8D6 EB XCHG Address PC in HL 420 D8D7 34 INR M Set bus expand signal 421 D8D8 36FD MVI M,:FD Set write strobe true 422 (Now data exchange done) 423 D8DA 36FF MVI M,:FF Reset strobe 424 D8DC 35 DCR M Clear bus expand signal 425 D8DD E1 POP H 426 D8DE F1 POP PSW 427 D8DF C9 RET 428 * 429 ********************** 430 * INPUT FROM DCE-BUS * 431 ********************** 432 * 433 * 'Real World' input. Reads a byte from a given 434 * Real World address. 435 * PAGE 08 DAI FIRMWARE D790-D8FA V1.1 436 * Entry: D: Busaddress. 437 * Exit: E: Data received. 438 * 439 D8E0 F5 RWIP PUSH PSW 440 D8E1 E5 PUSH H 441 D8E2 2103FE LXI H,:FE03 GIC control addr. in HL 442 D8E5 3690 MVI M,:90 PA input, rest output 443 D8E7 2B DCX H Address PC in HL 444 D8E8 36FE MVI M,:FE Clear bus expand signal 445 D8EA 7A MOV A,D Busaddress in A 446 D8EB 3201FE STA :FE01 Store busaddress in PB 447 D8EE 34 INR M Set bus expand signal 448 D8EF 36FB MVI M,:FB Set read strobe true 449 (Now data exchange) 450 D8F1 3A00FE LDA :FE00 Data to A 451 D8F4 5F MOV E,A Data in E 452 D8F5 36FF MVI M,:FF Reset strobe 453 D8F7 35 DCR M 454 D8F8 E1 POP H 455 D8F9 F1 POP PSW 456 D8FA C9 RET 457 * 458 * 459 * 464 D8FB END *************************** * S Y M B O L T A B L E * *************************** CASIN D795 CINTB D7A4 CINTE D7CB LD105 D891 LD221 D88D LD99 D826 MPT01 D795 MPT05 D879 MPT10 D7D8 MPT19 D897 MPT22 D7F8 MPT23 D7FF MPT25 D790 MPT33 D86D MPT3A D873 MPT42 D87F MPT52 D806 MPT53 D808 PCK40 D80F RLODA D85E RLSAS D83B RPN20 D7DE RSAVA D81D RWIP D8E0 RWOP D8C8 SCN30 D89E SNDINI D8A6 SNI10 D8C0 SPT04 D886 WPT D7CB