?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. clear_screen:
  2.         ld e,0
  3.         OS_CLS
  4.         ret
  5.  
  6. setpal_proc
  7. ;       call makefadepixel
  8. ;       call makewhitepixel
  9. ;       call makefonttable
  10. ;       ld de,(fadecolor)
  11. ;       OS_SETBORDER
  12.         ld de,pal
  13.         OS_SETPAL
  14.         xor a
  15.         ld (setpalflag),a
  16.         ret        
  17.  
  18.  
  19. print_hl
  20.         ld a,(hl)
  21.         or a
  22.         ret z
  23.         push hl
  24.         PRCHAR
  25.         pop hl
  26.         inc hl
  27.         jp print_hl
  28.         ret
  29.  
  30. ;---------------------------------------
  31. ;for 320x200
  32. _immed_big:
  33.         ld a,1
  34.         ld (setpalflag),a
  35.         call store8000c000
  36.  
  37.         halt
  38.         ld a,(load_buf1)
  39.         SETPG8000
  40.         ld a,(user_scr0_low)
  41.         SETPGC000
  42.  
  43.  
  44.         ld hl,0x8000
  45.         ld de,0xc000
  46.         ld bc,8000
  47.         ldir
  48.  
  49.  
  50.        
  51.         ld a,(load_buf2)
  52.         SETPG8000
  53.         ld a,(user_scr0_high)
  54.         SETPGC000
  55.  
  56.  
  57.         ld hl,0x8000
  58.         ld de,0xc000
  59.         ld bc,8000
  60.         ldir
  61.  
  62.        
  63.         ld a,(load_buf1)
  64.         SETPG8000
  65.         ld a,(user_scr0_low)
  66.         SETPGC000
  67.  
  68.  
  69.         ld hl,0xa000
  70.         ld de,0xe000
  71.         ld bc,8000
  72.         ldir
  73.  
  74.  
  75.        
  76.         ld a,(load_buf2)
  77.         SETPG8000
  78.         ld a,(user_scr0_high)
  79.         SETPGC000
  80.  
  81.  
  82.         ld hl,0xa000
  83.         ld de,0xe000
  84.         ld bc,8000
  85.         ldir
  86.  
  87.         jp restore8000c000
  88. ;-------------
  89. ;------------------------------------------------------------------        
  90. ; 320x200
  91. ;left to right and right to left same time (interleave)
  92. ;mode  ????
  93. _sidas_big:
  94.         xor a
  95.         ld (mask_mode),a
  96.  
  97.         ld a,(load_buf1)
  98.         ld (src_buf1),a
  99.         ld a,(load_buf2)
  100.         ld (src_buf2),a
  101.  
  102.         ld a,1
  103.         ld (setpalflag),a
  104.         call store8000c000
  105.  
  106.  
  107.         ld hl,0x8000
  108.         ld (sidas_l1),hl
  109.         ld hl,0x8000+39
  110.         ld (sidas_r1),hl
  111.  
  112.         ld b,40
  113. _sidas_loop1      
  114.         push bc
  115.  
  116.  
  117.         ld a,(src_buf1)
  118.         SETPG8000
  119.         ld a,(user_scr0_low)
  120.         SETPGC000
  121.  
  122.  
  123.         halt
  124.  
  125.         ld hl,0
  126. sidas_l1 equ $-2        
  127.         push hl
  128.         pop de
  129.         set 6,D
  130.  
  131.         push hl
  132.         push de
  133.  
  134.         ld b,200
  135.         call _down_cpy
  136.  
  137.         pop de
  138.         pop hl
  139.         push hl
  140.  
  141.         set 5,H
  142.         set 5,D
  143.  
  144.         ld b,200
  145.         call _down_cpy
  146.  
  147.         pop  hl
  148.         inc hl
  149.         ld (sidas_l1),hl
  150.  
  151.  
  152.         ld a,(src_buf2)
  153.         SETPG8000
  154.         ld a,(user_scr0_high)
  155.         SETPGC000
  156.  
  157.         ld hl,0
  158. sidas_r1 equ $-2        
  159.         push hl
  160.         pop de
  161.         set 6,D
  162.  
  163.         set 5,H
  164.         set 5,D
  165.  
  166.         push hl
  167.         push de
  168.  
  169.         ld b,200
  170.         call _down_cpy
  171.  
  172.         pop de
  173.         pop hl
  174.         push hl
  175.  
  176.         res 5,H
  177.         res 5,D
  178.  
  179.         ld b,200
  180.         call _down_cpy
  181.  
  182.         pop  hl
  183.         dec hl
  184.         ld (sidas_r1),hl
  185.  
  186.  
  187.         pop bc
  188.         dec b
  189.         jp nz,_sidas_loop1
  190.  
  191.         jp restore8000c000
  192. ;------------------------------------------------------------------        
  193. ;------------------------------------------------------------------        
  194. ;copy image to screen by mask (9 color in palette is mask)
  195. _iob_byte:
  196.         ld a,(de)
  197.         cp 0b11000000   ;double transparent bytes
  198.         jr z,_iob_next_b
  199.         push af
  200.         and 0b10111000
  201.         cp  0b10000000
  202.         jr z,_iob_left_transparent
  203.         pop  af
  204.         push af
  205.         and 0b01000111
  206.         cp  0b01000000
  207.         jr z,_iob_right_transparent
  208.         pop af
  209.         ld (hl),a; all solid. copy
  210. _iob_next_b
  211.         ret        
  212.  
  213. _iob
  214. _iob_loop        
  215.         call _iob_byte
  216.         inc de
  217.         inc hl
  218.         dec bc
  219.         ld a,b
  220.         or c
  221.         jr nz,_iob_loop
  222.         ret
  223. _iob_left_transparent
  224.         ld a,0b10111000 ;
  225.         and (hl)
  226.         ld (hl),a
  227.         pop af
  228.         and 0b01000111
  229.         or (hl)
  230.         ld (hl),a
  231.         jr _iob_next_b
  232. _iob_right_transparent
  233.         ld a,0b01000111
  234.         and (hl)
  235.         ld (hl),a
  236.         pop af
  237.         and 0b10111000
  238.         or (hl)
  239.         ld (hl),a
  240.         jr _iob_next_b  
  241. ;----------------------------------------
  242. mask_mode db 0
  243. _sprite_output_mask_no_pal:
  244.         ld a,1
  245.         jr _sprite_output_o
  246. sprite_output_no_pal:
  247.         xor a
  248. _sprite_output_o:        
  249.         ld (mask_mode),a
  250.  
  251.         ld a,(scr_buf1)
  252.         ld (src_buf1),a
  253.         ld a,(scr_buf2)
  254.         ld (src_buf2),a
  255.  
  256.         jp _mb_output
  257.  
  258.  
  259. _memory2_output_mask:
  260.         ld a,1
  261.         jr _memory2_output_o
  262. _memory2_output:
  263.         xor a
  264. _memory2_output_o:        
  265.         ld (mask_mode),a
  266.  
  267.         ld a,(mem_buf3)
  268.         ld (src_buf1),a
  269.         ld a,(mem_buf4)
  270.         ld (src_buf2),a
  271.  
  272.         ld hl,mempal
  273.         ld de,pal
  274.         ld bc,32
  275.         ldir            ;copy palette for image in membuf
  276.  
  277.         jp _mb_output
  278.  
  279.  
  280.  
  281. _memory2_output_mask_nopal:
  282.         ld a,1
  283.         jr _memory2_output_o_nopal
  284. _memory2_output_nopal:
  285.         xor a
  286. _memory2_output_o_nopal:        
  287.         ld (mask_mode),a
  288.  
  289.         ld a,(mem_buf3)
  290.         ld (src_buf1),a
  291.         ld a,(mem_buf4)
  292.         ld (src_buf2),a
  293.  
  294.         jp _mb_output
  295.  
  296. _memory_output_mask:
  297.         ld a,1
  298.         jr _memory_output_o
  299. _memory_output:
  300.         xor a
  301. _memory_output_o:        
  302.         ld (mask_mode),a
  303.  
  304.         ld a,(mem_buf1)
  305.         ld (src_buf1),a
  306.         ld a,(mem_buf2)
  307.         ld (src_buf2),a
  308.  
  309.         ld hl,mempal
  310.         ld de,pal
  311.         ld bc,32
  312.         ldir            ;copy palette for image in membuf
  313.  
  314.         jr _mb_output
  315. _2ndscreen_output:
  316.         xor a
  317.         ld (mask_mode),a
  318.         ld a,(user_scr1_low)
  319.         ld (src_buf1),a
  320.         ld a,(user_scr1_high)
  321.         ld (src_buf2),a
  322.         jr _mb_output
  323. _buffer_output_mask:
  324.         ld a,1
  325.         jr _buffer_output_o
  326. _buffer_output
  327.         xor a
  328. _buffer_output_o:        
  329.         ld (mask_mode),a
  330. _buffer_output_op:              
  331.         ld a,(load_buf1)
  332.         ld (src_buf1),a
  333.         ld a,(load_buf2)
  334.         ld (src_buf2),a
  335. _mb_output:
  336.         ld a,0
  337. outtyp equ $-1
  338.         jp _immed
  339.  
  340. /*        
  341.         cp 0x32
  342.         jp z,_immed
  343.         cp 0x36
  344. ;        jp z,_sidas
  345. ;        cp 0x37
  346.         jp z,_jaluzi
  347.         cp 0x38
  348. ;        jp z,_sidas
  349. ;        cp 0x39
  350. ;        jp z,_cntsds
  351. ;        cp 0x3a
  352. ;        jp z,_dn_up
  353. ;        cp 0x3c
  354.         jp z,_immed  ;_ud_nd
  355.         cp 0x3b
  356.         jp z,_jaluzi
  357. ;        cp 0x3d
  358. ;        jp z,_lftrgt
  359.         jp _jaluzi
  360. */        
  361. ;------------------------------------------------------------------        
  362. ; 240x148
  363. ;mode 0x32
  364. /*_immed:
  365.         ld a,1
  366.         ld (setpalflag),a
  367.         call store8000c000
  368.  
  369.  
  370.         halt
  371.         ld a,(src_buf1)
  372.         SETPG8000
  373.         ld a,(user_scr0_low)
  374.         SETPGC000
  375.  
  376.         ld hl,0x8005
  377.         ld b,148
  378.         call copy_immed_line
  379.  
  380.  
  381.         halt
  382.         ld a,(src_buf2)
  383.         SETPG8000
  384.         ld a,(user_scr0_high)
  385.         SETPGC000
  386.  
  387.         ld hl,0x8005
  388.         ld b,148
  389.         call copy_immed_line
  390.  
  391.         halt
  392.         ld a,(src_buf1)
  393.         SETPG8000
  394.         ld a,(user_scr0_low)
  395.         SETPGC000
  396.  
  397.         ld hl,0xa005
  398.         ld b,148
  399.         call copy_immed_line
  400.  
  401.  
  402.         halt
  403.         ld a,(src_buf2)
  404.         SETPG8000
  405.         ld a,(user_scr0_high)
  406.         SETPGC000        
  407.  
  408.         ld hl,0xa005
  409.         ld b,148
  410.         call copy_immed_line
  411.  
  412.         jp restore8000c000*/
  413. ;---
  414. _immed:
  415. ;        ld a,1
  416. ;        ld (setpalflag),a
  417.         call store8000c000
  418.  
  419.  
  420.         halt
  421.         ld a,(src_buf1)
  422.         SETPG8000
  423.         ld a,(user_scr0_low)
  424.         SETPGC000
  425.  
  426.         ld hl,0x8005
  427.         ld b,148
  428.         call copy_immed_line
  429.  
  430.         halt
  431.         ld hl,0xa005
  432.         ld b,148
  433.         call copy_immed_line
  434.  
  435.  
  436.         ld a,1
  437.         ld (setpalflag),a
  438.  
  439.         halt
  440.         ld a,(src_buf2)
  441.         SETPG8000
  442.         ld a,(user_scr0_high)
  443.         SETPGC000
  444.  
  445.         halt
  446.         ld hl,0x8005
  447.         ld b,148
  448.         call copy_immed_line
  449.  
  450.         ld hl,0xa005
  451.         ld b,148
  452.         call copy_immed_line
  453.  
  454.         jp restore8000c000
  455.  
  456. ;------------------------------------------------------------------
  457. ;pg8000 sourc
  458. ;pgc000 dest scr
  459. ;hl laddr
  460. ;b - num vert lines
  461. copy_immed_line:
  462. .lp:
  463.         push bc
  464.         push hl
  465.         pop de
  466.  
  467.         ex de,hl
  468.         set 6,h
  469.         ld bc,320
  470.         add hl,bc
  471.         ex de,hl
  472.  
  473.         call _ldi_30
  474.         ld bc,10
  475.         add hl,bc
  476.         pop bc
  477.         djnz .lp
  478.         ret      
  479. ;------------------------------------------------------------------
  480.  
  481. _ldi_30
  482.         ld a,(mask_mode)
  483.         and a
  484.         jp z,_ldi_30_noeob
  485. _ldi_30_iob
  486.         ex de,hl
  487.         dup 30
  488.         call _iob_byte
  489.         inc hl
  490.         inc de
  491.         edup
  492.         ex de,hl
  493.         ret
  494. _ldi_40_noeob:        
  495.         dup 10
  496.         ldi
  497.         edup
  498. _ldi_30_noeob:
  499.         dup 30
  500.         ldi
  501.         edup
  502.         ret
  503. ;----
  504.  
  505. ;hl-src de-dest b,counter
  506. _down_cpy:
  507.  
  508.         ld a,(mask_mode)
  509.         and a
  510.         jr nz,_down_cpy_iob
  511. _down_cpy1:
  512.         push bc
  513.         ld a,(hl)
  514.         ld (de),a
  515.         call DHL
  516.         ex de,hl
  517.         call DHL
  518.         ex de,hl
  519.         pop bc
  520.         djnz _down_cpy1
  521.         ret
  522. _down_cpy_iob:
  523.         push bc
  524.  
  525.         ex de,hl
  526.         call _iob_byte
  527.         ex de,hl
  528.  
  529.         call DHL
  530.         ex de,hl
  531.         call DHL
  532.         ex de,hl
  533.         pop bc
  534.         djnz _down_cpy_iob
  535.         ret
  536. ;------------------------------------------------------------------        
  537. ; 240x148
  538. ;left to right
  539. ;mode  ????? ;0x3d
  540. /*
  541. _lftrgt:
  542.         ld a,1
  543.         ld (setpalflag),a
  544.         call store8000c000
  545.  
  546.  
  547.         ld hl,0x8005
  548.  
  549.         ld b,30
  550. _lftrgt_loop        
  551.         push bc
  552.  
  553.         push hl
  554.         pop de
  555.  
  556.         ex de,hl
  557.         set 6,h
  558.         ld bc,320
  559.         add hl,bc
  560.         ex de,hl
  561.  
  562.  
  563.         push hl
  564.         push de
  565.  
  566.         halt
  567.         ld a,(src_buf1)
  568.         SETPG8000
  569.         ld a,(user_scr0_low)
  570.         SETPGC000
  571.  
  572.  
  573.         ld b,148
  574.         call _down_cpy
  575.  
  576.         pop de
  577.         pop hl
  578.         push hl
  579.         push de
  580.  
  581.         halt
  582.         ld a,(src_buf2)
  583.         SETPG8000
  584.         ld a,(user_scr0_high)
  585.         SETPGC000
  586.  
  587.         ld b,148
  588.         call _down_cpy
  589.  
  590.  
  591.         pop de
  592.         pop hl
  593.  
  594.         set 5,H
  595.         set 5,D
  596.  
  597.         push hl
  598.         push de
  599.  
  600.         halt
  601.         ld a,(src_buf1)
  602.         SETPG8000
  603.         ld a,(user_scr0_low)
  604.         SETPGC000
  605.  
  606.  
  607.         ld b,148
  608.         call _down_cpy
  609.  
  610.         pop de
  611.         pop hl
  612.         push hl
  613.         push de
  614.  
  615.         halt
  616.         ld a,(src_buf2)
  617.         SETPG8000
  618.         ld a,(user_scr0_high)
  619.         SETPGC000
  620.  
  621.         ld b,148
  622.         call _down_cpy
  623.  
  624.         pop de
  625.         pop hl
  626.         res 5,h
  627.         inc hl
  628.  
  629.  
  630.         pop bc
  631.         dec b
  632.         jp nz,_lftrgt_loop
  633.  
  634.         jp restore8000c000*/
  635. ;------------------------------------------------------------------        
  636. /*; 240x148
  637. ;left to right and right to left same time (interleave)
  638. ;mode  ????
  639. _sidas:
  640.         ld a,1
  641.         ld (setpalflag),a
  642.         call store8000c000
  643.  
  644.  
  645.         ld hl,0x8005
  646.         ld (sidas_l),hl
  647.         ld hl,0x8005+29
  648.         ld (sidas_r),hl
  649.  
  650.         ld b,30
  651. _sidas_loop        
  652.         push bc
  653.  
  654.  
  655.         ld a,(src_buf1)
  656.         SETPG8000
  657.         ld a,(user_scr0_low)
  658.         SETPGC000
  659.  
  660.  
  661.         halt
  662.  
  663.         ld hl,0
  664. sidas_l equ $-2        
  665.         push hl
  666.         pop de
  667.  
  668.         ex de,hl
  669.         set 6,h
  670.         ld bc,320
  671.         add hl,bc
  672.         ex de,hl
  673.  
  674.         push hl
  675.         push de
  676.  
  677.         ld b,148
  678.         call _down_cpy
  679.  
  680.         pop de
  681.         pop hl
  682.         push hl
  683.  
  684.         set 5,H
  685.         set 5,D
  686.  
  687.         ld b,148
  688.         call _down_cpy
  689.  
  690.         pop  hl
  691.         inc hl
  692.         ld (sidas_l),hl
  693.  
  694.  
  695.         ld a,(src_buf2)
  696.         SETPG8000
  697.         ld a,(user_scr0_high)
  698.         SETPGC000
  699.  
  700.         ld hl,0
  701. sidas_r equ $-2        
  702.         push hl
  703.         pop de
  704.  
  705.         ex de,hl
  706.         set 6,h
  707.         ld bc,320
  708.         add hl,bc
  709.         ex de,hl
  710.  
  711.         set 5,H
  712.         set 5,D
  713.  
  714.         push hl
  715.         push de
  716.  
  717.         ld b,148
  718.         call _down_cpy
  719.  
  720.         pop de
  721.         pop hl
  722.         push hl
  723.  
  724.         res 5,H
  725.         res 5,D
  726.  
  727.         ld b,148
  728.         call _down_cpy
  729.  
  730.         pop  hl
  731.         dec hl
  732.         ld (sidas_r),hl
  733.  
  734.  
  735.         pop bc
  736.         dec b
  737.         jp nz,_sidas_loop
  738.  
  739.         jp restore8000c000*/
  740. ;------------------------------------------------------------------        
  741. ; 240x148
  742. ;top to middle and bottom to middle same time
  743. ;mode ???
  744. /*_ud_nd:
  745.         ld a,1
  746.         ld (setpalflag),a
  747.         call store8000c000
  748.  
  749.  
  750.         ld hl,0x8005
  751.         ld (_ud_nd_top),hl
  752.         ld hl,0x8005+(147*40)
  753.         ld (_ud_nd_btm),hl
  754.  
  755.  
  756.         ld b,148/2 ;160/2
  757. _ud_nd_loop:        
  758.         halt
  759.         push bc
  760.  
  761.  
  762.  
  763.         ld a,(src_buf1)
  764.         SETPG8000
  765.         ld a,(user_scr0_low)
  766.         SETPGC000
  767.  
  768.  
  769.         ld hl,0
  770. _ud_nd_top: equ $-2
  771.  
  772.         push hl
  773.         pop de        
  774.  
  775.         ex de,hl
  776.         set 6,h
  777.         ld bc,320
  778.         add hl,bc
  779.         ex de,hl
  780.  
  781.         push hl
  782.         push de
  783.  
  784.         call _ldi_30
  785.  
  786.         pop de
  787.         pop hl
  788.  
  789.  
  790.         set 5,h
  791.         set 5,d
  792.  
  793.         call _ldi_30
  794.  
  795.         ld hl,0
  796. _ud_nd_btm: equ $-2
  797.  
  798.         push hl
  799.         pop de        
  800.  
  801.         ex de,hl
  802.         set 6,h
  803.         ld bc,320
  804.         add hl,bc
  805.         ex de,hl
  806.  
  807.         push hl
  808.         push de
  809.  
  810.         call _ldi_30
  811.  
  812.         pop de
  813.         pop hl
  814.  
  815.  
  816.         set 5,h
  817.         set 5,d
  818.  
  819.         call _ldi_30
  820.  
  821.         ld a,(src_buf2)
  822.         SETPG8000
  823.         ld a,(user_scr0_high)
  824.         SETPGC000
  825.  
  826.  
  827.         ld hl,(_ud_nd_top)
  828.  
  829.         push hl
  830.         pop de        
  831.  
  832.         ex de,hl
  833.         set 6,h
  834.         ld bc,320
  835.         add hl,bc
  836.         ex de,hl
  837.  
  838.         push hl
  839.         push de
  840.  
  841.         call _ldi_30
  842.  
  843.         pop de
  844.         pop hl
  845.         push hl
  846.  
  847.         set 5,h
  848.         set 5,d
  849.  
  850.         call _ldi_30
  851.  
  852.         pop hl
  853.         call DHL
  854.         ld (_ud_nd_top),hl
  855.  
  856.         ld hl,(_ud_nd_btm)
  857.  
  858.         push hl
  859.         pop de        
  860.  
  861.         ex de,hl
  862.         set 6,h
  863.         ld bc,320
  864.         add hl,bc
  865.         ex de,hl
  866.  
  867.         push hl
  868.         push de
  869.  
  870.         call _ldi_30
  871.  
  872.         pop de
  873.         pop hl
  874.  
  875.         push hl
  876.         set 5,h
  877.         set 5,d
  878.  
  879.         call _ldi_30
  880.  
  881.         pop hl
  882.         call UPHL
  883.         ld (_ud_nd_btm),hl
  884.  
  885.  
  886.         pop bc
  887.         dec b
  888.         jp nz,_ud_nd_loop
  889.  
  890.         jp restore8000c000*/
  891. ;------------------------------------------------------------------              
  892. ; 240x148
  893. ;from center up and down same time
  894. ;mode 0x3a
  895. /*_dn_up:
  896.         ld a,1
  897.         ld (setpalflag),a
  898.         call store8000c000
  899.  
  900.  
  901.         ld hl,0x8005+(74*40)
  902.         ld (_dn_up_top),hl
  903.         ld hl,0x8005+(73*40)
  904.         ld (_dn_up_btm),hl
  905.  
  906.  
  907.         ld b,74 ;148/2
  908. _dn_up_loop:        
  909.         halt
  910.         push bc
  911.  
  912.  
  913.  
  914.         ld a,(src_buf1)
  915.         SETPG8000
  916.         ld a,(user_scr0_low)
  917.         SETPGC000
  918.  
  919.  
  920.         ld hl,0
  921. _dn_up_top: equ $-2
  922.  
  923.         push hl
  924.         pop de        
  925.  
  926.         ex de,hl
  927.         set 6,h
  928.         ld bc,320
  929.         add hl,bc
  930.         ex de,hl
  931.  
  932.         push hl
  933.         push de
  934.  
  935.         call _ldi_30
  936.  
  937.         pop de
  938.         pop hl
  939.  
  940.  
  941.         set 5,h
  942.         set 5,d
  943.  
  944.         call _ldi_30
  945.  
  946.         ld hl,0
  947. _dn_up_btm: equ $-2
  948.  
  949.         push hl
  950.         pop de        
  951.  
  952.         ex de,hl
  953.         set 6,h
  954.         ld bc,320
  955.         add hl,bc
  956.         ex de,hl
  957.  
  958.         push hl
  959.         push de
  960.  
  961.         call _ldi_30
  962.  
  963.         pop de
  964.         pop hl
  965.  
  966.  
  967.         set 5,h
  968.         set 5,d
  969.  
  970.         call _ldi_30
  971.  
  972.         ld a,(src_buf2)
  973.         SETPG8000
  974.         ld a,(user_scr0_high)
  975.         SETPGC000
  976.  
  977.  
  978.         ld hl,(_dn_up_top)
  979.  
  980.         push hl
  981.         pop de        
  982.  
  983.         ex de,hl
  984.         set 6,h
  985.         ld bc,320
  986.         add hl,bc
  987.         ex de,hl
  988.  
  989.         push hl
  990.         push de
  991.  
  992.         call _ldi_30
  993.  
  994.         pop de
  995.         pop hl
  996.         push hl
  997.  
  998.         set 5,h
  999.         set 5,d
  1000.  
  1001.         call _ldi_30
  1002.  
  1003.         pop hl
  1004.         call DHL
  1005.         ld (_dn_up_top),hl
  1006.  
  1007.         ld hl,(_dn_up_btm)
  1008.  
  1009.         push hl
  1010.         pop de        
  1011.  
  1012.         ex de,hl
  1013.         set 6,h
  1014.         ld bc,320
  1015.         add hl,bc
  1016.         ex de,hl
  1017.  
  1018.         push hl
  1019.         push de
  1020.  
  1021.         call _ldi_30
  1022.  
  1023.         pop de
  1024.         pop hl
  1025.  
  1026.         push hl
  1027.         set 5,h
  1028.         set 5,d
  1029.  
  1030.         call _ldi_30
  1031.  
  1032.         pop hl
  1033.         call UPHL
  1034.         ld (_dn_up_btm),hl
  1035.  
  1036.  
  1037.         pop bc
  1038.         dec b
  1039.         jp nz,_dn_up_loop
  1040.  
  1041.         jp restore8000c000*/
  1042. ;------------------------------------------------------------------        
  1043. ; 240x148
  1044. ;jaluzi top to bottom and bottom to top same tome interleave
  1045. ;mode 0x3c
  1046. _jaluzi:
  1047.         ld a,1
  1048.         ld (setpalflag),a
  1049.         call store8000c000
  1050.  
  1051.  
  1052.  
  1053.         ld hl,0x8005
  1054.         ld (_jaluzi_top),hl
  1055.         ld hl,0x8005+(147*40)
  1056.         ld (_jaluzi_btm),hl
  1057.  
  1058.  
  1059.         ld b,74 ;148/2
  1060. _jaluzi_loop:
  1061.         halt
  1062.         push bc
  1063.  
  1064.         ld a,(src_buf1)
  1065.         SETPG8000
  1066.         ld a,(user_scr0_low)
  1067.         SETPGC000
  1068.  
  1069.  
  1070.         ld hl,0
  1071. _jaluzi_top: equ $-2
  1072.  
  1073.         push hl
  1074.         pop de        
  1075.  
  1076.         ex de,hl
  1077.         set 6,h
  1078.         ld bc,320
  1079.         add hl,bc
  1080.         ex de,hl
  1081.  
  1082.         push hl
  1083.         push de
  1084.  
  1085.         call _ldi_30
  1086.  
  1087.         pop de
  1088.         pop hl
  1089.  
  1090.  
  1091.         set 5,h
  1092.         set 5,d
  1093.  
  1094.         call _ldi_30
  1095.  
  1096.         ld hl,0
  1097. _jaluzi_btm: equ $-2
  1098.  
  1099.         push hl
  1100.         pop de        
  1101.  
  1102.         ex de,hl
  1103.         set 6,h
  1104.         ld bc,320
  1105.         add hl,bc
  1106.         ex de,hl
  1107.  
  1108.         push hl
  1109.         push de
  1110.  
  1111.         call _ldi_30
  1112.  
  1113.         pop de
  1114.         pop hl
  1115.  
  1116.  
  1117.         set 5,h
  1118.         set 5,d
  1119.  
  1120.         call _ldi_30
  1121.  
  1122.         ld a,(src_buf2)
  1123.         SETPG8000
  1124.         ld a,(user_scr0_high)
  1125.         SETPGC000
  1126.  
  1127.  
  1128.         ld hl,(_jaluzi_top)
  1129.  
  1130.         push hl
  1131.         pop de        
  1132.  
  1133.         ex de,hl
  1134.         set 6,h
  1135.         ld bc,320
  1136.         add hl,bc
  1137.         ex de,hl
  1138.  
  1139.         push hl
  1140.         push de
  1141.  
  1142.         call _ldi_30
  1143.  
  1144.         pop de
  1145.         pop hl
  1146.         push hl
  1147.  
  1148.         set 5,h
  1149.         set 5,d
  1150.  
  1151.         call _ldi_30
  1152.  
  1153.         pop hl
  1154.         call DHL1
  1155.         ld (_jaluzi_top),hl
  1156.  
  1157.         ld hl,(_jaluzi_btm)
  1158.  
  1159.         push hl
  1160.         pop de        
  1161.  
  1162.         ex de,hl
  1163.         set 6,h
  1164.         ld bc,320
  1165.         add hl,bc
  1166.         ex de,hl
  1167.  
  1168.         push hl
  1169.         push de
  1170.  
  1171.         call _ldi_30
  1172.  
  1173.         pop de
  1174.         pop hl
  1175.  
  1176.         push hl
  1177.         set 5,h
  1178.         set 5,d
  1179.  
  1180.         call _ldi_30
  1181.  
  1182.         pop hl
  1183.         call UPHL1
  1184.         ld (_jaluzi_btm),hl
  1185.  
  1186.         pop bc
  1187.         dec b
  1188.         jp nz,_jaluzi_loop
  1189.  
  1190.         jp restore8000c000
  1191. ;------------------------------------------------------------------        
  1192. ; 240x148
  1193. ;from center to sides left and right same time
  1194. ;mode 0x39
  1195. /*_cntsds:
  1196.         ld a,1
  1197.         ld (setpalflag),a
  1198.         call store8000c000
  1199.  
  1200.  
  1201.         ld hl,0x8005+14  ;to left
  1202.         ld (_cntsds_lft),hl
  1203.  
  1204.         ld hl,0x8005+15 ;to right
  1205.         ld (_cntsds_rgt),hl
  1206.  
  1207.         xor a
  1208.         ld (_cntsds_fsa),a
  1209.  
  1210.  
  1211.         ld b,60  ; 256 /2 /2
  1212. _cntsds_loop:
  1213.         halt
  1214.         push bc
  1215.  
  1216.         ld hl,_cntsds_loop_end
  1217.         push hl
  1218.  
  1219.  
  1220.         ld a,0
  1221. _cntsds_fsa: equ $-1
  1222.         and a
  1223.         jp z,_cntsds_f0
  1224.         cp 1
  1225.         jp z,_cntsds_f1
  1226.         cp 2
  1227.         jp z,_cntsds_f2
  1228.         cp 3
  1229.         jp z,_cntsds_f3
  1230.  
  1231.  
  1232. _cntsds_loop_end:
  1233.         ld a,(_cntsds_fsa)
  1234.         inc a
  1235.         and 3
  1236.         ld (_cntsds_fsa),a
  1237.         pop bc
  1238.         dec b
  1239.         jp nz,_cntsds_loop
  1240.  
  1241.  
  1242.         jp restore8000c000
  1243.  
  1244. ;----
  1245. _cntsds_f0:
  1246.         ld a,(src_buf2)
  1247.         SETPG8000
  1248.         ld a,(user_scr0_high)
  1249.         SETPGC000
  1250.  
  1251.         ld hl,0
  1252. _cntsds_lft: equ $-2
  1253.         push hl
  1254.         pop de
  1255.  
  1256.         ex de,hl
  1257.         set 6,h
  1258.         ld bc,320
  1259.         add hl,bc
  1260.         ex de,hl
  1261.  
  1262.         set 5,h
  1263.         set 5,d
  1264.  
  1265.         ld b,148
  1266.         call _down_cpy
  1267.  
  1268.         ld a,(src_buf1)
  1269.         SETPG8000
  1270.         ld a,(user_scr0_low)
  1271.         SETPGC000
  1272.  
  1273.         ld hl,0
  1274. _cntsds_rgt: equ $-2
  1275.         push hl
  1276.         pop de
  1277.  
  1278.         ex de,hl
  1279.         set 6,h
  1280.         ld bc,320
  1281.         add hl,bc
  1282.         ex de,hl
  1283.  
  1284.         ld b,148
  1285.         jp _down_cpy
  1286.  
  1287.  
  1288. ;----
  1289. _cntsds_f2:
  1290.         ld a,(src_buf2)
  1291.         SETPG8000
  1292.         ld a,(user_scr0_high)
  1293.         SETPGC000
  1294.  
  1295.         ld hl,(_cntsds_lft)
  1296.         push hl
  1297.         pop de
  1298.  
  1299.         ex de,hl
  1300.         set 6,h
  1301.         ld bc,320
  1302.         add hl,bc
  1303.         ex de,hl
  1304.  
  1305.         ld b,148
  1306.         call _down_cpy
  1307.  
  1308.         ld a,(src_buf1)
  1309.         SETPG8000
  1310.         ld a,(user_scr0_low)
  1311.         SETPGC000
  1312.  
  1313.         ld hl,(_cntsds_rgt)
  1314.         push hl
  1315.         pop de
  1316.  
  1317.         ex de,hl
  1318.         set 6,h
  1319.         ld bc,320
  1320.         add hl,bc
  1321.         ex de,hl
  1322.  
  1323.         set 5,h
  1324.         set 5,d
  1325.  
  1326.         ld b,148
  1327.         jp _down_cpy
  1328.  
  1329.  
  1330. ;----
  1331. _cntsds_f1:
  1332.         ld a,(src_buf1)
  1333.         SETPG8000
  1334.         ld a,(user_scr0_low)
  1335.         SETPGC000
  1336.  
  1337.         ld hl,(_cntsds_lft)
  1338.         push hl
  1339.         pop de
  1340.  
  1341.         ex de,hl
  1342.         set 6,h
  1343.         ld bc,320
  1344.         add hl,bc
  1345.         ex de,hl
  1346.  
  1347.         set 5,h
  1348.         set 5,d
  1349.  
  1350.         ld b,148
  1351.         call _down_cpy
  1352.  
  1353.         ld a,(src_buf2)
  1354.         SETPG8000
  1355.         ld a,(user_scr0_high)
  1356.         SETPGC000
  1357.  
  1358.         ld hl,(_cntsds_rgt)
  1359.         push hl
  1360.         pop de
  1361.  
  1362.         ex de,hl
  1363.         set 6,h
  1364.         ld bc,320
  1365.         add hl,bc
  1366.         ex de,hl
  1367.  
  1368.         ld b,148
  1369.         jp _down_cpy
  1370. ;----
  1371. _cntsds_f3:
  1372.         ld a,(src_buf1)
  1373.         SETPG8000
  1374.         ld a,(user_scr0_low)
  1375.         SETPGC000
  1376.  
  1377.         ld hl,(_cntsds_lft)
  1378.         push hl
  1379.         push hl
  1380.         pop de
  1381.  
  1382.         ex de,hl
  1383.         set 6,h
  1384.         ld bc,320
  1385.         add hl,bc
  1386.         ex de,hl
  1387.  
  1388.         ld b,148
  1389.         call _down_cpy
  1390.  
  1391.         pop hl
  1392.         dec hl
  1393.         ld (_cntsds_lft),hl
  1394.  
  1395.         ld a,(src_buf2)
  1396.         SETPG8000
  1397.         ld a,(user_scr0_high)
  1398.         SETPGC000
  1399.  
  1400.         ld hl,(_cntsds_rgt)
  1401.         push hl
  1402.         push hl
  1403.         pop de
  1404.  
  1405.         ex de,hl
  1406.         set 6,h
  1407.         ld bc,320
  1408.         add hl,bc
  1409.         ex de,hl
  1410.  
  1411.         set 5,h
  1412.         set 5,d
  1413.  
  1414.  
  1415.         ld b,148
  1416.         call _down_cpy
  1417.  
  1418.         pop hl
  1419.         inc hl
  1420.         ld (_cntsds_rgt),hl
  1421.         ret*/
  1422. ;------------------------------------------------------------------        
  1423. ; 240x148
  1424. ;from sides left and right  to center same time
  1425. ;mode 0x39
  1426. /*_cntsds_r:
  1427.         ld a,1
  1428.         ld (setpalflag),a
  1429.         call store8000c000
  1430.  
  1431.  
  1432.         ld hl,0x8005  ;to left
  1433.         ld (_cntsds_lft_r),hl
  1434.  
  1435.         ld hl,0x8005+29 ;to right
  1436.         ld (_cntsds_rgt_r),hl
  1437.  
  1438.         xor a
  1439.         ld (_cntsds_fsa_r),a
  1440.  
  1441.  
  1442.         ld b,64  ; 256 /2 /2
  1443. _cntsds_loop_r:
  1444.         halt
  1445.         push bc
  1446.  
  1447.         ld hl,_cntsds_loop_end_r
  1448.         push hl
  1449.  
  1450.  
  1451.         ld a,0
  1452. _cntsds_fsa_r: equ $-1
  1453.         and a
  1454.         jp z,_cntsds_f3_r
  1455.         cp 1
  1456.         jp z,_cntsds_f2_r
  1457.         cp 2
  1458.         jp z,_cntsds_f1_r
  1459.         cp 3
  1460.         jp z,_cntsds_f0_r
  1461.  
  1462.  
  1463. _cntsds_loop_end_r:
  1464.         ld a,(_cntsds_fsa_r)
  1465.         inc a
  1466.         and 3
  1467.         ld (_cntsds_fsa_r),a
  1468.         pop bc
  1469.         dec b
  1470.         jp nz,_cntsds_loop_r
  1471.  
  1472.  
  1473.         jp restore8000c000
  1474.  
  1475. ;----
  1476. _cntsds_f0_r:
  1477.         ld a,(src_buf2)
  1478.         SETPG8000
  1479.         ld a,(user_scr0_high)
  1480.         SETPGC000
  1481.  
  1482.         ld hl,0
  1483. _cntsds_lft_r: equ $-2
  1484.         push hl
  1485.         push hl
  1486.         pop de
  1487.  
  1488.         ex de,hl
  1489.         set 6,h
  1490.         ld bc,320
  1491.         add hl,bc
  1492.         ex de,hl
  1493.  
  1494.         set 5,h
  1495.         set 5,d
  1496.  
  1497.         ld b,148
  1498.         call _down_cpy
  1499.  
  1500.         pop hl
  1501.         inc hl
  1502.         ld (_cntsds_lft_r),hl
  1503.  
  1504.         ld a,(src_buf1)
  1505.         SETPG8000
  1506.         ld a,(user_scr0_low)
  1507.         SETPGC000
  1508.  
  1509.         ld hl,0
  1510. _cntsds_rgt_r: equ $-2
  1511.  
  1512.         push hl
  1513.         push hl
  1514.         pop de
  1515.  
  1516.         ex de,hl
  1517.         set 6,h
  1518.         ld bc,320
  1519.         add hl,bc
  1520.         ex de,hl
  1521.  
  1522.         ld b,148
  1523.         call _down_cpy
  1524.         pop hl
  1525.         dec hl
  1526.         ld (_cntsds_rgt_r),hl
  1527.         ret
  1528.  
  1529.  
  1530. ;----
  1531. _cntsds_f2_r:
  1532.         ld a,(src_buf2)
  1533.         SETPG8000
  1534.         ld a,(user_scr0_high)
  1535.         SETPGC000
  1536.  
  1537.         ld hl,(_cntsds_lft_r)
  1538.         push hl
  1539.         pop de
  1540.  
  1541.         ex de,hl
  1542.         set 6,h
  1543.         ld bc,320
  1544.         add hl,bc
  1545.         ex de,hl
  1546.  
  1547.         ld b,148
  1548.         call _down_cpy
  1549.  
  1550.         ld a,(src_buf1)
  1551.         SETPG8000
  1552.         ld a,(user_scr0_low)
  1553.         SETPGC000
  1554.  
  1555.         ld hl,(_cntsds_rgt_r)
  1556.         push hl
  1557.         pop de
  1558.  
  1559.         ex de,hl
  1560.         set 6,h
  1561.         ld bc,320
  1562.         add hl,bc
  1563.         ex de,hl
  1564.  
  1565.         set 5,h
  1566.         set 5,d
  1567.  
  1568.         ld b,148
  1569.         jp _down_cpy
  1570.  
  1571.  
  1572. ;----
  1573. _cntsds_f1_r:
  1574.         ld a,(src_buf1)
  1575.         SETPG8000
  1576.         ld a,(user_scr0_low)
  1577.         SETPGC000
  1578.  
  1579.         ld hl,(_cntsds_lft_r)
  1580.         push hl
  1581.         pop de
  1582.  
  1583.         ex de,hl
  1584.         set 6,h
  1585.         ld bc,320
  1586.         add hl,bc
  1587.         ex de,hl
  1588.  
  1589.         set 5,h
  1590.         set 5,d
  1591.  
  1592.         ld b,148
  1593.         call _down_cpy
  1594.  
  1595.         ld a,(src_buf2)
  1596.         SETPG8000
  1597.         ld a,(user_scr0_high)
  1598.         SETPGC000
  1599.  
  1600.         ld hl,(_cntsds_rgt_r)
  1601.         push hl
  1602.         pop de
  1603.  
  1604.         ex de,hl
  1605.         set 6,h
  1606.         ld bc,320
  1607.         add hl,bc
  1608.         ex de,hl
  1609.  
  1610.         ld b,148
  1611.         jp _down_cpy
  1612. ;----
  1613. _cntsds_f3_r:
  1614.         ld a,(src_buf1)
  1615.         SETPG8000
  1616.         ld a,(user_scr0_low)
  1617.         SETPGC000
  1618.  
  1619.         ld hl,(_cntsds_lft_r)
  1620.         push hl
  1621.         pop de
  1622.  
  1623.         ex de,hl
  1624.         set 6,h
  1625.         ld bc,320
  1626.         add hl,bc
  1627.         ex de,hl
  1628.  
  1629.         ld b,148
  1630.         call _down_cpy
  1631.  
  1632.         ld a,(src_buf2)
  1633.         SETPG8000
  1634.         ld a,(user_scr0_high)
  1635.         SETPGC000
  1636.  
  1637.         ld hl,(_cntsds_rgt_r)
  1638.  
  1639.         push hl
  1640.         pop de
  1641.  
  1642.         ex de,hl
  1643.         set 6,h
  1644.         ld bc,320
  1645.         add hl,bc
  1646.         ex de,hl
  1647.  
  1648.         set 5,h
  1649.         set 5,d
  1650.  
  1651.  
  1652.         ld b,148
  1653.         jp _down_cpy*/
  1654.  
  1655. ;------------------------------------------------------------------  
  1656. _pradd_p:
  1657.         LD (CORDS_P),BC
  1658.         SRL     C
  1659.         SBC     A
  1660.         AND %00100000
  1661.         LD      (.M111),A
  1662.  
  1663.         PUSH HL
  1664.         LD H,#80
  1665.         LD A,H
  1666.         OR 0
  1667. .M111    EQU $-1
  1668.         LD H,A
  1669.  
  1670.         LD A,C
  1671.         ADD A,4
  1672.         LD L,A
  1673.  
  1674.         push bc
  1675.         ld a,b
  1676.         and a
  1677.         jr z,.skip
  1678.         LD DE,320
  1679. .pradd_l:        
  1680.         ADD HL,DE
  1681.         DJNZ .pradd_l
  1682. .skip
  1683.         LD (COORDS_P),HL
  1684.  
  1685.         pop bc
  1686.         ld h,0x80
  1687.         ld l,37
  1688.         ld a,b
  1689.         and a
  1690.         jr z,.skip2
  1691.         LD DE,320
  1692. .pradd_l2:        
  1693.         ADD HL,DE
  1694.         DJNZ .pradd_l2
  1695. .skip2
  1696.         ld (COORDS_P_L),hl
  1697.  
  1698.  
  1699.         POP HL
  1700.         RET    
  1701. COORDS_P_L: DW 0
  1702.  
  1703. /*
  1704. _pradd_p2:
  1705.         LD (CORDS_P),BC
  1706.         SRL     C
  1707.         SBC     A
  1708.         AND %00100000
  1709.         LD      (.M111),A
  1710.  
  1711.         PUSH HL
  1712.         LD H,#80
  1713.         LD A,H
  1714.         OR 0
  1715. .M111    EQU $-1
  1716.         LD H,A
  1717.  
  1718.         LD A,C
  1719.         ADD A,4
  1720.         LD L,A
  1721.  
  1722.         ld a,b
  1723.         and a
  1724.         jr z,.skip
  1725.         LD DE,320
  1726. .pradd_l:        
  1727.         ADD HL,DE
  1728.         DJNZ .pradd_l
  1729. .skip
  1730.         ld de,160+320
  1731.         add hl,de
  1732.         LD (COORDS_P),HL
  1733.         ld hl,0xffff ;!!!!!!!!!!!!
  1734.         ld (COORDS_P_L),hl
  1735.         POP HL
  1736.         RET        
  1737. */        
  1738. ;------------------------------------------------------------------  
  1739.  
  1740. UPHL1   CALL UPHL
  1741. UPHL
  1742.         PUSH BC
  1743.         LD BC,40
  1744.         AND A
  1745.         SBC HL,BC
  1746.         POP BC
  1747.         RET
  1748.  
  1749.  
  1750. DHL1    CALL DHL
  1751. DHL
  1752.         PUSH BC
  1753.         LD BC,40
  1754.         ADD HL,BC
  1755.         POP BC
  1756.         RET
  1757.  
  1758. ;;;;;;;;;;;;;;;;;;;;;;;
  1759. prcharprop_shch
  1760.         ;ld a,'Щ'
  1761.         call prcharprop_do
  1762.         ld a,255
  1763.         jr prcharprop_do
  1764.  
  1765. _type_p:
  1766.         ;ld ix,0x47b8; palette 16 color
  1767.         ld ix,0x47b8; palette 9 color
  1768. _type_color equ $-2  
  1769. ;         exx
  1770. ;         ld a,0xff
  1771. ;         sub hx
  1772. ;         ld h,a
  1773. ;         ld a,0xff
  1774. ;         sub lx
  1775. ;         ld l,a
  1776. ;         exx
  1777.  
  1778.      
  1779.         ld hl,0
  1780. COORDS_P equ $-2
  1781. prcharprop_do
  1782. ;print with proportional font (any char width)
  1783. ;hl=screen addr
  1784. ;c=phase (even=left, odd=right pixel)
  1785. ;a=char
  1786.        push hl
  1787.  
  1788.         call setfontpage
  1789.  
  1790.         ld l,a
  1791.         ld h,FONT2/256  ;propfont
  1792.         ld de,font_buf  ;chardata
  1793. ;1. copy char data
  1794. ;shift 1 pix right if needed
  1795.         bit 0,c
  1796.         jr z,prcharprop_copyfontnoscroll
  1797.         dup 7
  1798.         ld a,(hl)
  1799.         rrca
  1800.         ld (de),a
  1801.         inc h
  1802.         inc e
  1803.         edup
  1804.         ld a,(hl)
  1805.         rrca
  1806.         jp prcharprop_copyfontq
  1807. prcharprop_copyfontnoscroll
  1808.         dup 7
  1809.         ld a,(hl)
  1810.         ld (de),a
  1811.         inc h
  1812.         inc e
  1813.         edup
  1814.         ld a,(hl)
  1815. prcharprop_copyfontq
  1816.         ld (de),a
  1817.         inc h
  1818.         ld b,(hl) ;charwidth
  1819.         ld a,c ;phase
  1820.         add a,b
  1821.         ld ly,a ;next phase = phase + charwidth
  1822.         ld a,c ;phase
  1823.         and 1 ;phase&1
  1824.         inc a
  1825.         add a,b ;charwidth
  1826.         rra
  1827.         ld hy,a ;number of 2 pixel columns = (charwidth + (phase&1) + 1)/2
  1828.  
  1829.        call unsetfontpage
  1830.  
  1831.         ld a,(user_scr0_low) ;ok
  1832.         SETPG8000
  1833.         ld a,(user_scr0_high) ;ok
  1834.         SETPGC000
  1835.  
  1836.        pop hl
  1837. ;hl=screen addr
  1838. ;hy=number of 2 pixel columns = (charwidth + (phase&1) + 1)/2
  1839. ;ly=next phase (even=left, odd=right pixel)
  1840. ;2. print 2 pixel vertical line (scroll left bits 7,6 in char data)
  1841.         ld bc,40
  1842. prcharprop_columns0
  1843.         push hl
  1844.         ld de,font_buf
  1845.  
  1846.         dup 7
  1847.         ex de,hl
  1848.         ld a,(de)
  1849.         rl (hl) ;CY=left pixel
  1850.         jr nc,$+6
  1851.         and 0b10111000    
  1852.         or hx ;0x47 ;
  1853.         rl (hl) ;CY=right pixel
  1854.         jr nc,$+6
  1855.         and 0b01000111
  1856.         or lx ;0xb8 ;
  1857.         ld (de),a
  1858.         ex de,hl
  1859.         add hl,bc
  1860.         inc e
  1861.         edup
  1862.         ex de,hl
  1863.         ld a,(de)
  1864.         rl (hl) ;CY=left pixel
  1865.         jr nc,$+6
  1866.         and 0b10111000    
  1867.         or hx ;0x47
  1868.         rl (hl) ;CY=right pixel
  1869.         jr nc,$+6
  1870.         and 0b01000111
  1871.         or lx ;0xb8 ;
  1872.  
  1873.         ld (de),a
  1874. ;3. next column and loop
  1875.         pop hl
  1876.         ld d,h
  1877.         ld e,l ;this will be next screen addr if the char ends in odd column ((ly&1) = 1)
  1878.         bit 6,h
  1879.         set 6,h
  1880.         jr z,$+2+4+2+2+1
  1881.          ld a,h
  1882.          xor 0x60
  1883.          ld h,a
  1884.          and 0x20
  1885.          jr nz,$+3
  1886.          inc hl
  1887.         dec hy
  1888.         jp nz,prcharprop_columns0
  1889.         ld c,ly
  1890. ;c=next phase (even=left, odd=right pixel)
  1891.         bit 0,c
  1892.         ;ret z
  1893.         jr z,_skpp
  1894.         ex de,hl ;old screen addr if the char ends in odd column ((ly&1) = 1)
  1895. ;hl=next screen addr
  1896. ;        ret
  1897.  
  1898.  
  1899.  
  1900. _skpp:
  1901.         push bc
  1902.         ld (COORDS_P),hl
  1903.         ld bc,(CORDS_P)
  1904.         inc c
  1905.         ld (CORDS_P),bc
  1906.         pop bc
  1907.         ret
  1908.  
  1909. ;;;;;;;;;;;;;;;;;;;;;;;
  1910. clear_whole_screen:
  1911.         call storec000
  1912.         ld a,(user_scr0_high)
  1913.         SETPGC000
  1914.         LD HL,#C000
  1915.         LD DE,#C001
  1916.         LD BC,16383
  1917.         LD [HL],L
  1918.         LDIR
  1919.         ld a,(user_scr0_low)
  1920.         SETPGC000
  1921.         LD HL,#C000
  1922.         LD DE,#C001
  1923.         LD BC,16383
  1924.         LD [HL],L
  1925.         LDIR
  1926.  
  1927.  
  1928.         ld hl,niggapal
  1929.         ld de,pal
  1930.         ld bc,32
  1931.         ldir
  1932.         ld a,1
  1933.         ld (setpalflag),a
  1934.         halt
  1935.  
  1936.         jp restorec000
  1937. ;;;;;;;;;;;;;;;;;;;;;;;;
  1938. _clear_textbox:
  1939.         ;ld hl,0xda44-160-320-2
  1940.         ;ld b,32+8+8
  1941.         ;LD C,32+4
  1942.         ;call clear_uni
  1943.         jp _draw_box
  1944.  
  1945. clear_status_bar:
  1946.         ld hl,0xc000
  1947.         ld b,8
  1948.         ld c,40
  1949. clear_uni:
  1950.         ld a,b
  1951.         ld (clear_uni_s.c2a),a
  1952.         ld (clear_uni_s.c2b),a
  1953.  
  1954.         ld a,c
  1955.         ld (clear_uni_s.c3a),a
  1956.         ld (clear_uni_s.c3b),a
  1957.  
  1958.         ld (clear_uni_s.c1a),hl
  1959.         set 5,h
  1960.         ld (clear_uni_s.c1b),hl
  1961.  
  1962.         call storec000
  1963.  
  1964.  
  1965.         ld a,(user_scr0_high)
  1966.         SETPGC000
  1967.  
  1968.         call clear_uni_s
  1969.  
  1970.         ld a,(user_scr0_low)
  1971.         SETPGC000
  1972.  
  1973.         call clear_uni_s
  1974.  
  1975.  
  1976.         jp restorec000
  1977.      
  1978.  
  1979. clear_uni_s:    
  1980.        LD HL,0
  1981. .c1a   equ $-2        
  1982.        LD B,0
  1983. .c2a   equ $-1    
  1984.         XOR A
  1985. .c0l:
  1986.         PUSH HL
  1987.         LD C,0
  1988. .c3a    equ $-1    
  1989.         LD (HL),A
  1990.         INC HL
  1991.         DEC C
  1992.         JR NZ,$-3
  1993.         POP HL
  1994.         LD DE,40
  1995.         ADD HL,DE
  1996.         DJNZ .c0l
  1997.  
  1998.         LD HL,0
  1999. .c1b:   equ $-2
  2000.         LD B,0
  2001. .c2b equ $-1  
  2002.         XOR A
  2003. .c1l:   PUSH HL
  2004.         LD C,0
  2005. .c3b equ $-1
  2006.         LD (HL),A
  2007.         INC HL
  2008.         DEC C
  2009.         JR NZ,$-3
  2010.         POP HL
  2011.         LD DE,40
  2012.         ADD HL,DE
  2013.         DJNZ .c1l
  2014.         ret
  2015.  
  2016. ;----------------------------------------------------
  2017. _draw_menu_box:
  2018.         push hl
  2019.         ld a,(user_scr0_low) ;ok
  2020.         SETPG8000
  2021.         ld a,(user_scr0_high) ;ok
  2022.         SETPGC000
  2023.  
  2024.         ld l,64
  2025.         ld e,140
  2026.         ld hx,0b11001001 ;fill color byte 0bRLrrrlll
  2027.         ld lx,0b00000000 ;11111111 ;brush color byte 0bRLrrrlll
  2028.         ld b,0 ;hgt-1
  2029. __d_m_box_hgt: equ $-1
  2030.         ld c,0 ;wid/2
  2031. __d_m_box_len: equ $-1
  2032.  
  2033. ;l=x/2
  2034. ;e=y
  2035. ;lx=brush color byte 0bRLrrrlll
  2036. ;hx=fill color byte 0bRLrrrlll
  2037. ;b=hgt-1
  2038. ;c=wid/2
  2039.         call drawwindow
  2040.         pop hl
  2041.         ret
  2042. ;----------------------------------------------------
  2043. drawwindow
  2044. ;l=x/2
  2045. ;e=y
  2046.         ld hy,e
  2047.         ld a,l
  2048.         ld ly,a
  2049. ;ly=x/2
  2050. ;hy=y
  2051.         call xytoscraddr
  2052. ;hl=screen addr
  2053. ;lx=brush color byte 0bRLrrrlll
  2054. ;hx=fill color byte 0bRLrrrlll
  2055. ;b=hgt-1
  2056. ;c=wid/2
  2057.         push bc
  2058.         push hl
  2059.        
  2060. drawwindowfill0
  2061.         push bc
  2062.         push hl
  2063.         ld c,hx ;ld c,0b11111111 ;color byte 0bRLrrrlll
  2064.         call drawverline
  2065.         pop hl
  2066.         NEXTCOLUMN
  2067.         pop bc
  2068.         dec c
  2069.         jr nz,drawwindowfill0
  2070.        
  2071.         pop hl ;screen addr
  2072.         pop bc
  2073.  
  2074.         push bc
  2075.  
  2076.         push bc
  2077.         push hl
  2078.         call drawbox
  2079.         pop hl
  2080.         pop bc
  2081.         NEXTCOLUMN
  2082.         ld de,40*2
  2083.         add hl,de ;тЄюЁющ сюъё тэєЄЁш яхЁтюую
  2084.         dec c
  2085.         dec c
  2086.         ld a,b
  2087.         sub 4
  2088.         ld b,a
  2089.         call drawbox
  2090.        
  2091.         pop bc ;b=hgt-1, c=wid/2
  2092.        
  2093. ;ly=x/2
  2094. ;hy=y
  2095.         ld e,hy
  2096.         inc e
  2097.         call drawwindowhormarks
  2098.        
  2099.         ld a,hy
  2100.         add a,b ;+hgt-1
  2101.         dec a
  2102.         ld e,a
  2103.         call drawwindowhormarks
  2104.  
  2105.         push bc
  2106.         call drawwindowvermarks
  2107.         pop bc
  2108.         ld a,ly
  2109.         add a,c ;wid/2
  2110.         dec a
  2111.         ld ly,a
  2112.         call drawwindowvermarks
  2113.        
  2114.         ret
  2115. ;----------------------------------------------
  2116.  
  2117. xytoscraddr
  2118. ;l=x/2
  2119. ;e=y (эх яюЁЄшЄё )
  2120. ;screen pages are mapped in 2 CPU windows
  2121. ;addr = tY(y) + tX(x)
  2122.         ld h,tx/256
  2123.         ld d,ty/256
  2124.         ld a,(de) ;(y*40)
  2125.         add a,(hl) ;x div 4
  2126.         ld (xytoscraddr_l),a
  2127.         inc d
  2128.         inc h
  2129.         ld a,(de) ;'(y*40)
  2130.         adc a,(hl) ;f(x mod 4)
  2131.         ld h,a
  2132. xytoscraddr_l=$+1
  2133.         ld l,0
  2134.         ret
  2135.  
  2136.  
  2137. drawwindowvermarks
  2138. ;ly=x/2
  2139. ;hy=y
  2140. ;b=hgt-1
  2141. ;lx=color byte 0bRLrrrlll
  2142.         ld a,ly
  2143.         ld l,a
  2144.         ld a,hy
  2145.         add a,6
  2146.         ld e,a
  2147. ;l=x/2
  2148. ;e=y
  2149.         call xytoscraddr
  2150.         ld a,lx
  2151.         ld (hl),a
  2152.         ld a,ly
  2153.         ld l,a
  2154.         ld a,hy
  2155.         add a,b ;+hgt-1
  2156.         sub 6
  2157.         ld e,a
  2158. ;l=x/2
  2159. ;e=y        
  2160.         call xytoscraddr
  2161.         ld a,lx
  2162.         ld (hl),a
  2163.         ret
  2164.  
  2165.        
  2166. drawwindowhormarks
  2167. ;ly=x/2
  2168. ;e=y
  2169. ;c=wid/2
  2170.         ld a,ly
  2171.         add a,3
  2172.         ld l,a
  2173. ;l=x/2
  2174. ;e=y
  2175.         call xytoscraddr
  2176.         ld a,lx
  2177.         xor hx
  2178.         and 0b01000111 ;color byte 0bRLrrrlll
  2179.         xor hx
  2180.         ld (hl),a
  2181.  
  2182.         ld a,ly
  2183.         add a,c ;+wid/2
  2184.         sub 3+1
  2185.         ld l,a
  2186. ;l=x/2
  2187. ;e=y
  2188.         call xytoscraddr
  2189.         ld a,lx
  2190.         xor hx
  2191.         and 0b10111000 ;color byte 0bRLrrrlll
  2192.         xor hx
  2193.         ld (hl),a
  2194.         ret
  2195.        
  2196.  
  2197. drawbox
  2198. ;hl=screen addr
  2199. ;lx=color byte 0bRLrrrlll
  2200. ;b=hgt-1
  2201. ;c=wid/2
  2202.         push bc
  2203.         push hl
  2204.         push bc
  2205.         ld a,lx
  2206.         xor hx
  2207.         and 0b01000111 ;color byte 0bRLrrrlll
  2208.         xor hx
  2209.         ld c,a
  2210.         call drawverline ;left line
  2211.         pop bc
  2212.         ld b,c ;wid/2
  2213.         ex (sp),hl
  2214.         ld c,lx ;ld c,0b11111111 ;color byte 0bRLrrrlll
  2215.         push bc
  2216.         call drawhorline ;top line
  2217.         pop bc ;b=wid/2, c=color byte 0bRLrrrlll
  2218.         ex (sp),hl ;bottom of left line
  2219.         call drawhorline ;bottom line
  2220.         pop hl ;rightmost byte of top line
  2221.         ld de,40
  2222.         add hl,de
  2223.         pop bc
  2224.         dec b ;b=hgt/2
  2225.         ld a,lx
  2226.         xor hx
  2227.         and 0b10111000 ;color byte 0bRLrrrlll
  2228.         xor hx
  2229.         ld c,a
  2230.         ;call drawverline ;right line
  2231.         ;ret
  2232. drawverline
  2233. ;hl=scraddr
  2234. ;c=color byte 0bRLrrrlll
  2235. ;b=hgt
  2236.         ld de,40
  2237. drawverline0
  2238.         ld (hl),c
  2239.         add hl,de
  2240.         djnz drawverline0
  2241.         ret
  2242.  
  2243. drawhorline
  2244. ;hl=scraddr
  2245. ;c=color byte 0bRLrrrlll
  2246. ;b=wid/2
  2247.         ld de,0x4000
  2248.         jr drawhorline0go
  2249. drawhorline0
  2250.         NEXTCOLUMN
  2251. drawhorline0go
  2252.         ld (hl),c
  2253.         djnz drawhorline0
  2254.         ret
  2255.      
  2256. ;----------------------------------------------
  2257. _pre_setup
  2258.         ; ld a,(hl);string length
  2259.         ld a,(hl)
  2260.         ld (_line_lenght),a
  2261.  
  2262.                 inc a
  2263.                 inc a
  2264.  
  2265.                 add a,a
  2266.                 add a,a
  2267.                 ;add a,a
  2268.  
  2269.                 dec a
  2270.         ld (__d_m_box_len),a
  2271.  
  2272.         inc hl
  2273.  
  2274.         ld a,(hl)
  2275.         ld (DOWN_LIMIT),a
  2276.  
  2277.                 inc a
  2278.                 inc a
  2279.                 add a,a ;x2
  2280.                 add a,a ;x4
  2281.                 add a,a ;x8
  2282.                 dec a
  2283.                 ld  (__d_m_box_hgt),a
  2284.  
  2285.         inc hl
  2286.         push hl
  2287.         xor a
  2288.         ld (CUR_POS),a
  2289.         LD HL,#1219
  2290.         LD (_mnpos),HL
  2291.         pop hl
  2292.         ret
  2293. ;----------------------------------------------------
  2294. _prt_menu
  2295.         ld bc,0
  2296. _mnpos: equ $-2        
  2297.         call _pradd_p
  2298. .m1:
  2299.         ld a,(hl)
  2300.         inc hl
  2301.         and a
  2302.         RET Z
  2303.         cp 1
  2304.         JR Z,.m2
  2305.         PUSH HL
  2306.         CALL _type_p
  2307.         POP HL
  2308.         JR .m1
  2309. .m2:
  2310.         LD A,(_mnpos+1)
  2311.         INC A
  2312.         LD (_mnpos+1),A
  2313.         JR _prt_menu
  2314.  
  2315. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2316. _sel_menu:
  2317.         ld a,0
  2318. CUR_POS EQU $-1
  2319.  
  2320.         ld hl,MENUCURHELPER_MAINMNU
  2321.         call sel_word
  2322.         ld (SELS4),hl
  2323.  
  2324.         call show_hand
  2325. ;         ld hl,0xD691 ;+320+160   ;- left top corner of menus
  2326. ;         and a
  2327. ;         jr z,_sel_m_skip_c
  2328. ;         ld bc,320
  2329. ; _sel_menu_clc:
  2330. ;         add hl,bc
  2331. ;         dec a
  2332. ;         jr nz,_sel_menu_clc
  2333. ; _sel_m_skip_c:
  2334. ;        ld (SEL_S),hl
  2335.  
  2336. ;        call _highlight_selected
  2337. _sel_wait_loop:
  2338.         call waitkey
  2339.  
  2340.         cp key_up
  2341.         jr z,_sel_move_up
  2342.         cp key_down
  2343.         jr z,_sel_move_down
  2344.         cp key_enter
  2345.         jr z,_sel_sel_key
  2346.         cp ' '
  2347.         jr z,_sel_sel_key
  2348.         cp key_esc
  2349.         jr z,_sel_esc_key
  2350.         jr _sel_wait_loop
  2351.  
  2352. _sel_move_down
  2353.         ld hl,(SELS4)
  2354.   ;      call _highlight_selected        
  2355.         call restore_hand
  2356.         ld hl,CUR_POS
  2357.         ld a,(hl)
  2358.         cp 0
  2359. DOWN_LIMIT EQU $-1        
  2360.         jp nc,_sel_menu
  2361.         inc (hl)
  2362.         jp _sel_menu
  2363.  
  2364. _sel_move_up
  2365.         ld hl,(SELS4)
  2366. ;        call _highlight_selected        
  2367.         call restore_hand
  2368.         ld hl,CUR_POS
  2369.         ld a,(hl)
  2370.         and a
  2371.         jp z,_sel_menu
  2372.         dec (HL)
  2373.         jp _sel_menu
  2374. _sel_sel_key:
  2375.         ld hl,(SELS4)
  2376. ;        call _highlight_selected
  2377.         call restore_hand
  2378.         ld a,(CUR_POS)
  2379.         ret
  2380.  
  2381. _sel_esc_key:
  2382. SEL_L  
  2383.         ld hl,(SELS4)
  2384. ;        call _highlight_selected
  2385.         call restore_hand
  2386.         ld a,0xff
  2387.         ret
  2388.  
  2389. ;--------------------------------------
  2390. ;in hl adress in screen
  2391. _highlight_selected
  2392. ;LINE1
  2393.         push de
  2394.         push hl
  2395.         call storec000
  2396.         pop hl
  2397.  
  2398.         LD A,0
  2399. _line_lenght equ $-1
  2400.         LD [LINELEN],A
  2401.         LD [LINELEN0],A
  2402.         LD [LINELEN1],A
  2403.         LD [LINELEN2],A
  2404.  
  2405.          LD [LINE1_1],HL
  2406.          set 5,h
  2407.          LD [LINE1_2],HL
  2408.  
  2409.          ld a,(user_scr0_high)
  2410.          SETPGC000
  2411.  
  2412.          LD HL,0
  2413. LINE1_1  EQU $-2
  2414.          LD B,8
  2415. 0        PUSH BC,HL
  2416.          LD B,6
  2417. LINELEN EQU $-1
  2418. 1        LD A,(HL)
  2419.           xor %00010010;0xff ;XOR %00010010
  2420.          LD (HL),A
  2421.          INC HL
  2422.          DJNZ 1B
  2423.          POP HL
  2424.          CALL DHL
  2425.          POP BC
  2426.          DJNZ 0B
  2427.          LD HL,0
  2428. LINE1_2  EQU $-2
  2429.          LD B,8
  2430. 0        PUSH BC,HL
  2431.          LD B,6
  2432. LINELEN0 EQU $-1
  2433. 1        LD A,(HL)
  2434.          xor %00010010;0xff ;XOR %00010010
  2435.          LD (HL),A
  2436.          INC HL
  2437.          DJNZ 1B
  2438.          POP HL
  2439.          CALL DHL
  2440.          POP BC
  2441.          DJNZ 0B
  2442.  
  2443.          ld a,(user_scr0_low)
  2444.          SETPGC000
  2445.  
  2446.          LD HL,(LINE1_1)
  2447.          LD B,8
  2448. 0        PUSH BC,HL
  2449.          LD B,6
  2450. LINELEN1 EQU $-1
  2451. 1        LD A,(HL)
  2452.          xor %00010010;0xff ;XOR %00010010
  2453.          LD (HL),A
  2454.          INC HL
  2455.          DJNZ 1B
  2456.          POP HL
  2457.          CALL DHL
  2458.          POP BC
  2459.          DJNZ 0B
  2460.  
  2461.          LD HL,[LINE1_2]
  2462.          LD B,8
  2463. 0        PUSH BC,HL
  2464.          LD B,6
  2465. LINELEN2 EQU $-1
  2466. 1        LD A,(HL)
  2467.          xor %00010010;0xff ;XOR %00010010
  2468.          LD (HL),A
  2469.          INC HL
  2470.          DJNZ 1B
  2471.          POP HL
  2472.          CALL DHL
  2473.          POP BC
  2474.          DJNZ 0B
  2475.  
  2476.          call restorec000
  2477.          pop de
  2478.          ret
  2479. ;;;;;;;;;;;;;;;;;;;;;;
  2480. _pre_menu_store_bgnd:
  2481.         push af
  2482.         push hl
  2483.         ;#d680
  2484.         call store8000c000
  2485.  
  2486.         ld a,(src_buf1)
  2487.         SETPG8000
  2488.  
  2489.         ld a,(user_scr0_low)
  2490.         SETPGC000
  2491.  
  2492.         ld hl,0xd680-320
  2493.         ld de,0x8000
  2494.         ld bc,320*8
  2495.         ldir
  2496.  
  2497.         ld hl,0xf680-320
  2498.         ld bc,320*8
  2499.         ldir
  2500.  
  2501.  
  2502.         ld a,(user_scr0_high)
  2503.         SETPGC000
  2504.         ld hl,0xd680-320
  2505.         ld bc,320*8
  2506.         ldir
  2507.  
  2508.         ld hl,0xf680-320
  2509.         ld bc,320*8
  2510.         ldir
  2511.  
  2512.         call restore8000c000
  2513.         pop hl
  2514.         pop af
  2515.         ret
  2516. _pre_menu_restore_bgnd:
  2517.         push af
  2518.         push hl
  2519.         ;#d680
  2520.         call store8000c000
  2521.  
  2522.         ld a,(src_buf1)
  2523.         SETPG8000
  2524.  
  2525.         ld a,(user_scr0_low)
  2526.         SETPGC000
  2527.  
  2528.         ld hl,0x8000
  2529.         ld de,0xd680-320
  2530.         ld bc,320*8
  2531.         ldir
  2532.  
  2533.         ld de,0xf680-320
  2534.         ld bc,320*8
  2535.         ldir
  2536.  
  2537.         ld a,(user_scr0_high)
  2538.         SETPGC000
  2539.         ld de,0xd680-320
  2540.         ld bc,320*8
  2541.         ldir
  2542.  
  2543.         ld de,0xf680-320
  2544.         ld bc,320*8
  2545.         ldir
  2546.         call restore8000c000        
  2547.         pop hl
  2548.         pop af
  2549.         ret
  2550. ;;;;;;;;;;;;;;;;;;;;;;
  2551. DECR_SPR:
  2552.  
  2553.         ld a,0
  2554. XPOS    EQU $-1
  2555.         SRL A
  2556.         jr nc,xpos1
  2557.         inc a
  2558. xpos1:        
  2559.         ld c,a
  2560.         ld b,0
  2561.  
  2562.  
  2563.         ld (decrspr_offset),bc
  2564.  
  2565.         and a
  2566.         ld hl,30
  2567.         SBC hl,bc
  2568.         ld (dcrspr_len),hl
  2569.  
  2570.         call store8000c000
  2571.  
  2572.         ld a,(scr_buf1)
  2573.         SETPG8000
  2574.         ld a,(load_buf1)
  2575.         SETPGC000
  2576.  
  2577.         ld bc,(decrspr_offset)
  2578.         ld hl,0xc005
  2579.         add hl,bc
  2580.         ld de,0x8005
  2581.  
  2582.         ld b,148
  2583. decr_spr_lp1:
  2584.         push bc
  2585.  
  2586.         push hl
  2587.         push de
  2588.  
  2589.         ld bc,(dcrspr_len)
  2590.         call _iob
  2591.  
  2592.         pop hl ; (de)
  2593.         call DHL
  2594.         ex de,hl
  2595.         pop hl
  2596.         call DHL
  2597.  
  2598.         pop bc
  2599.         djnz decr_spr_lp1
  2600.  
  2601.  
  2602.         ld bc,(decrspr_offset)
  2603.         ld hl,0xe005
  2604.         add hl,bc
  2605.         ld de,0xa005
  2606.  
  2607.         ld b,148
  2608. decr_spr_lp2:
  2609.         push bc
  2610.  
  2611.         push hl
  2612.         push de
  2613.  
  2614.         ld bc,(dcrspr_len)
  2615.         call _iob
  2616.  
  2617.         pop hl ; (de)
  2618.         call DHL
  2619.         ex de,hl
  2620.         pop hl
  2621.         call DHL
  2622.  
  2623.         pop bc
  2624.         djnz decr_spr_lp2
  2625.  
  2626.  
  2627.         ld a,(scr_buf2)
  2628.         SETPG8000
  2629.         ld a,(load_buf2)
  2630.         SETPGC000
  2631.  
  2632.         ld bc,(decrspr_offset)
  2633.         ld hl,0xc005
  2634.         add hl,bc
  2635.         ld de,0x8005
  2636.  
  2637.         ld b,148
  2638. decr_spr_lp3:
  2639.         push bc
  2640.  
  2641.         push hl
  2642.         push de
  2643.  
  2644.         ld bc,(dcrspr_len)
  2645.         call _iob
  2646.  
  2647.         pop hl ; (de)
  2648.         call DHL
  2649.         ex de,hl
  2650.         pop hl
  2651.         call DHL
  2652.  
  2653.         pop bc
  2654.         djnz decr_spr_lp3
  2655.  
  2656.  
  2657.         ld bc,(decrspr_offset)
  2658.         ld hl,0xe005
  2659.         add hl,bc
  2660.         ld de,0xa005
  2661.  
  2662.         ld b,148
  2663. decr_spr_lp4:
  2664.         push bc
  2665.  
  2666.         push hl
  2667.         push de
  2668.  
  2669.         ld bc,(dcrspr_len)
  2670.         call _iob
  2671.  
  2672.         pop hl ; (de)
  2673.         call DHL
  2674.         ex de,hl
  2675.         pop hl
  2676.         call DHL
  2677.  
  2678.         pop bc
  2679.         djnz decr_spr_lp4
  2680.  
  2681.         jp restore8000c000
  2682. decrspr_offset dw 0 ;offset to draw sprite
  2683. dcrspr_len dw 0      ; cutted length
  2684. ;-----------------------
  2685. anim_wait:
  2686.         LD      A,0
  2687.         INC     A
  2688.         AND     3
  2689.         LD      (anim_wait+1),A
  2690.         RET     NZ
  2691.  
  2692.         call store8000c000
  2693.  
  2694.         ld a,(user_scr0_low)
  2695.         SETPG8000
  2696.  
  2697.         ld a,(user_scr0_high)
  2698.         SETPGC000
  2699.  
  2700.        
  2701.         ld hl,PUSH_DATA
  2702.         ld de,0x9e23-160+1
  2703.  
  2704.         ld a,0
  2705. FASE    equ $-1
  2706.  
  2707.         add a,a;x2
  2708.         add a,a;x4
  2709.         add a,a;x8
  2710.         add a,a;x16
  2711.         add a,a;x32
  2712.         ld c,a
  2713.         ld b,0
  2714.         add hl,bc        
  2715.        
  2716.         ex de,hl
  2717.      
  2718.         ld b,1
  2719.         ld c,8
  2720.         call export_cursor_uni
  2721.  
  2722.  
  2723. ;         push hl
  2724. ;         ld b,8
  2725. ; export_push_iloop1:
  2726. ;         ld a,(de)
  2727. ;         ld (hl),a
  2728. ;         call DHL
  2729. ;         inc de
  2730. ;         djnz export_push_iloop1
  2731. ;         pop hl
  2732.  
  2733. ;         set 6,H
  2734. ;         push hl
  2735. ;         ld b,8
  2736. ; export_push_iloop2:
  2737. ;         ld a,(de)
  2738. ;         ld (hl),a
  2739. ;         call DHL
  2740. ;         inc de
  2741. ;         djnz export_push_iloop2
  2742. ;         pop hl
  2743.  
  2744. ;         res 6,H
  2745. ;         set 5,H
  2746.  
  2747. ;         push hl
  2748. ;         ld b,8
  2749. ; export_push_iloop3:
  2750. ;         ld a,(de)
  2751. ;         ld (hl),a
  2752. ;         call DHL
  2753. ;         inc de
  2754. ;         djnz export_push_iloop3
  2755. ;         pop hl
  2756.  
  2757. ;         set 6,H
  2758.  
  2759. ;         ld b,8
  2760. ; export_push_iloop4:
  2761. ;         ld a,(de)
  2762. ;         ld (hl),a
  2763. ;         call DHL
  2764. ;         inc de
  2765. ;         djnz export_push_iloop4
  2766. dbbg:
  2767.         ld a,(FASE)
  2768.         inc a
  2769.                 ;and 7
  2770.         cp 6
  2771.         jr nz,export_push_iloop6      
  2772.         xor a
  2773. export_push_iloop6:
  2774.         ld (FASE),a
  2775.  
  2776.         jp restore8000c000
  2777. ;-----------------------------
  2778. import_cursor_uni:
  2779.         ld b,2    ;2ї8
  2780. .l0:
  2781.         push bc
  2782.  
  2783.  
  2784.         push hl
  2785.         ld b,16
  2786. .l1:
  2787.         ld a,(hl)
  2788.         ld (de),a
  2789.         call DHL
  2790.         inc de
  2791.         djnz .l1
  2792.         pop hl
  2793.  
  2794.         set 6,H
  2795.         push hl
  2796.         ld b,16
  2797. .l2:
  2798.         ld a,(hl)
  2799.         ld (de),a
  2800.         call DHL
  2801.         inc de
  2802.         djnz .l2
  2803.         pop hl
  2804.  
  2805.         res 6,H
  2806.         set 5,H
  2807.  
  2808.         push hl
  2809.         ld b,16
  2810. .l3:
  2811.         ld a,(hl)
  2812.         ld (de),a
  2813.         call DHL
  2814.         inc de
  2815.         djnz .l3
  2816.         pop hl
  2817.  
  2818.         set 6,H
  2819.         push hl
  2820.         ld b,16
  2821. .l4:
  2822.         ld a,(hl)
  2823.         ld (de),a
  2824.         call DHL
  2825.         inc de
  2826.         djnz .l4
  2827.         pop hl
  2828.  
  2829.         res 6,H
  2830.         res 5,H
  2831.         inc hl
  2832.  
  2833.         pop bc
  2834.         djnz .l0
  2835.         ret
  2836. ;-----------------------------
  2837. export_cursor_uni:
  2838.        ;b - columns
  2839.        ;c - lines
  2840.        ;ld b,2
  2841. .lp0:
  2842.         push bc
  2843.  
  2844.         push hl
  2845.         ld b,c;16
  2846. .lp1:
  2847.         call _iob_byte
  2848.         call DHL
  2849.         inc de
  2850.         djnz .lp1
  2851.         pop hl
  2852.         set 6,H
  2853.  
  2854.         push hl
  2855.         ld b,c;16
  2856. .lp2:
  2857.         call _iob_byte
  2858.         call DHL
  2859.         inc de
  2860.         djnz .lp2
  2861.         pop hl
  2862.         res 6,H
  2863.         set 5,H
  2864.  
  2865.         push hl
  2866.         ld b,c;16
  2867. .lp3:
  2868.         call _iob_byte
  2869.         call DHL
  2870.         inc de
  2871.         djnz .lp3
  2872.         pop hl
  2873.         set 6,H
  2874.        
  2875.         push hl
  2876.         ld b,c;16
  2877. .lp4:
  2878.         call _iob_byte
  2879.         call DHL
  2880.         inc de
  2881.         djnz .lp4
  2882.  
  2883.         pop hl
  2884.         res 6,H
  2885.         res 5,H
  2886.         inc hl
  2887.  
  2888.         pop bc
  2889.         djnz .lp0
  2890.         ret
  2891. ;-----------------------------
  2892. restore_hand:
  2893.         call store8000c000
  2894.         push hl,bc,de
  2895.  
  2896.         ld a,(user_scr0_low)
  2897.         SETPG8000
  2898.  
  2899.         ld a,(user_scr0_high)
  2900.         SETPGC000
  2901.  
  2902.         ld de,CUR_BGND_STORE
  2903.        
  2904.         ld hl,(SELS4)
  2905.         ld b,2
  2906.         ld c,16
  2907.  
  2908.  
  2909.  
  2910. .lp0:
  2911.         push bc
  2912.  
  2913.         push hl
  2914.         ld b,c;16
  2915. .lp1:
  2916.         ld a,(de)
  2917.         ld (hl),a
  2918.         call DHL
  2919.         inc de
  2920.         djnz .lp1
  2921.         pop hl
  2922.         set 6,H
  2923.  
  2924.         push hl
  2925.         ld b,c;16
  2926. .lp2:
  2927.         ld a,(de)
  2928.         ld (hl),a
  2929.         call DHL
  2930.         inc de
  2931.         djnz .lp2
  2932.         pop hl
  2933.         res 6,H
  2934.         set 5,H
  2935.  
  2936.         push hl
  2937.         ld b,c;16
  2938. .lp3:
  2939.         ld a,(de)
  2940.         ld (hl),a
  2941.         call DHL
  2942.         inc de
  2943.         djnz .lp3
  2944.         pop hl
  2945.         set 6,H
  2946.        
  2947.         push hl
  2948.         ld b,c;16
  2949. .lp4:
  2950.         ld a,(de)
  2951.         ld (hl),a
  2952.         call DHL
  2953.         inc de
  2954.         djnz .lp4
  2955.  
  2956.         pop hl
  2957.         res 6,H
  2958.         res 5,H
  2959.         inc hl
  2960.  
  2961.         pop bc
  2962.         djnz .lp0
  2963.  
  2964.  
  2965.  
  2966.         pop de,bc,hl        
  2967.         jp restore8000c000  
  2968.  
  2969. show_hand:
  2970. ; hl - sprite position
  2971.  
  2972.         call store8000c000
  2973.  
  2974.         push hl,bc,de
  2975.  
  2976.         ld a,(user_scr0_low)
  2977.         SETPG8000
  2978.  
  2979.         ld a,(user_scr0_high)
  2980.         SETPGC000
  2981.  
  2982.        
  2983.         ld de,CUR_BGND_STORE
  2984.  
  2985.         push hl        
  2986.         call import_cursor_uni
  2987.         pop hl
  2988.    
  2989.         ld de,CUR_DATA
  2990.         ;hl - cursor screen addr
  2991.         ;de - cursor data
  2992.         ld b,2
  2993.         ld c,16
  2994.         call export_cursor_uni  
  2995.  
  2996.  
  2997.  
  2998.         pop de,bc,hl
  2999.  
  3000.         jp restore8000c000
  3001.  
  3002.  
  3003. ;---
  3004. ;in hl - x-coord 0-319
  3005. ;;out hl -adress in 8000 - ffff atm2 ega screen (x-offset)
  3006. p_calc_x:
  3007.         and a
  3008.         rr h
  3009.         rr l
  3010.         ld a,l
  3011.         rrca
  3012.         rrca
  3013.         ld h,0
  3014.         and a
  3015.         push af
  3016.         rla
  3017.         rr h
  3018.         rla
  3019.         rr h
  3020.         scf
  3021.         rr h
  3022.         pop af
  3023.         and 0x3f
  3024.         ld l,a
  3025.         ret
  3026. ;=============================================      
  3027. ;in hl - x-adress in atm2 ega screen
  3028. ;   a - y coord - 0-199
  3029. ;;out hl -adress in 8000 - ffff atm2 ega screen (xy offset)
  3030. p_calc_y:
  3031.         ld bc,40
  3032. p_calc_y_loop:
  3033.         and a
  3034.         ret z
  3035.         add hl,bc
  3036.         dec a
  3037.         jr p_calc_y_loop        
  3038. ;=============================================      
  3039. p_nextcolumn:
  3040.         bit 6,h
  3041.         set 6,h
  3042.         jr z,1f;shapes_linehorR_incxok
  3043.         ld a,h
  3044.         xor 0x60
  3045.         ld h,a
  3046.         and 0x20
  3047.         jr nz,1f;shapes_linehorR_incxok
  3048.         inc hl
  3049. 1 ;shapes_linehorR_incxok
  3050.     ret
  3051. ;---------------------------------------
  3052. _scr_move_
  3053.         ;TODO
  3054.         ;prepare screen
  3055.         ;*** copy screen to second screen
  3056.         call store8000c000
  3057.                 xor a
  3058.                 ld (mask_mode),a
  3059.  
  3060.                 ld a,(user_scr0_low)
  3061.                 SETPG8000
  3062.                 ld a,(user_scr1_low)
  3063.                 SETPGC000
  3064.  
  3065.                 ld hl,0x8000
  3066.                 ld de,0xc000
  3067.                 ld bc,8000
  3068.                 ldir
  3069.                 ld hl,0xa000
  3070.                 ld de,0xe000
  3071.                 ld bc,8000
  3072.                 ldir
  3073.  
  3074.                 ld a,(user_scr0_high)
  3075.                 SETPG8000
  3076.                 ld a,(user_scr1_high)
  3077.                 SETPGC000
  3078.  
  3079.                 ld hl,0x8000
  3080.                 ld de,0xc000
  3081.                 ld bc,8000
  3082.                 ldir
  3083.                 ld hl,0xa000
  3084.                 ld de,0xe000
  3085.                 ld bc,8000
  3086.                 ldir
  3087.  
  3088.        
  3089.         xor a
  3090.         ld (active_scr),a
  3091.  
  3092.  
  3093.         ld a,(_todown_y)
  3094.         and a
  3095.         jp nz,_scr_move_down
  3096.         ld a,(_toup_y)
  3097.         and a
  3098.         jp nz,_scr_move_up
  3099.         ld a,(_toright_x)
  3100.         and a
  3101.         jp nz,_scr_move_right
  3102.         ld a,(_toleft_x)
  3103.         and a
  3104.         jp nz,_scr_move_left
  3105.         ret
  3106. active_scr:   db 0     ;¤ъЁрэ ъюЄюЁ√щ юЄюсЁрцрхЄё  (чряшё№ шф╕Є эр тЄюЁющ ¤ъЁрэ)
  3107.  
  3108. ;b - counter vert lines
  3109. ;hl - source (loaded scr)
  3110. ;de - dest  (scr) (mention about +320 vert offset)
  3111. set_scr_low:
  3112.         ld a,(active_scr)
  3113.         and a
  3114.         jr nz,.spl1
  3115.           ld a,(user_scr1_low)  ;ld a,(user_scr1_low)
  3116.          SETPGC000
  3117.          ret
  3118. .spl1:
  3119.         ld a,(user_scr0_low)
  3120.         SETPGC000
  3121.         ret
  3122.  
  3123. set_scr_high:
  3124.         ld a,(active_scr)
  3125.         and a
  3126.         jr nz,.spl1
  3127.           ld a,(user_scr1_high) ;ld a,(user_scr1_high)
  3128.          SETPGC000
  3129.          ret
  3130. .spl1:
  3131.         ld a,(user_scr0_high)
  3132.         SETPGC000
  3133.         ret
  3134.  
  3135.  
  3136. copy_i_line:
  3137. .lp:
  3138.         ld a,b
  3139.         and a
  3140.         ret z
  3141.         push bc
  3142.  
  3143.         call _ldi_30
  3144.  
  3145.         ld bc,10
  3146.         add hl,bc
  3147.  
  3148.         ex de,hl
  3149.         add hl,bc
  3150.         ex de,hl
  3151.  
  3152.         pop bc
  3153.  
  3154.         djnz .lp
  3155.         ret    
  3156.  
  3157.  
  3158.  
  3159.  
  3160.  
  3161.  
  3162.  
  3163. s_move_adr1:  dw 0
  3164.  
  3165. s_move_lines1: db 0
  3166. s_move_lines2: db 0
  3167. ;--------------------------------------------------
  3168. _scr_move_up:
  3169.         ld hl,0x8005+5920; second line
  3170.         ld (s_move_adr1),hl
  3171.         ld a,0
  3172.         ld (s_move_lines1),a
  3173.         ld a,148
  3174.         ld (s_move_lines2),a
  3175.         ld hl,-80  ;-40
  3176.         ld a,0x3c          ;inc a
  3177.         ld b,0x3d          ;dec a
  3178.         jr _scr_move_ud
  3179.  
  3180. ;------
  3181. _scr_move_down:
  3182.         ;init
  3183.         ld hl,0x8005; second line
  3184.         ld (s_move_adr1),hl
  3185.         ld a,148
  3186.         ld (s_move_lines1),a
  3187.         ld a,0
  3188.         ld (s_move_lines2),a
  3189.         ld hl,80 ;40
  3190.         ld a,0x3d          ;dec a
  3191.         ld b,0x3c          ;inc a
  3192. _scr_move_ud:        
  3193.         ld (.offs40),hl
  3194.         ld (.sp_opc1-1),a
  3195.         ld (.sp_opc1),a
  3196.         ld a,b
  3197.         ld (.sp_opc2-1),a
  3198.         ld (.sp_opc2),a
  3199.                 ;ld hl,0xc005+320 тёхуфр!!!
  3200.         ld b,148/2+1 ;149
  3201. .lp0:
  3202.         push bc
  3203.  
  3204.                         call set_scr_low
  3205.  
  3206.  
  3207.  
  3208.                         ld a,(mem_buf1)
  3209.                         SETPG8000
  3210.                        
  3211.  
  3212.                        
  3213.                         ld hl,(s_move_adr1)
  3214.                         ld de,0xc005+320         ;screen
  3215.  
  3216.                         ld a,(s_move_lines1)
  3217.                         ld b,a
  3218.                         push hl,de
  3219.                         call copy_i_line
  3220.                         pop de,hl
  3221.  
  3222.                         set 5,h
  3223.                         set 5,d
  3224.  
  3225.                         ld a,(s_move_lines1)
  3226.                         ld b,a
  3227.                         call copy_i_line
  3228.  
  3229.                         push de
  3230.                         ld a,(mem_buf3)
  3231.                         SETPG8000                        
  3232.                         ld hl,0xa005   ;always -begin of secondimage
  3233.                         pop de
  3234.  
  3235.                         ld a,(s_move_lines2)
  3236.                         ld b,a
  3237.                         push hl,de
  3238.                         call copy_i_line
  3239.                         pop de,hl
  3240.  
  3241.                         res 5,h
  3242.                         res 5,d
  3243.  
  3244.                         ld a,(s_move_lines2)
  3245.                         ld b,a
  3246.                         call copy_i_line
  3247.  
  3248.  
  3249.  
  3250.  
  3251.                         call set_scr_high
  3252.  
  3253.  
  3254.  
  3255.                         ld a,(mem_buf2)
  3256.                         SETPG8000
  3257.                        
  3258.                         ld hl,(s_move_adr1)
  3259.                         ld de,0xc005+320         ;screen
  3260.                         ld a,(s_move_lines1)
  3261.                         ld b,a
  3262.  
  3263.                         push hl,de
  3264.  
  3265.                         call copy_i_line
  3266.  
  3267.                         pop de,hl
  3268.                         set 5,h
  3269.                         set 5,d
  3270.  
  3271.                         ld a,(s_move_lines1)
  3272.                         ld b,a
  3273.                         call copy_i_line
  3274.  
  3275.                         push de
  3276.  
  3277.                         ld a,(mem_buf4)
  3278.                         SETPG8000                        
  3279.  
  3280.  
  3281.                         ld hl,0xa005
  3282.                         pop de
  3283.                         ld a,(s_move_lines2)
  3284.                         ld b,a
  3285.  
  3286.                         push hl,de
  3287.                         call copy_i_line
  3288.                         pop de,hl
  3289.                         res 5,h
  3290.                         res 5,d
  3291.  
  3292.                         ld a,(s_move_lines2)
  3293.                         ld b,a
  3294.                         call copy_i_line
  3295.  
  3296.  
  3297.  
  3298.  
  3299.         halt
  3300.  
  3301.         ld a,(active_scr)
  3302.         and a
  3303.         jr nz,.spl1
  3304.        
  3305.         ; active scr 0 ; show 2nd screen . set active scr1
  3306.         inc a
  3307.         ld (active_scr),a
  3308.         ld e,a
  3309.         OS_SETSCREEN
  3310.         jr .spl0
  3311. .spl1:        
  3312.         ; active scr 1 ; show 1nd screen . set active scr 0
  3313.         dec a
  3314.         ld (active_scr),a
  3315.         ld e,a
  3316.         OS_SETSCREEN
  3317.  
  3318. .spl0:
  3319.        
  3320.  
  3321.         ld a,(s_move_lines1)
  3322.         dec a
  3323.         dec a
  3324. .sp_opc1: equ $-1        
  3325.         ld (s_move_lines1),a
  3326.         ld a,(s_move_lines2)
  3327.         inc a
  3328.         inc a
  3329. .sp_opc2: equ $-1        
  3330.         ld (s_move_lines2),a
  3331.  
  3332.  
  3333.         ld hl,(s_move_adr1)
  3334.         ld bc,40
  3335. .offs40 equ $-2        
  3336.         add hl,bc
  3337.         ld (s_move_adr1),hl
  3338.  
  3339.  
  3340.         pop bc
  3341.  
  3342.         dec b
  3343.         jp nz,.lp0
  3344.                
  3345.        
  3346. eerrr0
  3347.         ld a,(active_scr)
  3348.         and a
  3349.         jr  z,.spl11
  3350.         ;copy scr1 to scr0
  3351.  
  3352.         ld a,(user_scr0_low)
  3353.         SETPG8000
  3354.         ld a,(user_scr1_low)
  3355.         SETPGC000
  3356.         ld b,148
  3357.         ld hl,0xc005+320
  3358.         ld de,0x8005+320
  3359.         call copy_i_line
  3360.  
  3361.         ld b,148
  3362.         ld hl,0xe005+320
  3363.         ld de,0xa005+320
  3364.         call copy_i_line
  3365.  
  3366.         ld a,(user_scr0_high)
  3367.         SETPG8000
  3368.         ld a,(user_scr1_high)
  3369.         SETPGC000
  3370.  
  3371.         ld b,148
  3372.         ld hl,0xc005+320
  3373.         ld de,0x8005+320
  3374.         call copy_i_line
  3375.  
  3376.         ld b,148
  3377.         ld hl,0xe005+320
  3378.         ld de,0xa005+320        
  3379.         call copy_i_line
  3380.  
  3381. .spl11:
  3382.         ld e,0
  3383.         OS_SETSCREEN
  3384.  
  3385.         jp restore8000c000        
  3386.  
  3387.  
  3388.  
  3389. s_move_base_src: dw 0
  3390.  
  3391. copy_h_line:
  3392.  
  3393.         ld a,b
  3394.         and a
  3395.         ret z
  3396.  
  3397.         push de,bc
  3398.  
  3399.         ld a,40
  3400.         sub b  
  3401.         ld b,a
  3402.  
  3403.         push hl,de
  3404.  
  3405.         ld hl,_ldi_40_noeob
  3406.         add a,a
  3407.         ld d,0
  3408.         ld e,a
  3409.         add hl,de
  3410.         ld (._ldi_routine),hl
  3411.  
  3412.         ld a,b
  3413.         ld (.mnoffs),a
  3414.  
  3415.         pop de,hl
  3416.  
  3417.  
  3418.  
  3419.         ld b,148
  3420. .inl:        
  3421.         push bc
  3422.         ld bc,.inl_r
  3423.         push bc  ;
  3424.         jp 0
  3425. ._ldi_routine    equ $-2
  3426.  
  3427. .inl_r:
  3428.         ld bc,10
  3429. .mnoffs:  equ $-2
  3430.         add hl,bc
  3431.  
  3432.         ex de,hl
  3433.         add hl,bc
  3434.         ex de,hl
  3435.  
  3436.  
  3437.  
  3438.         pop bc
  3439.         djnz .inl
  3440.  
  3441.         pop bc,hl
  3442.         ld c,b
  3443.         ld b,0
  3444.         add hl,bc
  3445.         ex de,hl
  3446.  
  3447.         ret
  3448.  
  3449.  
  3450. ;--------------------------------------------------
  3451. _scr_move_left:
  3452.         ld hl,0x8005+18  ;
  3453.         ld (s_move_base_src),hl ;src
  3454.  
  3455.  
  3456.         ld a,12 ;+1
  3457.         ld (s_move_lines1),a
  3458.         ld a,148/8  ;8 pixels per move
  3459.         ld (s_move_lines2),a
  3460.  
  3461.         ld hl,-1
  3462.         ld a,0x3c          ;inc a
  3463.         ld b,0x3d          ;dec a
  3464.         jr _scr_move_lr        
  3465. _scr_move_right:
  3466.         ;a = vert counter
  3467.  
  3468.         ld hl,0x8005  ;
  3469.         ld (s_move_base_src),hl ;src
  3470.  
  3471.  
  3472.         ld a,240/8 ;+1
  3473.         ld (s_move_lines1),a
  3474.         ld a,0  ;8 pixels per move
  3475.         ld (s_move_lines2),a
  3476.  
  3477.         ld hl,1
  3478.         ld a,0x3d          ;dec a
  3479.         ld b,0x3c          ;inc a
  3480.  
  3481. _scr_move_lr:        
  3482.         ld (.offs40),hl
  3483.         ld (.sp_opc1),a
  3484.         ld a,b
  3485.         ld (.sp_opc2),a
  3486.  
  3487.  
  3488.         ld b,148/8+1
  3489. .lp0:        
  3490.         push bc
  3491.  
  3492.                 call set_scr_low
  3493.  
  3494.                 ld a,(mem_buf1)
  3495.                 SETPG8000
  3496.  
  3497.                 ld de,0xc005+320   ;0xc005 +320 for real
  3498.                 ld hl,(s_move_base_src)
  3499.  
  3500.                 ld a,(s_move_lines1)
  3501.                 ld b,a
  3502.                 push hl,de
  3503.                 call copy_h_line
  3504.                 pop de,hl
  3505.  
  3506.  
  3507.                 set 5,h
  3508.                 set 5,d
  3509.  
  3510.                 ld a,(s_move_lines1)
  3511.                 ld b,a
  3512.                 call copy_h_line
  3513.  
  3514.  
  3515.                         push de
  3516.                         ld a,(mem_buf3)
  3517.                         SETPG8000                        
  3518.                         ld hl,0xa005   ;always -begin of secondimage
  3519.                         pop de
  3520.  
  3521.                         ld a,(s_move_lines2)
  3522.                         ld b,a
  3523.                         push hl,de
  3524.                         call copy_h_line
  3525.                         pop de,hl
  3526.  
  3527.                         res 5,h
  3528.                         res 5,d
  3529.  
  3530.                         ld a,(s_move_lines2)
  3531.                         ld b,a
  3532.                         call copy_h_line
  3533.  
  3534.  
  3535.                         call set_scr_high
  3536.  
  3537.  
  3538.  
  3539.                         ld a,(mem_buf2)
  3540.                         SETPG8000
  3541.                        
  3542.                         ld hl,(s_move_base_src)
  3543.                         ld de,0xc005+320         ;screen
  3544.                         ld a,(s_move_lines1)
  3545.                         ld b,a
  3546.  
  3547.                         push hl,de
  3548.  
  3549.                         call copy_h_line
  3550.  
  3551.                         pop de,hl
  3552.                         set 5,h
  3553.                         set 5,d
  3554.  
  3555.                         ld a,(s_move_lines1)
  3556.                         ld b,a
  3557.                         call copy_h_line
  3558.  
  3559.                         push de
  3560.  
  3561.                         ld a,(mem_buf4)
  3562.                         SETPG8000                        
  3563.  
  3564.  
  3565.                         ld hl,0xa005
  3566.                         pop de
  3567.                         ld a,(s_move_lines2)
  3568.                         ld b,a
  3569.  
  3570.                         push hl,de
  3571.                         call copy_h_line
  3572.                         pop de,hl
  3573.                         res 5,h
  3574.                         res 5,d
  3575.  
  3576.                         ld a,(s_move_lines2)
  3577.                         ld b,a
  3578.                         call copy_h_line
  3579.  
  3580.  
  3581.         halt
  3582.  
  3583.         ld a,(active_scr)
  3584.         and a
  3585.         jr nz,.spl1
  3586.        
  3587.         ; active scr 0 ; show 2nd screen . set active scr1
  3588.         inc a
  3589.         ld (active_scr),a
  3590.         ld e,a
  3591.         OS_SETSCREEN
  3592.         jr .spl0
  3593. .spl1:        
  3594.         ; active scr 1 ; show 1nd screen . set active scr 0
  3595.         dec a
  3596.         ld (active_scr),a
  3597.         ld e,a
  3598.         OS_SETSCREEN
  3599.  
  3600. .spl0:
  3601.        
  3602.  
  3603.         ld a,(s_move_lines1)
  3604.         dec a
  3605. .sp_opc1: equ $-1        
  3606.         ld (s_move_lines1),a
  3607.         ld a,(s_move_lines2)
  3608.         inc a
  3609. .sp_opc2: equ $-1        
  3610.         ld (s_move_lines2),a
  3611.  
  3612.  
  3613.         ld hl,(s_move_base_src)
  3614.         ld bc,1
  3615. .offs40 equ $-2        
  3616.         add hl,bc
  3617.         ld (s_move_base_src),hl
  3618.  
  3619.  
  3620.         pop bc
  3621.  
  3622.         dec b
  3623.         jp nz,.lp0
  3624.                
  3625.        
  3626.  
  3627.         ld a,(active_scr)
  3628.         and a
  3629.         jr  z,.spl11
  3630.         ;copy scr1 to scr0
  3631.  
  3632.         ld a,(user_scr0_low)
  3633.         SETPG8000
  3634.         ld a,(user_scr1_low)
  3635.         SETPGC000
  3636.         ld b,148
  3637.         ld hl,0xc005+320
  3638.         ld de,0x8005+320
  3639.         call copy_i_line
  3640.  
  3641.         ld b,148
  3642.         ld hl,0xe005+320
  3643.         ld de,0xa005+320
  3644.         call copy_i_line
  3645.  
  3646.         ld a,(user_scr0_high)
  3647.         SETPG8000
  3648.         ld a,(user_scr1_high)
  3649.         SETPGC000
  3650.  
  3651.         ld b,148
  3652.         ld hl,0xc005+320
  3653.         ld de,0x8005+320
  3654.         call copy_i_line
  3655.  
  3656.         ld b,148
  3657.         ld hl,0xe005+320
  3658.         ld de,0xa005+320        
  3659.         call copy_i_line
  3660.  
  3661. .spl11:
  3662.         ld e,0
  3663.         OS_SETSCREEN
  3664.  
  3665.         jp restore8000c000        
  3666.  
  3667.  
  3668. ;=====================================
  3669. _draw_box:
  3670.         push hl,bc,de
  3671.         call store8000c000
  3672.  
  3673.         ld a,(user_scr0_low) ;ok
  3674.         SETPG8000
  3675.         ld a,(user_scr0_high) ;ok
  3676.         SETPGC000
  3677.  
  3678.         ld l,10
  3679.         ld e,157
  3680.         ld hx,0b00001001 ;0b00000000 ;0b00001001;0b00111111 ;fill color byte 0bRLrrrlll
  3681. _draw_box_color: equ $-1
  3682.         ld lx,0b00000000 ;0b00001001 ;0b00000000 ;11111111 ;brush color byte 0bRLrrrlll
  3683.         ld b,44-2 ;hgt-1
  3684.         ld c,142 ;0 ;wid/2
  3685.  
  3686.  
  3687. ;l=x/2
  3688. ;e=y
  3689. ;lx=brush color byte 0bRLrrrlll
  3690. ;hx=fill color byte 0bRLrrrlll
  3691. ;b=hgt-1
  3692. ;c=wid/2
  3693.         call drawwindow
  3694.         call restore8000c000
  3695.         pop de,bc,hl
  3696.         ret
  3697.