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

Function idiv16

source/emulation/cpu/normal/instructions.cpp:79–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79U32 idiv16(CPU* cpu, S16 src) {
80 S32 num = (S32)(((U32)DX << 16) | AX);
81
82 if (src==0) {
83 cpu->prepareException(EXCEPTION_DIVIDE, 0);
84 return 0;
85 }
86 S32 quo=num/src;
87 S16 rem=(S16)(num % src);
88 S16 quo16s=(S16)quo;
89 if (quo!=(S32)quo16s) {
90 cpu->prepareException(EXCEPTION_DIVIDE, 1);
91 return 0;
92 }
93 DX=rem;
94 AX=quo16s;
95 return 1;
96}
97
98U32 div32(CPU* cpu, U32 src) {
99 U64 num = ((U64)EDX << 32) | EAX;

Callers 2

normal_idivR16Function · 0.70
normal_idivE16Function · 0.70

Calls 1

prepareExceptionMethod · 0.80

Tested by

no test coverage detected