Subversion Repositories NedoOS

Rev

Rev 2082 | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
1903 alone 1
        DEVICE ZXSPECTRUM128
1916 alone 2
        include "settings.asm"
1903 alone 3
 
2082 alone 4
;music=doublescr
1958 alone 5
 
1916 alone 6
NTEXPGS=0
1958 alone 7
;curpg=0x5b5c
213 alone 8
 
1916 alone 9
pgtmp=#04
1977 alone 10
pgmusic=#06
435 alone 11
 
1982 alone 12
texturesinpg=12
13
spritesinpg=8;4
14
 
213 alone 15
;tcos=#5B00
16
imer=#7F7F
1916 alone 17
INTSTACK=imer
1909 alone 18
imstackbegin=imer&0xff00
2222 alone 19
distbuf=#7C00 ;#300 ;ID,texx,dist ; ਭ 24 chr$    64  , (  0x7f00 96  ( ⥪  ࠡ稪)  ᪮ ᮢ hud)
435 alone 20
 
2222 alone 21
LOWHUD=1
22
 
1903 alone 23
        page 0
24
        ORG #6000;,0
213 alone 25
begin
1907 alone 26
        jp init
27
       IF doublescr
1977 alone 28
SETPGmusic_silent
29
        ld a,pgmusic
30
        jr SETPG_silent
1907 alone 31
SETPG
32
        LD (curpg),A
1977 alone 33
SETPG_silent
1907 alone 34
curscr=$+1
35
        OR 0
36
        LD BC,#7FFD
37
        OUT (C),A
2222 alone 38
        RET
39
       ENDIF
1907 alone 40
 
1977 alone 41
        include "my_int.asm"
1907 alone 42
        INCLUDE "WCTRL.ASM"
2222 alone 43
        display "wctrl end=",$
1907 alone 44
 
1960 alone 45
        include "beeper.asm"
2222 alone 46
        ;include "beeper_sfxdata.asm"
1962 alone 47
        include "anims.asm"
48
        include "savestate.asm"
1960 alone 49
 
2222 alone 50
drawhudhealth
51
       if LOWHUD
52
       dec d
53
       endif
2080 alone 54
        if doublescr
55
        push de
56
        call drawhudhealth_1scr
57
        pop de
58
        set 7,d
59
drawhudhealth_1scr
60
        endif
61
        ex de,hl
62
        inc h
63
        ;ld hl,0x50e0+25
64
        ld a,(health)
65
        srl a
66
        ld e,a
2222 alone 67
drawhudhealthline0
2080 alone 68
        push hl
69
        ld (hl),0x3f
70
        ld b,6
71
        inc l
72
        ld (hl),0xff
73
        djnz $-3
74
        pop hl
75
        inc h
76
        bit 0,h
77
        jr z,drawhudhealthline0
78
        ld (hl),0x20
79
        inc h
80
 
81
        ld a,-4
82
        call drawhudhealthcolumncount
83
        set 5,c
2222 alone 84
        call drawhudhealthcolumn
2080 alone 85
        call drawhudhealthcolumncountdraw2
86
        call drawhudhealthcolumncountdraw2
87
drawhudhealthcolumncountdraw2
88
        call drawhudhealthcolumncountdraw
89
drawhudhealthcolumncountdraw
90
        call drawhudhealthcolumncount
91
drawhudhealthcolumn
92
;de=scraddr
93
;c=1100000  ..
94
        ld (hl),c
95
        inc h
96
        ld (hl),c
97
        inc h
98
        ld (hl),c
99
        dec h
100
        dec h
101
        inc l
102
        ret
103
 
2222 alone 104
       if 0
105
demobegin
106
       IF demoplay
107
        INCBIN "demorec*"
108
       ELSE
109
        DB %00111111 ;all keys released
110
       ENDIF
111
       endif
112
 
113
        include "hud.ast"
114
        display $," before align"
115
        align 256
116
tlogd2sca
117
       IF scale64
118
       IF scale64 == 3
119
        INCBIN "logd2sc3"
120
       ELSE
121
        INCBIN "logd2sc2"
122
       ENDIF
123
       ELSE
124
        INCBIN "logd2sc_"
125
       ENDIF
126
tsqr2
127
        INCBIN "sqr2int"
128
tlogd
129
        INCBIN "logd" ; 128  (ᥩ 64  antizalom)  ᯮ -  :
130
        org $-256
131
        include "beeper_sfxdata.asm"
132
        org ($&0xff00)+256
133
tcorrlogd
134
        INCBIN "corlogd_" ;᫥ 64  ᢮  ਭ 24 chr$ - TODO
135
        ORG $-256
136
       DUP scrwid*8;256
137
        DB {$+(scrtopx*8)}&0xff
138
       EDUP
139
drawhud
140
;뢠  ZXLOOP
141
       IF doublescr
142
        LD A,#17
143
        CALL SETPG
144
       ENDIF
145
        ld hl,sprweapon1
146
        ld de,0x50e0-1+(256*LOWHUD)
147
        call x4_ince_drawsprchr2
148
        ;call x2_ince_drawsprchr2
149
        ;call x2_ince_drawsprchr2
150
        inc e
151
        call drawsprchr ;sprbullets
152
        ld a,(bullets)
153
        call draw99
154
        inc e
155
        call drawsprchr ;sprgrenades
156
        ld a,(grenades)
157
        call draw9
158
        inc e
159
        ld a,(leveltime+2)
160
        call draw99
161
        ld a,(leveltime+1)
162
        call draw99
163
        ld bc,0x52e0+21
164
        call drawhuddot
165
        ld bc,0x55e0+21
166
        call drawhuddot
167
        inc e
168
        call drawsprchr ;sprhealth
169
        jp drawhudhealth
170
       if $&0xff
171
        ds (-$)&0xff,0
172
       endif
173
       IF lores
174
        ORG $-256
175
_=$
176
       DUP 128
177
        DB {_}&0xff
178
_=_+2
179
       EDUP
180
        DS 128
181
       ENDIF
182
;tcos
183
        ;DS 256
184
tlogcos
185
        INCBIN "pluslcos"
186
tda
187
        INCBIN "da"
188
        ORG $-256
189
       DUP 256
190
        DB 0xff&({$}+128)
191
       EDUP
192
        ORG $-256
193
       DUP 256
194
        DB 0xff&({$+(scrtopx*8)})
195
       EDUP
196
       IF lores
197
        ORG $-256
198
_=$
199
       DUP 128
200
        DB {_}&0xff
201
_=_+2
202
       EDUP
203
        DS 128
204
       ENDIF
205
tctg
206
        INCBIN "plusctg"
207
tsin
208
        INCBIN "sin"
209
       if 1
210
;               z=0:255; sprintf('%d,',fix(atan(2.^(z/32))*128/pi))
211
 
212
                ;;;;;;;; atan(2^(x/32))*128/pi ;;;;;;;;
213
atan_tab:
214
                db 020h,020h,020h,021h,021h,022h,022h,023h,023h,023h,024h,024h,025h,025h,026h,026h
215
                db 026h,027h,027h,028h,028h,028h,029h,029h,02Ah,02Ah,02Ah,02Bh,02Bh,02Ch,02Ch,02Ch
216
                db 02Dh,02Dh,02Dh,02Eh,02Eh,02Eh,02Fh,02Fh,02Fh,030h,030h,030h,031h,031h,031h,031h
217
                db 032h,032h,032h,032h,033h,033h,033h,033h,034h,034h,034h,034h,035h,035h,035h,035h
218
                db 036h,036h,036h,036h,036h,037h,037h,037h,037h,037h,037h,038h,038h,038h,038h,038h
219
                db 038h,039h,039h,039h,039h,039h,039h,039h,039h,03Ah,03Ah,03Ah,03Ah,03Ah,03Ah,03Ah
220
                db 03Ah,03Bh,03Bh,03Bh,03Bh,03Bh,03Bh,03Bh,03Bh,03Bh,03Bh,03Bh,03Ch,03Ch,03Ch,03Ch
221
                db 03Ch,03Ch,03Ch,03Ch,03Ch,03Ch,03Ch,03Ch,03Ch,03Dh,03Dh,03Dh,03Dh,03Dh,03Dh,03Dh
222
                db 03Dh,03Dh,03Dh,03Dh,03Dh,03Dh,03Dh,03Dh,03Dh,03Dh,03Dh,03Dh,03Eh,03Eh,03Eh,03Eh
223
                db 03Eh,03Eh,03Eh,03Eh,03Eh,03Eh,03Eh,03Eh,03Eh,03Eh,03Eh,03Eh,03Eh,03Eh,03Eh,03Eh
224
                db 03Eh,03Eh,03Eh,03Eh,03Eh,03Eh,03Eh,03Eh,03Eh,03Eh,03Eh,03Eh,03Fh,03Fh,03Fh,03Fh
225
                db 03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh
226
                db 03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh
227
                db 03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh
228
                db 03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh
229
                db 03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh,03Fh
230
 
231
 ;              x=0:255;x(1)=1; sprintf('%d,',fix(32*log2(x)))
232
 
233
                ;;;;;;;; log2(x)*32 ;;;;;;;;
234
log2_tab:
235
                db 000h,000h,020h,032h,040h,04Ah,052h,059h,060h,065h,06Ah,06Eh,072h,076h,079h,07Dh
236
                db 080h,082h,085h,087h,08Ah,08Ch,08Eh,090h,092h,094h,096h,098h,099h,09Bh,09Dh,09Eh
237
                db 0A0h,0A1h,0A2h,0A4h,0A5h,0A6h,0A7h,0A9h,0AAh,0ABh,0ACh,0ADh,0AEh,0AFh,0B0h,0B1h
238
                db 0B2h,0B3h,0B4h,0B5h,0B6h,0B7h,0B8h,0B9h,0B9h,0BAh,0BBh,0BCh,0BDh,0BDh,0BEh,0BFh
239
                db 0C0h,0C0h,0C1h,0C2h,0C2h,0C3h,0C4h,0C4h,0C5h,0C6h,0C6h,0C7h,0C7h,0C8h,0C9h,0C9h
240
                db 0CAh,0CAh,0CBh,0CCh,0CCh,0CDh,0CDh,0CEh,0CEh,0CFh,0CFh,0D0h,0D0h,0D1h,0D1h,0D2h
241
                db 0D2h,0D3h,0D3h,0D4h,0D4h,0D5h,0D5h,0D5h,0D6h,0D6h,0D7h,0D7h,0D8h,0D8h,0D9h,0D9h
242
                db 0D9h,0DAh,0DAh,0DBh,0DBh,0DBh,0DCh,0DCh,0DDh,0DDh,0DDh,0DEh,0DEh,0DEh,0DFh,0DFh
243
                db 0DFh,0E0h,0E0h,0E1h,0E1h,0E1h,0E2h,0E2h,0E2h,0E3h,0E3h,0E3h,0E4h,0E4h,0E4h,0E5h
244
                db 0E5h,0E5h,0E6h,0E6h,0E6h,0E7h,0E7h,0E7h,0E7h,0E8h,0E8h,0E8h,0E9h,0E9h,0E9h,0EAh
245
                db 0EAh,0EAh,0EAh,0EBh,0EBh,0EBh,0ECh,0ECh,0ECh,0ECh,0EDh,0EDh,0EDh,0EDh,0EEh,0EEh
246
                db 0EEh,0EEh,0EFh,0EFh,0EFh,0EFh,0F0h,0F0h,0F0h,0F1h,0F1h,0F1h,0F1h,0F1h,0F2h,0F2h
247
                db 0F2h,0F2h,0F3h,0F3h,0F3h,0F3h,0F4h,0F4h,0F4h,0F4h,0F5h,0F5h,0F5h,0F5h,0F5h,0F6h
248
                db 0F6h,0F6h,0F6h,0F7h,0F7h,0F7h,0F7h,0F7h,0F8h,0F8h,0F8h,0F8h,0F9h,0F9h,0F9h,0F9h
249
                db 0F9h,0FAh,0FAh,0FAh,0FAh,0FAh,0FBh,0FBh,0FBh,0FBh,0FBh,0FCh,0FCh,0FCh,0FCh,0FCh
250
                db 0FDh,0FDh,0FDh,0FDh,0FDh,0FDh,0FEh,0FEh,0FEh,0FEh,0FEh,0FFh,0FFh,0FFh,0FFh,0FFh
251
       endif
252
cursprites=0x5b00
253
        ;DS 256
254
 
255
        DISPLAY "tables end=",$,"<",distbuf
256
tscalesw3
257
        incbin "scalesw3"
258
initproc
259
 
260
        ;DS #8000-$
261
 
262
        ds imstackbegin-$
2080 alone 263
drawhudhealthcolumncount
264
;e=health
265
;a=health left value
266
        ld c,1
267
drawhudhealthcolumncount0
268
        cp e
269
        rl c
270
        inc a
271
        jr nc,drawhudhealthcolumncount0
272
        ret
273
 
274
draw99
275
        ld bc,10-256
276
        inc b
277
        sub c
278
        jr nc,$-2
279
        add a,c
280
        push af
281
        ld a,b
282
        call draw9
283
        pop af
284
draw9
285
        push hl
2222 alone 286
       if LOWHUD
287
       ld b,a
288
       endif
2080 alone 289
        add a,a
290
        add a,a
291
        add a,a
2222 alone 292
       if LOWHUD
293
       sub b
294
       endif
2080 alone 295
        ld hl,sprdigits
296
        add a,l
297
        ld l,a
298
        jr nc,$+3
299
        inc h
300
        call drawsprchr
301
        pop hl
302
        ret
303
 
304
drawhuddot
305
        if doublescr
306
        call drawhuddot_1scr
307
        set 7,b
308
drawhuddot_1scr
309
        endif
310
        ld a,(bc)
311
        or 0x80
312
        ld (bc),a
313
        ret
314
 
2222 alone 315
x4_ince_drawsprchr2
316
        call x2_ince_drawsprchr2
317
x2_ince_drawsprchr2
318
        call ince_drawsprchr2
319
ince_drawsprchr2
320
        inc e
2080 alone 321
drawsprchr2
322
        call drawsprchr
323
drawsprchr
324
        if doublescr
325
        push de
326
        push hl
327
        set 7,d
328
        call drawsprchr_1scr
329
        pop hl
330
        pop de
331
drawsprchr_1scr
332
        endif
333
        push de
2222 alone 334
        ld b,8-LOWHUD
2080 alone 335
drawsprchr0
336
        ld a,(hl)
337
        ld (de),a
338
        inc hl
339
        inc d
340
        djnz drawsprchr0
341
        pop de
342
        inc e
343
        ret
344
 
2222 alone 345
        display "render vars=",$
1907 alone 346
;६ ७ (  砫 ७)
347
curXx
348
curx    DB #80
349
curX    DB #0
350
curYy
351
cury    DB #80
352
curY    DB #0
353
curxy   DW 0
354
curyx   DW 0
355
curYX   DW 0
356
curangle
357
        DW tsin
2222 alone 358
;  ⥪
1909 alone 359
        ds imer-$
1916 alone 360
        include "int.asm"
435 alone 361
 
1908 alone 362
        ;DS ((IMER/256+1)<<8)-$
1909 alone 363
        ;ds (IMER&0xff00)-$
213 alone 364
 
1908 alone 365
        ds 0x8000-$ ;ORG #8000
213 alone 366
imvec
1909 alone 367
        DS 257,imer&0xff
213 alone 368
 
1916 alone 369
        INCLUDE "zxloop.asm"
435 alone 370
        INCLUDE "WSCAN10.asm"
371
        INCLUDE "WREND.asm"
213 alone 372
 
1912 alone 373
badmonstexture
374
        db 0xc0,0xff
375
 
1903 alone 376
        align 256
377
t1x
378
        db 255
379
        dup 255
380
        db (255*2/($&0xff)+1)/2
381
        edup
382
 
1913 alone 383
        DISPLAY "48K PROG END=",$
213 alone 384
 
2222 alone 385
        ORG initproc
1916 alone 386
        include "recmap.asm"
435 alone 387
 
213 alone 388
        DS distbuf+#300-$
389
 
1907 alone 390
;;;;;
213 alone 391
        ORG scrbuf
392
GO
1918 alone 393
        ;xor a
394
        ;out (0xfe),a
2222 alone 395
      if 0
396
        DI
213 alone 397
        LD HL,WAStcos
398
        LD DE,tcos
399
       PUSH DE
400
        LD BC,256
2222 alone 401
        LDIR
213 alone 402
       POP HL
403
REtcos0
404
       DUP 2;4
405
        SRA (HL)
2222 alone 406
       EDUP
213 alone 407
        INC L
1903 alone 408
        jr nz,REtcos0
2222 alone 409
      endif
213 alone 410
 
411
        LD HL,imvec
412
        LD DE,imvec+1
1909 alone 413
        LD (HL),imer/256
213 alone 414
        LD B,E,C,L
415
        LD A,H
2222 alone 416
        LDIR
213 alone 417
        LD I,A
418
        IM 2
2222 alone 419
        EI
420
       HALT
213 alone 421
        LD HL,-2
422
        ADD HL,SP
423
        LD (clscrbufsp),HL
424
        LD (eorfillsp),HL
1916 alone 425
        ld hl,ZXLOOP
426
        push hl
427
        LD BC,#FBDF
428
        IN A,(C)
2222 alone 429
        LD (mouseoldx),A
1907 alone 430
        JP RECMAP ;->ZXLOOP
2222 alone 431
 
1907 alone 432
        display "ZXLOOP=",ZXLOOP
213 alone 433
 
434
WASMAP
1917 alone 435
       IF invmap;atm
435 alone 436
        INCBIN "mapatm.E"
2222 alone 437
       ELSE
213 alone 438
        INCBIN "map48.E"
2222 alone 439
       ENDIF
213 alone 440
szMAP=$-WASMAP
441
 
2222 alone 442
      if 0
213 alone 443
WAStcos
444
        INCBIN "cos"
2222 alone 445
      endif
1903 alone 446
init
1918 alone 447
        if mouse
448
        call initmouse
449
        endif
213 alone 450
;prepare 48K block
451
        DI ;IY
1910 alone 452
        LD HL,#5800
453
        LD DE,#5801
454
        LD BC,767
455
        LD (HL),L
2222 alone 456
        LDIR
1958 alone 457
        call gettexpg
2222 alone 458
       if doublescr
1958 alone 459
       LD A,0x10+pgtmp
460
       call SETPG
461
        call gettexpg
1977 alone 462
       endif
463
       IF music && !atm
464
        call SETPGmusic_silent
465
        CALL #c000 ;init mus
2222 alone 466
       ENDIF
467
       if doublescr
1958 alone 468
       LD A,0x10
469
       call SETPG
470
       endif
471
        LD IY,23610
2222 alone 472
        EI
2080 alone 473
       JP GO ;⠬ recmap,  INICLS
2222 alone 474
 
1958 alone 475
gettexpg
1982 alone 476
        ld hl,wasgoods
477
        ld de,0x4000
478
        ld bc,0x1000
479
        ldir
480
        ld de,0xb000
481
        ld bc,0x1000
482
        ldir
483
        ld hl,0xffff-0x2000
484
        ld de,0xffff
485
        ld bc,0x2000
486
        lddr
487
        LD HL,0x2000+waswalls;#C000
488
        call copyscrcolumns_2k
1912 alone 489
        LD DE,#C000+0x80;maxscale+1
490
       LD HY,d;0xc0;#FE
1910 alone 491
;4 upper textures = #09A6
492
;4 lower textures = #0AAC
1982 alone 493
        LD HL,0x5000
1910 alone 494
        CALL GETTEX
495
        CALL GETTEX
496
        CALL GETTEX
497
        CALL GETTEX
1982 alone 498
        LD HL,0x2000+waswalls+0x800;#C000
499
        call copyscrcolumns_2k
500
        LD HL,0x5000
1910 alone 501
        CALL GETTEX
502
        CALL GETTEX
503
        CALL GETTEX
504
        CALL GETTEX
1982 alone 505
        LD HL,0x2000+waswalls+0x1000;#C000
506
        call copyscrcolumns_2k
507
        LD HL,0x5000
1910 alone 508
        CALL GETTEX
509
        CALL GETTEX
1912 alone 510
         CALL GETTEX
511
         CALL GETTEX
1982 alone 512
        ;walls: [e2b8] (e3b4 8spr, e274 4spr?), walls2: (eef6 8spr, ec88 4spr?)
513
        ;LD HL,wasgoods
514
        ;call copyscrcolumns_4k
515
      if sprites
516
       LD HL,0x4000
1939 alone 517
       CALL GETSPR
1982 alone 518
       LD HL,0x4400
1939 alone 519
       CALL GETSPR
1982 alone 520
       LD HL,0x4800
1912 alone 521
       CALL GETSPR
1982 alone 522
       LD HL,0x4c00
1912 alone 523
       CALL GETSPR
1982 alone 524
        ;LD HL,wasgoods+0x1000;#C000
525
        ;call copyscrcolumns_4k
526
        ;jr $
527
      if spritesinpg==8
528
       LD HL,0xb000
529
       CALL GETSPR
530
       LD HL,0xb400
531
       CALL GETSPR
532
       LD HL,0xb800
533
       CALL GETSPR
534
       LD HL,0xbc00
535
       CALL GETSPR
536
      endif
537
      endif
538
        ;jr $ ;walls:  ⨬樥 f699(f4c0) (12 +4 ࠩ  ⨬樨( ⨬樥)), (fdbd 8spr, fb6f 4spr?) walls2: 00f4(febd), (0cc0 8spr, 07d6 4spr?)
1912 alone 539
        ;jr $ ; 7:  ⨬樥 de=ec70[ebdf] (f4c8 12 )
540
        ;jr $ ; 3:  ⨬樥 de=e1e4[de70]
541
        ;jr $ ; 2:  ⨬樥 de=f070[f6cd]
542
        ;jr $ ; 1:  ⨬樥 de=efdf[ef76,  ⨬樨 f256]
2222 alone 543
        ;jr $ ;pg1:ec86 ;pg2:e2a6
1912 alone 544
        if 1
545
;ࠢ塞 ९ ᮢ ⥪ (   塞  0xc080,   ࠩ⮢  badmonstexture)
546
        ld h,0xc0
547
fixtexoverflow0
548
        ld l,0x40
549
fixtexoverflow1
550
        ld e,(hl)
551
        inc h
552
        ld d,(hl)
553
        bit 7,d
554
        jr nz,$+5 ;  
555
badaddrpatch=$+1
556
         ld de,0xc080
557
        ld (hl),d
558
        dec h
559
        ld (hl),e
560
        inc l
561
        jp p,fixtexoverflow1
562
        inc h
563
        inc h
564
        ld de,badmonstexture
565
        ld a,h
1982 alone 566
        cp 0xc0+(2*texturesinpg)
1912 alone 567
        jr c,$+6
568
         ld (badaddrpatch),de
1982 alone 569
        cp 0xc0+(2*(texturesinpg+spritesinpg))
1912 alone 570
        jr nz,fixtexoverflow0
571
        endif
572
 
2222 alone 573
;⠢塞 ⠡ ⠡஢
1910 alone 574
        ld hl,tscalesw3
575
        ld c,0
576
        ld b,64
577
initscales0
578
        ld e,(hl)
579
        inc hl
580
        ld d,(hl)
581
        inc hl
582
        push hl
583
        ld l,c
584
        push bc
585
        ld b,d
586
        ld c,e ;adder 8.8
587
;  0040...0400 ᤥ 78..00  砫(0x80 -08..-80) = 0x80 - adder*32
588
;  0040...0400 ᤥ 78..04  砫 (0x80 -08..-7c) = 0x80 - adder*31
589
;...
590
;  0040...0400 ᤥ 87..f4          (0x80 +07..+74)
591
;  0040...0400 ᤥ 88..f8    (0x80 +08..+78)
592
        dup 5
593
        sla e
594
        rl d
595
        edup
596
        xor a
597
        sub e
598
        ld e,a
599
        ld a,0x80
600
        sbc a,d
601
        ld d,a ;0x80 - adder*32
602
        ld h,0xc0
1911 alone 603
        ld (hl),0 ;祬?  d ᭥ - ࠩ⮢
1910 alone 604
        inc h
605
initscales1
606
        ex de,hl
607
        add hl,bc
608
        ex de,hl
609
        ld (hl),d ;Ys=(Y/32-1)*sc
610
        inc h
611
        jr nz,initscales1
612
        pop bc
613
        inc c
614
        pop hl
615
        djnz initscales0
213 alone 616
        LD H,#C1
617
INIRETAB0 ;
618
        LD L,0
619
        LD B,maxscale+1
620
INIRETAB1 ;
621
        LD A,(HL)
622
        CP 128-(scrhgtpix/2)
1903 alone 623
        jr nc,$+4
213 alone 624
        LD A,128-(scrhgtpix/2)
625
        CP 128+(scrhgtpix/2);-1
1903 alone 626
        jr c,$+4
1912 alone 627
       ;LD A,128+(scrhgtpix/2)-1 ;    ९-
1903 alone 628
       LD A,0xff&(dropline-(scrbuf+(scrhgtpix/2)-128))
629
        ADD A,+(0xff&scrbuf)+(scrhgtpix/2)-128
213 alone 630
        LD (HL),A
631
        INC L
632
        DJNZ INIRETAB1
633
        INC H
634
        LD A,H
635
        INC A ;#C0XX,#FFXX  ண
1903 alone 636
        jr nz,INIRETAB0
213 alone 637
       LD HL,#FF00
638
       LD DE,#FF01
639
       LD BC,maxscale
640
       LD (HL),1
2222 alone 641
       LDIR
1958 alone 642
        ret
213 alone 643
 
1918 alone 644
        if mouse
645
initmouse
646
        ei
647
        halt
648
      ;প, ⮡ 誠 ᯥ  - min 2500 ⠪⮢  Evo (  280 ⠪⮢ த⢨)
649
      LD B,75
650
prosirtime
651
      LD DE,(0)        ;20 ⠪⮢
652
      DJNZ prosirtime  ;13 ⠪⮢
653
  ld a, 0x90
654
  out (0x7F), a
655
  out (0x5F), a
656
  ld bc, 0x0FFDF
657
  in h, (c)
658
  ld b, 0x0FB
659
  in l, (c)
660
  dec b
661
  in a, (c)
662
  cp l
663
  ret nz ;jr nz, @detected
664
  cp h
665
  ret nz ;jr z, @comeon
666
        LD A,0xaf ;xor a
667
        LD (mouseon),A
668
        ;ld hl,0x18+(256*readmousejr) ;"jr"
669
        ;ld (readmouse_patch),hl
670
        ret
671
        endif
672
 
1982 alone 673
copyscrcolumns_2k
674
        push de
675
        ld de,0x5000
676
        ld bc,0x800
677
        ldir
678
        pop de
1910 alone 679
        ret
680
 
213 alone 681
GETTEX
1903 alone 682
       IF scale64
213 alone 683
        LD LY,#40
2222 alone 684
       ELSE
213 alone 685
        LD LY,#80
2222 alone 686
       ENDIF
213 alone 687
        LD BC,#0880 ;B=width/8, C=#80(mask)
688
GETTEX00 ;
689
       PUSH BC
2222 alone 690
GETTEX0
1982 alone 691
        push hl
692
        CALL GETTEXLINE
693
        pop hl
213 alone 694
        INC LY
1903 alone 695
       IF scale64 == 0
213 alone 696
       INC LY
2222 alone 697
       ENDIF
213 alone 698
        RRC C
1903 alone 699
        jr nc,GETTEX0
1982 alone 700
        ;INC L
701
        ld bc,64
702
        add hl,bc
213 alone 703
       POP BC
704
        DJNZ GETTEX00
1912 alone 705
       inc hy,hy;DEC HY,HY
2222 alone 706
        RET
213 alone 707
 
708
GETSPR
1982 alone 709
        ;jr $
1903 alone 710
       IF scale64
213 alone 711
        LD LY,#40
2222 alone 712
       ELSE
213 alone 713
        LD LY,#80
2222 alone 714
       ENDIF
213 alone 715
        LD BC,#0880 ;B=width/8, C=#80(mask)
716
GETSPR00 ;
717
       PUSH BC
2222 alone 718
GETSPR0
1982 alone 719
        push hl
720
        CALL GETSPRLINE
721
        pop hl
213 alone 722
        INC LY
1903 alone 723
       IF scale64 == 0
213 alone 724
       INC LY
2222 alone 725
       ENDIF
213 alone 726
        RRC C
1903 alone 727
        jr nc,GETSPR0
1982 alone 728
        ;INC L
729
        ld bc,128;64
730
        add hl,bc
213 alone 731
       POP BC
732
        DJNZ GETSPR00
1912 alone 733
       inc hy,hy;DEC HY,HY
2222 alone 734
        RET
213 alone 735
 
1982 alone 736
GETTEXincD
737
        call GETincD
738
       JR GETTEXRETRY
739
 
213 alone 740
GETTEXLINE
741
       PUSH HL
742
GETTEXRETRY ;
743
       LD (gettexDE),DE ;linelength addr
744
       POP HL
745
       PUSH HL
746
        LD (IY),E
1903 alone 747
       IF scale64 == 0
213 alone 748
       LD (IY+1),E
2222 alone 749
       ENDIF
213 alone 750
        INC HY
751
        LD (IY),D
1903 alone 752
       IF scale64 == 0
213 alone 753
       LD (IY+1),D
2222 alone 754
       ENDIF
213 alone 755
        DEC HY
1982 alone 756
       inc e
757
       dec e
758
       jr z,GETTEXincD
213 alone 759
        INC E
1982 alone 760
        ;jr z,GETTEXincD
213 alone 761
        LD LX,0;C ;bit
1912 alone 762
        LD HX,17 ;17-pixels
213 alone 763
        LD B,62 ;62..1 -> 1..62
764
GETTEX1 ;
1982 alone 765
        inc hl;CALL DHL
213 alone 766
        LD A,(HL)
767
        AND C
768
        CP LX
769
        LD LX,A
1903 alone 770
        jr z,GETTEXN
213 alone 771
       LD A,HX
772
       OR A
1912 alone 773
       jr z,GETTEXN ;can't add more pixels
1982 alone 774
       inc e
775
       dec e
776
       jr z,GETTEXincD
1903 alone 777
        LD A,tscale/256+63
213 alone 778
        SUB B
779
        LD (DE),A
780
        DEC HX ;17-pixels
781
        INC E ;todo check before write
1982 alone 782
        ;jr z,GETTEXiD
213 alone 783
GETTEXN ;
2222 alone 784
        DJNZ GETTEX1
213 alone 785
        LD A,HX ;17-pixels
786
        ADD A,A
787
        ADD A,A
788
        ADD A,A
1912 alone 789
        SUB HX  ;(17-pixels)*7
1903 alone 790
       ADD A,DWJP&0xff
213 alone 791
gettexDE=$+1
792
        LD (0),A
1982 alone 793
        ld a,17+1
794
        sub hx ;17+1-(17-pixels)
795
        ld (gettexB),a ;size=1+pixels (min=2 -  )
796
       POP HL
797
 
798
GETTEX_cmp ;ࠢ  ।騬 ⮫栬
1912 alone 799
         push de
800
         push iy
1982 alone 801
GETTEX_cmpnext
1912 alone 802
        ld hl,(gettexDE)
803
        ld a,ly
804
        cp 0x40 ; ⮣ tscales
805
        jr nz,GETTEX_cmpgo
806
        ld a,hy
807
        cp 0xc0
808
        jr z,GETTEX_endcmp
1982 alone 809
        ld ly,0x80;7f
1912 alone 810
        dec hy,hy
811
GETTEX_cmpgo
812
        dec ly
813
        ld e,(iy)
814
        inc hy
815
        ld d,(iy)
816
        dec hy
1982 alone 817
        ;ld a,17+1
818
        ;sub hx ;17+1-(17-pixels)
819
gettexB=$+1
820
        ld b,0;a ;size=1+pixels (min=2 -  )
1912 alone 821
GETTEX_cmp1
822
        ld a,(de)
823
        cp (hl)
824
        jr nz,GETTEX_cmpnext
825
        inc hl
826
        inc de
827
        djnz GETTEX_cmp1
828
;⠢ 뫪   
829
        ld e,(iy)
830
        inc hy
831
        ld d,(iy)
832
         pop iy
833
         pop af;de
834
        LD (IY),e
835
        INC HY
836
        LD (IY),d
837
        DEC HY
838
        ld de,(gettexDE) ;⪠ DE
1982 alone 839
        ret
1912 alone 840
GETTEX_endcmp
841
         pop iy
842
         pop de
2222 alone 843
        RET
213 alone 844
 
1982 alone 845
GETSPRincD
846
        call GETincD
847
        JR GETSPRRETRY
848
 
213 alone 849
GETSPRLINE
850
       PUSH HL
851
GETSPRRETRY ;
1982 alone 852
       LD (gettexDE),DE ;linelength addr
213 alone 853
       POP HL
854
       PUSH HL
855
        LD (IY),E
1903 alone 856
       IF scale64 == 0
213 alone 857
       LD (IY+1),E
2222 alone 858
       ENDIF
213 alone 859
        INC HY
860
        LD (IY),D
1903 alone 861
       IF scale64 == 0
213 alone 862
       LD (IY+1),D
2222 alone 863
       ENDIF
213 alone 864
        DEC HY
1982 alone 865
       ld a,l
866
       add a,2*62
867
       ld l,a ;line 62
213 alone 868
        LD HX,1
1982 alone 869
        ld lx,2 ;size
213 alone 870
GETSPR1 ;
871
        CALL FIND10
1903 alone 872
        jr nc,GETSPRQ ;end of column
1982 alone 873
       inc e
874
       dec e
875
       jr z,GETSPRincD
213 alone 876
        LD A,HX
2222 alone 877
        CPL
213 alone 878
        LD (DE),A ;Y
1982 alone 879
         inc lx
213 alone 880
        INC E
1982 alone 881
        ;jr z,GETSPRiD
213 alone 882
        CALL FIND1HEIGHT
1982 alone 883
       inc e
884
       dec e
885
       jr z,GETSPRincD
213 alone 886
        LD A,HX
2222 alone 887
        CPL
213 alone 888
        LD (DE),A ;Y2
1982 alone 889
         inc lx
213 alone 890
        INC E
1982 alone 891
        ;jr z,GETSPRiD
213 alone 892
        CALL FIND0HEIGHT
1982 alone 893
       inc e
894
       dec e
895
       jr z,GETSPRincD
213 alone 896
        LD A,HX
2222 alone 897
        CPL
213 alone 898
        LD (DE),A ;Y3
1982 alone 899
         inc lx
213 alone 900
        INC E
1982 alone 901
        ;jr z,GETSPRiD
213 alone 902
        JR GETSPR1
903
GETSPRQ
1982 alone 904
       inc e
905
       dec e
906
       jr z,GETSPRincD
213 alone 907
        LD A,#C0
908
        LD (DE),A
909
        INC E
1982 alone 910
        ;jr z,GETSPRiD
911
       inc e
912
       dec e
913
       jr z,GETSPRincD
213 alone 914
        LD A,#FF
915
        LD (DE),A
916
        INC E
1982 alone 917
        ;jr nz,$+5
918
        ; INC D
919
        ; LD E,maxscale+1
213 alone 920
       POP HL
1982 alone 921
        ld a,lx
922
        ld (gettexB),a
2222 alone 923
 
1982 alone 924
        jp GETTEX_cmp ;ࠢ  ।騬 ⮫栬
213 alone 925
 
1982 alone 926
GETincD
927
        INC D
928
       LD E,0x80;maxscale+1
929
       ld a,d
930
       cp 0xc0+(2*(texturesinpg+spritesinpg))
931
       jr c,$+4;GETSPRRETRY
932
       ld e,0x40 ;  ⠡ ᮢ
933
       ret
213 alone 934
 
1982 alone 935
maxVhgt=12;14;10 ; ᨬ쭮 㢥祭 ( 4 ࠧ)  ᮢ뢠   maxlinehgt=59 ᥫ! (TODO 祬 13,14 ???)
936
 
213 alone 937
;HX=V
938
;HL=mask
939
FIND10
940
        LD A,HX
941
        CP 63
942
        RET Z ;CY=0: end of column
943
        CALL GETPIXEL
944
        RET C ;CY=1: pixel
1982 alone 945
        dec hl;CALL UHL
946
         dec hl
213 alone 947
        INC HX ;V
948
        JR FIND10
949
FIND1HEIGHT
950
       ;LD LX,HX ;oldV
951
        LD B,0
952
F1H0    CALL GETPIXEL
953
        RET NC ;transparent
954
        RET Z ;0
1982 alone 955
        dec hl;CALL UHL
956
         dec hl
213 alone 957
        INC HX ;V
958
        INC B
959
        LD A,B
960
        CP maxVhgt
1903 alone 961
        jr c,F1H0
2222 alone 962
        RET
213 alone 963
FIND0HEIGHT
964
       ;LD LX,HX ;oldV
965
        LD B,0
966
F0H0    CALL GETPIXEL
967
        RET NC ;transparent
968
        RET NZ ;1
1982 alone 969
        dec hl;CALL UHL
970
         dec hl
213 alone 971
        INC HX ;V
972
        INC B
973
        LD A,B
974
        CP maxVhgt
1903 alone 975
        jr c,F0H0
2222 alone 976
        RET
213 alone 977
 
978
GETPIXEL
979
        LD A,HX
980
        CP 63
981
        RET Z ;CY=0: transparent
1982 alone 982
        inc l;set 1,h;SET 3,L
213 alone 983
        LD A,(HL)
1982 alone 984
        dec l;res 1,h;RES 3,L
213 alone 985
        AND C
986
        RET NZ ;CY=0: transparent
987
        LD A,(HL)
988
        AND C
989
        SCF ;CY=1: pixel (Z)
2222 alone 990
        RET
991
 
1982 alone 992
        if 0
213 alone 993
UHL
994
        LD A,H
995
        DEC H
996
        AND 7
997
        RET NZ
998
        LD A,L
999
        SUB #20
1000
        LD L,A
1001
        RET C
1002
        LD A,H
1003
        ADD A,8
1004
        LD H,A
2222 alone 1005
        RET
1982 alone 1006
        endif
1907 alone 1007
;endall
1982 alone 1008
        display "end init=",$
213 alone 1009
 
1982 alone 1010
        DS 0xb000-$
213 alone 1011
        DS #C000-$
1910 alone 1012
 
1013
        if 0
1907 alone 1014
        ;ORG #C000
1015
       IF scale64
1016
       IF scale64 == 3
1017
        INCBIN "tscale3"
2222 alone 1018
       ELSE
1907 alone 1019
        INCBIN "tscale2"
2222 alone 1020
       ENDIF
1021
       ELSE
1907 alone 1022
        INCBIN "tscale"
1910 alone 1023
       ENDIF
1024
        endif
1025
 
1958 alone 1026
;hicode_begin
1939 alone 1027
        ;ds 0x10000-0x1800-0x0800-$ ;0x040..7f ᮤন ⠡ ᮢ ⥪ (16 ⥪?)
1982 alone 1028
        ds 0x10000-0x1800-0x2000-$ ;0x040..7f ᮤন ⠡ ᮢ ⥪ (16 ⥪?)
1910 alone 1029
waswalls
1982 alone 1030
        incbin "walls.bin"
1910 alone 1031
wasgoods
1982 alone 1032
        incbin "goods.bin"
1958 alone 1033
;hicode_end
1034
end
1035
 
1036
        page pgtmp
1037
        org 0xc000
1038
hicode_begin
1982 alone 1039
        ds 0x10000-0x1800-0x2000-$
1958 alone 1040
;waswalls
1982 alone 1041
        incbin "walls2.bin"
1958 alone 1042
;wasgoods
1982 alone 1043
        incbin "goods2.bin"
1910 alone 1044
hicode_end
1045
 
1977 alone 1046
        page pgmusic
1047
        org 0xc000
1048
hicode2_begin
1049
        include "../../_sdk/ptsplay.asm"
1050
MDLADDR
1051
        incbin "testmusi.pt3"
1052
hicode2_end
1053
 
1907 alone 1054
        page 0
1986 alone 1055
       if doublescr
1907 alone 1056
        savebin "code.c",begin,end-begin
1958 alone 1057
        page pgtmp
1058
        savebin "hicode.c",hicode_begin,hicode_end-hicode_begin
1977 alone 1059
        page pgmusic
1060
        savebin "hicode2.c",hicode2_begin,hicode2_end-hicode2_begin
1986 alone 1061
       else
1062
        savebin "code.c",begin,hicode_end-begin
1063
       endif
1907 alone 1064
 
1065
        LABELSLIST "../../../us/user.l",1