Skip to content

Commit 2f242e7

Browse files
authored
Add files via upload
1 parent cfd6a37 commit 2f242e7

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

DisLib080/dislib.c

+17-9
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
* EFFECTIVE ADDRESS ==> #imm 16 or 32 (propagate size)
1212
* EFFECTIVE ADDRESS ==> Resolve PC Relative address
1313
* DECODE_LABEL() ==> Resolve Correct Relative address
14-
* DIVxL ==> Implements
1514
************************************************************************************
1615
* Useful links
1716
* http://www.apollo-core.com/bringup/decoder_cpu.ods
@@ -967,20 +966,24 @@ APTR DECODE_020_CMP2(APTR p, UINT16 op, UINT16 ex, int size) {
967966
OUT("CMP2.%c %s,%c%i", SZ[size], ea, DA[BIT(ex, 15)], DOWNTO(ex, 14, 12));
968967
return p;
969968
}
970-
APTR DECODE_020_DIV(APTR p, UINT16 op) { // TODO: DIVxL <ea>,Dr:Dq
969+
APTR DECODE_020_DIV(APTR p, UINT16 op) {
971970
// DIVU.L <ea>,Dq 32/16 => 32q
972971
// DIVU.L <ea>,Dr:Dq 64/32 => 32r-32q
973-
// DIVUL.L <ea>,Dr:Dq 32/32 => 32r-32q ==> TODO: Implement
972+
// DIVUL.L <ea>,Dr:Dq 32/32 => 32r-32q
974973
// DIVS.L <ea>,Dq 32/32 => 32q
975974
// DIVS.L <ea>,Dr:Dq 64/32 => 32r-32q
976-
// DIVSL.L <ea>,Dr:Dq 32/32 => 32r-32q ==> TODO: Implement
977-
UINT16 ex;
975+
// DIVSL.L <ea>,Dr:Dq 32/32 => 32r-32q
976+
UINT16 ex, dq, dr;
978977
p = READWORD(p, &ex);
979978
p = DECODE_EA(p, op);
980-
OUT("DIV%s.L %s,", BIT(ex, 11) ? "S" : "U", ea);
981-
if (BIT(ex, 10))
982-
OUT("d%i:", DOWNTO(ex, 14, 12));
983-
OUT("d%i", DOWNTO(ex, 2, 0));
979+
dr = DOWNTO(ex, 2, 0);
980+
dq = DOWNTO(ex, 14, 12);
981+
OUT("DIV%s%s %s,d%i",
982+
BIT(ex, 11) ? "S" : "U",
983+
BIT(ex, 10) ? ".l " : "L.l",
984+
ea, dr);
985+
if (dq != dr)
986+
OUT(":d%i", dq);
984987
return p;
985988
}
986989
APTR DECODE_020_EXTB(APTR p, UINT16 op) {
@@ -1863,6 +1866,11 @@ int main(int argc, char *argv[]) {
18631866
UINT16 sample[100] = {
18641867
0x4cdf,0x7cfc,
18651868
0x3228,0x001c,
1869+
1870+
0x4c40,0x1001, // DIVU.L d0,d1
1871+
0x4c40,0x2401, // DIVU.L d0,d1:d2
1872+
0x4c40,0x2001, // DIVUL.L d0,d1:d2
1873+
18661874
0x690f,
18671875
0x69f0,
18681876
0xe000,

0 commit comments

Comments
 (0)