?login_element?

Subversion Repositories NedoOS

Rev

Rev 1442 | 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. STACK=0x4000
  5. scrbase=0x8000
  6.  
  7.         macro NEXTCOLUMN
  8.         bit 6,h
  9.         set 6,h
  10.         jr z,1f;shapes_linehorR_incxok
  11.         ld a,h
  12.         xor 0x60
  13.         ld h,a
  14.         and 0x20
  15.         jr nz,1f;shapes_linehorR_incxok
  16.         inc hl
  17. 1;shapes_linehorR_incxok
  18.         endm
  19.  
  20.         org PROGSTART
  21. begin
  22.         ld sp,STACK
  23.         OS_HIDEFROMPARENT
  24.  
  25.         ld e,0
  26.         OS_SETGFX ;e=0:EGA, e=2:MC, e=3:6912, e=6:text ;+SET FOCUS ;e=-1: disable gfx (out: e=old gfxmode)
  27.        
  28.         ld e,0 ;color byte 0bRLrrrlll
  29.         OS_CLS
  30.        
  31.         ld a,(user_scr0_low) ;ok
  32.         SETPG32KLOW
  33.         ld a,(user_scr0_high) ;ok
  34.         SETPG32KHIGH
  35.        
  36. ;01          89          01    ;low+0x0000
  37. ;   23          ab          23 ;high+0x0000
  38. ;      45          cd          ;low+0x2000
  39. ;         67          ef       ;high+0x2000
  40.  
  41.         ;ld hl,0x8000
  42.         ;ld b,10
  43.         ;ld c,0xff        
  44. ;hl=scraddr
  45. ;c=color byte 0bRLrrrlll
  46. ;b=wid/2
  47.         ;call drawhorline
  48.         ;jr $
  49.        
  50.         ld l,1
  51.         ld e,10
  52.         ld hx,0b00111111 ;fill color byte 0bRLrrrlll
  53.         ld lx,0b00000000 ;11111111 ;brush color byte 0bRLrrrlll
  54.         ld b,100-1 ;hgt-1
  55.         ld c,159 ;wid/2
  56. ;l=x/2
  57. ;e=y
  58. ;lx=brush color byte 0bRLrrrlll
  59. ;hx=fill color byte 0bRLrrrlll
  60. ;b=hgt-1
  61. ;c=wid/2
  62.         call drawwindow
  63.        
  64.         jr $
  65.        
  66.         QUIT
  67.  
  68. xytoscraddr
  69. ;l=x/2
  70. ;e=y (не портится)
  71. ;screen pages are mapped in 2 CPU windows
  72. ;addr = tY(y) + tX(x)
  73.         ld h,tx/256
  74.         ld d,ty/256
  75.         ld a,(de) ;(y*40)
  76.         add a,(hl) ;x div 4
  77.         ld (xytoscraddr_l),a
  78.         inc d
  79.         inc h
  80.         ld a,(de) ;'(y*40)
  81.         adc a,(hl) ;f(x mod 4)
  82.         ld h,a
  83. xytoscraddr_l=$+1
  84.         ld l,0
  85.         ret
  86.  
  87.         if 1==0
  88. prpixel
  89. ;bc=x (не портится)
  90. ;e=y (не портится)
  91. ;screen pages are mapped in 2 CPU windows
  92. ;addr = tY(y) + tX(x)
  93.         push bc
  94.         ld a,b
  95.         rra
  96.         ld a,c
  97.         rra
  98.         ld l,a
  99.         ;ld d,ty/256
  100.         ;ld h,tx/256
  101.         ld a,(de) ;(y*40)
  102.         jr c,prpixel_r
  103.         add a,(hl) ;x div 4
  104.         ld c,a
  105.         inc d
  106.         inc h
  107.         ld a,(de) ;'(y*40)
  108.         adc a,(hl) ;f(x mod 4)
  109.         ld b,a
  110.         ld a,(bc)
  111.         and 0xb8 ;keep right pixel ;иначе надо cls перед redraw
  112. prpixel_color_l=$+1
  113.         or 0;lx
  114.         ld (bc),a
  115.         dec h
  116.         dec d
  117.         pop bc
  118.         ret
  119. prpixel_r
  120.         add a,(hl) ;x div 4
  121.         ld c,a
  122.         inc d
  123.         inc h
  124.         ld a,(de) ;'(y*40)
  125.         adc a,(hl) ;f(x mod 4)
  126.         ld b,a
  127.         ld a,(bc)
  128.         and 0x47 ;keep left pixel ;иначе надо cls перед redraw
  129. prpixel_color_r=$+1
  130.         or 0;lx
  131.         ld (bc),a
  132.         dec h
  133.         dec d
  134.         pop bc
  135.         ret
  136.         endif
  137.  
  138. drawwindow
  139. ;l=x/2
  140. ;e=y
  141.         ld hy,e
  142.         ld a,l
  143.         ld ly,a
  144. ;ly=x/2
  145. ;hy=y
  146.         call xytoscraddr
  147. ;hl=screen addr
  148. ;lx=brush color byte 0bRLrrrlll
  149. ;hx=fill color byte 0bRLrrrlll
  150. ;b=hgt-1
  151. ;c=wid/2
  152.         push bc
  153.         push hl
  154.        
  155. drawwindowfill0
  156.         push bc
  157.         push hl
  158.         ld c,hx ;ld c,0b11111111 ;color byte 0bRLrrrlll
  159.         call drawverline
  160.         pop hl
  161.         NEXTCOLUMN
  162.         pop bc
  163.         dec c
  164.         jr nz,drawwindowfill0
  165.        
  166.         pop hl ;screen addr
  167.         pop bc
  168.  
  169.         push bc
  170.  
  171.         push bc
  172.         push hl
  173.         call drawbox
  174.         pop hl
  175.         pop bc
  176.         NEXTCOLUMN
  177.         ld de,40*2
  178.         add hl,de ;второй бокс внутри первого
  179.         dec c
  180.         dec c
  181.         ld a,b
  182.         sub 4
  183.         ld b,a
  184.         call drawbox
  185.        
  186.         pop bc ;b=hgt-1, c=wid/2
  187.        
  188. ;ly=x/2
  189. ;hy=y
  190.         ld e,hy
  191.         inc e
  192.         call drawwindowhormarks
  193.        
  194.         ld a,hy
  195.         add a,b ;+hgt-1
  196.         dec a
  197.         ld e,a
  198.         call drawwindowhormarks
  199.  
  200.         push bc
  201.         call drawwindowvermarks
  202.         pop bc
  203.         ld a,ly
  204.         add a,c ;wid/2
  205.         dec a
  206.         ld ly,a
  207.         call drawwindowvermarks
  208.        
  209.         ret
  210.        
  211. drawwindowvermarks
  212. ;ly=x/2
  213. ;hy=y
  214. ;b=hgt-1
  215. ;lx=color byte 0bRLrrrlll
  216.         ld a,ly
  217.         ld l,a
  218.         ld a,hy
  219.         add a,6
  220.         ld e,a
  221. ;l=x/2
  222. ;e=y
  223.         call xytoscraddr
  224.         ld a,lx
  225.         ld (hl),a
  226.         ld a,ly
  227.         ld l,a
  228.         ld a,hy
  229.         add a,b ;+hgt-1
  230.         sub 6
  231.         ld e,a
  232. ;l=x/2
  233. ;e=y        
  234.         call xytoscraddr
  235.         ld a,lx
  236.         ld (hl),a
  237.         ret
  238.  
  239.        
  240. drawwindowhormarks
  241. ;ly=x/2
  242. ;e=y
  243. ;c=wid/2
  244.         ld a,ly
  245.         add a,3
  246.         ld l,a
  247. ;l=x/2
  248. ;e=y
  249.         call xytoscraddr
  250.         ld a,lx
  251.         xor hx
  252.         and 0b01000111 ;color byte 0bRLrrrlll
  253.         xor hx
  254.         ld (hl),a
  255.  
  256.         ld a,ly
  257.         add a,c ;+wid/2
  258.         sub 3+1
  259.         ld l,a
  260. ;l=x/2
  261. ;e=y
  262.         call xytoscraddr
  263.         ld a,lx
  264.         xor hx
  265.         and 0b10111000 ;color byte 0bRLrrrlll
  266.         xor hx
  267.         ld (hl),a
  268.         ret
  269.        
  270.  
  271. drawbox
  272. ;hl=screen addr
  273. ;lx=color byte 0bRLrrrlll
  274. ;b=hgt-1
  275. ;c=wid/2
  276.         push bc
  277.         push hl
  278.         push bc
  279.         ld a,lx
  280.         xor hx
  281.         and 0b01000111 ;color byte 0bRLrrrlll
  282.         xor hx
  283.         ld c,a
  284.         call drawverline ;left line
  285.         pop bc
  286.         ld b,c ;wid/2
  287.         ex (sp),hl
  288.         ld c,lx ;ld c,0b11111111 ;color byte 0bRLrrrlll
  289.         push bc
  290.         call drawhorline ;top line
  291.         pop bc ;b=wid/2, c=color byte 0bRLrrrlll
  292.         ex (sp),hl ;bottom of left line
  293.         call drawhorline ;bottom line
  294.         pop hl ;rightmost byte of top line
  295.         ld de,40
  296.         add hl,de
  297.         pop bc
  298.         dec b ;b=hgt/2
  299.         ld a,lx
  300.         xor hx
  301.         and 0b10111000 ;color byte 0bRLrrrlll
  302.         xor hx
  303.         ld c,a
  304.         ;call drawverline ;right line
  305.         ;ret
  306. drawverline
  307. ;hl=scraddr
  308. ;c=color byte 0bRLrrrlll
  309. ;b=hgt
  310.         ld de,40
  311. drawverline0
  312.         ld (hl),c
  313.         add hl,de
  314.         djnz drawverline0
  315.         ret
  316.  
  317. drawhorline
  318. ;hl=scraddr
  319. ;c=color byte 0bRLrrrlll
  320. ;b=wid/2
  321.         ld de,0x4000
  322.         jr drawhorline0go
  323. drawhorline0
  324.         NEXTCOLUMN
  325. drawhorline0go
  326.         ld (hl),c
  327.         djnz drawhorline0
  328.         ret
  329.  
  330.         align 256
  331. tx
  332.         dup 256
  333.         db ($&0xff)/4
  334.         edup
  335.         dup 64
  336.         db 0x80
  337.         db 0xc0
  338.         db 0xa0
  339.         db 0xe0
  340.         edup
  341. ty
  342.         dup 200
  343.         db 0xff&(($&0xff)*40)
  344.         edup
  345.         ds 56,0xff&8000
  346.         dup 200
  347.         db (($&0xff)*40)/256
  348.         edup
  349.         ds 56,8000/256
  350.  
  351. end
  352.         savebin "gfxtest.com",begin,end-begin
  353.