mirror of https://git.cro.wtf/kip.git
13 lines
324 B
C
13 lines
324 B
C
#include<stdio.h>
|
|
#include"kip.h"
|
|
#define BLK 0x1000
|
|
_ FILE*f;
|
|
_ W z,s,a;
|
|
|
|
V disk_open(IM C*n){f=xopen(n,"r+b"),fseek(f,0,SEEK_END),z=ftell(f),fseek(f,0,SEEK_SET);}
|
|
V disk_close(V){Q(f,fclose(f));}
|
|
|
|
DEV(disk_size,((V)x),(R z))
|
|
DEV(disk_seek,(fseek(f,BLK*(s=x),SEEK_SET)),(R s))
|
|
DEV(disk_read,(a=fread(mem+x,1,BLK,f)),(R a))
|