Skip to content

Instantly share code, notes, and snippets.

@ifknot
Forked from tanayseven/expr.asm
Created January 29, 2023 16:49
Show Gist options
  • Save ifknot/5f8c617520a223be87ec9941cf201a18 to your computer and use it in GitHub Desktop.
Save ifknot/5f8c617520a223be87ec9941cf201a18 to your computer and use it in GitHub Desktop.
8087 assembly level program to evaluate (x+y)(a+b)/(a+b)(x-y), floating point
;8087 program to evaluate (x+y)(a+b)/(a+b)(x-y)
data segment
a dd 3.2
b dd 2.1
x dd 6.3
y dd 7.7
result dd ?
ends data
code segment
ASSUME cs:code, ds:data
start: mov ax, data
mov ds, ax
finit
fld x;(x+y)
fld y
fadd
fld a;(a-b)
fld b
fsub
fmul;(x+y)(a-b)
fld a;(a+b)
fld b
fadd
fld x;(x-y)
fld y
fsub
fmul;(a+b)(x-y)
fdiv;(x+y)(a+b)/(a+b)(x-y)
fstp result
quit: mov ah,4ch
int 21h
ends code
end start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment