?login_element?

Subversion Repositories NedoOS

Rev

Rev 555 | Rev 668 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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