MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / idiv8

Function idiv8

source/emulation/cpu/normal/instructions.cpp:41–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41U32 idiv8(CPU* cpu, S8 src) {
42 if (src==0) {
43 cpu->prepareException(EXCEPTION_DIVIDE, 0);
44 return 0;
45 }
46
47 S16 quo = (S16)AX / src;
48 S8 quo8 = (S8)quo;
49 S8 rem = (S16)AX % src;
50
51 if (quo != quo8) {
52 cpu->prepareException(EXCEPTION_DIVIDE, 1);
53 return 0;
54 }
55 AL = quo8;
56 AH = rem;
57 return 1;
58}
59
60U32 div16(CPU* cpu, U16 src) {
61 U32 num = ((U32)DX << 16) | AX;

Callers 2

normal_idivR8Function · 0.70
normal_idivE8Function · 0.70

Calls 1

prepareExceptionMethod · 0.80

Tested by

no test coverage detected