You need more bits to go above 65536 (0xFFFF) so you need a larger register, 32 bit, or another 16 bit register. Set that other 16 bit register to zero and after your add to add the digits so far, put an add with carry to add the carry bit into this next register.
Up vote 0 down vote favorite 1 share g+ share fb share tw.
I am writing a number converter between the (b h d) numbering systems , the program accepts 16 bits binary number , or 4 digits hex. Or 5 decimal. The reading procedure I wrote seems to have a problem when the decimal value is above 65535 (FFFFh) since im dealing with 16 bit registers and it cant contain larger values I would appreciate it if you help me.
Here is my read procedure: Proc R mov ah,01;read first digit int 21h mov saveal,al cmp al,0dh; if it is a new line break then don't read jz toret mov al,radex ; the radex value already entered by user mov ah,0 mul dx mov dx,ax; multiplies the radex by the number entered so far to shift it 1 dig. Mov al,saveal cmp al,65 jge big2 sub al,30h; taking decimal value of the character cont2: call checkerror mov ah,0 add dx,ax; adding the digit to the number read so far loop R toret: ret endp Thanks Nataly assembly 8086 link|improve this question asked Oct 27 '10 at 15:19Nataly274 75% accept rate.
– Oli Charlesworth Oct 27 '10 at 15:21 I want to convert the numbers > 65535 as well , I tried extended registers but I couldn't manage them well. – Nataly Oct 27 '10 at 15:29.
You need more bits to go above 65536 (0xFFFF) so you need a larger register, 32 bit, or another 16 bit register. Set that other 16 bit register to zero and after your add to add the digits so far, put an add with carry to add the carry bit into this next register. So 0xFFFF + 5 for example is 0x10004 or 0x0004 with the carry bit set, take this other register add the carry bit to it to pick up that other bit, now you have 0x0001 in the high order register and 0x0004 in the low order register.
Absolutely no difference than if you were to do addition with pencil and paper. 99+5 = 04 with a "carry the one" to the hundreds place. And when the hundreds place overflows you carry to the next place.
Binary is the same just much easier. Each bit column is like a decimal column when you do it on paper, it is just invisible from bit 0 to bit 15, but the carry from bit 15 is visible so you can chain adders together and make them as arbitrarily wide as you wish.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.