Mvi c
lda 4150h
mov b,a
lda 4151
sub b
jnc loop
cma
inr a
inr c
sta 4152
mov a,c
sta 4153
hlt
Chat with our AI personalities
write it in 8085
A signed 16 bit number can represent the decimal numbers -32768 to 32767.
The fundamental operations on whole numbers and decimals are addition, subtraction, division, and multiplication. However, multiplying and dividing decimals is a bit more complicated because you have to count decimal points to get an accurate answer.
Using 4 bits the signed range of numbers is -8 to 7. When working with signed numbers one bit is the sign bit, thus with 4 bits this leaves 3 bits for the value. With 3 bits there are 8 possible values, which when using 2s complement have ranges: for non-negative numbers these are 0 to 7; for negative numbers these are -1 to -8. Thus the range for signed 4 bit numbers is -8 to 7.
This was a bit of a pain but here it is: 123-45-67+89=100