mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-06-26 00:29:29 +00:00
hgr: add an image load demo
This commit is contained in:
parent
31e44937d1
commit
04453a2426
BIN
gr-sim/hgr/KATC.BIN
Normal file
BIN
gr-sim/hgr/KATC.BIN
Normal file
Binary file not shown.
BIN
gr-sim/hgr/LENNA.BIN
Normal file
BIN
gr-sim/hgr/LENNA.BIN
Normal file
Binary file not shown.
|
@ -6,9 +6,17 @@ SDL_LIBS= `sdl-config --libs`
|
|||
SDL_INCLUDE= `sdl-config --cflags`
|
||||
GR_SIM = ../gr-sim.a
|
||||
|
||||
all: lines
|
||||
all: lines image_load
|
||||
|
||||
|
||||
###
|
||||
|
||||
image_load: image_load.o $(GR_SIM)
|
||||
$(CC) $(LFLAGS) $(SDL_LIBS) -o image_load image_load.o $(GR_SIM)
|
||||
|
||||
image_load.o: image_load.c
|
||||
$(CC) $(CFLAGS) -c image_load.c
|
||||
|
||||
###
|
||||
|
||||
lines: lines.o $(GR_SIM)
|
||||
|
@ -21,4 +29,4 @@ lines.o: lines.c
|
|||
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o lines
|
||||
rm -f *~ *.o lines image_load
|
||||
|
|
54
gr-sim/hgr/image_load.c
Normal file
54
gr-sim/hgr/image_load.c
Normal file
|
@ -0,0 +1,54 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "gr-sim.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
int ch,fd;
|
||||
|
||||
grsim_init();
|
||||
|
||||
home();
|
||||
|
||||
hgr();
|
||||
|
||||
fd=open("KATC.BIN",O_RDONLY);
|
||||
if (fd<0) {
|
||||
printf("Error opening!\n");
|
||||
return -1;
|
||||
}
|
||||
read(fd,&ram[0x2000],8192);
|
||||
close(fd);
|
||||
|
||||
grsim_update();
|
||||
|
||||
while(1) {
|
||||
ch=grsim_input();
|
||||
if (ch) break;
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
fd=open("LENNA.BIN",O_RDONLY);
|
||||
lseek(fd,4,SEEK_SET);
|
||||
if (fd<0) {
|
||||
printf("Error opening!\n");
|
||||
return -1;
|
||||
}
|
||||
read(fd,&ram[0x2000],8192);
|
||||
close(fd);
|
||||
|
||||
grsim_update();
|
||||
|
||||
while(1) {
|
||||
ch=grsim_input();
|
||||
if (ch) break;
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user