tasm


How to do inverse subtraction in TASM?


So we have a TASM program that will ask the user for 2 8-bit numbers. The program shall then solve for the difference and the inverse subtraction (but i could not get it working in this code)
;SUBTRACTION PROGRAM
.MODEL small
.STACK 100h
.DATA
first db 10,13,'First double-digit number: $'
second db 10,13,'Second double-digit number: $'
diff db 10,13,'Difference is: $'
retry db 10,13,'Try again (Y)?: $'
.CODE
mov ax,#data
mov ds,ax
again:
mov ah,9
mov dx, OFFSET first
int 21h
mov ah,1
int 21h
mov bh,al
mov ah,1
int 21h
mov bl,al
mov ah,9
mov dx, OFFSET second
int 21h
mov ah,1
int 21h
mov ch,al
mov ah,1
int 21h
mov cl,al
and bx,0f0fh ;EXTRACT ASCII
and cx,0f0fh
mov ax,00h ;CLEAR REGISTRY
This part solves the least significant number first
SUB bl,cl
mov al,bl
AAS
mov dx,ax
2nd least significant
SUB bh,ch ;subtract 2sn
mov ah,0
mov al,bh
AAS
SUB al,dh
or dl, 30h
or ax,3030h
mov bx,ax
mov cl,dl
mov ah,9
mov dx, offset diff
int 21h
mov ah,2
mov dl,bh
int 21h
mov ah,2
mov dl,bl
int 21h
mov ah,2
mov dl,cl
int 21h
mov ah,9
mov dx, offset retry
int 21h
mov ah,1
int 21h
cmp al, 'y'
jz again
cmp al, 'Y'
jnz done
done:
mov ah, 4ch
int 21h
END

Related Links

How do you code subtraction in TASM
How to do inverse subtraction in TASM?
Display Negative numbers in TASM
getch() in TASM
why do we use 0dh,0ah after msg1 db in this statement :msg1 db 0dh, 0ah, “ENTER A CHOICE $”;
TASM problems with output
TASM Can't locate .asm file Error: **Fatal** Command line: Can't locate file: filename.asm
TASM giving no output after compile
I can't figure out how to delete a row in my tasm assembly homework
How to read and write A FAT in WinXP [duplicate]
Turbo Assembler [closed]
8086 programming using TASM: pc to pc communication

Categories

HOME
sonarqube
phpword
developer-tools
pagination
r-googlesheets
javacc
aws-cli
nested-if
nuget-package
python-multithreading
computer-science
owin
datastage
tput
frequency-distribution
linear-algebra
charles
lilypond
visual-glitch
rubymotion
ios10.2
imageresizer
monit
resourcebundle
google-api-client
tiki-wiki
apktool
bioinformatics
finagle
userdefaults
memory-address
rselenium
laravel-eloquent
classcastexception
mnist
batching
projects-and-solutions
health-monitoring
signals-slots
mcustomscrollbar
subclipse
oracle-service-bus
knime
apache-spark-dataset
oim
httr
hammer.js
netbeans6.8
configurationmanager
geotiff
launchctl
openblas
page-replacement
rackspace-cloud
branch-prediction
seek
google-cloud-console
cifilter
cassia
php-socket
turbo-prolog
yajsw
asyncdisplaykit
themoviedb-api
file-move
evolus-pencil
ember-cli-rails
sql-server-data-tools
canvg
diff3
umlgraph
infosphere-spl
ejb-2.x
cocos3d
human-computer-interface
build-script
kissfft
mintty
twitter-bootstrap-rails
qscrollarea
git-repo
embedded-fonts
inputmismatchexception
model-driven-development
android-sdk-2.3
flex-mobile
mysql-error-1205
vs-android
binomial-heap
zend-rest
echo3
tui
asynchronous-wcf-call
movieplayer
idatareader

Resources

Encrypt Message