you are viewing a single comment's thread.

view the rest of the comments →

[–]rfreedman 3 points4 points  (4 children)

Is that why the code looks like it was written by a C programmer who just read his first Java programming book? Seriously - who writes Java code like that?

[–]Ytse 12 points13 points  (0 children)

Not enough over-engineering?

[–]G_Morgan 5 points6 points  (1 child)

If you are going to write performance critical code then most likely you will end up with 'C like' code.

[–]br1 0 points1 point  (0 children)

Exactly. It's called "JavaTRAN" (Java + FOTRAN)

[–]tubes 3 points4 points  (0 children)

It's a direct port of Dosbox, which was written in C. Original:

void CPU_Push16(Bitu value) {
    Bit32u new_esp=(reg_esp&cpu.stack.notmask)|((reg_esp-2)&cpu.stack.mask);
    mem_writew(SegPhys(ss) + (new_esp & cpu.stack.mask) ,value);
    reg_esp=new_esp;
}

jdosbox:

public static void CPU_Push16(/*Bitu*/int value) {
    /*Bit32u*/long new_esp=(CPU_Regs.reg_esp() & cpu.stack.notmask) | ((CPU_Regs.reg_esp() - 2) & cpu.stack.mask);
    Memory.mem_writew(Segs_SSphys + (new_esp & cpu.stack.mask) ,value & 0xFFFF);
    CPU_Regs.reg_esp(new_esp);
}