Rev 961 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log
| Rev 961 | Rev 1029 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | DEVICE ZXSPECTRUM128 |
1 | DEVICE ZXSPECTRUM128 |
| 2 | include "../../_sdk/sys_h.asm" |
2 | include "../../_sdk/sys_h.asm" |
| 3 | 3 | ||
| 4 | BINADDR=0x4000 |
4 | BINADDR=0x4000 |
| 5 | 5 | ||
| 6 | ;include "../_sdk/target.asm" |
- | |
| 7 | - | ||
| 8 | ;MEM_SLOT0=#37f7 |
- | |
| 9 | ;MEM_SLOT1=#77f7 |
- | |
| 10 | ;MEM_SLOT2=#b7f7 |
- | |
| 11 | ;MEM_SLOT3=#f7f7 |
- | |
| 12 | - | ||
| 13 | INVMASK=#ff |
- | |
| 14 | - | ||
| 15 | ;include "_temp_/pages.asm" |
- | |
| 16 | NUMBER_OF_PAGES=10 |
- | |
| 17 | - | ||
| 18 | scrbase=0x4000 |
6 | scrbase=0x4000 |
| 19 | sprmaxwid=32 |
7 | sprmaxwid=32 |
| 20 | sprmaxhgt=32 |
8 | sprmaxhgt=32 |
| 21 | scrwid=160 ;double pixels |
9 | scrwid=160 ;double pixels |
| 22 | scrhgt=200 |
10 | scrhgt=200 |
| Line 25... | Line 13... | ||
| 25 | 13 | ||
| 26 | STACK=0x4000 |
14 | STACK=0x4000 |
| 27 | tempsp=0x3f06 ;6 bytes for prspr |
15 | tempsp=0x3f06 ;6 bytes for prspr |
| 28 | INTSTACK=0x3f00 |
16 | INTSTACK=0x3f00 |
| 29 | 17 | ||
| 30 | - | ||
| 31 | SND_PAGE=0;(0^INVMASK) |
18 | SND_PAGE=0;(0^INVMASK) |
| 32 | SPTBL_PAGE=1;(6^INVMASK) |
19 | SPTBL_PAGE=1;(6^INVMASK) |
| 33 | PAL_PAGE=2;(4^INVMASK) |
20 | PAL_PAGE=2;(4^INVMASK) |
| 34 | 21 | ||
| 35 | SPBUF_PAGE0=3;(8^INVMASK) |
22 | SPBUF_PAGE0=3;(8^INVMASK) |
| 36 | SPBUF_PAGE1=4;(9^INVMASK) |
23 | SPBUF_PAGE1=4;(9^INVMASK) |
| 37 | SPBUF_PAGE2=5;(10^INVMASK) |
24 | SPBUF_PAGE2=5;(10^INVMASK) |
| 38 | SPBUF_PAGE3=6;(11^INVMASK) |
25 | SPBUF_PAGE3=6;(11^INVMASK) |
| 39 | 26 | ||
| 40 | ;CC_PAGE0=(12^INVMASK) |
- | |
| 41 | CC_PAGE1=7;(13^INVMASK) |
27 | CC_PAGE1=7;(13^INVMASK) |
| 42 | CC_PAGE2=8;(14^INVMASK) |
28 | CC_PAGE2=8;(14^INVMASK) |
| 43 | CC_PAGE3=9;(12^INVMASK) |
29 | CC_PAGE3=9;(12^INVMASK) |
| 44 | 30 | ||
| 45 | GFX_PAGE=10;(16^INVMASK) ;и далее |
31 | GFX_PAGE=10;(16^INVMASK) ;и далее |
| 46 | 32 | ||
| 47 | - | ||
| 48 | IMG_LIST =0xd000;#1000 |
33 | IMG_LIST =0xd000;#1000 |
| 49 | 34 | ||
| 50 | ;смещения в SND_PAGE |
35 | ;смещения в SND_PAGE |
| 51 | 36 | ||
| 52 | AFX_INIT =#4000 |
37 | AFX_INIT =#4000 |
| Line 63... | Line 48... | ||
| 63 | 48 | ||
| 64 | MUS_LIST =#4a00 |
49 | MUS_LIST =#4a00 |
| 65 | SMP_LIST =#4d00 |
50 | SMP_LIST =#4d00 |
| 66 | SFX_DATA =#5100 |
51 | SFX_DATA =#5100 |
| 67 | 52 | ||
| 68 | - | ||
| 69 | - | ||
| 70 | macro MDebug color |
53 | macro MDebug color |
| 71 | push af |
54 | push af |
| 72 | ld a,color |
55 | ld a,color |
| 73 | out (#fe),a |
56 | out (#fe),a |
| 74 | pop af |
57 | pop af |
| 75 | endm |
58 | endm |
| 76 | 59 | ||
| 77 | macro MSetShadowScreen |
60 | macro MSetShadowScreen |
| 78 | ;ld a,(_screenActive) |
- | |
| 79 | ;SETPG16K |
- | |
| 80 | ;sub 4 |
- | |
| 81 | ;SETPG32KLOW |
- | |
| 82 | call setpgsscr40008000;_current |
61 | call setpgsscr40008000 |
| 83 | endm |
62 | endm |
| 84 | 63 | ||
| 85 | macro MRestoreMemMap012 |
64 | macro MRestoreMemMap012 |
| 86 | ;TODO переделать на (pgmain4000) и т.п. (сейчас с пересчётом по таблице) |
65 | ;TODO переделать на (pgmain4000) и т.п. (сейчас с пересчётом по таблице) |
| 87 | ;ld bc,MEM_SLOT3 |
- | |
| 88 | ld a,CC_PAGE3 |
66 | ld a,CC_PAGE3 |
| 89 | ;out (c),a |
- | |
| 90 | call setpgc000;SETPG32KHIGH |
67 | call setpgc000;SETPG32KHIGH |
| 91 | - | ||
| 92 | ;ld b,high MEM_SLOT1 |
- | |
| 93 | ld a,CC_PAGE1 |
68 | ld a,CC_PAGE1 |
| 94 | ;ld (_memSlot1),a |
- | |
| 95 | ;out (c),a |
- | |
| 96 | call setpg4000;SETPG16K |
69 | call setpg4000;SETPG16K |
| 97 | - | ||
| 98 | ;ld b,high MEM_SLOT2 |
- | |
| 99 | ld a,CC_PAGE2 |
70 | ld a,CC_PAGE2 |
| 100 | ;ld (_memSlot2),a |
- | |
| 101 | ;out (c),a |
- | |
| 102 | call setpg8000;SETPG32KLOW |
71 | call setpg8000;SETPG32KLOW |
| 103 | endm |
72 | endm |
| 104 | 73 | ||
| 105 | macro MRestoreMemMap12 |
74 | macro MRestoreMemMap12 |
| 106 | ;ld bc,MEM_SLOT1 |
- | |
| 107 | ld a,CC_PAGE1 |
75 | ld a,CC_PAGE1 |
| 108 | ;ld (_memSlot1),a |
- | |
| 109 | ;out (c),a |
- | |
| 110 | call setpg4000;SETPG16K |
76 | call setpg4000;SETPG16K |
| 111 | - | ||
| 112 | ;ld b,high MEM_SLOT2 |
- | |
| 113 | ld a,CC_PAGE2 |
77 | ld a,CC_PAGE2 |
| 114 | ;ld (_memSlot2),a |
- | |
| 115 | ;out (c),a |
- | |
| 116 | call setpg8000;SETPG32KLOW |
78 | call setpg8000;SETPG32KLOW |
| 117 | endm |
79 | endm |
| 118 | 80 | ||
| 119 | org PROGSTART |
81 | org PROGSTART |
| 120 | begin |
82 | begin |
| Line 146... | Line 108... | ||
| 146 | ld (tpages+CC_PAGE1),a |
108 | ld (tpages+CC_PAGE1),a |
| 147 | ld a,h |
109 | ld a,h |
| 148 | LD (pgmain8000),A |
110 | LD (pgmain8000),A |
| 149 | ld (tpages+CC_PAGE2),a |
111 | ld (tpages+CC_PAGE2),a |
| 150 | ld a,l |
112 | ld a,l |
| 151 | ;LD (pgmainc000),A |
- | |
| 152 | ;pgmainc000=$+1 |
- | |
| 153 | ; ld a,0 |
- | |
| 154 | ld (tpages+CC_PAGE3),a |
113 | ld (tpages+CC_PAGE3),a |
| 155 | call setpgsmain40008000 ;записать в curpg... |
114 | call setpgsmain40008000 ;записать в curpg... |
| 156 | 115 | ||
| 157 | ;OS_GETSCREENPAGES |
- | |
| 158 | ;de=страницы 0-го экрана (d=старшая), hl=страницы 1-го экрана (h=старшая) |
- | |
| 159 | ;ld a,l |
- | |
| 160 | ;ld (setpgs_scr_low),a |
- | |
| 161 | ;xor e |
- | |
| 162 | ;ld (setpgs_scr_scrxor),a |
- | |
| 163 | ;ld a,h |
- | |
| 164 | ;ld (ttexpgs+31),a ;ld (IR128),a ;на всякой случай, для прерывания |
- | |
| 165 | ;xor l |
- | |
| 166 | ;ld (setpgs_scr_pgxor),a |
- | |
| 167 | - | ||
| 168 | ld de,res_path |
116 | ld de,res_path |
| 169 | OS_CHDIR |
117 | OS_CHDIR |
| 170 | 118 | ||
| 171 | ld de,fnaddr |
119 | ld de,fnaddr |
| 172 | OS_OPENHANDLE |
120 | OS_OPENHANDLE |
| Line 225... | Line 173... | ||
| 225 | pop bc |
173 | pop bc |
| 226 | djnz mkpages0 |
174 | djnz mkpages0 |
| 227 | 175 | ||
| 228 | call initsfx |
176 | call initsfx |
| 229 | 177 | ||
| 230 | if 1==0 |
- | |
| 231 | call loadpage |
178 | call swapimer |
| 232 | ld (pgmusic),a |
- | |
| 233 | SETPG4000 |
- | |
| 234 | push af |
- | |
| 235 | call 0x4000 ;init |
- | |
| 236 | pop af |
- | |
| 237 | ld hl,0x4005 ;play |
- | |
| 238 | OS_SETMUSIC |
- | |
| 239 | endif |
179 | |
| 240 | call setpgsmain40008000 |
180 | call setpgsmain40008000 |
| 241 | call RestoreMemMap3 |
181 | call RestoreMemMap3 |
| 242 | ld de,fnbin |
182 | ld de,fnbin |
| 243 | ld hl,0x4000 |
183 | ld hl,0x4000 |
| 244 | call loadbinpg |
184 | call loadbinpg |
| Line 247... | Line 187... | ||
| 247 | call loadbinpg |
187 | call loadbinpg |
| 248 | ld de,fnbin3 |
188 | ld de,fnbin3 |
| 249 | ld hl,0xc000 |
189 | ld hl,0xc000 |
| 250 | call loadbinpg |
190 | call loadbinpg |
| 251 | 191 | ||
| 252 | call swapimer |
- | |
| 253 | - | ||
| 254 | ld de,CURPAL |
192 | ld de,CURPAL |
| 255 | OS_SETPAL |
193 | OS_SETPAL |
| 256 | 194 | ||
| 257 | call _swap_screen |
195 | call _swap_screen |
| 258 | jpaddr=$+1 |
196 | jpaddr=$+1 |
| Line 270... | Line 208... | ||
| 270 | 208 | ||
| 271 | ds 0x0200-$ |
209 | ds 0x0200-$ |
| 272 | tpages |
210 | tpages |
| 273 | ds 256 ;pages |
211 | ds 256 ;pages |
| 274 | 212 | ||
| 275 | initsfx |
- | |
| 276 | ;определение TS |
- | |
| 277 | ld bc,#fffd ;稯 0 |
- | |
| 278 | out (c),b |
- | |
| 279 | xor a ;регистр 0 |
- | |
| 280 | out (c),a |
- | |
| 281 | ld b,#bf ;значение #bf |
- | |
| 282 | out (c),b |
- | |
| 283 | ld b,#ff ;稯 1 |
- | |
| 284 | ld a,#fe |
- | |
| 285 | out (c),a |
- | |
| 286 | xor a ;регистр 0 |
- | |
| 287 | out (c),a |
- | |
| 288 | ld b,#bf ;значение 0 |
- | |
| 289 | out (c),a |
- | |
| 290 | ld b,#ff ;稯 0 |
- | |
| 291 | out (c),b |
- | |
| 292 | xor a ;регистр 0 |
- | |
| 293 | out (c),a |
- | |
| 294 | in a,(c) |
- | |
| 295 | ld (turboSound),a |
- | |
| 296 | ld a,SND_PAGE |
- | |
| 297 | call setpg4000 |
- | |
| 298 | xor a |
- | |
| 299 | call reset_ay_ay |
- | |
| 300 | inc a |
- | |
| 301 | call reset_ay_ay |
- | |
| 302 | ld hl,SFX_DATA |
- | |
| 303 | jp AFX_INIT |
- | |
| 304 | - | ||
| 305 | loadbinpg |
213 | loadbinpg |
| 306 | push hl |
214 | push hl |
| 307 | OS_OPENHANDLE |
215 | OS_OPENHANDLE |
| 308 | pop de ;addr |
216 | pop de ;addr |
| 309 | push bc |
217 | push bc |
| 310 | ;ld de,BINADDR ;addr |
- | |
| 311 | ;ld hl,0x4000 ;size |
- | |
| 312 | ;OS_READHANDLE |
- | |
| 313 | ;pop bc |
- | |
| 314 | ;push bc |
- | |
| 315 | ;ld de,BINADDR ;addr |
- | |
| 316 | ld hl,-BINADDR ;size |
218 | ld hl,-BINADDR ;size |
| 317 | OS_READHANDLE |
219 | OS_READHANDLE |
| 318 | pop bc |
220 | pop bc |
| 319 | OS_CLOSEHANDLE |
221 | OS_CLOSEHANDLE |
| 320 | ret |
222 | ret |
| Line 357... | Line 259... | ||
| 357 | or a ;CY=0 |
259 | or a ;CY=0 |
| 358 | ret |
260 | ret |
| 359 | 261 | ||
| 360 | CURPAL |
262 | CURPAL |
| 361 | ;DDp palette: %grbG11RB(low),%grbG11RB(high), инверсные |
263 | ;DDp palette: %grbG11RB(low),%grbG11RB(high), инверсные |
| 362 | dw 0xffff,0xfefe,0x1d1d,0x3c3c,0xcdcd,0x4c4c,0x2c2c,0xecec |
- | |
| 363 | dw 0xfdfd,0x2d2d,0xeeee,0x3f3f,0xafaf,0x5d5d,0x4e4e,0x0c0c |
- | |
| 364 | ;RSTPAL |
- | |
| 365 | ; STANDARDPAL |
264 | STANDARDPAL |
| 366 | 265 | ||
| 367 | sndfilename |
266 | sndfilename |
| 368 | db "page_0.bin",0 |
267 | db "page_0.bin",0 |
| 369 | sprtblfilename |
268 | sprtblfilename |
| 370 | db "page_1.bin",0 |
269 | db "page_1.bin",0 |
| Line 379... | Line 278... | ||
| 379 | 278 | ||
| 380 | 279 | ||
| 381 | setpgsmain40008000 |
280 | setpgsmain40008000 |
| 382 | pgmain4000=$+1 |
281 | pgmain4000=$+1 |
| 383 | ld a,0 |
282 | ld a,0 |
| 384 | ;ld (curpg4000),a |
- | |
| 385 | SETPG4000 |
283 | SETPG4000 |
| 386 | pgmain8000=$+1 |
284 | pgmain8000=$+1 |
| 387 | ld a,0 |
285 | ld a,0 |
| 388 | ;ld (curpg8000),a |
- | |
| 389 | SETPG8000 |
286 | SETPG8000 |
| 390 | ret |
287 | ret |
| 391 | 288 | ||
| 392 | setpgsscr40008000_current |
289 | setpgsscr40008000_current |
| 393 | call getuser_scr_low_cur |
290 | call getuser_scr_low_cur |
| 394 | ;ld (curpg4000),a ;TODO kill |
- | |
| 395 | SETPG4000 |
291 | SETPG4000 |
| 396 | call getuser_scr_high_cur |
292 | call getuser_scr_high_cur |
| 397 | ;ld (curpg8000),a ;TODO kill |
- | |
| 398 | SETPG8000 |
293 | SETPG8000 |
| 399 | ret |
294 | ret |
| 400 | 295 | ||
| 401 | setpgsscr40008000 |
296 | setpgsscr40008000 |
| 402 | call getuser_scr_low |
297 | call getuser_scr_low |
| 403 | ;ld (curpg4000),a ;TODO kill |
- | |
| 404 | SETPG4000 |
298 | SETPG4000 |
| 405 | call getuser_scr_high |
299 | call getuser_scr_high |
| 406 | ;ld (curpg8000),a ;TODO kill |
- | |
| 407 | SETPG8000 |
300 | SETPG8000 |
| 408 | ret |
301 | ret |
| 409 | 302 | ||
| 410 | setpgscrlow4000 |
303 | setpgscrlow4000 |
| 411 | call getuser_scr_low |
304 | call getuser_scr_low |
| Line 440... | Line 333... | ||
| 440 | getuser_scr_high_cur_patchN=0xff&(user_scr0_high^user_scr1_high) |
333 | getuser_scr_high_cur_patchN=0xff&(user_scr0_high^user_scr1_high) |
| 441 | ld a,(user_scr0_high) ;ok |
334 | ld a,(user_scr0_high) ;ok |
| 442 | ret |
335 | ret |
| 443 | 336 | ||
| 444 | changescrpg_current |
337 | changescrpg_current |
| 445 | ; ld a,(setpgs_scr_low) |
- | |
| 446 | ;setpgs_scr_scrxor=$+1 |
- | |
| 447 | ; xor 0 |
- | |
| 448 | ; ld (setpgs_scr_low),a |
- | |
| 449 | ld hl,getuser_scr_low_patch |
338 | ld hl,getuser_scr_low_patch |
| 450 | ld a,(hl) |
339 | ld a,(hl) |
| 451 | xor getuser_scr_low_patchN |
340 | xor getuser_scr_low_patchN |
| 452 | ld (hl),a |
341 | ld (hl),a |
| 453 | ld hl,getuser_scr_high_patch |
342 | ld hl,getuser_scr_high_patch |
| Line 470... | Line 359... | ||
| 470 | ret |
359 | ret |
| 471 | 360 | ||
| 472 | changescrpg |
361 | changescrpg |
| 473 | ;TODO убрать |
362 | ;TODO убрать |
| 474 | call changescrpg_current |
363 | call changescrpg_current |
| 475 | ;ld (curscrnum_physical),a |
- | |
| 476 | ld e,a |
364 | ld e,a |
| 477 | OS_SETSCREEN |
365 | OS_SETSCREEN |
| 478 | ret |
366 | ret |
| 479 | 367 | ||
| 480 | setpg4000 |
368 | setpg4000 |
| 481 | ;ld ($+4),a |
- | |
| 482 | ;ld a,(tpages) ;нереентерабельно! |
- | |
| 483 | ld b,tpages/256 |
369 | ld b,tpages/256 |
| 484 | ld c,a |
370 | ld c,a |
| 485 | ld a,(bc) |
371 | ld a,(bc) |
| 486 | SETPG16K |
372 | SETPG16K |
| 487 | ret |
373 | ret |
| 488 | 374 | ||
| 489 | setpg8000 |
375 | setpg8000 |
| 490 | ;ld ($+4),a |
- | |
| 491 | ;ld a,(tpages) ;нереентерабельно! |
- | |
| 492 | ld b,tpages/256 |
376 | ld b,tpages/256 |
| 493 | ld c,a |
377 | ld c,a |
| 494 | ld a,(bc) |
378 | ld a,(bc) |
| 495 | SETPG32KLOW |
379 | SETPG32KLOW |
| 496 | ret |
380 | ret |
| 497 | 381 | ||
| 498 | setpgc000 |
382 | setpgc000 |
| 499 | ;ld ($+4),a |
- | |
| 500 | ;ld a,(tpages) ;нереентерабельно! |
- | |
| 501 | ld b,tpages/256 |
383 | ld b,tpages/256 |
| 502 | ld c,a |
384 | ld c,a |
| 503 | ld a,(bc) |
385 | ld a,(bc) |
| 504 | SETPG32KHIGH |
386 | SETPG32KHIGH |
| 505 | ret |
387 | ret |
| Line 539... | Line 421... | ||
| 539 | halt |
421 | halt |
| 540 | 422 | ||
| 541 | ld a,(_screenActive) |
423 | ld a,(_screenActive) |
| 542 | xor 2 |
424 | xor 2 |
| 543 | ld (_screenActive),a ;for select sprqueue |
425 | ld (_screenActive),a ;for select sprqueue |
| 544 | ;ld e,a |
- | |
| 545 | - | ||
| 546 | ;ld a,#10 |
- | |
| 547 | ;bit 1,e |
- | |
| 548 | ;jr z,$+4 |
- | |
| 549 | ;or #08 |
- | |
| 550 | ;ld bc,#7ffd |
- | |
| 551 | ;out (c),a |
- | |
| 552 | call changescrpg |
426 | call changescrpg |
| 553 | ;rra |
- | |
| 554 | ;and 1 ;+cpl? |
- | |
| 555 | ;ld e,a |
- | |
| 556 | ;OS_SETSCREEN |
- | |
| 557 | 427 | ||
| 558 | pop af |
428 | pop af |
| 559 | jr z,.noSpr1 |
429 | jr z,.noSpr1 |
| 560 | 430 | ||
| 561 | call setShadowScreen |
431 | call setShadowScreen |
| 562 | call respr |
432 | call respr |
| 563 | call updateTilesFromBuffer |
433 | call updateTilesFromBuffer |
| 564 | ;MRestoreMemMap012 |
- | |
| 565 | call RestoreMemMap3;0 |
434 | call RestoreMemMap3;0 |
| 566 | call RestoreMemMap12 |
435 | call RestoreMemMap12 |
| 567 | .noSpr1 |
436 | .noSpr1 |
| 568 | ;pop iy |
437 | ;pop iy |
| 569 | pop ix |
438 | pop ix |
| Line 577... | Line 446... | ||
| 577 | add hl,hl |
446 | add hl,hl |
| 578 | add hl,hl |
447 | add hl,hl |
| 579 | set 7,h |
448 | set 7,h |
| 580 | set 6,h |
449 | set 6,h |
| 581 | 450 | ||
| 582 | ;ld bc,MEM_SLOT0 |
- | |
| 583 | ld a,PAL_PAGE |
451 | ld a,PAL_PAGE |
| 584 | ;out (c),a |
- | |
| 585 | call setpgc000;SETPG32KHIGH |
452 | jp setpgc000;SETPG32KHIGH |
| 586 | ret |
- | |
| 587 | - | ||
| 588 | 453 | ||
| 589 | 454 | ||
| 590 | _pal_select |
455 | _pal_select |
| 591 | call pal_get_address |
456 | call pal_get_address |
| 592 | 457 | ||
| Line 595... | Line 460... | ||
| 595 | ldir |
460 | ldir |
| 596 | 461 | ||
| 597 | ld a,d |
462 | ld a,d |
| 598 | ld (_palChange),a |
463 | ld (_palChange),a |
| 599 | RestoreMemMap3;0 |
464 | RestoreMemMap3;0 |
| 600 | ;ld bc,MEM_SLOT0 |
- | |
| 601 | ld a,CC_PAGE3;0 |
465 | ld a,CC_PAGE3;0 |
| 602 | ;out (c),a |
- | |
| 603 | call setpgc000;SETPG32KHIGH |
466 | jp setpgc000;SETPG32KHIGH |
| 604 | ret |
- | |
| 605 | 467 | ||
| 606 | 468 | ||
| 607 | 469 | ||
| 608 | _pal_bright |
470 | _pal_bright |
| 609 | cp 7 |
471 | cp 7 |
| Line 629... | Line 491... | ||
| 629 | 491 | ||
| 630 | ld de,palTemp |
492 | ld de,palTemp |
| 631 | ld bc,16 |
493 | ld bc,16 |
| 632 | ldir |
494 | ldir |
| 633 | 495 | ||
| 634 | ;ld bc,MEM_SLOT0 |
- | |
| 635 | ld a,CC_PAGE3;0 |
496 | ld a,CC_PAGE3;0 |
| 636 | ;out (c),a |
- | |
| 637 | call setpgc000;SETPG32KHIGH |
497 | call setpgc000;SETPG32KHIGH |
| 638 | 498 | ||
| 639 | pop de |
499 | pop de |
| 640 | ld hl,palTemp |
500 | ld hl,palTemp |
| 641 | ld bc,16 |
501 | ld bc,16 |
| 642 | ldir |
502 | ldir |
| 643 | - | ||
| 644 | ret |
503 | ret |
| 645 | 504 | ||
| 646 | 505 | ||
| 647 | 506 | ||
| 648 | ;более быстрая версия ldir, эффективна при bc>12 |
507 | ;более быстрая версия ldir, эффективна при bc>12 |
| 649 | ;из статьи на MSX Assembly Page |
508 | ;из статьи на MSX Assembly Page |
| 650 | ;в отличие от нормального ldir портит A и флаги |
509 | ;в отличие от нормального ldir портит A и флаги |
| 651 | - | ||
| 652 | _fast_ldir |
510 | _fast_ldir |
| 653 | DOSorTFM=0 |
- | |
| 654 | ifdef DOS |
- | |
| 655 | DOSorTFM=1 |
- | |
| 656 | endif |
- | |
| 657 | ifdef TFM |
- | |
| 658 | DOSorTFM=1 |
- | |
| 659 | endif |
- | |
| 660 | - | ||
| 661 | if DOSorTFM |
- | |
| 662 | ldir |
- | |
| 663 | ret |
- | |
| 664 | else |
- | |
| 665 | - | ||
| 666 | xor a |
511 | xor a |
| 667 | sub c |
512 | sub c |
| 668 | and 63 |
513 | and 63 |
| 669 | add a,a |
514 | add a,a |
| 670 | ld (.jump),a |
515 | ld (.jump),a |
| Line 675... | Line 520... | ||
| 675 | ldi |
520 | ldi |
| 676 | edup |
521 | edup |
| 677 | jp pe,.loop |
522 | jp pe,.loop |
| 678 | ret |
523 | ret |
| 679 | 524 | ||
| 680 | endif ;~DOSorTFM |
- | |
| 681 | - | ||
| 682 | align 256 ;#nn00 |
525 | align 256 ;#nn00 |
| 683 | tileUpdateXTable |
526 | tileUpdateXTable |
| 684 | dup 8 |
527 | dup 8 |
| 685 | db #01,#02,#04,#08,#10,#20,#40,#80 |
528 | db #01,#02,#04,#08,#10,#20,#40,#80 |
| 686 | edup |
529 | edup |
| Line 756... | Line 599... | ||
| 756 | 599 | ||
| 757 | align 256 ;#nn00 |
600 | align 256 ;#nn00 |
| 758 | tileUpdateMap ;битовая карта обновившихся знакомест, 64x25 бит |
601 | tileUpdateMap ;битовая карта обновившихся знакомест, 64x25 бит |
| 759 | ds 8*25,0 |
602 | ds 8*25,0 |
| 760 | 603 | ||
| 761 | ;export changescrpg |
- | |
| 762 | - | ||
| 763 | export _pal_select |
604 | export _pal_select |
| 764 | export _pal_copy |
605 | export _pal_copy |
| 765 | export _pal_bright |
606 | export _pal_bright |
| 766 | export _swap_screen |
607 | export _swap_screen |
| 767 | export _clear_screen |
608 | export _clear_screen |
| Line 778... | Line 619... | ||
| 778 | include "../_sdk/lib_sprites.asm" |
619 | include "../_sdk/lib_sprites.asm" |
| 779 | export _sprites_start |
620 | export _sprites_start |
| 780 | export _sprites_stop |
621 | export _sprites_stop |
| 781 | 622 | ||
| 782 | include "../_sdk/lib_input.asm" |
623 | include "../_sdk/lib_input.asm" |
| 783 | - | ||
| 784 | export _joystick |
624 | export _joystick |
| 785 | export _keyboard |
625 | export _keyboard |
| 786 | export _mouse_apply_clip |
626 | export _mouse_apply_clip |
| 787 | 627 | ||
| 788 | _sample_play |
- | |
| 789 | ;проигрывание сэмпла |
- | |
| 790 | ;l=номер сэмпла |
- | |
| 791 | push ix |
- | |
| 792 | ld a,(curpg32khigh) ;ok |
- | |
| 793 | push af |
- | |
| 794 | ld a,SND_PAGE |
- | |
| 795 | call setpgc000 |
- | |
| 796 | ld a,(SMP_COUNT|0xc000) |
- | |
| 797 | ld e,a |
- | |
| 798 | ld a,l |
- | |
| 799 | cp e |
- | |
| 800 | jr nc,.skip |
- | |
| 801 | - | ||
| 802 | ld h,high (SMP_LIST|0xc000) |
- | |
| 803 | ld e,(hl) ;lsb |
- | |
| 804 | inc h |
- | |
| 805 | ld a,(hl) ;msb |
- | |
| 806 | or 0xc0 |
- | |
| 807 | ld d,a |
- | |
| 808 | inc h |
- | |
| 809 | ld a,(hl) ;page |
- | |
| 810 | cpl |
- | |
| 811 | inc h |
- | |
| 812 | ld h,(hl) ;delay |
- | |
| 813 | ex de,hl ;hl=data |
- | |
| 814 | ld hx,d ;delay |
628 | include "../_sdk/lib_sound.asm" |
| 815 | ld e,a |
- | |
| 816 | ld d,tpages/256 |
- | |
| 817 | ;hl=data (0xc000+, 0x00=end), de=pagetable (0x0000+), hx=delay (18=11kHz, 7=22kHz, 1=44kHz) |
- | |
| 818 | OS_PLAYCOVOX |
- | |
| 819 | .skip |
- | |
| 820 | pop af |
- | |
| 821 | SETPG32KHIGH |
- | |
| 822 | pop ix |
- | |
| 823 | ret |
- | |
| 824 | - | ||
| 825 | ;выключение звука на указанном чипе |
- | |
| 826 | ;a=0 или 1 |
- | |
| 827 | reset_ay |
- | |
| 828 | ;используется в _sfx_stop, _music_stop |
- | |
| 829 | ifdef TFM |
- | |
| 830 | push af |
- | |
| 831 | di |
- | |
| 832 | - | ||
| 833 | call turbo_off |
- | |
| 834 | - | ||
| 835 | ld a,SND_PAGE |
- | |
| 836 | call setpg4000 |
- | |
| 837 | ld a,(TURBOFMON) |
- | |
| 838 | or a |
- | |
| 839 | call nz,#400f;tfmshut |
- | |
| 840 | ld a,CC_PAGE1 |
- | |
| 841 | call setpg4000 |
- | |
| 842 | pop af |
- | |
| 843 | call reset_ay_ay |
- | |
| 844 | - | ||
| 845 | call turbo_on |
- | |
| 846 | - | ||
| 847 | ei |
- | |
| 848 | ret |
- | |
| 849 | - | ||
| 850 | else |
- | |
| 851 | - | ||
| 852 | di |
- | |
| 853 | call reset_ay_ay |
- | |
| 854 | ei |
- | |
| 855 | ret |
- | |
| 856 | - | ||
| 857 | endif |
- | |
| 858 | - | ||
| 859 | if 1==0 |
- | |
| 860 | turbo_on |
- | |
| 861 | ld a,%10101000 ;режим EGA с турбо |
- | |
| 862 | ld bc,#bd77 |
- | |
| 863 | out (c),a |
- | |
| 864 | ret |
- | |
| 865 | - | ||
| 866 | turbo_off |
- | |
| 867 | ld a,%10100000 ;режим EGA без турбо, так как в 14 МГц скорость нестабильна |
- | |
| 868 | ld bc,#bd77 |
- | |
| 869 | out (c),a |
- | |
| 870 | ret |
- | |
| 871 | endif |
- | |
| 872 | - | ||
| 873 | reset_ay_ay |
- | |
| 874 | ;в TFM нужно для глушения AY перед выводом эффектов |
- | |
| 875 | push af |
- | |
| 876 | ifdef TFM |
- | |
| 877 | or %11111000 |
- | |
| 878 | ;or %11111010 ;no wait sync |
- | |
| 879 | else |
- | |
| 880 | or #fe |
- | |
| 881 | endif |
- | |
| 882 | ld bc,#fffd |
- | |
| 883 | out (c),a |
- | |
| 884 | - | ||
| 885 | xor a |
- | |
| 886 | ld l,a |
- | |
| 887 | .l0 |
- | |
| 888 | ld b,#ff |
- | |
| 889 | ifdef TFM |
- | |
| 890 | call libstartup_waitstatus |
- | |
| 891 | endif |
- | |
| 892 | out (c),a |
- | |
| 893 | ifdef TFM |
- | |
| 894 | call libstartup_waitstatus |
- | |
| 895 | endif |
- | |
| 896 | ld b,#bf |
- | |
| 897 | out (c),l |
- | |
| 898 | inc a |
- | |
| 899 | cp 14 |
- | |
| 900 | jr nz,.l0 |
- | |
| 901 | pop af |
- | |
| 902 | ret |
- | |
| 903 | - | ||
| 904 | ;запуск звукового эффекта |
- | |
| 905 | _sfx_play |
- | |
| 906 | push bc |
- | |
| 907 | ld a,SND_PAGE |
- | |
| 908 | call setpg4000 |
- | |
| 909 | pop bc |
- | |
| 910 | ld a,b |
- | |
| 911 | call AFX_PLAY |
- | |
| 912 | ld a,CC_PAGE1 |
- | |
| 913 | jp setpg4000 |
- | |
| 914 | - | ||
| 915 | ;останов звуковых эффектов |
- | |
| 916 | _sfx_stop |
- | |
| 917 | xor a |
- | |
| 918 | jp reset_ay |
- | |
| 919 | - | ||
| 920 | ;запуск музыки |
- | |
| 921 | _music_play |
- | |
| 922 | push ix |
- | |
| 923 | push iy |
- | |
| 924 | push af |
- | |
| 925 | ld a,SND_PAGE |
- | |
| 926 | call setpg4000 |
- | |
| 927 | - | ||
| 928 | ld a,(MUS_COUNT) |
- | |
| 929 | ld l,a |
- | |
| 930 | pop af |
- | |
| 931 | - | ||
| 932 | cp l |
- | |
| 933 | jr nc,.skip |
- | |
| 934 | - | ||
| 935 | ld h,high MUS_LIST |
- | |
| 936 | ld l,a |
- | |
| 937 | - | ||
| 938 | ld e,(hl) |
- | |
| 939 | inc h |
- | |
| 940 | ld d,(hl) |
- | |
| 941 | inc h |
- | |
| 942 | ld a,(hl) |
- | |
| 943 | ex de,hl |
- | |
| 944 | di |
- | |
| 945 | ld (musicPage),a |
- | |
| 946 | call setpg8000 |
- | |
| 947 | ifdef TFM |
- | |
| 948 | ld a,(TURBOFMON) |
- | |
| 949 | or a |
- | |
| 950 | call nz,PT3_INIT |
- | |
| 951 | else |
- | |
| 952 | ld bc,#fffd |
- | |
| 953 | ld a,#fe |
- | |
| 954 | out (c),a |
- | |
| 955 | call PT3_INIT |
- | |
| 956 | endif |
- | |
| 957 | ei |
- | |
| 958 | ld a,CC_PAGE2 |
- | |
| 959 | call setpg8000 |
- | |
| 960 | - | ||
| 961 | .skip |
- | |
| 962 | pop iy |
- | |
| 963 | pop ix |
- | |
| 964 | - | ||
| 965 | ld a,CC_PAGE1 |
- | |
| 966 | jp setpg4000 |
- | |
| 967 | - | ||
| 968 | - | ||
| 969 | - | ||
| 970 | ;выключение музыки |
- | |
| 971 | _music_stop |
- | |
| 972 | xor a |
- | |
| 973 | ld (musicPage),a |
- | |
| 974 | jp reset_ay |
- | |
| 975 | - | ||
| 976 | export _music_play |
629 | export _music_play |
| 977 | export _music_stop |
630 | export _music_stop |
| 978 | export _sample_play |
631 | export _sample_play |
| 979 | export _sfx_play |
632 | export _sfx_play |
| 980 | export _sfx_stop |
633 | export _sfx_stop |
| 981 | 634 | ||
| 982 | - | ||
| 983 | ;переменные |
635 | ;переменные |
| 984 | 636 | ||
| 985 | musicPage db 0 |
637 | musicPage db 0 |
| 986 | tileOffset dw 0 |
638 | tileOffset dw 0 |
| 987 | spritesActive db 0 ;1 если вывод спрайтов разрешён |
639 | spritesActive db 0 ;1 если вывод спрайтов разрешён |
| Line 1017... | Line 669... | ||
| 1017 | rgb222(0,3,0) |
669 | rgb222(0,3,0) |
| 1018 | rgb222(0,3,3) |
670 | rgb222(0,3,3) |
| 1019 | rgb222(3,3,0) |
671 | rgb222(3,3,0) |
| 1020 | rgb222(3,3,3) |
672 | rgb222(3,3,3) |
| 1021 | 673 | ||
| 1022 | ;_memSlot1 |
- | |
| 1023 | ;curpg4000 |
- | |
| 1024 | ; db 0 |
- | |
| 1025 | ;_memSlot2 |
- | |
| 1026 | ;curpg8000 |
- | |
| 1027 | ; db 0 |
- | |
| 1028 | ;_memSlot3 |
- | |
| 1029 | ;curpgc000 |
- | |
| 1030 | ; db 0 |
- | |
| 1031 | - | ||
| 1032 | _borderCol db 0 |
674 | _borderCol db 0 |
| 1033 | _palBright dw 3<<6 |
675 | _palBright dw 3<<6 |
| 1034 | _palChange db 1 |
676 | _palChange db 1 |
| 1035 | _screenActive db 0 ;~1 или ~3 |
677 | _screenActive db 0 ;~1 или ~3 |
| 1036 | _mouse_dx db 0 |
678 | _mouse_dx db 0 |
| Line 1068... | Line 710... | ||
| 1068 | ;в этом относительном пути будут лежать все загружаемые данные игры |
710 | ;в этом относительном пути будут лежать все загружаемые данные игры |
| 1069 | ;db "nedoload" |
711 | ;db "nedoload" |
| 1070 | include "_temp_/sets.asm" |
712 | include "_temp_/sets.asm" |
| 1071 | db 0 |
713 | db 0 |
| 1072 | fnbin |
714 | fnbin |
| 1073 | ;db "code0.bin",0 |
- | |
| 1074 | db "page_101.bin",0 |
715 | db "page_101.bin",0 |
| 1075 | fnbin2 |
716 | fnbin2 |
| 1076 | db "page_102.bin",0 |
717 | db "page_102.bin",0 |
| 1077 | fnbin3 |
718 | fnbin3 |
| 1078 | db "page_103.bin",0 |
719 | db "page_103.bin",0 |
| 1079 | fnaddr |
720 | fnaddr |
| 1080 | db "addr.bin",0 |
721 | db "addr.bin",0 |
| 1081 | end |
722 | end |
| 1082 | - | ||
| 1083 | display "begin=",begin |
- | |
| 1084 | display "end=",end |
- | |
| 1085 | display "Size ",/d,end-begin," bytes" |
- | |
| 1086 | - | ||
| 1087 | savebin "nedoload.com",begin,end-begin |
723 | savebin "nedoload.com",begin,end-begin |
| 1088 | - | ||
| 1089 | LABELSLIST "..\..\..\us\user.l" |
724 | LABELSLIST "..\..\..\us\user.l" |