From: Doni Pracner Date: Sun, 5 Jan 2014 18:59:27 +0000 (+0100) Subject: mjc2wsl - process start of bytecode proper X-Git-Tag: v0.1.4~45 X-Git-Url: https://svarog.pmf.uns.ac.rs/gitweb/?a=commitdiff_plain;h=7e5b8285bb929997901cad1d834f6cd8a94f3f31;p=mjc2wsl.git mjc2wsl - process start of bytecode proper --- diff --git a/src/mjc2wsl.java b/src/mjc2wsl.java index 0adf8f9..512d238 100644 --- a/src/mjc2wsl.java +++ b/src/mjc2wsl.java @@ -270,9 +270,14 @@ public class mjc2wsl{ public void convertStream(InputStream ins) throws Exception{ mainIn = ins; - //skip start TODO make better - for (int i = 0; i < 14; i++) - get(); + //process start + byte m = (byte) get(); + byte j = (byte) get(); + if (m!='M' || j !='J') + throw new Exception("Wrong start of bytecode file"); + int codesize = get4(); + int numberOfWords = get4(); + int mainAdr = get4(); prl(getStandardStart()); prl("SKIP;\n ACTIONS A_S_start:\n A_S_start == CALL a14 END");