run.c (503B)
1 #include <u.h> 2 #include <libc.h> 3 4 #include "vsm.h" 5 void 6 usage(void) 7 { 8 fprint(2, "usage: %s imgfile\n", argv0); 9 exits("usage"); 10 } 11 12 void 13 stackdump(CELL *st, CELL *sp) 14 { 15 for (st++; st <= sp; st++) { 16 print("%d ", *st); 17 } 18 } 19 20 void 21 main(int argc, char **argv) 22 { 23 ARGBEGIN{ 24 default: 25 usage(); 26 break; 27 }ARGEND 28 if (argc != 1) usage(); 29 vsm_readimage(argv[0]); 30 vsm_reset(); 31 vsm_run(); 32 print("dstack:\n "); 33 stackdump(dstack, dsp); 34 print("\nrstack:\n "); 35 stackdump(rstack, rsp); 36 print("\n"); 37 38 }