From e3ccf5d976965dbda58db4f7d7ec663ce0b0fdf9 Mon Sep 17 00:00:00 2001 From: pommicket Date: Tue, 9 Nov 2021 20:00:56 -0500 Subject: offsets for label definitions, immediates --- 02/in01 | 20214 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 02/in02 | 4 +- 2 files changed, 20190 insertions(+), 28 deletions(-) (limited to '02') diff --git a/02/in01 b/02/in01 index 721ff02..5ae547b 100644 --- a/02/in01 +++ b/02/in01 @@ -1,5 +1,5 @@ || ELF Header -;jm;cd;cd;cd;cd jump to start of first pass +;jm;73;00;00;00 jump to start of first pass ;'i;'n;'0;'2;00 (0x40007d) input filename ;'o;'u;'t;'0;'2;00 (0x400082) output filename ;00;00;' ;'n;'o;'t;' ;'r;'e;'c;'o;'g;'n;'i;'z;'e;'d;\n;00;00;00;00;00;00 (0x400088) error message/where we read to @@ -12,7 +12,7 @@ unused padding ;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00 ;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00 --- code starts here +-- code starts here (0x4000f0) ;im;7d;00;40;00;00;00;00;00 pointer to input filename ;JA @@ -42,7 +42,7 @@ the segment we're loading in includes the ELF header at address 0x400000, so we ;im;01;00;00;00;00;00;00;00 write ;sy --- read command -- +-- read command (0x400174) -- ;im;03;00;00;00;00;00;00;00 input file descriptor ;JA ;im;88;00;40;00;00;00;00;00 where to read to @@ -74,7 +74,7 @@ look at second byte of command ;BA rbx now contains the command offset ;im;d0;e9;00;00;00;00;00;00 ':' << 10 | ':' << 3 -;cm;jn;cd;cd;cd;cd +;cm;jn;19;01;00;00 it's a label definition read the label name: @@ -121,13 +121,13 @@ look at second byte of label find location in label table ;BA -;im;cd;cd;cd;cd;cd;cd;cd;cd +;im;00;00;42;00;00;00;00;00 ;+B ;BA ;AC ;sd store the address there -;jm;cd;cd;cd;cd skip to newline +;jm;a8;05;00;00 skip to newline unused padding ;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00;00 @@ -157,36 +157,38 @@ let's read it one byte at a time, storing the full number in RBP ;sy ;im;88;00;40;00;00;00;00;00 +;BA ;zA;lb ;BA ;im;30;00;00;00;00;00;00;00 -;cm;jl;cd;cd;cd;cd not 0-9 +;cm;jg;2e;00;00;00 not 0-9 ;im;39;00;00;00;00;00;00;00 -;cm;jg;cd;cd;cd;cd not 0-9 +;cm;jl;1b;00;00;00 not 0-9 okay it's 0-9 ;im;d0;ff;ff;ff;ff;ff;ff;ff -;jm;cd;cd;cd;cd +;jm;3c;00;00;00 ;00;00;00;00;00;00;00;00;00;00;00;00 padding ;im;61;00;00;00;00;00;00;00 -;cm;jl;cd;cd;cd;cd not a-f--end loop +;cm;jg;8f;00;00;00 not a-f--end loop ;im;66;00;00;00;00;00;00;00 -;cm;jg;cd;cd;cd;cd not a-f--end loop +;cm;jl;7c;00;00;00 not a-f--end loop ;im;a9;ff;ff;ff;ff;ff;ff;ff ;+B +;BA okay we now have a digit in RBX ;AR ;