?login_element?

Subversion Repositories NedoOS

Rev

Rev 1965 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
213 alone 1
        DEVICE ZXSPECTRUM128
1916 alone 2
        include "settings.asm"
213 alone 3
 
438 alone 4
NTEXPGS=5
591 alone 5
NSPRPGS=2;1
438 alone 6
 
660 alone 7
SPOIL6BSTACK=0x4000
438 alone 8
STACK=SPOIL6BSTACK-6
437 alone 9
INTSTACK=0x3e80
435 alone 10
;scrbase=0x8000
213 alone 11
 
1916 alone 12
addhlbc=1 ; scrhgt=200    ࠭
435 alone 13
customscales=0;1
14
 
1965 alone 15
IMPOSSIBLECOLOR=0b01000111;0x01 ;(b+w)
437 alone 16
 
231 alone 17
muz=0x8000
18
 
213 alone 19
        org PROGSTART
20
begin
21
        ld sp,STACK
583 alone 22
        OS_HIDEFROMPARENT
213 alone 23
 
882 alone 24
        ld e,0;+0x80
25
        OS_SETGFX ;e=0:EGA, e=2:MC, e=3:6912, e=6:text ;+0x80=keep screen ;+SET FOCUS ;e=-1: disable gfx (out: e=old gfxmode)
213 alone 26
        ld e,0 ;color byte
27
        OS_CLS
28
        ld e,1
29
        OS_SETSCREEN
30
        ld e,0 ;color byte
31
        OS_CLS
237 dimkam 32
 
33
                ld de,res_path
34
                OS_CHDIR
213 alone 35
 
36
        OS_GETMAINPAGES
1916 alone 37
;dehl= ࠭  0000,4000,8000,c000
772 alone 38
        ld a,e
39
        LD (pgmain4000),A
40
        ld a,h
41
        LD (pgmain8000),A
213 alone 42
        ld a,l
43
        LD (pgscalersnum),A
44
 
1916 alone 45
       if 0;OLDMUZ
231 alone 46
        ld hl,wasmuz
47
        ld de,muz
48
        ld bc,wasmuz_sz
49
        ldir
50
        call muz
772 alone 51
       else
52
        ld hl,muzfilename
53
        call loadpage
54
        ld (pgsfx),a
55
        call loadpage
56
        ld (pgmusic),a
1620 alone 57
        SETPG4000
434 alone 58
 
1916 alone 59
; ⭮  㧪 ஢
772 alone 60
        push af
61
        call 0x4000 ;init
62
 
63
        ld a,(pgsfx)
1620 alone 64
        SETPG8000
772 alone 65
        pop af
66
        ld hl,0x4005 ;play
67
        OS_SETMUSIC
68
        call setpgsmain40008000
69
        ld a,(pgscalersnum)
1620 alone 70
        SETPGC000
772 alone 71
       endif
72
 
437 alone 73
        ;pop af ;LD a,(pg8000)
1620 alone 74
        ;SETPG8000
231 alone 75
 
76
        OS_NEWPAGE
77
        ld a,e
213 alone 78
        ld (pgmapnum),a
79
 
1916 alone 80
        if 1;TEXBMP
438 alone 81
        ld de,texfilename
439 alone 82
        call openfile_skipbmpheader
83
;b=handle
438 alone 84
        ld hl,ttexpgs+NTEXPGS-1
85
        ld c,NTEXPGS
439 alone 86
gettexpgs0
438 alone 87
        push bc
88
        push hl
439 alone 89
        call ldpgrecodebmp
90
 
438 alone 91
        push de
439 alone 92
 
1916 alone 93
;2. 室  hl ࠢ 孨 㣮쭨 ⥪,   de -  , 塞  ⠬
438 alone 94
        ld hl,0x4000
95
gettexpgsrot0
96
        push hl    
97
        ld b,64
98
gettexpgsrot1
99
        push bc
100
        push hl
101
        ld d,h
102
        ld e,l
103
gettexpgsrot2
104
        ld c,(hl)
105
        ld a,(de)
106
        ld (hl),a
107
        ld a,c
108
        ld (de),a
109
        inc l
110
        inc d
111
        djnz gettexpgsrot2
112
        pop hl
113
        inc l
114
        inc h
115
        pop bc
116
        djnz gettexpgsrot1
117
        pop hl
118
        ld a,l
119
        add a,64
120
        ld l,a
121
        jr nz,gettexpgsrot0
122
 
123
        pop de
124
        pop hl
125
        ld (hl),e
126
        dec hl
127
        pop bc
128
        dec c
439 alone 129
        jr nz,gettexpgs0
438 alone 130
 
131
        OS_CLOSEHANDLE
132
 
439 alone 133
        ld de,sprfilename
134
        call openfile_skipbmpheader
135
;b=handle
136
        ld hl,ttexpgs+NTEXPGS+NSPRPGS-1
137
        ld c,NSPRPGS
138
getsprpgs0
139
        push bc
140
        push hl
141
        call ldpgrecodebmp        
142
        pop hl
143
        ld (hl),e
144
        dec hl
145
        pop bc
146
        dec c
147
        jr nz,getsprpgs0
148
 
149
        OS_CLOSEHANDLE
150
 
1916 alone 151
        else ;~TEXBMP
438 alone 152
 
213 alone 153
        ld hl,ttexpgs
154
        ld b,5
155
getttexpgs0
156
        push bc
157
        push hl
158
        OS_NEWPAGE
159
 
160
        push de
161
        ld a,e
1620 alone 162
        SETPG4000
213 alone 163
        ld de,texfilename
164
        OS_OPENHANDLE
165
        push bc
166
        ld de,0x4000 ;addr
167
        ld hl,0x4000 ;size
168
        OS_READHANDLE
169
        pop bc
170
        OS_CLOSEHANDLE
171
 
172
        ld hl,texfilenamenum
173
        inc (hl)
174
        pop de
175
 
176
        pop hl
177
        ld (hl),e
178
        inc hl
179
        pop bc
180
        djnz getttexpgs0
181
 
438 alone 182
        endif
183
 
184
 
213 alone 185
        LD HL,tID
186
REtID0  LD A,(HL)
187
        add a,ttexpgs&0xff
188
        ld e,a
189
        adc a,ttexpgs/256
190
        sub e
191
        ld d,a
192
        ld a,(de)
193
;basepggfx=$+1
194
;        ADD A,0
195
        LD (HL),A
196
        INC L
197
        INC L
198
        jr NZ,REtID0
765 alone 199
         ld hl,tID+128
200
         ld de,tID
201
         ld bc,128
202
         ldir ;ID_DOOR < 128
213 alone 203
 
437 alone 204
        ld ix,tscales
205
        ld hl,tscales_rev
206
        ld b,64
207
revscale0
208
        push bc
209
        push hl
210
        ld c,(ix)
211
        inc ix
212
        ld b,(ix)
213
        inc ix
214
        ld de,256
1916 alone 215
;
437 alone 216
;DE=+-7.8;BC=+7.8
217
;DE=DE/BC=+-8.7/2
1916 alone 218
    ;BC ࠭!!!
437 alone 219
        call MONDIV
220
        pop hl
221
        sla e
222
        rl d
223
        ld (hl),e
224
        inc hl
225
        ld (hl),d
226
        inc hl
227
        pop bc
228
        djnz revscale0
229
 
213 alone 230
        call genscalers
231
 
232
        call swapimer
233
 
234
        call TEXCODEGO
235
 
236
        call swapimer
237
 
772 alone 238
        ;call shutay        
239
pgmusic=$+1
240
        ld a,0
1620 alone 241
        SETPG4000
242
        halt
243
        ld hl,0x4000;0x4008+3 ;stop
772 alone 244
        OS_SETMUSIC
245
        halt
213 alone 246
        QUIT
247
 
772 alone 248
setpgsmain40008000
249
pgmain4000=$+1
250
        ld a,0
1620 alone 251
        SETPG4000
772 alone 252
pgmain8000=$+1
253
        ld a,0
1620 alone 254
        SETPG8000
772 alone 255
        ret
256
 
512 alone 257
        if 1==0
258
setpgsscr40008000_current
259
        call getuser_scr_low_cur
1620 alone 260
        SETPG4000
512 alone 261
        call getuser_scr_high_cur
1620 alone 262
        SETPG8000
512 alone 263
        ret
264
 
265
setpgsscr40008000
266
        call getuser_scr_low
1620 alone 267
        SETPG4000
512 alone 268
        call getuser_scr_high
1620 alone 269
        SETPG8000
512 alone 270
        ret
271
 
272
setpgscrlow4000
273
        call getuser_scr_low
1620 alone 274
        SETPG4000
512 alone 275
        ret
276
 
277
setpgscrhigh4000
278
        call getuser_scr_high
1620 alone 279
        SETPG4000
512 alone 280
        ret
281
        endif
282
 
283
getuser_scr_low
284
getuser_scr_low_patch=$+1
285
getuser_scr_low_patchN=0xff&(user_scr0_low^user_scr1_low)
555 alone 286
        ld a,(user_scr1_low) ;ok
512 alone 287
        ret
288
 
289
getuser_scr_high
290
getuser_scr_high_patch=$+1
291
getuser_scr_high_patchN=0xff&(user_scr0_high^user_scr1_high)
555 alone 292
        ld a,(user_scr1_high) ;ok
512 alone 293
        ret
294
 
295
getuser_scr_low_cur
296
getuser_scr_low_cur_patch=$+1
297
getuser_scr_low_cur_patchN=0xff&(user_scr0_low^user_scr1_low)
555 alone 298
        ld a,(user_scr0_low) ;ok
512 alone 299
        ret
300
 
301
getuser_scr_high_cur
302
getuser_scr_high_cur_patch=$+1
303
getuser_scr_high_cur_patchN=0xff&(user_scr0_high^user_scr1_high)
555 alone 304
        ld a,(user_scr0_high) ;ok
512 alone 305
        ret
306
 
307
changescrpg_current
308
;        ld a,(setpgs_scr_low)
309
;setpgs_scr_scrxor=$+1
310
;        xor 0
311
;        ld (setpgs_scr_low),a
312
        ld hl,getuser_scr_low_patch
313
        ld a,(hl)
314
        xor getuser_scr_low_patchN
315
        ld (hl),a
316
        ld hl,getuser_scr_high_patch
317
        ld a,(hl)
318
        xor getuser_scr_high_patchN
319
        ld (hl),a
320
        ld hl,getuser_scr_low_cur_patch
321
        ld a,(hl)
322
        xor getuser_scr_low_cur_patchN
323
        ld (hl),a
324
        ld hl,getuser_scr_high_cur_patch
325
        ld a,(hl)
326
        xor getuser_scr_high_cur_patchN
327
        ld (hl),a
328
 
329
        ld a,1
330
curscrnum=$+1
331
        xor 0
332
        ld ($-1),a
333
         ;add a,a
334
         ;add a,a
335
         ;add a,a
336
         ;ld (imer_curscreen_value),a
337
        ret
338
 
339
changescrpg
340
        ;jr $
341
        call changescrpg_current
342
        ;ld (curscrnum_physical),a
343
        ld e,a
344
        OS_SETSCREEN
345
        ret
346
 
439 alone 347
openfile_skipbmpheader
348
        OS_OPENHANDLE
349
        push bc
350
        ld de,bmpbuf;0x4000 ;addr
460 alone 351
        ld hl,14+2;0x0076 ;size
439 alone 352
        OS_READHANDLE ;b=handle
353
        pop bc
460 alone 354
        push bc
355
        ld de,bmpbuf;0x4000 ;addr
356
        ld hl,(bmpbuf+14)
357
        dec hl
358
        dec hl
359
        OS_READHANDLE ;b=handle
360
        pop bc
361
        push bc
362
        ld de,bmpbuf;0x4000 ;addr
363
        ld hl,4*16;0x0076 ;size
364
        OS_READHANDLE ;b=handle
365
        pop bc
439 alone 366
        ret
367
 
368
ldpgrecodebmp
369
        push bc
370
        OS_NEWPAGE
371
        ld a,e
1620 alone 372
        SETPG4000
439 alone 373
        pop bc ;b=handle
374
        push de
375
 
376
        ld de,0x4000 ;addr
377
        ld hl,0x4000 ;size
378
        OS_READHANDLE
379
 
380
        ld hl,0x4000
381
        ld d,trecolor/256
382
gettexpgsrecode0
383
        ld e,(hl)
384
        ld a,(de)
385
        ld (hl),a
386
        inc hl
387
        bit 7,h
388
        jr z,gettexpgsrecode0
389
 
1916 alone 390
; ⥪  90 ࠤᮢ ( ⥭,   ࠩ⮢  ॢ?)
391
;1. ॢ ⥪
439 alone 392
        ld hl,0x4000
393
        ld de,0x4000+0x3f00
394
        ld b,32
395
gettexpgsturn0
396
gettexpgsturn1
397
        ld c,(hl)
398
        ld a,(de)
399
        ld (hl),a
400
        ld a,c
401
        ld (de),a
402
        inc l
403
        inc e
404
        jr nz,gettexpgsturn1
405
        inc h
406
        dec d
407
        djnz gettexpgsturn0
408
 
409
        pop de ;e=pg
410
        ret
411
 
2080 alone 412
drawhud
413
;TODO
414
        ret
415
 
231 alone 416
shutay
417
        ld de,0xe00
418
shutay0
419
        dec d
420
        ld bc,0xfffd
421
        out (c),d
422
        ld b,0xbf
423
        out (c),e
424
        jr nz,shutay0
425
        ret
426
 
213 alone 427
texfilename
1916 alone 428
        if 1;TEXBMP
1965 alone 429
        db "wolftex3.bmp",0
438 alone 430
        else
213 alone 431
        db "wolftex.0",0
432
texfilenamenum=$-2
438 alone 433
        endif
439 alone 434
sprfilename
1965 alone 435
        db "wolfspr3.bmp",0
213 alone 436
 
440 alone 437
        align 256
775 alone 438
t1x
439
        db 255
440
        dup 255
441
        db (255*2/($&0xff)+1)/2
442
        edup
213 alone 443
ttexpgs
439 alone 444
        ds NTEXPGS+NSPRPGS
213 alone 445
 
446
setpgmap4000
447
pgmapnum=$+1
448
        ld a,0
1620 alone 449
        SETPG4000
213 alone 450
        ret
451
 
1916 alone 452
        include "int.asm"
213 alone 453
 
772 alone 454
loadpage
1916 alone 455
;뢠 ࠭  㧨 㤠 䠩 ( 䠩  hl)
456
;out: hl=᫥  䠩, a=pg
772 alone 457
        push hl
458
        OS_NEWPAGE
459
        pop hl
460
        ld a,e
461
        push af ;pg
1620 alone 462
        SETPGC000
772 alone 463
        push hl
464
        ex de,hl
465
        OS_OPENHANDLE
466
        push bc
467
        ld de,0xc000 ;addr
468
        ld hl,0x4000 ;size
469
        OS_READHANDLE
470
        pop bc
471
        OS_CLOSEHANDLE                
472
        pop hl
473
        ld b,1
474
        xor a
475
        cpir ;after 0
476
        pop af ;pg
477
        ret
478
 
479
muzfilename
480
        db "sfx.bin",0
481
        db "music.bin",0
482
 
435 alone 483
wolfpal
1965 alone 484
        ;dw 0xffff,0x0c0c,0x3f3f,0xdede,0xfefe,0xdfdf,0x4c4c,0xaeae
485
        ;dw 0xbdbd,0xfdfd,0xbfbf,0xeded,0x8d8d,0x7d7d,0xecec,0x1f1f
486
        include "pal.ast"
435 alone 487
 
213 alone 488
        include "WATM2.asm"
489
 
435 alone 490
scale2ytop
491
;bc=scale
492
;out: de=Y, lx=y
493
        XOR A
494
        LD L,A
495
        ld H,A
496
        SBC HL,BC ;-scale = -0x40..-0x410
497
        ADD HL,HL
498
        ADD HL,HL
499
        ADD HL,HL
500
        ADD HL,HL
501
        ADD HL,HL ;*32 = -0x800..-0x8200
502
        EXD
503
        LD LX,E
504
        LD a,D
505
        LD D,-1
506
        ADD A,Ycenter ;0x64
507
        LD E,A
508
        ret nc ;jr NC,$+3
509
        INC D
510
        ret
511
 
512
YtoADDR
513
       PUSH HL
514
        LD H,D
515
        ld L,E
516
        ADD HL,HL
517
        ADD HL,HL
518
        ADD HL,DE ;*5
519
        ADD HL,HL
520
        ADD HL,HL
521
        ADD HL,HL ;*40
522
        LD DE,scrbase
523
        ADD HL,DE
524
;genX=$+1
525
;        LD DE,0
526
;        ADD HL,DE
527
        EXD
528
       POP HL
529
        RET
530
        ;align 256;DS .(-$)
531
tscales
532
       IF customscales == 0
1916 alone 533
        INCBIN "scalesw3" ;᭠砫 
435 alone 534
       ELSE
535
        DS 8,5,0
536
        DS 7,6,0
537
        DS 6,7,0
538
        DS 5,8,0
539
        DS 4,9,0
540
        DS 3,10,0
541
        DS 2,11,0
542
        DS 1,12,0
543
        DS 1,13,0
544
        DS 1,14,0
545
        DS 1,15,0
546
        DS 1,16,0
547
        DS 1,17,0
548
        DS 1,18,0
549
        DS 1,19,0
550
        DS 1,20,0
551
        DS 1,21,0
552
        DS 1,22,0
553
        DS 1,23,0
554
        DS 1,24,0
555
        DS 1,25,0
556
        DS 1,26,0
557
        DS 1,27,0
558
        DS 1,28,0
559
        DS 1,29,0
560
        DS 1,30,0
561
        DS 1,31,0
562
        DS 1,32,0
563
        DS 1,33,0
564
        DS 1,34,0
565
        DS 1,35,0
566
        DS 1,36,0
567
        DS 1,38,0
568
        DS 1,40,0
569
        DS 1,42,0
570
        DS 1,44,0
571
        DISPLAY $-tscales,"=#80"
572
       ENDIF
437 alone 573
tscales_rev
574
        ds 128
435 alone 575
 
1916 alone 576
        include "anims.asm"
577
        include "savestate.asm"
440 alone 578
 
438 alone 579
        align 256
580
trecolor
581
;%00003210 => %.3...210
582
        dup 256
583
_3=$&8
584
_210=$&7
585
_3L=($>>4)&8
586
_210L=($>>4)&7
587
        db (_3L*0x08) + (_210L*0x01) + (_3*0x10) + (_210*0x08)
588
        edup
589
 
590
bmpbuf
591
 
437 alone 592
        display "free before stack=",0x3e00-$
593
 
594
        ds 0x8000-$
595
 
213 alone 596
       IF atm
597
        ;ORG #C000;,pgscalers
598
        ;ds 0xc000-$
599
        ;INCBIN "scalers"
231 alone 600
wasmuz
764 alone 601
        ;ds 9,201
437 alone 602
        incbin "DOOM-MUS" ;TODO load
231 alone 603
wasmuz_sz=$-wasmuz
437 alone 604
 
605
        include "genscale.asm"
606
 
607
        display "WASMAP=",$
608
WASMAP
609
        INCBIN "mapatm.E" ;TODO load
610
szMAP=$-WASMAP
611
 
612
res_path
613
        defb "wolf3d",0
614
 
615
 
616
       else ;~atm
213 alone 617
       ENDIF
618
end
619
 
289 dimkam 620
        ;display "End=",end
213 alone 621
        ;display "Free after end=",/d,#c000-end
289 dimkam 622
        ;display "Size ",/d,end-begin," bytes"
213 alone 623
 
624
        savebin "wolf3d.com",begin,end-begin
625
 
1916 alone 626
        LABELSLIST "../../../us/user.l",1