unsigned char expand_CL(void)
{
//unsigned char y;
__asm{
//MOV CL, x
AND CL, BIN8(00000111)
CMP CL, 3
JB M1
INC CL
M1: CMP CL, 7
JB M2
INC CL
M2: RET //MOV y, CL
}
//return 0;
}
unsigned int _8_to_10(unsigned char x)
{
unsigned int y;
__asm {
MOV EAX, 0
MOV AL, x
CMP AL, BIN8(11110000)
JB N1
//y = (x&BIN8(00001100))<<6 | BIN8(10101010);
AND AL, BIN8(00001100)
SHL EAX, 6
OR EAX, BIN8(10101010)
JMP M_end
N1: CMP AL, BIN8(11000000)
JB N2
AND AL, BIN8(00110000)
SHL EAX, 4
MOV CL, x
CALL expand_CL
// AND CL, BIN8(00000111)
// CMP CL, 3
// JB M1
// INC CL
//M1: CMP CL, 7
// JB M2
// INC CL
//M2: //RET
MOV CH, x
TEST CH, BIN8(00001000)
JZ M3
OR EAX, BIN8(00001010)
SHL CL, 4
OR AL, CL
JMP M4
M3: OR EAX, BIN8(10100000)
OR AL, CL
M4: JMP M_end
N2: //else {
M_end:
MOV y, EAX
}
return y;
}