mirror of https://git.cro.wtf/kip.git
kip-io:add display:pal
This commit is contained in:
parent
1a804c0cba
commit
53e7e766af
|
@ -3,6 +3,7 @@ X(io_term2)
|
|||
X(io_disk_size)
|
||||
X(io_disk_seek)
|
||||
X(io_disk_read)
|
||||
X(io_display_pal)
|
||||
X(io_display_pos)
|
||||
X(io_display_blit)
|
||||
X(io_display_out)
|
||||
|
|
|
@ -14,7 +14,7 @@ _ B layer[4][wid*hig]={0},redraw;
|
|||
_ W computed[wid*hig]={0};
|
||||
|
||||
_ H mx,my,px,py;
|
||||
_ W blit,out;
|
||||
_ W blit,out,pal;
|
||||
|
||||
_ Ws min(Ws x,Ws y){R x<y?x:y;}
|
||||
_ Ws max(Ws x,Ws y){R x>y?x:y;}
|
||||
|
@ -26,6 +26,7 @@ _ V out_2bpp(B l,W c,H x,H y){W i,j,k;for(i=0;i<8;++i)for(j=0,k=loh(blit+2*i);j<
|
|||
_ V out_4bpp(B l,W c,H x,H y){W i,j,k;for(i=0;i<8;++i)for(j=0,k=low(blit+4*i);j<8;k<<=4,++j)out_pixel(l,(k>>28),x+j,y+i);(V)c;}
|
||||
_ V(*outs[])(B,W,H,H)={out_pixel,out_1bpp,out_2bpp,out_4bpp};
|
||||
|
||||
DEV(display_pal,(pal=x,palette[x>>24]=x&0x00ffffff),(R pal))
|
||||
DEV(display_pos,(px=x>>16,py=x),(R px<<16|py))
|
||||
DEV(display_blit,(blit=x),(R blit))
|
||||
DEV(display_out,(W c;B m,l;out=x,m=0xf&x,l=(0xf0&x)>>4,c=x>>8,outs[m](l,c,px,py)),(R out))
|
||||
|
|
12
x/dev.inc
12
x/dev.inc
|
@ -1,12 +1,12 @@
|
|||
{device macro defs}
|
||||
|
||||
!term:0 pb #0 ;
|
||||
!term:1 pb #1 ;
|
||||
!disk:size pb #2 ;
|
||||
!disk:seek pb #3 ;
|
||||
!disk:read pb #4 ;
|
||||
!disp:pos pb #5 ;
|
||||
!disp:blt pb #6 ;
|
||||
!disp:out pb #7 ;
|
||||
!mouse:pos pb #8 ;
|
||||
!mouse:but pb #9 ;
|
||||
!disp:pal pb #5 ;
|
||||
!disp:pos pb #6 ;
|
||||
!disp:blt pb #7 ;
|
||||
!disp:out pb #8 ;
|
||||
!mouse:pos pb #9 ;
|
||||
!mouse:but pb #a ;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
-inc "x/dev.inc"
|
||||
-org #100
|
||||
:entry
|
||||
pw #00000000 `disp:pal io
|
||||
|
||||
pw @box1bpp `disp:blt io
|
||||
pw #00100010 `disp:pos io
|
||||
ph #0f01 `disp:out io
|
||||
|
|
Loading…
Reference in New Issue