Only LONGINTs. After more investigation I found CPL486.GenDiv which handles both DIV and MOD for all the smaller integer types.Robert wrote:I don't understand the significance of the "largeint support" comment here. Does it mean this code works with INTEGERs and LONGINTs, or with the latter only?
WARNING: the following extract contains some commented-out code:
![Shocked :shock:](./images/smilies/icon_eek.gif)
Code: Select all
PROCEDURE GenDiv* (VAR src: Item; mod, pos: BOOLEAN);
VAR w, rem: INTEGER;
BEGIN
ASSERT(src.mode = Reg);
IF src.form >= Int32 THEN DevCPE.GenByte(99H) (* cdq *)
ELSIF src.form = Int16 THEN DevCPE.GenByte(66H); DevCPE.GenByte(99H) (* cwd *)
ELSE DevCPE.GenByte(66H); DevCPE.GenByte(98H) (* cbw *)
END;
CheckSize(src.form, w); DevCPE.GenByte(0F6H + w); GenCExt(38H, src); (* idiv src *)
IF src.form > Int8 THEN rem := 2 (* edx *) ELSE rem := 4 (* ah *) END;
IF pos THEN (* src > 0 *)
CheckSize(src.form, w); DevCPE.GenByte(8 + w); DevCPE.GenByte(0C0H + 9 * rem); (* or rem,rem *)
IF mod THEN
DevCPE.GenByte(79H); DevCPE.GenByte(2); (* jns end *)
DevCPE.GenByte(2 + w); GenCExt(8 * rem, src); (* add rem,src *)
ELSE
DevCPE.GenByte(79H); DevCPE.GenByte(1); (* jns end *)
DevCPE.GenByte(48H); (* dec eax *)
END
ELSE
CheckSize(src.form, w); DevCPE.GenByte(30H + w); GenCExt(8 * rem, src); (* xor src,rem *)
IF mod THEN
DevCPE.GenByte(79H); (* jns end *)
IF src.form = Int16 THEN DevCPE.GenByte(9); DevCPE.GenByte(66H) ELSE DevCPE.GenByte(8) END;
DevCPE.GenByte(8 + w); DevCPE.GenByte(0C0H + 9 * rem); (* or rem,rem *)
DevCPE.GenByte(74H); DevCPE.GenByte(4); (* je end *)
DevCPE.GenByte(30H + w); GenCExt(8 * rem, src); (* xor src,rem *)
DevCPE.GenByte(2 + w); GenCExt(8 * rem, src); (* add rem,src *)
ELSE
DevCPE.GenByte(79H); (* jns end *)
IF src.form = Int16 THEN DevCPE.GenByte(6); DevCPE.GenByte(66H) ELSE DevCPE.GenByte(5) END;
DevCPE.GenByte(8 + w); DevCPE.GenByte(0C0H + 9 * rem); (* or rem,rem *)
DevCPE.GenByte(74H); DevCPE.GenByte(1); (* je end *)
DevCPE.GenByte(48H); (* dec eax *)
END
(*
CheckSize(src.form, w); DevCPE.GenByte(3AH + w); GenCExt(8 * rem, src); (* cmp rem,src *)
IF mod THEN
DevCPE.GenByte(72H); DevCPE.GenByte(4); (* jb end *)
DevCPE.GenByte(7FH); DevCPE.GenByte(2); (* jg end *)
DevCPE.GenByte(2 + w); GenCExt(8 * rem, src); (* add rem,src *)
ELSE
DevCPE.GenByte(72H); DevCPE.GenByte(3); (* jb end *)
DevCPE.GenByte(7FH); DevCPE.GenByte(1); (* jg end *)
DevCPE.GenByte(48H); (* dec eax *)
END
*)
END;
a1.mode := 0; a2.mode := 0
END GenDiv;
Yes - but not included here. I should have pointed out that I use an unmodified installation of the official final release of BlackBox 1.6 from Oberon microsystems that was announced on 15 Oct 2013.Robert wrote:I can't help observing that the code extract ... contains (at least) two bugs, and their fixes have been previously published: