mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-02-22 14:29:00 +00:00
gr-sim: add bload support
This commit is contained in:
parent
b52890bfeb
commit
737c56cfd0
@ -17,8 +17,10 @@ static int ysize=YSIZE*PIXEL_Y_SCALE;
|
||||
|
||||
static unsigned char framebuffer[XSIZE][YSIZE];
|
||||
|
||||
|
||||
/* 128kB of RAM */
|
||||
unsigned char ram[128*1024];
|
||||
#define RAMSIZE 128*1024
|
||||
unsigned char ram[RAMSIZE];
|
||||
|
||||
|
||||
static SDL_Surface *sdl_screen=NULL;
|
||||
@ -189,3 +191,33 @@ int gr(void) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bload(char *filename, int address) {
|
||||
|
||||
FILE *fff;
|
||||
int count=0,ch=0;
|
||||
|
||||
fff=fopen(filename,"r");
|
||||
if (fff==NULL) {
|
||||
fprintf(stderr,"Could not open %s\n",filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
while(1) {
|
||||
|
||||
if ((address+count)>RAMSIZE) {
|
||||
fprintf(stderr,"ERROR ram too high\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
ch=fgetc(fff);
|
||||
if (ch<0) break;
|
||||
|
||||
ram[address+count]=ch;
|
||||
count++;
|
||||
}
|
||||
fclose(fff);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -7,3 +7,4 @@ int plot(int x, int y);
|
||||
int hlin(int x1, int x2, int at);
|
||||
int vlin(int y1, int y2, int at);
|
||||
int gr(void);
|
||||
int bload(char *filename, int address);
|
||||
|
Loading…
x
Reference in New Issue
Block a user