gr: add gr-viewer

This commit is contained in:
Vince Weaver 2018-09-27 20:00:05 -04:00
parent 567baa330e
commit b9e04f6605
3 changed files with 68 additions and 2 deletions

23
gr-sim/gr/Makefile Normal file
View File

@ -0,0 +1,23 @@
CC = gcc
CFLAGS = -Wall -O2 -I.. -g
LFLAGS = -lm
SDL_LIBS= `sdl-config --libs`
SDL_INCLUDE= `sdl-config --cflags`
GR_SIM = ../gr-sim.a
all: gr_view
###
gr_view: gr_view.o $(GR_SIM)
$(CC) $(LFLAGS) $(SDL_LIBS) -o gr_view gr_view.o $(GR_SIM)
gr_view.o: gr_view.c
$(CC) $(CFLAGS) -c gr_view.c
####
clean:
rm -f *~ *.o gr_view

43
gr-sim/gr/gr_view.c Normal file
View File

@ -0,0 +1,43 @@
#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;
if (argc<1) {
fprintf(stderr,"Usage: hgr_view FILENAME\n");
fprintf(stderr," where FILENAME is an 1k AppleII LORES image\n\n");
}
grsim_init();
home();
gr();
/* Show all 40x48, no bottom text */
soft_switch(MIXCLR);
fd=open(argv[1],O_RDONLY);
if (fd<0) {
printf("Error opening!\n");
return -1;
}
read(fd,&ram[0x400],1024);
close(fd);
grsim_update();
while(1) {
ch=grsim_input();
if (ch) break;
usleep(100000);
}
return 0;
}

View File

@ -1,3 +1,4 @@
;=============================================
; put_sprite
;=============================================
@ -23,7 +24,7 @@
; so cost = 28 + Y*(34+18)+ (INNER-Y) -1 + 6
; = 33 + Y*(52)+(INNER-Y)
; = 33 + Y*(52)+ [30A + 64B + 69C + 54D]-Y
.align $100
put_sprite:
ldy #0 ; byte 0 is xsize ; 2
@ -134,4 +135,3 @@ put_sprite_done_draw:
rts ; return ; 6