From b840059a7f2fb0e3796414f30f1e241d03b44dbf Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Fri, 10 Jan 2014 16:55:37 +0100 Subject: =?UTF-8?q?Correction=20de=20li=20pour=20valeurs=20n=C3=A9gatives?= =?UTF-8?q?=20;=20utilisation=20de=20labels=20dans=20des=20data.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- asm/assembler.ml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'asm/assembler.ml') diff --git a/asm/assembler.ml b/asm/assembler.ml index 66999fb..c794c98 100644 --- a/asm/assembler.ml +++ b/asm/assembler.ml @@ -114,7 +114,8 @@ let print_program p = sprintf "liuz %s %s" (rts r) (its i) | Hlt -> (0b01111 lsl 11),"hlt" | Word w -> (byte 16 w), "" - | Byte b -> byte 8 b, "" in + | Byte b -> byte 8 b, "" + | Wlab l -> fst (Imap.find l p.lbls), l in let n = List.fold_left (fun n i -> size i + n) 0 p.text in let rev_lbls = Array.make n "" in Imap.iter (fun l (v,t) -> @@ -131,7 +132,8 @@ let print_program p = else printf "\n"; pc := !pc + 2 ) else ( - printf "%s\n" (bts w) ) in + printf "%s\n" (bts w); + incr pc ) in printf "%d %d\n" (n) 8; List.iter f p.text; printf "\n" -- cgit v1.2.3