Rev 1137 | Details | Compare with Previous | Last modification | View Log
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1057 | alone | 1 | EMUOUT |
| 2 | ;BC=port, A=value |
||
| 3 | BIT 0,C |
||
| 4 | jp Z,eoutFE |
||
| 5 | BIT 1,C |
||
| 6 | jr Z,eoutFD |
||
| 7 | PUSH AF |
||
| 8 | LD A,(doson0) |
||
| 9 | OR A |
||
| 10 | jp Z,EMUOUTDOS |
||
| 11 | POP AF |
||
| 12 | RET |
||
| 13 | eoutFD |
||
| 14 | BIT 7,B |
||
| 15 | jp Z,eout7FFD |
||
| 16 | BIT 6,B |
||
| 17 | jr NZ,eoutFFFD |
||
| 18 | LD BC,#BFFD |
||
| 19 | OUT (C),A |
||
| 20 | RET |
||
| 21 | eoutFFFD |
||
| 22 | BIT 5,B |
||
| 23 | jr z,eoutDFFD |
||
| 1212 | alone | 24 | BIT 1,B |
| 25 | jr z,eoutDFFD ;ATM1 |
||
| 1057 | alone | 26 | LD BC,#FFFD |
| 27 | OUT (C),A |
||
| 28 | RET |
||
| 29 | eoutDFFD |
||
| 30 | ld (_dffd),a |
||
| 31 | AND 128 ;video mode |
||
| 32 | oldcurvideomode=$+1 |
||
| 33 | cp 0 |
||
| 1137 | alone | 34 | ;jr z,eoDFFDnovideomode |
| 35 | ;ld (oldcurvideomode),a |
||
| 36 | call nz,setvideomode |
||
| 37 | ;eoDFFDnovideomode |
||
| 1057 | alone | 38 | ld a,(_fd) |
| 39 | eout7FFD |
||
| 40 | ;TODO block if bit 5 was "1" in (_fd) |
||
| 41 | LD (_fd),A |
||
| 42 | LD C,A |
||
| 1212 | alone | 43 | if PENT512 |
| 44 | rlca |
||
| 45 | rlca |
||
| 46 | and 3 |
||
| 47 | ld hl,_dffd |
||
| 48 | or (hl) |
||
| 49 | else |
||
| 1057 | alone | 50 | ld a,(_dffd) |
| 1212 | alone | 51 | endif |
| 1057 | alone | 52 | if PROFI==512 |
| 53 | and 3 ;Profi 512K |
||
| 54 | else |
||
| 55 | and 7 ;Profi 1024K |
||
| 56 | endif |
||
| 57 | add a,a |
||
| 58 | add a,a |
||
| 59 | add a,a |
||
| 1212 | alone | 60 | xor c |
| 61 | and 0xf8 |
||
| 62 | xor c |
||
| 1057 | alone | 63 | ld (_logicpg),a |
| 64 | ld l,a |
||
| 65 | ld h,temulpgs/256 |
||
| 66 | ld a,(hl) |
||
| 67 | deadpg=$+1 |
||
| 68 | cp 0 |
||
| 69 | jr nz,eout7FFDOK |
||
| 70 | push bc |
||
| 71 | push de |
||
| 72 | push hl |
||
| 73 | exx |
||
| 74 | push bc |
||
| 75 | push de |
||
| 76 | push hl |
||
| 77 | push ix |
||
| 78 | push iy |
||
| 79 | exa |
||
| 80 | push af |
||
| 81 | OS_NEWPAGE ;мегабайт захватывать динамически постранично |
||
| 82 | pop af |
||
| 83 | exa |
||
| 84 | ld a,e |
||
| 85 | pop iy |
||
| 86 | pop ix |
||
| 87 | pop hl |
||
| 88 | pop de |
||
| 89 | pop bc |
||
| 90 | exx |
||
| 91 | pop hl |
||
| 92 | pop de |
||
| 93 | pop bc |
||
| 94 | ld (hl),a |
||
| 95 | eout7FFDOK |
||
| 96 | |||
| 97 | ld a,(_dffd) |
||
| 98 | and 16 ;D4 = rom off |
||
| 99 | jr z,eout7FFD_romon |
||
| 100 | ld a,(temulpgs+0) |
||
| 101 | LD (emulcurpg0000),A |
||
| 102 | ld a,ROMSTATE_OFF |
||
| 103 | ld (romstate_flag),a |
||
| 104 | ld a,DOSSTATE_FROM128 |
||
| 105 | ld (DOSER_state),a ;skip DOSER |
||
| 106 | jr eout7FFD_romonq |
||
| 107 | eout7FFD_romon |
||
| 108 | LD A,(doson0) ;DOS ports on |
||
| 109 | OR A |
||
| 110 | jr Z,eo7FFDdos |
||
| 111 | BIT 4,C ;номер ПЗУ |
||
| 112 | ld b,DOSSTATE_FROM48 |
||
| 113 | LD A,(pgrom48) |
||
| 114 | jr NZ,eo7FFDo |
||
| 115 | ld b,DOSSTATE_FROM128 |
||
| 116 | LD A,(pgrom128) |
||
| 117 | JR eo7FFDo |
||
| 118 | eo7FFDdos |
||
| 119 | BIT 4,C ;номер ПЗУ |
||
| 120 | ld b,DOSSTATE_FROMDOS |
||
| 121 | LD A,(pgromDOS) |
||
| 122 | jr NZ,eo7FFDo |
||
| 123 | LD A,(pgromSYS) |
||
| 124 | eo7FFDo |
||
| 125 | LD (emulcurpg0000),A |
||
| 126 | ld a,b |
||
| 127 | ld (DOSER_state),a |
||
| 128 | ld a,ROMSTATE_ON |
||
| 129 | ld (romstate_flag),a |
||
| 130 | eout7FFD_romonq |
||
| 131 | |||
| 132 | LD A,C |
||
| 133 | AND 8 ;номер экрана |
||
| 134 | LD (curscr),A |
||
| 135 | oldcurscr7ffd=$+1 |
||
| 136 | cp 0 |
||
| 1137 | alone | 137 | ;jr z,eo7FFDnoscr |
| 138 | ;ld (oldcurscr7ffd),a |
||
| 139 | call nz,setscreen |
||
| 140 | ;eo7FFDnoscr |
||
| 1057 | alone | 141 | ld hl,_dffd |
| 142 | bit 3,(hl) |
||
| 143 | ld a,5 |
||
| 144 | jr z,eo7FFD_nomem4000 |
||
| 145 | _logicpg=$+1 |
||
| 146 | ld a,0;(_logicpg) |
||
| 147 | eo7FFD_nomem4000 |
||
| 148 | ld (_logicpg4000),a |
||
| 149 | ld a,(_logicpg) |
||
| 150 | jr z,eo7FFD_nomemc000 |
||
| 151 | ld a,7 |
||
| 152 | eo7FFD_nomemc000 |
||
| 153 | ld (_logicpgc000),a |
||
| 154 | bit 6,(hl) |
||
| 155 | ld a,2 |
||
| 156 | jr z,eo7FFD_nomem8000 |
||
| 157 | ld a,6 |
||
| 158 | eo7FFD_nomem8000 |
||
| 159 | ld (_logicpg8000),a |
||
| 160 | ;(_logicpgx000) are formed! |
||
| 161 | |||
| 162 | ld hl,(_logicpg4000) |
||
| 163 | ld h,temulpgs/256 |
||
| 164 | ld a,(hl) |
||
| 165 | LD (emulcurpg4000),A |
||
| 166 | |||
| 167 | ld hl,(_logicpgc000) |
||
| 168 | ld h,temulpgs/256 |
||
| 169 | ld a,(hl) |
||
| 170 | LD (emulcurpgc000),A |
||
| 171 | if margins;MEM48C0 |
||
| 172 | SETPGC000 |
||
| 173 | endif |
||
| 174 | ld hl,(_logicpg8000) |
||
| 175 | ld h,temulpgs/256 |
||
| 176 | ld a,(hl) |
||
| 177 | LD (emulcurpg8000),A |
||
| 178 | if margins;MEM48C0 |
||
| 179 | SETPG8000 |
||
| 180 | endif |
||
| 181 | |||
| 182 | if extpg5 |
||
| 183 | ld a,(_dffd) |
||
| 184 | rla |
||
| 185 | ld a,(_logicpgc000) |
||
| 186 | jr nc,screeninc000_noprofi |
||
| 187 | and 0xff-2 |
||
| 188 | cp 0x04 |
||
| 189 | jr z,screeninc000_noprofiq |
||
| 190 | cp PGATTR0 |
||
| 191 | jr screeninc000_noprofiq |
||
| 192 | screeninc000_noprofi |
||
| 193 | and 0xff-2 |
||
| 194 | cp 5 |
||
| 195 | screeninc000_noprofiq |
||
| 196 | ld a,0xc9 ;screen off |
||
| 197 | jr nz,$+3 |
||
| 198 | xor a ;screen on |
||
| 199 | ld (screeninc000_flag),a |
||
| 200 | |||
| 201 | ld a,(_dffd) |
||
| 202 | rla |
||
| 203 | ld a,(_logicpg4000) |
||
| 204 | jr nc,screenin4000_noprofi |
||
| 205 | and 0xff-2 |
||
| 206 | cp 0x04 |
||
| 207 | jr z,screenin4000_noprofiq |
||
| 208 | cp PGATTR0 |
||
| 209 | jr screenin4000_noprofiq |
||
| 210 | screenin4000_noprofi |
||
| 211 | and 0xff-2 |
||
| 212 | cp 5 |
||
| 213 | screenin4000_noprofiq |
||
| 214 | ld a,0xc9 ;screen off |
||
| 215 | jr nz,$+3 |
||
| 216 | xor a ;screen on |
||
| 217 | ld (screenin4000_flag),a |
||
| 218 | |||
| 219 | ld a,(_dffd) |
||
| 220 | rla |
||
| 221 | ld a,(_logicpg8000) |
||
| 222 | jr nc,screenin8000_noprofi |
||
| 223 | and 0xff-2 |
||
| 224 | cp 0x04 |
||
| 225 | jr z,screenin8000_noprofiq |
||
| 226 | cp PGATTR0 |
||
| 227 | jr screenin8000_noprofiq |
||
| 228 | screenin8000_noprofi |
||
| 229 | and 0xff-2 |
||
| 230 | cp 5 |
||
| 231 | screenin8000_noprofiq |
||
| 232 | ld a,0xc9 ;screen off |
||
| 233 | jr nz,$+3 |
||
| 234 | xor a ;screen on |
||
| 235 | ld (screenin8000_flag),a |
||
| 236 | |||
| 237 | endif |
||
| 238 | |||
| 239 | if margins |
||
| 240 | ld a,0x3e |
||
| 241 | ld (set4000com),a |
||
| 242 | CALCpgcom |
||
| 243 | endif |
||
| 244 | RET |
||
| 245 | eoutFE |
||
| 246 | LD (_fe),A |
||
| 247 | outFE |
||
| 248 | OUT (#FE),A |
||
| 249 | RET |
||
| 250 | EMUOUTDOS |
||
| 251 | LD A,C |
||
| 252 | CP #3F |
||
| 253 | jr Z,eod3F |
||
| 254 | CP #5F |
||
| 255 | jr Z,eod5F |
||
| 256 | CP #FF |
||
| 257 | jr Z,eodFF |
||
| 258 | POP AF |
||
| 259 | RET |
||
| 260 | eod3F |
||
| 261 | POP AF |
||
| 262 | LD (dos3F),A |
||
| 263 | RET |
||
| 264 | eod5F |
||
| 265 | POP AF |
||
| 266 | LD (dos5F),A |
||
| 267 | RET |
||
| 268 | eodFF |
||
| 269 | POP AF |
||
| 270 | LD (dosFF),A |
||
| 271 | RET |
||
| 272 | |||
| 273 | copyscreen_profi |
||
| 274 | ;a=logicpg |
||
| 275 | ld (copyscreen_profi_logicpg),a |
||
| 276 | ld c,a |
||
| 277 | ld b,temulpgs/256 |
||
| 278 | ld a,(bc) |
||
| 279 | ld (copyscreen_profi_physpg),a |
||
| 280 | ld hl,0x4000 |
||
| 281 | copyscreen_profi0 |
||
| 282 | push hl |
||
| 283 | copyscreen_profi_physpg=$+1 |
||
| 284 | ld a,0 |
||
| 285 | OUTPG4000 |
||
| 286 | ld c,(hl) |
||
| 287 | or a |
||
| 288 | copyscreen_profi_logicpg=$+1 |
||
| 289 | ld a,0 |
||
| 290 | call screen4000_branchvideomode |
||
| 291 | pop hl |
||
| 292 | inc l |
||
| 293 | jr nz,copyscreen_profi0 |
||
| 294 | inc h |
||
| 295 | jp p,copyscreen_profi0 |
||
| 296 | ret |
||
| 297 | |||
| 298 | EMUIN |
||
| 299 | ;BC=port |
||
| 300 | ;return A=value |
||
| 301 | BIT 0,C |
||
| 302 | jr Z,einFE |
||
| 303 | LD A,(doson0) |
||
| 304 | OR A |
||
| 305 | jr Z,EMUINDOS |
||
| 306 | LD A,C |
||
| 307 | cp 0xfd |
||
| 308 | jr z,einAY |
||
| 309 | CP #DF |
||
| 310 | jr Z,einMOUSE |
||
| 311 | CP #1F |
||
| 312 | jr Z,einKEMPSTON |
||
| 313 | LD A,#FF |
||
| 314 | RET |
||
| 315 | einAY |
||
| 316 | ld bc,0xfffd |
||
| 317 | in a,(c) |
||
| 318 | ret |
||
| 319 | einMOUSE |
||
| 320 | LD A,B |
||
| 321 | CP #FA |
||
| 322 | jr Z,einFADF |
||
| 323 | CP #FB |
||
| 324 | jr Z,einFBDF |
||
| 325 | CP #FF |
||
| 326 | jr Z,einFFDF |
||
| 327 | LD A,#FF |
||
| 328 | RET |
||
| 329 | einFADF |
||
| 330 | ;LD BC,#FADF |
||
| 331 | ;IN A,(C) |
||
| 332 | mousebuttons=$+1 |
||
| 333 | ld a,0xff |
||
| 334 | RET |
||
| 335 | einFBDF |
||
| 336 | ;LD BC,#FBDF |
||
| 337 | ;IN A,(C) |
||
| 338 | mousex=$+1 |
||
| 339 | ld a,0 |
||
| 340 | RET |
||
| 341 | einFFDF |
||
| 342 | ;LD BC,#FFDF |
||
| 343 | ;IN A,(C) |
||
| 344 | mousey=$+1 |
||
| 345 | ld a,0 |
||
| 346 | RET |
||
| 347 | einKEMPSTON |
||
| 348 | ;IN A,(#1f) |
||
| 349 | kempston=$+1 |
||
| 350 | ld a,0 |
||
| 351 | RET |
||
| 352 | einFE |
||
| 353 | ;LD C,#FE |
||
| 354 | ;IN A,(C) |
||
| 355 | ;ld a,b |
||
| 356 | ;or a |
||
| 357 | ;jr z,$ |
||
| 358 | push hl |
||
| 359 | ld hl,keymatrix |
||
| 360 | ld a,0xff |
||
| 361 | dup 8 |
||
| 362 | rlc b |
||
| 363 | jr c,$+3 |
||
| 364 | and (hl) |
||
| 365 | inc hl |
||
| 366 | edup |
||
| 367 | pop hl |
||
| 368 | and a |
||
| 369 | ;LD C,#FE |
||
| 370 | ;IN A,(C) |
||
| 1137 | alone | 371 | RET |
| 1057 | alone | 372 | EMUINDOS |
| 373 | LD A,C |
||
| 374 | CP #1F |
||
| 375 | jr Z,eid1F |
||
| 376 | CP #3F |
||
| 377 | jr Z,eid3F |
||
| 378 | CP #5F |
||
| 379 | jr Z,eid5F |
||
| 380 | CP #5F |
||
| 381 | jr Z,eidFF |
||
| 382 | LD A,#FF |
||
| 1137 | alone | 383 | RET |
| 1057 | alone | 384 | eidFF |
| 385 | ;LD A,#80 ;INTRQ=команда выполнена ok |
||
| 386 | ld a,r |
||
| 387 | rla |
||
| 388 | and 0xc0 ;D6=DRQ, D7=INTRQ |
||
| 1137 | alone | 389 | RET |
| 1057 | alone | 390 | eid1F |
| 391 | ;LD A,#80 ;команда выполнена ok, диск вставлен |
||
| 392 | ld a,r |
||
| 393 | fddstatemask=$+1 |
||
| 394 | and 3 |
||
| 395 | or 0x80 |
||
| 1137 | alone | 396 | RET |
| 1057 | alone | 397 | eid3F |
| 398 | LD A,(dos3F) ;trk |
||
| 1137 | alone | 399 | RET |
| 1057 | alone | 400 | eid5F |
| 401 | LD A,(dos5F) ;sec |
||
| 1137 | alone | 402 | RET |
| 403 | |||
| 404 | setvideomode |
||
| 405 | ld (oldcurvideomode),a |
||
| 406 | ;video mode changed! set system video mode and recode screen data |
||
| 407 | ;push bc |
||
| 408 | push de |
||
| 409 | ;push hl |
||
| 410 | rla |
||
| 411 | jr c,eoDFFD_copyprofi |
||
| 412 | ld a,SCREEN4000_VIDEOMODE_6912 |
||
| 413 | ld (screen4000_videomode),a |
||
| 414 | ld a,SCREEN8000_VIDEOMODE_6912 |
||
| 415 | ld (screen8000_videomode),a |
||
| 416 | ld a,SCREENC000_VIDEOMODE_6912 |
||
| 417 | ld (screenc000_videomode),a |
||
| 418 | ld a,0x05 |
||
| 419 | call copyscreen_profi |
||
| 420 | ld a,0x07 |
||
| 421 | call copyscreen_profi |
||
| 422 | ld e,3+0x80 ;6912+keep |
||
| 423 | jr eoDFFD_copyprofiq |
||
| 424 | eoDFFD_copyprofi |
||
| 425 | ld a,(user_scr1_high) ;ok |
||
| 426 | call clearpg |
||
| 427 | ld a,(user_scr0_high) ;ok |
||
| 428 | call clearpg |
||
| 429 | ld a,SCREEN4000_VIDEOMODE_PROFI |
||
| 430 | ld (screen4000_videomode),a |
||
| 431 | ld a,SCREEN8000_VIDEOMODE_PROFI |
||
| 432 | ld (screen8000_videomode),a |
||
| 433 | ld a,SCREENC000_VIDEOMODE_PROFI |
||
| 434 | ld (screenc000_videomode),a |
||
| 435 | ld a,0x04 |
||
| 436 | call copyscreen_profi |
||
| 437 | ld a,0x06 |
||
| 438 | call copyscreen_profi |
||
| 439 | ld a,PGATTR0;0x38 |
||
| 440 | call copyscreen_profi |
||
| 441 | ld a,PGATTR1;0x3a |
||
| 442 | call copyscreen_profi |
||
| 443 | ld e,2+0x80 ;MC+keep |
||
| 444 | eoDFFD_copyprofiq |
||
| 445 | exx |
||
| 446 | push bc |
||
| 447 | push de |
||
| 448 | push hl |
||
| 449 | push ix |
||
| 450 | push iy |
||
| 451 | exx |
||
| 452 | exa |
||
| 453 | push af |
||
| 454 | OS_SETGFX ;e=0:EGA, e=2:MC, e=3:6912, e=6:text ;+SET FOCUS ;e=-1: disable gfx (out: e=old gfxmode) |
||
| 455 | pop af |
||
| 456 | exa |
||
| 457 | ld a,e |
||
| 458 | pop iy |
||
| 459 | pop ix |
||
| 460 | pop hl |
||
| 461 | pop de |
||
| 462 | pop bc |
||
| 463 | exx |
||
| 464 | ;pop hl |
||
| 465 | pop de |
||
| 466 | ;pop bc |
||
| 467 | ret |
||
| 468 | |||
| 469 | setscreen |
||
| 470 | ld (oldcurscr7ffd),a |
||
| 471 | ;push bc |
||
| 472 | push de |
||
| 473 | ;push hl |
||
| 474 | exx |
||
| 475 | push bc |
||
| 476 | push de |
||
| 477 | push hl |
||
| 478 | push ix |
||
| 479 | push iy |
||
| 480 | rrca |
||
| 481 | rrca |
||
| 482 | rrca |
||
| 483 | ld e,a |
||
| 484 | exa |
||
| 485 | push af |
||
| 486 | OS_SETSCREEN |
||
| 487 | pop af |
||
| 488 | exa |
||
| 489 | pop iy |
||
| 490 | pop ix |
||
| 491 | pop hl |
||
| 492 | pop de |
||
| 493 | pop bc |
||
| 494 | exx |
||
| 495 | ;pop hl |
||
| 496 | pop de |
||
| 497 | ;pop bc |
||
| 498 | ret |