def _mulf16(ins): ''' Multiplies 2 32bit (16.16) fixed point numbers. The result is pushed onto the stack. ''' op1, op2 = tuple(ins.quad[2:]) if _f_ops(op1, op2) is not None: op1, op2 = _f_ops(op1, op2) if op2 == 1: # A * 1 => A output = _f16_oper(op1) output.append('push de') output.append('push hl') return output if op2 == -1: return _neg32(ins) output = _f16_oper(op1) if op2 == 0: output.append('ld hl, 0') output.append('ld e, h') output.append('ld d, l') output.append('push de') output.append('push hl') return output output = _f16_oper(op1, str(op2)) output.append('call __MULF16') output.append('push de') output.append('push hl') REQUIRES.add('mulf16.asm') return output
def _negf16(ins): ''' Negates (arithmetic) top of the stack (Fixed point in DE.HL) Fixed point signed version ''' return _neg32(_f16_to_32bit(ins))