Skip to content

Commit 9836a37

Browse files
committed
byterun/Makefile
1 parent 904b1aa commit 9836a37

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

byterun/Makefile

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
FLAGS=-m32 -g2 -fstack-protector-all
22

3-
all: byterun.o
4-
$(CC) $(FLAGS) -o byterun byterun.o ../runtime/runtime.a
3+
all: byterun.o eval.o
4+
$(CC) $(FLAGS) -no-pie -o byterun byterun.o eval.o ../runtime/runtime.a
55

66
byterun.o: byterun.c
7-
$(CC) $(FLAGS) -g -c byterun.c
7+
$(CC) $(FLAGS) -no-pie -g -c byterun.c
8+
9+
eval.o: eval.s
10+
$(CC) $(FLAGS) -c eval.s
811

912
clean:
1013
$(RM) *.a *.o *~ byterun

byterun/byterun.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ void disassemble (FILE *f, bytefile *bf) {
8989
h = (x & 0xF0) >> 4,
9090
l = x & 0x0F;
9191

92-
fprintf (f, "0x%.8x:\t", ip-bf->code_ptr-1);
92+
fprintf (f, "0x%.8x:\t%.2x %.2x\t", ip-bf->code_ptr-1, h, l);
9393

9494
switch (h) {
9595
case 15:
@@ -294,8 +294,13 @@ void dump_file (FILE *f, bytefile *bf) {
294294
disassemble (f, bf);
295295
}
296296

297+
extern void eval (void*);
298+
297299
int main (int argc, char* argv[]) {
298300
bytefile *f = read_file (argv[1]);
299301
dump_file (stdout, f);
302+
printf ("%x\n", *f->code_ptr);
303+
printf ("%x\n", *(f->code_ptr+1));
304+
eval (f->code_ptr);
300305
return 0;
301306
}

0 commit comments

Comments
 (0)