I am trying to write an x86 emulator in JavaScript for education purposes. I have already written a compiler and at the moment I am trying to write the x86 emulator in JavaScript.
I have however a problem with the DIV instruction. According to http://siyobik.info/index.php?module=x86&id=72 DIV takes a 64bit number as input by interpreting EDX as the higher 32bit and EAX as the lower 32bit. It then divides this number by the DIV parameter and puts the result (if it is not greater than 0xFFFFFFFF) into EAX and the remainder into EDX.
As JavaScript does not support 64bit integer I need to apply some tricks. But so far I did not come up with something useful.
Does someone here have an idea how to implement that correctly with 32bit arithmetic?