home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
simtel
/
sigm
/
vols000
/
vol089
/
syslib7.hlp
< prev
next >
Wrap
Text File
|
1985-02-09
|
6KB
|
188 lines
Introduction
Arithmetic Operations -- Add, Subtract, Multiply, Divide
Complement Operations -- Negate (2's Comp) and Complement (1's)
Rotate and Shift Operations -- Left and Right
Logical Operations -- And, Or, Xor
:Introduction
Thi≤á modulσá contain≤ ß se⌠ oµ 16-bi⌠á unsigneΣá arithmetiπ ì
routines«á Al∞ routine≤ usσ H╠ a≤ thσ accumulato≥ o≥ thσ result¼ ì
anΣá H╠ anΣ D┼ contaiε thσ operand≤ requireΣ (iµ onl∙ onσ operanΣ ì
is needed, HL contains it).
The available routines are:
ADDHD -- HL = HL + DE SUBHD -- HL = HL - DE
MULHD -- HL = HL * DE DIVHD -- HL = HL / DE
NEGH -- HL = 2's Complement of HL
CMPH -- HL = 1's Complement of HL
ROTLH -- HL is rotated left one bit position
ROTRH -- HL is rotated right one bit position
SHFTLH -- HL is shifted left one bit position
SHFTRH -- HL is shifted right one bit position
ANDHD -- HL = HL AND DE
ORHD -- HL = HL OR DE
XORHD -- HL = HL XOR DE
:Arithmetic Operations -- ADDHD, SUBHD, MULHD, DIVHD
Al∞á oµá thesσ routine≤ operatσ oε H╠ anΣá DE¼á placinτá thσ ì
resul⌠á iε HL«á Thσ Carr∙ Flaτ i≤ affected¼á frequentl∙ useΣá t∩ ì
indicate overflow.
Routine Name: ADDHD
Function║
HL = HL + DE
Inputs: HL, DE are operands
Outputs: HL is result, Carry Flag Set (C) means overflow
Registers Affected: HL, PSW
SYSLIB Routines Called: None
Specia∞á Erro≥ Conditions║ None
Routine Name: SUBHD
Function║
HL = HL - DE
Inputs: HL, DE are operands
Outputs: HL is result, Carry Flag Set (C) if HL<DE
Registers Affected: HL, PSW
SYSLIB Routines Called: None
Specia∞á Erro≥ Conditions║ None
Routine Name: MULHD
Function║
HL = HL * DE
Inputs: HL, DE are operands
Outputs: HL is result, Carry Set means Overflow
Registers Affected: HL, PSW
SYSLIB Routines Called: SHFTRH, SHFTLH
Specia∞á Erro≥ Conditions║ None
Note║á Thi≤á routinσ i≤ optimizeΣ fo≥ speed¼á witΦ ßá mino≥ ì
sacrificσá oε size¼á anΣ i⌠ alway≤ take≤ 1╢ loop≤ t∩ perforφá an∙ ì
multiplication.
Routine Name: DIVHD
Function║
HL = HL / DE
Inputs: HL, DE are operands
Outputs: HL is result
Registers Affected: HL
SYSLIB Routines Called: SHFTLH
Specia∞á Erro≥ Conditions║ None
Note║á Thi≤á routinσ i≤ optimizeΣ fo≥ speed¼á witΦ ßá mino≥ ì
sacrificσá oε size¼á anΣ i⌠ alway≤ take≤ 1╢ loop≤ t∩ perforφá an∙ ì
division.
:Complement Operations -- NEGH and CMPH
These routines operate on HL, placing the result into HL.
Routine Name: NEGH
Function║
HL = 2's Complement of HL
Inputs: HL is operand
Outputs: HL is result
Registers Affected: HL
SYSLIB Routines Called: CMPH
Specia∞á Erro≥ Conditions║ None
Routine Name: CMPH
Function║
HL = 1's Complement of HL
Inputs: HL is operand
Outputs: HL is result
Registers Affected: HL
SYSLIB Routines Called: None
Specia∞á Erro≥ Conditions║ None
:Rotate and Shift Operations -- ROTLH, ROTRH, SHFTLH, SHFTRH
These operations operate on HL, placing the result into HL.
Routine Name: ROTLH
Function║
H╠á i≤á rotateΣá lef⌠ onσá bi⌠á position«á Thi≤á i≤á ß ì
circula≥á rotate¼á anΣá thσ mos⌠ significan⌠ bi⌠ oµ ╚ i≤á rotateΣ ì
into the least significant bit position of L.
Inputs: HL is operand
Outputs: HL is result
Registers Affected: HL
SYSLIB Routines Called: None
Specia∞á Erro≥ Conditions║ None
Routine Name: ROTRH
Function║
H╠á i≤á rotateΣá righ⌠ onσ bi⌠á position«á Thi≤á i≤á ß ì
circula≥á rotate¼á anΣ thσ leas⌠ significan⌠ bi⌠ oµ ╠ i≤á rotateΣ ì
into the most significant bit position of H.
Inputs: HL is operand
Outputs: HL is result
Registers Affected: HL
SYSLIB Routines Called: None
Specia∞á Erro≥ Conditions║ None
Routine Name: SHFTLH
Function║
H╠á i≤á shifteΣá lef⌠á onσá bi⌠á position«á Thσá leas⌠ ì
significant bit of L is filled with a Zero.
Inputs: HL is operand
Outputs: HL is result
Registers Affected: HL
SYSLIB Routines Called: None
Specia∞á Erro≥ Conditions║ None
Routine Name: SHFTRH
Function║
H╠á i≤á shifteΣá righ⌠á onσá bi⌠á position«á Thσá mos⌠ ì
significant bit of H is filled with a Zero.
Inputs: HL is operand
Outputs: HL is result
Registers Affected: HL
SYSLIB Routines Called: None
Specia∞á Erro≥ Conditions║ None
:Logical Operations -- ANDHD, ORHD, XORHD
These operate on HL and DE, placing the result into HL.
Routine Name: ANDHD
Function║
HL = HL AND DE
Inputs: HL and DE are operands
Outputs: HL is result
Registers Affected: HL
SYSLIB Routines Called: None
Specia∞á Erro≥ Conditions║ None
Routine Name: ORHD
Function║
HL = HL OR DE
Inputs: HL and DE are operands
Outputs: HL is result
Registers Affected: HL
SYSLIB Routines Called: None
Specia∞á Erro≥ Conditions║ None
Routine Name: XORHD
Function║
HL = HL XOR DE
Inputs: HL and DE are operands
Outputs: HL is result
Registers Affected: HL
SYSLIB Routines Called: None
Specia∞á Erro≥ Conditions║ None