home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
progm
/
dpl.zip
/
_DV1616.D
< prev
next >
Wrap
Text File
|
1988-07-11
|
896b
|
37 lines
; Doug's Programming Language -- DPL, Version 2.22
; Copyright (c) 1988 Douglas S. Cody, All rights reserved.
;---------------------------------
; _DV1616 - DIVIDE TWO 16 BIT INTEGERS
;
; Entry conditions:
; AX holds the divv...
; BX holds the divisor
; Exit conditions:
; STATUS = 00, good divide
; AX holds the result
; DX holds the remainder
; STATUS = 01, divide by zero attempted
; AX = 00
;
SUBPGM _DV1616
BEGIN _DV1616
OR BX,BX ; ANY VALUE?
JNE @DIV_05 ; YES, CONTINUE ON...
MOV STATUS,01 ; DIVISION BY ZERO ATTEMPTED
XOR AX,AX ; CLEAR THE RESULT
RET
;
@DIV_05:
SUB DX,DX ; CLEAR MSB
TEST AX,8000H ; NEGATIVE?
JE @DIV_10 ; NO, CONTINUE ON...
NEG DX
;
@DIV_10:
IDIV BX
MOV STATUS,00 ; STATUS = GOOD DIVIDE
RET
;
ENDPGM _DV1616
;