?login_element?

Subversion Repositories NedoOS

Rev

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

Rev Author Line No. Line
68 Alone 1
        DEVICE ZXSPECTRUM128
14 dimkam 2
        include "../_sdk/sys_h.asm"
3
 
73 Alone 4
WGETBUF=0x0800
5
;WGETBUFSZ=0x0400
6
;WGETBEGINADDR=WGETBUF+WGETBUFSZ
7
;WGETENDADDR=WGETBEGINADDR+2
8
 
59 Alone 9
end1=0x3500
10
 
11
DISKBUF=0x3500;0xb000
12
DISKBUFsz=0x800;0x1000
13
 
344 alone 14
LINEPIXELS=0x3d00 ;,wid8*2 (. ࠧ = 512  wid=2048) ;TODO ࠭   LINEGIF (⮡ pixels 諨 ࠭,  attr ࠫ    ᨨ)
59 Alone 15
 
344 alone 16
SPOIL4B=0x4000 ;⥪  4 ,   0x3b00 ;࠭ 뫮    ࠭ ࠭,  ᥩ  ४砥 ࠭  ⨬ ⥪
668 alone 17
INTSTACK=0x3ffc
18
STACK=0x3fc0
40 alone 19
 
59 Alone 20
end2=0x7e00
21
 
344 alone 22
depkbuf=0x7e00 ;32K+ for zip (match length of 3-258 bytes)
59 Alone 23
buf64k=0
24
 
344 alone 25
FREE=0x8000 ;᪠  jpeg,  ப gif
26
LINE1=0x9400 ; ப 0x400*3? jpeg
40 alone 27
LINE1_sz=0x0c00
18 dimkam 28
 
16 dimkam 29
 
14 dimkam 30
COLOR=7
32 Alone 31
STATUSCOLOR=0x38
14 dimkam 32
 
16 dimkam 33
GIF_PIXELSIZE=0
34
 
28 Alone 35
HTMLTOPY=0
31 Alone 36
HTMLHGT=24
59 Alone 37
SCROLLHGT=HTMLHGT*8;192;200
28 Alone 38
 
344 alone 39
BACKGROUNDCOLORLEVEL=0 ; ⪥  ப ( ࠢ쭮 ࠢ   ⪥ )
40 alone 40
 
447 alone 41
MAXLINKSZ=256+256-1-2 ;  ନ  Yy
59 Alone 42
 
43
EDITLINEY=192
44
EDITLINEMAXVISIBLEX=72
45
 
444 alone 46
key_up_scroll=key_ssup ;=F7!
47
key_down_scroll=key_ssdown ;=F6!
59 Alone 48
 
23 dimkam 49
       MACRO rdbyte
50
        INC LY
51
        LD A,(IY)
52
        CALL Z,RDBYH
18 dimkam 53
       ENDM
54
 
59 Alone 55
       MACRO ziprdbyte
56
        INC LY
57
        LD A,(IY)
58
        CALL Z,ZIPRDBYH
59
       ENDM
60
 
14 dimkam 61
;b=R/G/Bmin
344 alone 62
;de  砫  R/G/B
16 dimkam 63
;h=maxdistdiv
344 alone 64
; ਭ 室 ⮫쪮   ⠢饩, ⠫  ⠥:
14 dimkam 65
        macro DITHERMC1B ch0,ch1,ch2,ch3
16 dimkam 66
        ld a,(de) ;R(pixel)
67
        inc e
14 dimkam 68
        sub b ;Rmin
69
         rra ;maybe<0
16 dimkam 70
        ld l,a ;h=maxdistdiv
71
        ld a,(hl) ;inklevel
14 dimkam 72
        cp ch0 ;chunklevel[x%4][y%4]
73
        rl c ;bits
16 dimkam 74
        ld a,(de) ;R(pixel)
75
        inc e
14 dimkam 76
        sub b ;Rmin
77
         rra ;maybe<0
16 dimkam 78
        ld l,a ;h=maxdistdiv
79
        ld a,(hl) ;inklevel
14 dimkam 80
        cp ch1 ;chunklevel[x%4][y%4]
81
        rl c ;bits
16 dimkam 82
        ld a,(de) ;R(pixel)
83
        inc e
14 dimkam 84
        sub b ;Rmin
85
         rra ;maybe<0
16 dimkam 86
        ld l,a ;h=maxdistdiv
87
        ld a,(hl) ;inklevel
14 dimkam 88
        cp ch2 ;chunklevel[x%4][y%4]
89
        rl c ;bits
16 dimkam 90
        ld a,(de) ;R(pixel)
91
        inc e
14 dimkam 92
        sub b ;Rmin
93
         rra ;maybe<0
16 dimkam 94
        ld l,a ;h=maxdistdiv
95
        ld a,(hl) ;inklevel
14 dimkam 96
        cp ch3 ;chunklevel[x%4][y%4]
97
        rl c ;bits
98
 
16 dimkam 99
        ld a,(de) ;R(pixel)
100
        inc e
14 dimkam 101
        sub b ;Rmin
102
         rra ;maybe<0
16 dimkam 103
        ld l,a ;h=maxdistdiv
104
        ld a,(hl) ;inklevel
14 dimkam 105
        cp ch0 ;chunklevel[x%4][y%4]
106
        rl c ;bits
16 dimkam 107
        ld a,(de) ;R(pixel)
108
        inc e
14 dimkam 109
        sub b ;Rmin
110
         rra ;maybe<0
16 dimkam 111
        ld l,a ;h=maxdistdiv
112
        ld a,(hl) ;inklevel
14 dimkam 113
        cp ch1 ;chunklevel[x%4][y%4]
114
        rl c ;bits
16 dimkam 115
        ld a,(de) ;R(pixel)
116
        inc e
14 dimkam 117
        sub b ;Rmin
118
         rra ;maybe<0
16 dimkam 119
        ld l,a ;h=maxdistdiv
120
        ld a,(hl) ;inklevel
14 dimkam 121
        cp ch2 ;chunklevel[x%4][y%4]
122
        rl c ;bits
16 dimkam 123
        ld a,(de) ;R(pixel)
124
        inc e
14 dimkam 125
        sub b ;Rmin
126
         rra ;maybe<0
16 dimkam 127
        ld l,a ;h=maxdistdiv
128
        ld a,(hl) ;inklevel
14 dimkam 129
        cp ch3 ;chunklevel[x%4][y%4]
130
        ld a,c
131
        rla ;bits
16 dimkam 132
        exx
344 alone 133
        ld (de),a ; bits
40 alone 134
        ;exx
14 dimkam 135
        endm
136
 
137
        org PROGSTART
138
cmd_begin
344 alone 139
        ld sp,STACK ;  ᪠  #3b00!    OS
668 alone 140
        call init
141
 
344 alone 142
;curfulllink 㦥  ࠭  ਨ  ᯮ짮   ⭮⥫ 뫮
143
;linkbuf ᮤন 뫪 (  ⭮⥫쭠)
32 Alone 144
        if 1==0
145
        call setpgs_scr
146
        call setpgcode4000
147
        ld de,0xc000;0x0801
148
        call setxymc
149
        ld de,curfulllink;COMMANDLINE
59 Alone 150
        call prtextmc
32 Alone 151
        call setpgtemp8000
152
        endif
31 Alone 153
 
34 Alone 154
        ;call keepcurlink
155
 
68 Alone 156
        jp browser_go_curfulllink
32 Alone 157
 
31 Alone 158
browser_godownload
159
        ld a,1
160
        ld (downloadflag),a
28 Alone 161
browser_go
344 alone 162
;curfulllink ᮤন ⥪ 뫪 (   ), ᫥   http://ser.ver 㦥 
163
; linkbuf  뫪 (  쭠)
164
;TODO ४஢ ᪨ 㪢  뫪  %? ⮫쪮  ࠭ ?
68 Alone 165
        ld hl,linkbuf
166
        push hl
167
        push hl
168
        call strlen
169
        inc hl
170
        ;move block to end of buf:
171
        pop de;ld de,linkbuf
172
        ld b,h
173
        ld c,l ;size
174
        dec de ;linkbuf-1
175
        add hl,de ;end of data
176
        ld de,linkbuf+(MAXLINKSZ+1)-1
177
        lddr
178
        inc de ;begin of data
179
        ex de,hl
180
        pop de;ld de,linkbuf
181
recodelinkamp0
182
        ld a,(hl)
183
        inc hl
184
        ld (de),a
185
        inc de
186
        or a
187
        jr z,recodelinkamp0q
188
        cp '&'
189
        jr nz,recodelinkamp0
190
        ld a,(hl)
191
        cp 'a'
192
        jr nz,recodelinkamp0
193
        inc hl
194
        ld a,(hl)
195
        cp 'm'
196
        jr nz,recodelinkamp0dec1
197
        inc hl
198
        ld a,(hl)
199
        cp 'p'
200
        jr nz,recodelinkamp0dec2
201
        inc hl
202
        ld a,(hl)
203
        cp ';'
204
        inc hl
205
        jr z,recodelinkamp0
206
        dec hl
207
        dec hl
208
recodelinkamp0dec2
209
        dec hl
210
recodelinkamp0dec1
211
        dec hl
212
        jr recodelinkamp0
213
recodelinkamp0q
214
 
34 Alone 215
        call keepcurlink
668 alone 216
 
73 Alone 217
        call makefulllink
344 alone 218
;curfulllink ᮤন  url, ᮡ࠭  ண curfullink  뫪 linkbuf
32 Alone 219
 
220
        if 1==0
221
        call setpgs_scr
222
        call setpgcode4000
223
        ld de,0x0000
224
        call setxymc
225
        ld de,curfulllink;COMMANDLINE
226
        call prtextmc
227
        call setpgtemp8000
228
        endif
668 alone 229
 
32 Alone 230
browser_go_curfulllink
668 alone 231
 
34 Alone 232
        jr browser_backspaceq
233
keepcurlink
344 alone 234
; backspace:     ⮪  
235
;histaddr 㪠뢠  ᫥  ਨ
31 Alone 236
        call setpghist
237
histaddr=$+1
34 Alone 238
        ld de,0xc000
239
        ld a,d
447 alone 240
         cp -2 ;inc a
31 Alone 241
        jr nz,keeptohist_nooverflow
447 alone 242
         ld hl,0xc100+256
31 Alone 243
        ld de,0xc000
447 alone 244
         ld bc,0x3f00-256
31 Alone 245
        ldir ;forget oldest link
246
keeptohist_nooverflow
32 Alone 247
        ld hl,curfulllink;linkbuf
447 alone 248
         ld bc,254+256
31 Alone 249
        ldir
34 Alone 250
        ld hl,html_curtopy
40 alone 251
        ld c,2
252
        ldir
34 Alone 253
        ld (histaddr),de
40 alone 254
        ld (html_curtopy),bc ;0
34 Alone 255
        ret
14 dimkam 256
 
73 Alone 257
remembercurlink
31 Alone 258
        ld hl,(histaddr)
259
        ld a,h
260
        cp 0xc0
73 Alone 261
        ret z ;jr z,browser_reload ;no history
31 Alone 262
        dec h
447 alone 263
         dec h
31 Alone 264
        ld (histaddr),hl
265
        call setpghist
32 Alone 266
        ld de,curfulllink;linkbuf
447 alone 267
         ld bc,256+254
34 Alone 268
        ldir
269
        ld de,html_curtopy
270
        ldi
271
        ldi
73 Alone 272
        ret
14 dimkam 273
 
73 Alone 274
browser_downloadthis
275
        ld a,1
276
        ld (downloadflag),a
277
browser_reload
344 alone 278
;histaddr 㪠뢠  ᫥  ਨ
73 Alone 279
        ;ld hl,(histaddr)
280
        ;call setpghist
281
        ;ld de,curfulllink;linkbuf
282
        ;call strcopy
283
        jr browser_backspaceq
284
 
285
browser_backspace
344 alone 286
;ᯮ    ⮪  ,    curfulllink
287
;ᥩ histaddr 㪠뢠  ᫥  ਨ.      㪠⥫
73 Alone 288
        call remembercurlink
289
 
28 Alone 290
browser_backspaceq
344 alone 291
;curfulllink ᮤন  url, ᮡ࠭  ண curfullink  뫪 linkbuf        
292
        ld sp,STACK ;  ᪠  #3b00!    OS
14 dimkam 293
 
31 Alone 294
        call unreservepages
295
        xor a
296
        ld h,a
297
        ld l,a
298
        ld (freemem_hl),hl
299
        ld (freemem_a),a
300
 
59 Alone 301
        call cleanstatusline
302
        call browser_editline_print
447 alone 303
         ;call setpgcode4000 ;ᠬ ⠭
23 dimkam 304
        call setpgtemp8000
18 dimkam 305
 
1510 alone 306
         OS_GETTIMER ;dehl=timer
307
         ld (timebegin),hl
28 Alone 308
 
32 Alone 309
        ld hl,curfulllink
310
        call isprotocolpresent
303 alone 311
;a=protocol (0=file, 1=http, 2=gopher, 3=https), hl=after "//"
261 alone 312
        ld (curprotocol),a
32 Alone 313
        push hl ;hl=after "//"
28 Alone 314
 
344 alone 315
;   㦭 ⮪
28 Alone 316
        ld bc,readstream_file
317
        ld de,closestream_file
318
        ld hl,openstream_file
319
         or a
320
         jr z,browser_go_changeprotocol_nohttp
321
        ld bc,readstream_http
322
        ld de,closestream_http
323
        ld hl,openstream_http
324
browser_go_changeprotocol_nohttp
325
        ld (openstream_patch),hl
326
        ld (readstream_patch),bc
327
        ld (closestream_patch),de
32 Alone 328
 
28 Alone 329
        pop hl
330
 
344 alone 331
;hl=砫 path  ⮪
447 alone 332
;모뢠 #... (TODO ࠭  ᯮ짮  室  类)
333
        push hl
334
        call strlen_tobc_keephl
335
        jr z,browser_open_skip
336
        ld a,'#'
337
        cpir
338
        jr nz,browser_open_skip
339
        dec hl
340
        ld (hl),0
341
browser_open_skip
342
        pop hl
28 Alone 343
 
344
        ex de,hl ;de=filename
345
openstream_patch=$+1
346
        call openstream_file
31 Alone 347
        or a
32 Alone 348
        jp nz,LOADERROR
14 dimkam 349
 
32 Alone 350
        xor a
31 Alone 351
downloadflag=$+1
32 Alone 352
        cp 0
31 Alone 353
        ld (downloadflag),a
354
        jp nz,downloadfile
355
 
42 DimkaM 356
        call initframes_time_scroll
668 alone 357
 
23 dimkam 358
       LD IY,DISKBUF+DISKBUFsz-1
16 dimkam 359
 
28 Alone 360
        call RDBYTE
32 Alone 361
        ;cp '<'
362
        ;jp z,loadhtml
363
         ;cp 0x0a ;speccy.info
364
         ;jp z,loadhtml
16 dimkam 365
        cp 'G'
366
        jp z,loadgif
59 Alone 367
        cp 0x89
368
        jp z,loadpng
16 dimkam 369
        cp 0xff
370
        jp z,loadjpeg
371
        cp 'B'
403 alone 372
        jr z,loadbmp
373
         ld a,(DISKBUF+1)
374
         cp '?' ;<?xml
406 alone 375
         ld a,(DISKBUF)
447 alone 376
         jp z,loadxml;svg ; ᪠ !DOCTYPE HTML  svg
32 Alone 377
        jp nz,loadhtml;loadbmp_fail
28 Alone 378
        call RDBYTE
16 dimkam 379
        cp 'M'
32 Alone 380
        jp nz,loadhtml;loadbmp_fail
403 alone 381
loadbmp
344 alone 382
; I    1    0      2    ਧ -䠩 - ᨬ 'BM'       (+)
383
;      2    2      4     -䠩 ()                ( ,   )
384
;      3    6      4     (=0)                            (  )
385
;      4   10      4    饭    砫 䠩    
386
;                       砫 ᠭ ஢ ࠦ (  ,   118)
16 dimkam 387
 
460 alone 388
; II   5   14      4     ᠭ ࠦ (=40 WINDOWS) (  , ᥣ 40 -  Linux !)
344 alone 389
;      6   18      4    ਭ ࠦ ( ᥫ)        (+)
390
;      7   22      4     ࠦ ( ᥫ)        (+)
391
;      8   26      2    ⢮ 梥⮢ ᪮⥩ (=1)    (  , ᥣ 1)
392
;      9   28      2    ⢮   ᥫ               (+ 4, 8, 24 ,   1)
393
;     10   30      4     ᦠ ଠ樨 (0,1  2)      (   )
394
;     11   34      4     ࠧ ஢ ࠦ   ( ,   )
395
;     12   38      4    㥬 ਧ- ࠧ襭    (  )
396
;     13   42      4    㥬 ⨪쭮 ࠧ襭  (  )
397
;     14   46      4    ⢮ 梥⮢              (+)
398
;     15   50      4    ⢮  梥⮢       (  )
16 dimkam 399
 
344 alone 400
;   (B, G, R, 0)
16 dimkam 401
 
344 alone 402
;  ⨭ ( ப    4)
16 dimkam 403
 
460 alone 404
        ld b,18-2 -4+1
405
;loadbmp_skipheader0
406
;        call RDBYTE
407
;        djnz loadbmp_skipheader0
408
        call read_b_bytes
409
         call GETDWORD_slow
410
         push de
411
 
16 dimkam 412
        call GETDWORD_slow
460 alone 413
        ex de,hl ;hl=wid ;TODO 
23 dimkam 414
        call setpicwid
16 dimkam 415
        call GETDWORD_slow
40 alone 416
        ;ld (curpichgt),de
460 alone 417
        ex de,hl ;TODO 
40 alone 418
        call setpichgt
16 dimkam 419
 
460 alone 420
         pop hl
421
         ld a,l
422
         sub 12
423
         ld b,a
424
        ;ld b,54-26
59 Alone 425
        call read_b_bytes
16 dimkam 426
 
28 Alone 427
        ;ld de,0
428
        ;ld hl,0 ;dehl=shift in file
429
        ;ld a,(filehandle)
430
        ;ld b,a
431
        ;OS_SEEKHANDLE
40 alone 432
 
344 alone 433
;TODO     㧨   ( 㧨   , 窨   , ⮣  bmp  㦥)
18 dimkam 434
 
28 Alone 435
        call reservepage
436
        ret nz ;no memory
437
        ld hl,DISKBUF
438
        ld de,0xc000
439
        ld bc,DISKBUFsz
440
        ldir ;beginning of file is already read
441
        ld hl,0x4000-DISKBUFsz
42 DimkaM 442
        jr nvview_loadbmp0go
28 Alone 443
 
42 DimkaM 444
nvview_loadbmp0
14 dimkam 445
        call reservepage
446
        ret nz ;no memory
447
 
448
        ld de,0xc000
449
        ld hl,0x4000
42 DimkaM 450
nvview_loadbmp0go
31 Alone 451
;DE = Buffer address, HL = Number of bytes to read
28 Alone 452
         push hl
453
        call readstream
61 Alone 454
;HL = Number of bytes actually read
14 dimkam 455
        ld b,h
456
        ld c,l
28 Alone 457
         pop hl
447 alone 458
        xor a
14 dimkam 459
        sbc hl,bc ;NZ = bytes to read != bytes actually read
42 DimkaM 460
        jr z,nvview_loadbmp0
668 alone 461
 
447 alone 462
        ld h,a
463
        ld l,a ;0
42 DimkaM 464
        ld a,(npages)
465
        srl a
466
        rr h
467
        srl a
468
        rr h
469
        ld (freemem_hl),hl
344 alone 470
        ld (freemem_a),a ; (TODO 뢠   bmp ଠ쭮)
668 alone 471
 
42 DimkaM 472
        call reservefirstframeaddr
344 alone 473
        call initframe ; ࠧ  ⨭ ᫥ setpicwid, setpichgt  ᫥ ⠭ gifframetime ;뢠   祭 
474
;ahl=   祭 
42 DimkaM 475
 
344 alone 476
        ld hl,54 ;TODO ⭮⥫쭮 砫 bmp
42 DimkaM 477
        xor a
344 alone 478
;३  ᫥  (⮡ ᮢ ᭨ , 㦭  drawscreenline_frombuf):
42 DimkaM 479
        if GIF_PIXELSIZE
480
        ld de,(curpicwid)
481
        else
482
        ld de,(curpicwidx3)
483
        endif
484
        dec de
485
        set 1,e
486
        set 0,e
344 alone 487
        inc de ;㣫 ࠧ ப   4 : 0=>0, 1..3=>4, 4=>4...
42 DimkaM 488
        ld (bmplinestep),de
489
        ld bc,(curpichgt)
490
bmpfindlastline0
491
        add hl,de
492
        adc a,0
493
        dec hl
494
        cpi
495
        jp pe,bmpfindlastline0
496
        ld (putchar_hl),hl
497
        ld (putchar_a),a
498
 
499
        call setpgtemp8000
500
 
501
        ld bc,(curpichgt)
502
fill0
503
        push bc
504
 
505
        ld hl,(putchar_hl)
506
        ld a,(putchar_a)
507
bmplinestep=$+1
508
        ld bc,0
509
        or a
510
        sbc hl,bc
511
        sbc a,0
512
        ld (putchar_hl),hl
513
        ld (putchar_a),a        
514
 
515
        call islinevisible ;CY=invisible
516
        jr c,bmpgetline_ifvisibleq
517
        ld hl,(putchar_hl)
518
        ld a,(putchar_a)
519
        ld bc,(bmplinestep)
520
        ld de,LINEGIF
521
        call getfrommem
522
        ld hl,LINEGIF
523
        call drawscreenline_frombuf
344 alone 524
        call keepconvertedline ; ᪮祭 ப  LINEPIXELS
42 DimkaM 525
bmpgetline_ifvisibleq
526
        call inccury
527
 
528
        pop bc
529
        cpi
530
        jp pe,fill0
531
        jp showgif ;jp closequit
668 alone 532
 
31 Alone 533
downloadfile
534
        call reservepage
535
        ret nz ;no memory
668 alone 536
 
344 alone 537
        ld de,downloadfilename ;TODO ᣥ஢  ૠ  HTTP ⢥ +  ।஢
31 Alone 538
;de=filename
539
        OS_CREATEHANDLE
540
;b=new file handle
541
        ld a,b
542
        ld (downloadfilehandle),a
668 alone 543
 
31 Alone 544
downloadfile0
545
        ld de,0xc000
546
        ld hl,0x4000
547
;DE = Buffer address, HL = Number of bytes to read
548
         push hl
549
        call readstream
550
;HL = Number of bytes actually read, A=error
551
 
552
        push hl
553
        ld de,0xc000
554
downloadfilehandle=$+1
555
        ld b,0
556
        OS_WRITEHANDLE
557
        pop hl
558
 
559
        ld b,h
560
        ld c,l
561
         pop hl
562
        or a
563
        sbc hl,bc ;NZ = bytes to read != bytes actually read
564
        jr z,downloadfile0
668 alone 565
 
31 Alone 566
        ld a,(downloadfilehandle)
567
        ld b,a
568
        OS_CLOSEHANDLE
668 alone 569
 
31 Alone 570
        ld hl,downloadfilename
344 alone 571
        inc (hl) ;TODO  
31 Alone 572
        jp closequit
573
 
447 alone 574
DOCTYPEsz=9
575
loadxml;svg
576
; ᪠ !DOCTYPE HTML  svg
577
;a=first char
578
         ld e,a
579
        ld hl,DISKBUF
580
        ld bc,DISKBUFsz-DOCTYPEsz
581
        ld a,'!'
582
        cpir ;!
555 alone 583
        ld bc,DOCTYPEsz-1
447 alone 584
        add hl,bc
585
        ld a,(hl)
586
        or 0x20
587
        cp 's'
588
         ld a,e ;ld a,(iy) ;first char
589
        jp nz,loadhtml
668 alone 590
 
447 alone 591
        push af
406 alone 592
        push iy
403 alone 593
        ld e,3 ;6912
594
        OS_SETGFX
406 alone 595
         call setpgscr4000
596
         call setpgtemp8000
597
         call setpgsvgc000
403 alone 598
        LD      HL,#4000
599
        LD      DE,#4001
600
        LD      BC,#1800
601
        LD      (HL),L
602
        LDIR
603
        LD      (HL),7
604
        LD      BC,#2FF
605
        LDIR
406 alone 606
        pop iy
447 alone 607
        pop af ;a=(iy)=first char
403 alone 608
        call readsvg
407 alone 609
         call setpgcode4000
610
loadsvgq0
611
        call yieldgetkeynolang ;z=nokey
612
        jr z,loadsvgq0
555 alone 613
        cp key_enter
614
        jr nz,loadsvgq0
407 alone 615
        ld e,2 ;MC hires mode
616
        OS_SETGFX
555 alone 617
        ld e,0
618
        OS_CLS
619
loadsvgq1
620
        call yieldgetkeynolang
407 alone 621
        call globalbuttons
555 alone 622
        ;jp browser_backspace
623
        jr loadsvgq1
407 alone 624
        ;jr showgif
403 alone 625
 
59 Alone 626
loadpng
627
         call setpgtemp8000
628
        call readpng
629
        jr showgif
630
 
16 dimkam 631
loadjpeg
42 DimkaM 632
        ;call initframes_time_scroll
16 dimkam 633
        call readjpeg
59 Alone 634
        jr showgif
16 dimkam 635
 
636
loadgif
42 DimkaM 637
        ;call initframes_time_scroll
16 dimkam 638
        call readgif
639
 
32 Alone 640
showgif
42 DimkaM 641
        call showtime
642
 
40 alone 643
showgif_firstframe
34 Alone 644
        ;jr $
645
nframes=$+1
344 alone 646
        ld bc,0 ;0  1 몫 ࠢ
40 alone 647
        dec bc
648
 
649
        ld hl,(curpichgt_visible)
650
        ld de,SCROLLHGT+1
651
        or a
652
        sbc hl,de
653
        jr nc,showgif_drawevenifoneframe
654
        ld hl,(keepframe_linesize)
655
        ld de,80+1
656
        or a
657
        sbc hl,de
658
        jr nc,showgif_drawevenifoneframe
659
        dec bc
660
        bit 7,b
661
        inc bc
344 alone 662
        jp nz,closequit;showgifq ;᫨ 0  1 
40 alone 663
showgif_drawevenifoneframe
664
 
32 Alone 665
firstframeaddr=$+1
666
        ld hl,0
667
firstframeaddrHSB=$+1
668
        ld a,0
344 alone 669
;bc=᫮ ஢-1
32 Alone 670
showgif_frames0
671
        push bc
668 alone 672
 
32 Alone 673
        push hl
674
        push af
1510 alone 675
        OS_GETTIMER ;dehl=timer
32 Alone 676
        pop af
677
        ex (sp),hl
344 alone 678
        call showframe ;⠥ showframetime  
668 alone 679
 
32 Alone 680
        pop de ;timer
668 alone 681
 
32 Alone 682
        push af
683
        push hl
668 alone 684
 
32 Alone 685
showframetime=$+1
686
        ld hl,0 ;in 1/100 s
687
        inc hl
688
        srl h
689
        rr l
690
        add hl,de ;max timer for this frame
691
        ld (showframemaxtimer),hl
692
 
40 alone 693
showframe_delay0
59 Alone 694
        call yieldgetkeynolang ;z=nokey
116 alone 695
        ;cp key_enter
42 DimkaM 696
        ;jp z,closequit ;TODO restore stack
697
        ;cp 'z'
698
        ;jr z,showframe_setzoom
699
        call globalbuttons
40 alone 700
        ld hl,(xscroll)
116 alone 701
        cp key_left
40 alone 702
        jr z,showframe_left
116 alone 703
        cp key_right
40 alone 704
        jr z,showframe_right
705
        ld hl,(yscroll)
116 alone 706
        cp key_down
40 alone 707
        jr z,showframe_down
116 alone 708
        cp key_up
40 alone 709
        jr z,showframe_up
710
showframe_nokey
1510 alone 711
        OS_GETTIMER ;dehl=timer
32 Alone 712
showframemaxtimer=$+1
713
        ld bc,0 ;max timer for this frame
714
        or a
715
        sbc hl,bc
40 alone 716
        jp m,showframe_delay0 ;timer<maxtimer
717
 
32 Alone 718
        pop hl
719
        pop af
116 alone 720
 
32 Alone 721
        pop bc
40 alone 722
        dec bc
723
        bit 7,b
724
        jr z,showgif_frames0
32 Alone 725
 
42 DimkaM 726
        jp showgif_firstframe
32 Alone 727
 
42 DimkaM 728
showframe_setzoom
729
        ld hl,setzoom_patch
730
        ld a,(hl)
731
        xor 0x80
732
        ld (hl),a
733
        jp browser_reload
734
 
344 alone 735
;TODO ஡, ᫨ প  ᫨誮 쪠, ᯥ ⮫쪮  ࠧ  
32 Alone 736
 
40 alone 737
showframe_left
738
;hl=xscroll
739
        dec hl
42 DimkaM 740
        res 0,l
40 alone 741
        bit 7,h
742
        jr nz,showframe_nokey
743
        jr showframe_leftrightq
32 Alone 744
 
40 alone 745
showframe_right
746
;hl=xscroll
344 alone 747
;  xscroll, ᫨ ࠢ ࠭ (=keepframe_linesize-xscroll) 砥 <80
40 alone 748
        inc hl
42 DimkaM 749
        inc hl
40 alone 750
        ex de,hl
751
        ld hl,(keepframe_linesize)
752
        or a
753
        sbc hl,de
754
        ld bc,80
755
        or a
756
        sbc hl,bc
757
        ex de,hl
42 DimkaM 758
        jr nc,showframe_leftrightq
344 alone 759
;। ஫: xscroll=keepframe_linesize-80 >=0
42 DimkaM 760
         ld hl,(keepframe_linesize)
761
         or a
762
         sbc hl,bc
40 alone 763
        jr c,showframe_nokey
764
showframe_leftrightq
765
        ld (xscroll),hl
766
        jr showframe_nokey
32 Alone 767
 
40 alone 768
showframe_up
769
;hl=yscroll
42 DimkaM 770
        ld bc,8
771
        xor a
772
        sbc hl,bc
773
        jr nc,showframe_updownq
774
        ld h,a
775
        ld l,a
40 alone 776
        jr showframe_updownq
777
 
778
showframe_down
779
;hl=yscroll
344 alone 780
;  yscroll, ᫨  ࠭ (=curpichgt_visible-yscroll) 砥 <SCROLLHGT(200)
42 DimkaM 781
        ld bc,8
782
        add hl,bc
40 alone 783
        ex de,hl
784
        ld hl,(curpichgt_visible)
785
        or a
786
        sbc hl,de
787
        ld bc,SCROLLHGT;200
788
        or a
789
        sbc hl,bc
790
        ex de,hl
42 DimkaM 791
        jr nc,showframe_updownq
344 alone 792
;। ஫: yscroll=curpichgt_visible-SCROLLHGT >=0
42 DimkaM 793
         ld hl,(curpichgt_visible)
794
         or a
795
         sbc hl,bc
40 alone 796
        jr c,showframe_nokey
797
showframe_updownq
798
        ld (yscroll),hl
799
        jr showframe_nokey
800
 
28 Alone 801
loadbmp_fail
23 dimkam 802
closequit
31 Alone 803
        call closestream
42 DimkaM 804
         jr getkeyquit
14 dimkam 805
 
32 Alone 806
LOADERROR
807
        call closestream
808
        ld de,tloaderr
809
        jr TYPE_ERROR
28 Alone 810
CONNECTIONERROR
32 Alone 811
        ld de,tconnerr
812
TYPE_ERROR
813
        push de
814
        call setpgs_scr
815
        call setpgcode4000
816
        ld a,STATUSCOLOR
817
        call initprcharmc
59 Alone 818
        ld de,0xc048
32 Alone 819
        call setxymc
820
        pop de
821
        call prtextmc
822
 
16 dimkam 823
ERROR ;for jpeg
824
ERROR2
825
ERROR4
31 Alone 826
getkeyquit
32 Alone 827
getkeyquit0
344 alone 828
        ;YIELD ;halt ;᫨ ᤥ  di:rst #38,  1.ᤢ ⠩  2.  ஢ 뢠,  ᫨  ei,   
32 Alone 829
        ;GET_KEY ;OS_GETKEYNOLANG
830
        ;ld a,c ;keynolang
831
        call yieldgetkeynolang
42 DimkaM 832
        call globalbuttons
833
        jr getkeyquit0
834
 
835
globalbuttons
116 alone 836
        cp key_backspace
31 Alone 837
        jp z,browser_backspace
838
        cp '5'
839
        jp z,browser_reload
42 DimkaM 840
        cp 'z'
841
        jp z,showframe_setzoom
31 Alone 842
        cp 's'
843
        jp z,browser_downloadthis
59 Alone 844
        cp 'e'
845
        jp z,browser_editline
116 alone 846
        cp key_esc
42 DimkaM 847
        ret nz
31 Alone 848
browser_quit
74 Alone 849
        ld a,(wgetloaded_pid)
850
        or a
851
        jr z,browser_quitq
852
 
344 alone 853
;TODO ஢,  wget :
74 Alone 854
        ld e,a
875 alone 855
        OS_CHECKPID
74 Alone 856
        or a
875 alone 857
        jr z,browser_quitq ;dead
74 Alone 858
 
859
        ld a,(wgetmainpg)
860
        SETPG32KHIGH
861
        ld a,0xff
862
        ld (0xc000+COMMANDLINE+2),a
863
browser_quitq
16 dimkam 864
        QUIT
31 Alone 865
 
501 alone 866
oraret
503 alone 867
        or a
501 alone 868
        ret
32 Alone 869
yieldgetkeynolang
444 alone 870
;out: z=no key, no action
871
        YIELD ;halt ;᫨ ᤥ  di:rst 0x38,  1.ᤢ ⠩  2.  ஢ 뢠,  ᫨  ei,   
872
        GET_KEY
873
        ld lx,a ;keylang
503 alone 874
        jr nz,oraret ;no focus (a=0, nz) => ret with Z
875
        ;jr z,yieldgetkeynolang_focus
876
        ;;ld de,(control_imer_oldmousecoords) ;no focus
877
        ;xor a
878
        ;ret
879
;yieldgetkeynolang_focus
501 alone 880
         cp key_redraw ;!=0
503 alone 881
         jr z,oraret ;a!=0 => ret with NZ ;   ,  ࠭   (NZ!)
444 alone 882
;hl=(sysmousebuttons)
883
        ld a,l
884
        and 0xf0
885
control_imer_oldmousewheel=$+2
886
        ld hx,0
887
        ld (control_imer_oldmousewheel),a
888
        sub hx
889
        ld (mouse_scrollvalue),a
890
        jr z,yieldgetkeynolang_key
891
        ;jp p,yieldgetkeynolang_scrollup
892
        ;neg
893
        ;ld (mouse_scrollvalue),a        
894
        ld a,key_down_scroll
1135 alone 895
        ret p;m ;nz        
444 alone 896
;yieldgetkeynolang_scrollup
897
        ld a,key_up_scroll
898
        ret ;nz
899
yieldgetkeynolang_key
900
        ld a,0
901
        ld (mouse_scrollvalue),a ;default scrollvalue
902
        ld a,l
903
        cpl
904
        ld l,a
905
        bit 0,l ;LMB
906
        ld a,key_enter
907
        ret nz
908
        bit 1,l ;RMB
909
        ld a,key_backspace
910
        ret nz
911
        ld a,lx ;keylang
912
        or a ;cp NOKEY ;keylang==0?
913
        ret nz ;jr nz,$+3
914
        cp c ;keynolang==0?
915
        ret nz
916
;no action? mouse coords change is also an action
917
        push bc
918
control_imer_oldmousecoords=$+1
919
        ld bc,0
920
        ld (control_imer_oldmousecoords),de
921
        ld a,b
922
        sub d
923
        ld d,a
924
        ld a,e
925
        sub c
926
        ld e,a
927
        ld (control_imer_mousecoordsdelta),de
928
        ld a,d
929
        or e
930
        ld a,0
931
        pop bc
932
        ret ;z/nz
32 Alone 933
 
31 Alone 934
closestream
935
closestream_patch=$+1
936
        jp closestream_file
16 dimkam 937
 
32 Alone 938
tconnerr
939
        db "conn.err",0
940
tloaderr
941
        db "load err",0
668 alone 942
 
42 DimkaM 943
showtime
944
         call setpgcode4000
945
        ld a,STATUSCOLOR
946
        call initprcharmc
947
 
1510 alone 948
         OS_GETTIMER ;dehl=timer
42 DimkaM 949
timebegin=$+1
950
         ld de,0
951
         or a
952
         sbc hl,de
953
         ld de,0xc04a
954
;d=y, e=x8
955
;hl=time (frames)
956
         jp prnumfrac
668 alone 957
 
42 DimkaM 958
showmem
959
        ld a,(npages)
960
npages_old=$+1
961
        cp -1
962
        ret z
963
        ld (npages_old),a
964
        ld l,a
965
        ld h,0
966
        push hl
967
         call setpgcode4000
968
        ld a,STATUSCOLOR
969
        call initprcharmc
970
        pop hl
971
         ld de,0xc046
972
        jp prnum123
668 alone 973
 
59 Alone 974
cleanstatusline
975
        call setpgs_scr
976
        call setpgcode4000
977
        xor a
978
        ld (browser_editline_scroll),a
979
        ld hl,EDITLINEY*256+(40*192)
980
        ld a,STATUSCOLOR
981
        call cleanlinemc
982
        ;ld a,STATUSCOLOR
983
        jp initprcharmc
668 alone 984
 
28 Alone 985
;hl = poi to filename in string
986
;out: de = after last slash
987
findlastslash.
988
nfopenfnslash.
989
        ld d,h
990
        ld e,l ;de = after last slash
991
nfopenfnslash0.
992
        ld a,[hl]
993
        inc hl
994
        or a
32 Alone 995
        ret z
28 Alone 996
        cp '/'
997
        jr nz,nfopenfnslash0.
998
        jr nfopenfnslash.
16 dimkam 999
 
1656 dimkam 1000
 
1001
 
28 Alone 1002
strcopy
1003
;hl->de
668 alone 1004
;out: hl,de after terminator
1005
        xor a
28 Alone 1006
strcopy0
668 alone 1007
        cp (hl)
28 Alone 1008
        ldi
1009
        jr nz,strcopy0
16 dimkam 1010
        ret
1656 dimkam 1011
 
73 Alone 1012
makefulllink
1013
;curfulllink = curfulllink+linkbuf
1014
        ld hl,linkbuf
344 alone 1015
;᫨ 뫪 稭  ᫥,   १  , ஬ ࢥ
73 Alone 1016
        ld a,(hl)
1017
        cp '/'
1018
        jr z,browser_go_rootlink ;"/Timex"
668 alone 1019
 
73 Alone 1020
        call isprotocolpresent
1021
;nz=protocol absent (hl=link), z=protocol present (a=protocol (0=file, 1=http), hl=after "//")
344 alone 1022
        jr z,browser_go_protocolpresent ;⮪  - linkbuf ᮤন  뫪 (  ⮫쪮  /  砥 http://ser.ver)
73 Alone 1023
        ld a,(linkbuf+1)
1024
        sub ':'
1025
        jr z,browser_go_defaultprotocolpresent ;1:/file... => file://1:/file...
344 alone 1026
; ⮪ -  ⥪騩   curfulllink (.. १  ᫥ ᫥ ᫥)  ਪ    뫪 ( ⮬ ../)
1027
;᫥   http://ser.ver 㦥 ?  ᥣ! ᫨  ,  
73 Alone 1028
        ld hl,curfulllink
1029
        call isprotocolpresent
1030
;a=protocol (0=file, 1=http), hl=after "//"
250 alone 1031
         push hl
1032
        call findlastslash. ;out: de = after last slash or beginning
1033
         pop hl
1034
         or a
1035
         sbc hl,de
1036
         jr nz,browser_go_noaddslashafterserver
1037
         add hl,de
1038
         push hl ;after "//"
1039
         call addslashafterserver
1040
         pop hl
1041
         call findlastslash. ;out: de = after last slash
1042
browser_go_noaddslashafterserver
1043
;de=curfulllink+...=end of curdir (after slash)
73 Alone 1044
        ld hl,linkbuf
1045
browser_go_chdir
1046
        ld a,'.'
1047
        cp (hl)
1048
        jr nz,browser_go_chdirq
1049
        inc hl ;skip dot
1050
         ld a,(hl)
1051
         cp '/'
1052
        inc hl ;if nz,skip another dot supposed
1053
         jr z,browser_go_dotslash
1054
        ld a,(hl)
1055
        or a
1056
        jr z,$+3
1057
        inc hl ;skip / supposed
1058
;hl=linkbuf+... (path/file without ../)
1059
;de=curfulllink+...=end of curdir (after slash)
1060
;remove last element of curdir = move de to previous slash
1061
        dec de ;at slash
1062
        dec de
1063
        ld a,(de)
1064
        inc de
1065
        inc de ;after slash
1066
        cp '/' ;is it "//"?
1067
        jr z,browser_go_chdir_error
1068
        dec de ;at slash
1069
        ex de,hl ;hl=at slash
1070
        dec hl
1071
        ld a,'/'
1072
        ld b,-1
1073
        cpdr
1074
        inc hl ;at previous slash (might be last slash of "//")
1075
        inc hl ;after slash
1076
        ex de,hl ;de=curfulllink+...=end of curdir (after slash)
1077
         jr browser_go_chdir
1078
browser_go_chdir_error
1079
browser_go_chdirq
1080
;hl=linkbuf+... (path/file without ../)
1081
;de=curfulllink+...=end of curdir (after slash)
1082
        call strcopy
1083
        jr browser_go_protocolpresentq
1084
browser_go_defaultprotocolpresent
1085
;1:/file... => file://1:/file...
1086
;a=0
1087
        call adddefaultprotocol
1088
        jr browser_go_protocolpresentq
1089
browser_go_dotslash=browser_go_chdir ;"./Timex"
1090
 
1091
browser_go_rootlink
1092
;"/Timex"
1093
;hl=linkbuf+... at slash
447 alone 1094
;᫨ 뫪 稭  //,   १  , ஬ ⮪
1095
         inc hl
1096
         ld a,(hl)
1097
         cp '/'
1098
         jr z,browser_go_rootprotocol
1099
         dec hl
73 Alone 1100
         push hl
1101
        ld hl,curfulllink
1102
        call isprotocolpresent
1103
;a=protocol (0=file, 1=http), hl=after "//"
1104
        call findslash
1105
        dec hl ;at slash
1106
        ex de,hl ;de=curfulllink+ after server (at slash)
1107
         pop hl
1108
        jr browser_go_copyto;linkbuf
447 alone 1109
 
73 Alone 1110
browser_go_protocolpresent
1111
;a=protocol (0=file, 1=http), hl=after "//"
1112
        call addslashafterserver ;add / after http://ser.ver
1113
        ld de,curfulllink
1114
;browser_go_copytolinkbuf
1115
        ld hl,linkbuf
1116
browser_go_copyto
1117
        call strcopy
1118
browser_go_protocolpresentq
344 alone 1119
;curfulllink ᮤন  url, ᮡ࠭  ண curfullink  뫪 linkbuf
73 Alone 1120
        ret
1121
 
447 alone 1122
browser_go_rootprotocol
1123
        inc hl
1124
;hl=linkbuf+... after "//"
1125
         push hl
1126
        ld hl,curfulllink
1127
        call isprotocolpresent
1128
;a=protocol (0=file, 1=http), hl=after "//"
1129
        ex de,hl ;de=curfulllink+ after protocol://
1130
         pop hl
1131
        jr browser_go_copyto;linkbuf
1132
 
32 Alone 1133
adddefaultprotocol
1134
;1:/file... => file://1:/file...
1135
;ser.ver... => http://ser.ver...
1136
;a=protocol (0=file, 1=http)
1137
        push af ;a=protocol (0=file, 1=http)
1138
        or a
1139
        ld hl,tfileprotocol
1140
        jr z,$+5
668 alone 1141
         ld hl,thttpprotocol
32 Alone 1142
        ld de,curfulllink
1143
        call strcopy
1144
        dec de
1145
        push de
1146
        ld hl,linkbuf
1147
        call strcopy        
1148
        pop hl
1149
        pop af ;a=protocol (0=file, 1=http)
1150
        ret
1151
 
1152
addslashafterserver
1153
;add / after http://ser.ver
1154
;hl=after "//"
1155
        call findslash
344 alone 1156
        ret z ;᫥ 㦥 
32 Alone 1157
         ld (hl),c;0
1158
         dec hl
1159
         ld (hl),a ;add / after http://ser.ver
1160
        ret
1161
 
1162
findslash
668 alone 1163
        call strlen_tobc_keephl ;out: bc=len (Z: len==0)
447 alone 1164
         ret z
32 Alone 1165
        ld a,'/'
1166
        cpir
1167
        ret
1168
 
1169
strlen_tobc_keephl
1170
;hl=string
668 alone 1171
;out: bc=len (Z: len==0)
32 Alone 1172
        push hl
1173
        xor a
1174
        ld b,-1
1175
        cpir
1176
        pop de
1177
        sbc hl,de
1178
        ld b,h
1179
        ld c,l ;bc=strlen
1180
        ex de,hl ;hl=string
1181
        ret
1182
 
1183
isprotocolpresent
1184
;hl=link string
1185
;out: nz=protocol absent (hl=link), z=protocol present (a=protocol (0=file, 1=http), hl=after "//")
1186
        ld de,tfileprotocol
1187
        push hl
1188
        call strcp_tillde0 ;if found, hl=after "//"
1189
        pop de
1190
        ld a,0
1191
        ret z
1192
        ex de,hl
1193
        ld de,thttpprotocol
1194
        push hl
1195
        call strcp_tillde0 ;if found, hl=after "//"
1196
        pop de
1197
        ld a,1
1198
        ret z
1199
        ex de,hl
261 alone 1200
        ld de,tgopherprotocol
1201
        push hl
1202
        call strcp_tillde0 ;if found, hl=after "//"
1203
        pop de
1204
        ld a,2
1205
        ret z
1206
        ex de,hl
303 alone 1207
        ld de,thttpsprotocol
1208
        push hl
1209
        call strcp_tillde0 ;if found, hl=after "//"
1210
        pop de
1211
        ld a,3
1212
        ret z
1213
        ex de,hl
32 Alone 1214
        ret ;nz=protocol absent (hl=start)
1215
 
1216
nextscreenline
344 alone 1217
;out: de= ப, nc=out of screen
28 Alone 1218
drawscreenline_frombuf_scr=$+1
40 alone 1219
        ld de,0
28 Alone 1220
        ld hl,40
1221
        add hl,de ;next line on screen
42 DimkaM 1222
         ;push bc
59 Alone 1223
         ld bc,40*(SCROLLHGT+1)+0x4000
42 DimkaM 1224
         or a
1225
         sbc hl,bc
1226
         add hl,bc
1227
         ;pop bc
1228
         ret nc
1229
        ;bit 5,h
1230
        ;ret nz ;jr nz,drawscreenline_frombufq ;end of screen, current line doesn't fit
28 Alone 1231
        ld (drawscreenline_frombuf_scr),hl
32 Alone 1232
        ret
668 alone 1233
 
32 Alone 1234
drawscreenline_frombuf
1235
;hl=from
28 Alone 1236
        exx
32 Alone 1237
        call nextscreenline
40 alone 1238
        ;exx
42 DimkaM 1239
        ;ret nc ;end of screen, current line doesn't fit
28 Alone 1240
 
31 Alone 1241
        push ix
23 dimkam 1242
        push iy
16 dimkam 1243
 
23 dimkam 1244
drawscreenline_frombuf_ixaddr=$+2
1245
        ld ix,(dithermcy0-2)
1246
drawscreenline_frombuf_iyaddr=$+2
1247
        ld iy,(colorlace0-2)
40 alone 1248
 
1249
        ;exx
42 DimkaM 1250
        push af ;nc=out of screen
40 alone 1251
        push de ;screen
1252
        ld de,LINEPIXELS;-0x4000
1253
        ld hl,(keepframe_linesize)
1254
        ld b,h
1255
        ld c,l
1256
        add hl,de
1257
        exx
1258
         call setpgdiv4000
344 alone 1259
         call setpgtemp8000 ;⠪           
40 alone 1260
        jr drawscreenline_frombuf0go
23 dimkam 1261
drawscreenline_frombuf0
40 alone 1262
        exx
1263
        pop hl
1264
drawscreenline_frombuf0go
42 DimkaM 1265
readchr_patch=$+1
23 dimkam 1266
        call readchrlomem
1267
        push hl
344 alone 1268
        call convertchr ;jp=1980t (  exx  ,  㤮⢠)
23 dimkam 1269
        inc de
344 alone 1270
        cpi ; inc hl
40 alone 1271
        jp pe,drawscreenline_frombuf0
1272
        pop af
668 alone 1273
 
23 dimkam 1274
        dec ix
1275
        dec ix
1276
        ld (drawscreenline_frombuf_ixaddr),ix
1277
        dec iy
1278
        dec iy
1279
        ld (drawscreenline_frombuf_iyaddr),iy
668 alone 1280
 
40 alone 1281
         ;call setpgs_scr
1282
        exx
1283
        pop bc ;screen
42 DimkaM 1284
        pop af ;nc=out of screen
40 alone 1285
        ld hl,LINEPIXELS;-0x4000
1286
;hl=data
1287
;bc=screen=0xc000+
42 DimkaM 1288
        call c,prlinefast
40 alone 1289
 
1290
         call setpgtemp8000
34 Alone 1291
         call setpgcode4000
23 dimkam 1292
 
1293
        pop iy
31 Alone 1294
        pop ix
28 Alone 1295
        ret;jp setpgtemp8000
668 alone 1296
 
59 Alone 1297
read_b_bytes
1298
read_b_bytes0
1299
        call RDBYTE
1300
        djnz read_b_bytes0
1301
        ret
1302
 
23 dimkam 1303
RDBYTE
1304
        INC LY
18 dimkam 1305
        LD A,(IY)
23 dimkam 1306
        RET NZ
1307
RDBYH
403 alone 1308
;TODO ஢ઠ  䠩   a=0, 䫠 CY=1?
23 dimkam 1309
        INC HY
1310
        LD A,HY
1311
        CP DISKBUF/256+(DISKBUFsz/256)
1312
        LD A,(IY)
1313
         ccf ;CY=0: OK
1314
        RET nz
1315
       PUSH HL
1316
       PUSH DE
18 dimkam 1317
        PUSH BC
23 dimkam 1318
        push IX
1319
       CALL rdCS
28 Alone 1320
       ex af,af'
23 dimkam 1321
       PUSH AF
18 dimkam 1322
        exx
1323
        push bc
1324
        push de
1325
        push hl
1326
        ld de,DISKBUF
1327
        ld hl,DISKBUFsz
28 Alone 1328
        call readstream
403 alone 1329
;hl=actual size (TODO if 0 then exit? ᥩ  ᫥   ⮣   ﬨ, 㦭  html)
28 Alone 1330
;fill the rest of buffer with zeros
1331
        ld de,DISKBUF
1332
        add hl,de
1333
        ex de,hl ;de=start of zeros
1334
        ld hl,DISKBUF+DISKBUFsz
1335
        xor a
1336
        sbc hl,de
1337
        ld b,h
1338
        ld c,l ;bc=length of zeros (Z=no zeros)
1339
        jr z,readdiskbuf_nozeros
1340
        ld h,d
1341
        ld l,e ;start of zeros
1342
        ld (hl),a;0
1343
        inc de
1344
        dec bc
1345
        ld a,b
1346
        or c
1347
        jr z,readdiskbuf_nozeros
1348
        ldir
1349
readdiskbuf_nozeros
18 dimkam 1350
        pop hl
1351
        pop de
1352
        pop bc
1353
        exx
23 dimkam 1354
       POP AF
28 Alone 1355
       ex af,af'
18 dimkam 1356
        POP IX
23 dimkam 1357
        pop BC
18 dimkam 1358
       POP DE
23 dimkam 1359
         pop hl
1360
       ld iy,DISKBUF
18 dimkam 1361
       LD A,(IY)
23 dimkam 1362
       or a ;CY=0: OK
1363
        RET
18 dimkam 1364
 
59 Alone 1365
ZIPRDBYH
344 alone 1366
;TODO  ⮫쪮, ᪮쪮 ⠫  IDAT (᫨    DISKBUFsz), ⮬ ᪠ ᫥騩 IDAT
59 Alone 1367
        INC HY
1368
        LD A,HY
1369
        CP DISKBUF/256+(DISKBUFsz/256)
1370
        LD A,(IY)
1371
         ccf ;CY=0: OK
1372
        RET nz
1373
 
1374
       PUSH HL
1375
       PUSH DE
1376
        PUSH BC
1377
        push IX
1378
       ;CALL rdCS
1379
       ex af,af'
1380
       PUSH AF
1381
        exx
1382
        push bc
1383
        push de
1384
        push hl
668 alone 1385
 
59 Alone 1386
pngIDATremainedHSW=$+1
1387
        ld de,0
1388
pngIDATremained=$+1
1389
        ld hl,0
1390
ZIPRDBYH0read
1391
        ld a,d
1392
        or e
1393
        ld bc,DISKBUFsz
1394
        call z,minhl_bc_tobc ;keeps hl
1395
;bc=size
1396
        ;jr $
1397
        ld a,b
1398
        or c
1399
        jr nz,ZIPRDBYHn0
344 alone 1400
; CRC
1401
; chunksize
1402
; "IDAT"
59 Alone 1403
        ld de,DISKBUF
1404
        ld hl,12
1405
        call readstream
344 alone 1406
; remained:
59 Alone 1407
        ld hl,DISKBUF+4
1408
        ld d,(hl)
1409
        inc hl
1410
        ld e,(hl)
1411
        inc hl
1412
        ld a,(hl)
1413
        inc hl
1414
        ld l,(hl)
1415
        ld h,a
344 alone 1416
;᭮  ࠧ ⥪饣 
59 Alone 1417
        jr ZIPRDBYH0read
1418
ZIPRDBYHn0
1419
;bc=size
1420
        or a
1421
        sbc hl,bc
1422
        ld (pngIDATremained),hl
1423
        jr nc,$+3
1424
        dec de
1425
        ld (pngIDATremainedHSW),de
1426
        ld d,b
1427
        ld e,c
1428
;de=size
1429
        ld hl,DISKBUF+DISKBUFsz
1430
        or a
1431
        sbc hl,de ;size
1432
        ex de,hl ;de=addr = DISKBUF+; hl=size
1433
         push de
1434
        call readstream
1435
         pop de
1436
         push de ;addr
1437
;hl=actual size
1438
         ld a,h
1439
         or l
1440
         jr z,ZIPRDBYHq;readerror
1441
;move block to end of buf:
1442
        ld b,h
1443
        ld c,l
1444
        dec de ;ld de,DISKBUF-1
1445
        add hl,de ;end of data
1446
        ld de,DISKBUF+DISKBUFsz-1
1447
        sbc hl,de
1448
        add hl,de
1449
        jr z,ZIPRDBYHq
1450
         pop af
1451
        lddr
1452
        inc de ;begin of data
1453
         push de
1454
ZIPRDBYHq
1455
         pop iy ;addr = DISKBUF+
668 alone 1456
 
59 Alone 1457
        pop hl
1458
        pop de
1459
        pop bc
1460
        exx
1461
       POP AF
1462
       ex af,af'
1463
        POP IX
1464
        pop BC
1465
       POP DE
1466
         pop hl
1467
       LD A,(IY)
1468
       or a ;CY=0: OK
1469
        ret
668 alone 1470
 
28 Alone 1471
readstream
1472
readstream_patch=$+1
1473
        jp readstream_file
1474
 
40 alone 1475
rdCS    
1476
        LD A,0
1477
        OR A
1478
        RET Z
1479
rdCSU  
1480
        LD A,0xfe
1481
        IN A,(0xfe)
1482
        LD (getCS+1),A
1483
getCS
1484
        LD A,0xff
1485
        RRA
1486
        RET        
1487
 
16 dimkam 1488
GETDWORD_slow
1489
;hlde
32 Alone 1490
        ;call RDBYTE
1491
        ;ld e,a
1492
        ;call RDBYTE
1493
        ;ld d,a
1494
        call GETWORD_slowhl
1495
        ex de,hl
1496
GETWORD_slowhl
28 Alone 1497
        call RDBYTE
16 dimkam 1498
        ld l,a
28 Alone 1499
        call RDBYTE
16 dimkam 1500
        ld h,a
1501
        ret
14 dimkam 1502
 
28 Alone 1503
RDWORDHSBLSBtohl
1504
        CALL RDBYTE
1505
        LD H,A
1506
        CALL RDBYTE
1507
        LD L,A
1508
        RET  
1509
 
23 dimkam 1510
readchrlomem
1511
;hl=from (BRG)
16 dimkam 1512
        ld d,chrbuf/256
1513
_=0
1514
        if GIF_PIXELSIZE
1515
        dup 8
1516
        ld a,(hl)
1517
        inc hl
1518
        ld (chrbuf+16+_),a
1519
        ld (chrbuf+8+_),a
1520
        ld (chrbuf+0+_),a
1521
_=_+1
1522
        edup
1523
        else
1524
        dup 8
1525
        ld e,0xff&(chrbuf+16+_)
1526
        ldi ;b
1527
        ld e,0xff&(chrbuf+8+_)
1528
        ldi ;g
1529
        ld e,0xff&(chrbuf+0+_)
1530
        ldi ;r
1531
_=_+1
1532
        edup
668 alone 1533
 
16 dimkam 1534
        endif
42 DimkaM 1535
        ret
1536
 
1537
readchrlomemx2
1538
        ld d,chrbuf/256
1539
_=0
1540
        if GIF_PIXELSIZE
1541
        dup 4
1542
        ld a,(hl)
1543
        inc hl
1544
        ld (chrbuf+16+_),a
1545
        ld (chrbuf+8+_),a
1546
        ld (chrbuf+0+_),a
1547
_=_+1
1548
        ld (chrbuf+16+_),a
1549
        ld (chrbuf+8+_),a
1550
        ld (chrbuf+0+_),a
1551
_=_+1
1552
        edup
1553
        else
1554
        dup 4
1555
        ld e,0xff&(chrbuf+16+_)
1556
        ld a,(hl)
1557
        ld (de),a
1558
        inc e
1559
        ldi ;b
1560
        ld e,0xff&(chrbuf+8+_)
1561
        ld a,(hl)
1562
        ld (de),a
1563
        inc e
1564
        ldi ;g
1565
        ld e,0xff&(chrbuf+0+_)
1566
        ld a,(hl)
1567
        ld (de),a
1568
        inc e
1569
        ldi ;r
1570
_=_+2
1571
        edup
668 alone 1572
 
40 alone 1573
        endif
14 dimkam 1574
        ret
1575
 
1576
convertchr
16 dimkam 1577
 
14 dimkam 1578
chrbufG=64+8
344 alone 1579
; 2 梥⮢ (  ४भ 梥⮢, ⮡ ⮬  ):
14 dimkam 1580
        ld hl,chrbuf
1581
_=chrbufG
1582
        ld de,_*257
1583
        ld c,(hl) ;Rmin
1584
        ld b,c ;Rmax
1585
_=_+1
1586
        dup 7
1587
        inc l
1588
        ld a,(hl) ;R(pixel)
1589
        cp c ;Rmin
1590
        jr nc,$+2+1+2
1591
         ld c,a ;Rmin
344 alone 1592
         ld e,_ ;Rmincolor =  ⥪饣 梥
14 dimkam 1593
        cp b ;Rmax
1594
        jr c,$+2+1+2
1595
         ld b,a ;Rmax
344 alone 1596
         ld d,_ ;Rmaxcolor =  ⥪饣 梥
14 dimkam 1597
_=_+1
1598
        edup
1599
        push de ;ld (Rminmaxcolor),de
1600
        ld a,b
1601
        sub c
1602
        push af ;Rmax-Rmin
1603
 
1604
        inc l ;ld hl,chrbuf+8
1605
_=chrbufG
1606
        ld de,_*257
1607
        ld c,(hl) ;Gmin
1608
        ld b,c ;Gmax
1609
_=_+1
1610
        dup 7
1611
        inc l
1612
        ld a,(hl) ;G(pixel)
1613
        cp c ;Gmin
1614
        jr nc,$+2+1+2
1615
         ld c,a ;Gmin
344 alone 1616
         ld e,_ ;Gmincolor =  ⥪饣 梥
14 dimkam 1617
        cp b ;Gmax
1618
        jr c,$+2+1+2
1619
         ld b,a ;Gmax
344 alone 1620
         ld d,_ ;Gmaxcolor =  ⥪饣 梥
14 dimkam 1621
_=_+1
1622
        edup
1623
        push de ;ld (Gminmaxcolor),de
1624
        ld a,b
1625
        sub c
1626
        push af ;Gmax-Gmin
1627
 
1628
        inc l ;ld hl,chrbuf+16
1629
_=chrbufG
1630
        ld de,_*257
1631
        ld c,(hl) ;Bmin
1632
        ld b,c ;Bmax
1633
_=_+1
1634
        dup 7
1635
        inc l
1636
        ld a,(hl) ;B(pixel)
1637
        cp c ;Bmin
1638
        jr nc,$+2+1+2
1639
         ld c,a ;Bmin
344 alone 1640
         ld e,_ ;Bmincolor =  ⥪饣 梥
14 dimkam 1641
        cp b ;Bmax
1642
        jr c,$+2+1+2
1643
         ld b,a ;Bmax
344 alone 1644
         ld d,_ ;Bmaxcolor =  ⥪饣 梥
14 dimkam 1645
_=_+1
1646
        edup
1647
        ld a,b
1648
        sub c ;Bmax-Bmin
1649
 
344 alone 1650
;롨ࠥ     minmaxcolor:
14 dimkam 1651
        ld c,a ;maxdist
1652
        pop af ;Gmax-Gmin
1653
        pop hl ;Gminmaxcolor
1654
        cp c ;>=maxdist?
1655
        jr c,$+2+1+1
1656
         ld c,a ;maxdist
1657
         ex de,hl
1658
        pop af ;Rmax-Rmin
1659
        pop hl ;Rminmaxcolor
1660
        cp c ;>=maxdist?
1661
        jr c,$+2+1
1662
         ex de,hl
1663
 
1664
;d=maxcolor
1665
;e=mincolor
344 alone 1666
; ४भ 梥 (  color16):
1667
;⮡  color16,  ᭠砫 color64(=BBGGRR), ⮬  ⠡  
18 dimkam 1668
        jp (iy) ;colorlace0 ;/1
1669
 
1670
ROUNDUP=32
1671
ROUNDDOWN=32
31 Alone 1672
        macro DOROUNDDOWN
1673
         sub ROUNDDOWN
1674
         jr nc,$+3
1675
         xor a
1676
        endm
18 dimkam 1677
 
31 Alone 1678
        macro DOROUNDUP
1679
         add a,d;ROUNDUP;d
1680
         jr nc,$+3
1681
         sbc a,a
1682
        endm
1683
 
18 dimkam 1684
        dw colorlace1
1685
colorlace0
1686
;d=maxcolor
1687
;e=mincolor
344 alone 1688
; ४भ 梥 (  color16):
1689
;⮡  color16,  ᭠砫 color64(=BBGGRR), ⮬  ⠡  
14 dimkam 1690
        ld h,chrbuf/256
1691
        ld l,d ;maxcolor
18 dimkam 1692
        ld c,(hl) ;G
1693
        res 3,l
1694
        ld b,(hl) ;R
1695
        set 4,l
1696
        ld a,(hl) ;B
1697
        rlca
1698
        rlca
1699
        rl c
1700
        rla
1701
        rl c ;g
1702
        rla
1703
        rl b
1704
        rla
1705
        rl b ;r
1706
        rla ;BBGGRR
1707
        or 0xc0
1708
        ld l,a
31 Alone 1709
       ld d,h ;e=mincolor
18 dimkam 1710
        ld a,(de);(hl) ;G
31 Alone 1711
        DOROUNDDOWN
18 dimkam 1712
        ld c,a
40 alone 1713
        res 3,e
18 dimkam 1714
        ld a,(de);(hl) ;R
31 Alone 1715
        DOROUNDDOWN
18 dimkam 1716
        ld b,a
40 alone 1717
        set 4,e
18 dimkam 1718
        ld a,(de);(hl) ;B
31 Alone 1719
        DOROUNDDOWN
18 dimkam 1720
        rlca
1721
        rlca
1722
        rl c
1723
        rla
1724
        rl c ;g
1725
        rla
1726
        rl b
1727
        rla
1728
        rl b ;r
1729
        rla ;BBGGRR
1730
        and 0x3f
1731
        ld e,a;l,a
31 Alone 1732
       ld a,(de) ;paper(maxcolor)
1733
       or (hl) ;ink(mincolor)     
18 dimkam 1734
;a=attr
1735
        exx
344 alone 1736
        ld (hl),a ; attr
18 dimkam 1737
        exx
344 alone 1738
; ॠ ਡ⠬   maxaxis, min, maxdist! (஢७,   ⮣ 砥 ⭨):
18 dimkam 1739
        ld d,h
1740
        dec h ;ld h,tmaxaxis/256+2
344 alone 1741
        ld l,a ;㤥 室  ⮩ 梥⮢ ⠢饩
18 dimkam 1742
        ld e,(hl) ;maxaxis*8
1743
        dec h
1744
        ld b,(hl) ;min
1745
        dec h
1746
        ld h,(hl) ;maxdistdiv
1747
;b=R/G/Bmin
344 alone 1748
;de  砫  R/G/B
18 dimkam 1749
;h=maxdistdiv
344 alone 1750
; ਭ 室 ⮫쪮   ⠢饩, ⠫  ⠥:
18 dimkam 1751
        jp (ix) ;dithermcy0/1/2/3
1752
 
1753
        dw colorlace0
1754
colorlace1
1755
;d=maxcolor
1756
;e=mincolor
344 alone 1757
; ४भ 梥 (  color16):
1758
;⮡  color16,  ᭠砫 color64(=BBGGRR), ⮬  ⠡  
18 dimkam 1759
        ld h,chrbuf/256
1760
        ld l,d ;maxcolor
1761
         ld d,ROUNDUP
14 dimkam 1762
        ld a,(hl) ;G
31 Alone 1763
        DOROUNDUP
14 dimkam 1764
        ld c,a
1765
        res 3,l
1766
        ld a,(hl) ;R
31 Alone 1767
        DOROUNDUP
14 dimkam 1768
        ld b,a
1769
        set 4,l
1770
        ld a,(hl) ;B
31 Alone 1771
        DOROUNDUP
14 dimkam 1772
        rlca
1773
        rlca
1774
        rl c
1775
        rla
1776
        rl c ;g
1777
        rla
1778
        rl b
1779
        rla
1780
        rl b ;r
1781
        rla ;BBGGRR
1782
        or 0xc0
1783
        ld l,a
31 Alone 1784
        ld d,(hl) ;paper(maxcolor)
14 dimkam 1785
        ld l,e ;mincolor
16 dimkam 1786
        ld c,(hl) ;G
1787
        res 3,l
1788
        ld b,(hl) ;R
1789
        set 4,l
1790
        ld a,(hl) ;B
14 dimkam 1791
        rlca
1792
        rlca
1793
        rl c
1794
        rla
1795
        rl c ;g
1796
        rla
1797
        rl b
1798
        rla
1799
        rl b ;r
1800
        rla ;BBGGRR
1801
        and 0x3f
1802
        ld l,a
31 Alone 1803
        ld a,(hl) ;ink(mincolor)
1804
        or d ;paper(maxcolor)
14 dimkam 1805
        exx
344 alone 1806
        ld (hl),a ; attr
14 dimkam 1807
        exx
344 alone 1808
; ॠ ਡ⠬   maxaxis, min, maxdist! (஢७,   ⮣ 砥 ⭨):
16 dimkam 1809
        ld d,h
1810
        dec h ;ld h,tmaxaxis/256+2
344 alone 1811
        ld l,a ;㤥 室  ⮩ 梥⮢ ⠢饩
16 dimkam 1812
        ld e,(hl) ;maxaxis*8
1813
        dec h
14 dimkam 1814
        ld b,(hl) ;min
16 dimkam 1815
        dec h
1816
        ld h,(hl) ;maxdistdiv
14 dimkam 1817
;b=R/G/Bmin
344 alone 1818
;de  砫  R/G/B
16 dimkam 1819
;h=maxdistdiv
344 alone 1820
; ਭ 室 ⮫쪮   ⠢饩, ⠫  ⠥:
18 dimkam 1821
        jp (ix) ;dithermcy0/1/2/3
668 alone 1822
 
344 alone 1823
 ;0 ᫥ (ᥣ NC), ⮬  祭 㢥祭  1:
18 dimkam 1824
        dw dithermcy2
16 dimkam 1825
dithermcy3
14 dimkam 1826
        DITHERMC1B 0x1, 0xd, 0x3, 0xf
23 dimkam 1827
        ret;jp convertchrq
668 alone 1828
 
18 dimkam 1829
        dw dithermcy1
16 dimkam 1830
dithermcy2
14 dimkam 1831
        DITHERMC1B 0x9, 0x5, 0xb, 0x7
23 dimkam 1832
        ret;jp convertchrq
668 alone 1833
 
18 dimkam 1834
        dw dithermcy0
16 dimkam 1835
dithermcy1
14 dimkam 1836
        DITHERMC1B 0x4, 0x10, 0x2, 0xe
23 dimkam 1837
        ret;jp convertchrq
668 alone 1838
 
18 dimkam 1839
        dw dithermcy3
16 dimkam 1840
dithermcy0
14 dimkam 1841
        DITHERMC1B 0xc, 0x8, 0xa, 0x6
23 dimkam 1842
        ret;jp convertchrq
668 alone 1843
 
14 dimkam 1844
skipword
1845
;hl=string
1846
;out: hl=terminator/space addr
1847
getword0
1848
        ld a,(hl)
1849
        or a
1850
        ret z
1851
        cp ' '
1852
        ret z
1853
        inc hl
1854
        jr getword0
1855
 
1856
skipspaces
1857
;hl=string
1858
;out: hl=after last space
1859
        ld a,(hl)
1860
        cp ' '
1861
        ret nz
1862
        inc hl
1863
        jr skipspaces
1864
 
1865
minhl_bc_tobc
1866
        or a
1867
        sbc hl,bc
1868
        add hl,bc
1869
        ret nc ;bc<=hl
1870
        ld b,h
1871
        ld c,l
1872
        ret
1873
 
18 dimkam 1874
MULWORD
1875
;out: HLBC=DE*BC
1876
        LD HL,0
1877
        LD A,17
1878
MULWOR0 RR B
1879
        RR C
1880
        DEC A
1881
        RET Z
1882
        JR NC,$+3
1883
        ADD HL,DE
1884
        RR H
1885
        RR L
1886
        JR MULWOR0
1887
 
16 dimkam 1888
putline
344 alone 1889
;hl=㤠 㥬 ப
1890
;bc=᪮쪮  㥬
1891
; 室 ᤢ 㪠⥫, 㤠 㥬 (putchar_hl, putchar_a)
32 Alone 1892
        ex de,hl
16 dimkam 1893
putchar_hl=$+1
1894
        ld hl,0
1895
putchar_a=$+1
1896
        ld a,0
28 Alone 1897
;de=from       
1898
;ahl=to
1899
;bc=size
1900
        call puttomem
42 DimkaM 1901
nextputlineaddr
1902
;keeps bc
16 dimkam 1903
        ld a,(putchar_a)
1904
        ld hl,(putchar_hl)
28 Alone 1905
curpicwidx3=$+1
42 DimkaM 1906
        ld de,0
1907
        add hl,de
16 dimkam 1908
        adc a,0
42 DimkaM 1909
setputlineaddr
16 dimkam 1910
        ld (putchar_hl),hl
1911
        ld (putchar_a),a
1912
        ret
1913
 
32 Alone 1914
getline
344 alone 1915
;de=㤠  ப
1916
;bc=᪮쪮  
40 alone 1917
gifwasdisposalmethod=$+1
34 Alone 1918
        ld a,0 ;bit0 = transparent color present, bit4..2 = disposal method (0=not specified(?), 1=do not dispose(?), 2=overwrite with bg color, 3=overwrite with prev frame(?))
1919
        and 0x1c
1920
        cp 8
1921
        jr z,getline_fill
1922
        ld hl,(nframes)
1923
        ld a,h
1924
        or l
1925
        jr nz,getline_frommem
1926
getline_fill
344 alone 1927
;䮭 ࢮ  - 
34 Alone 1928
        push de
1929
gifbgcolor=$+1
1930
         ld hl,PAL_GLOB
1931
         ldi
1932
         dec hl
1933
         inc h
1934
         ldi
1935
         dec hl
1936
         inc h
344 alone 1937
         ldi ;TODO ஢ 冷 !
34 Alone 1938
        pop hl
1939
         ret po ;bc=0
1940
        ldir
1941
        ret
1942
 
1943
getline_frommem
32 Alone 1944
        ld hl,(putchar_hl)
1945
        ld a,(putchar_a)
1946
        jp getfrommem
668 alone 1947
 
1948
swapimer
1949
        di
1950
        ld de,0x0038
1951
        ld hl,oldimer
1952
        ld bc,3
1953
swapimer0
1954
        ld a,(de)
1955
        ldi ;[oldimer] -> [0x0038]
1956
        dec hl
1957
        ld (hl),a ;[0x0038] -> [oldimer]
1958
        inc hl
1959
        jp pe,swapimer0
1960
        ei
1961
        ret
1962
oldimer
1963
        jp on_int ;    0x0038
1964
        jp 0x0038+3
1965
 
1966
on_int
1967
;restore stack with de
1968
        EX DE,HL
1969
        EX (SP),HL ;de="hl",  ⥪ "de"
1970
        LD (on_int_jp),HL
1971
        LD (on_int_sp),SP
1972
        LD SP,INTSTACK
1973
        ex de,hl ;hl="hl"
1974
 
1975
        call oldimer ;ei
1976
 
1977
on_int_sp=$+1
1978
        ld sp,0
1979
        pop de
1980
        ;ei
1981
on_int_jp=$+1
1982
        jp 0
1983
 
16 dimkam 1984
curpicwid
1985
        dw 0
1986
curpichgt
1987
        dw 0
40 alone 1988
curpichgt_visible
1989
        dw 0
16 dimkam 1990
 
31 Alone 1991
downloadfilename
1992
        db "download.fil",0
1993
 
28 Alone 1994
tfileprotocol
1995
        db "file://",0
1996
thttpprotocol
1997
        db "http://",0
261 alone 1998
tgopherprotocol
1999
        db "gopher://",0
303 alone 2000
thttpsprotocol
305 alone 2001
        db "https://",0
14 dimkam 2002
 
28 Alone 2003
linkbuf
68 Alone 2004
        ds MAXLINKSZ+1
32 Alone 2005
curfulllink
68 Alone 2006
        ds MAXLINKSZ+1
32 Alone 2007
 
31 Alone 2008
        include "htmlview.asm"
23 dimkam 2009
        include "html.asm"
31 Alone 2010
        include "prvirt.asm"
2011
        include "mempgs.asm"
28 Alone 2012
        include "dynmem.asm"
59 Alone 2013
        include "../_sdk/file.asm"
34 Alone 2014
        include "gif.asm"
40 alone 2015
        include "drawmc.asm"
59 Alone 2016
        include "editline.asm"
668 alone 2017
 
14 dimkam 2018
        align 256
18 dimkam 2019
textpages
2020
        ds 256
344 alone 2021
;TODO  ⤥쭮 gfxpages (⮡  뫮 㤠 RGB ᫥ ᨨ)
18 dimkam 2022
 
2023
        align 256
16 dimkam 2024
tmaxaxis ;maxdistdiv_fromattr[256], min_fromattr[256], maxaxis_fromattr[256]
2025
        incbin "tmaxaxis"
668 alone 2026
 
344 alone 2027
        ;align 256 ;।⢥ ᫥ tmaxaxis
14 dimkam 2028
t64to16ink
2029
        incbin "t64to16i"
2030
chrbuf
2031
        ds 8 ;R
2032
chrbufG=$&0xff
2033
        ds 8 ;G
2034
        ds 8 ;B
2035
        ds 256-64-24-64
2036
t64to16paper
2037
        incbin "t64to16p"
28 Alone 2038
 
2039
twinto866
470 baho 2040
        incbin "../_sdk/codepage/winto866"
668 alone 2041
 
16 dimkam 2042
endcode=$
668 alone 2043
 
59 Alone 2044
        ds end1-$
460 alone 2045
        display "free for code=",$-endcode
16 dimkam 2046
 
2047
        ds 0x4000-$ ;stack
447 alone 2048
        align 256
2049
fnt
2050
        incbin "1125vert.fnt"
2051
        include "http.asm"
31 Alone 2052
        include "prmc.asm"
34 Alone 2053
        include "jpeg.asm"
59 Alone 2054
        include "png.asm"
2055
depkbeg=$
2056
initCRC
2057
CRC32_
2058
        ret
2059
saveblock
2060
savelastblock
2061
        push af
2062
        push bc
2063
        push de
2064
        push hl
344 alone 2065
;TODO ᪮
59 Alone 2066
        ld de,depkbuf        
2067
pngdepktoaddr=$+1
2068
        ld hl,0
2069
pngdepktoaddrHSB=$+1
2070
        ld a,0
344 alone 2071
        ld bc,(Z6546) ;᪮쪮  ࠭
2072
        ld (TD198),bc ;᪮쪮  ࠭﫨 
18 dimkam 2073
 
59 Alone 2074
        inc bc
2075
        jr saveblock0_go
344 alone 2076
; 0x7e00..0xffff
59 Alone 2077
saveblock0
2078
        push bc
2079
         push af
2080
         call gifsetpgLZW
2081
         pop af
2082
        ex de,hl
2083
        ld c,(hl)
2084
        inc hl
2085
        ex de,hl
2086
        call writebyte
2087
        pop bc
2088
saveblock0_go
2089
        dec hl
2090
        cpi
2091
        jp pe,saveblock0
2092
        ld (pngdepktoaddr),hl
2093
        ld (pngdepktoaddrHSB),a
2094
         call gifsetpgLZW
668 alone 2095
 
59 Alone 2096
        ld hl,0
2097
        ld (Z6546),hl
2098
        pop hl
2099
        pop de
2100
        pop bc
2101
        pop af
2102
        ret
2103
depkqerror=ERROR        
2104
ziptrees
2105
        ds 0xa60 + 2*288
2106
        include "../pkunzip/depk.asm"
668 alone 2107
 
289 dimkam 2108
        ;display "depk size=",$-depkbeg
59 Alone 2109
 
73 Alone 2110
wgetfilename
2111
        db "wget.com",0
2112
 
403 alone 2113
        include "init.asm"
32 Alone 2114
 
59 Alone 2115
free2=end2-$;0x8000-$
303 alone 2116
        display "free for code in 0x4000=",free2
18 dimkam 2117
        ds 0x8000-$
668 alone 2118
 
14 dimkam 2119
        incbin "tdiv"
403 alone 2120
;0xc000
2121
        include "svg.asm"
2122
        display "end=",$
668 alone 2123
 
14 dimkam 2124
cmd_end
55 Alone 2125
        ;display "Size ",/d,cmd_end-cmd_begin," bytes"
14 dimkam 2126
 
2127
        savebin "browser.com",cmd_begin,cmd_end-cmd_begin
668 alone 2128
 
555 alone 2129
        LABELSLIST "../../us/user.l"