how can i perform 16-bit addition in assembly language?
349881
In 8 bit Intel assembly:\n\nYou have 3 integers defined as:\n\nNumber1High   ;high byte of number1\nNumber1Low    ;low byte of nuber1\n\nNumber2High   ;high byte of number2\nNumber2Low    ;low byte of number2\n\nResultHigh    ;high byte of result\nResultLow     ;low byte of result\n\nto add:\nCLR  C;\nMOV  A,Number1Low;\nADD  A,Number2Low;\nMOV  ResultLow,A;\nMOV  A,Number1High;\nADDC A,Number2High;\nMOV  ResultHigh,A;
966120
try this stuff... pls understand the logic...\n\n#include<stdio.h>\n\nint main()\n{\nint no,rem;\nscanf("%d",&no);\nwhile (no)\n{\nrem = no % 10;\nprintf("%d",rem);\nno = no / 10;\n}\n}
160575
if it 2 numbers... you multiply msb by 10D and add to your answer the lsb... and youl get the number in hex!
207361
You need to use CPUID assembler instruction to get it. To learn more, follow the link below
378548
I_binmid = (I_binmax + I_binmin)/2
274854
The difficult thing here is reading and writing the numbers. They must be transformed from ASCII and then the result transformed back to ASCII.I found a program that calculates the sum of 2 numbers.I hope it helps.
610630
Segment registers hold the base address of where a particular segment begins in memory.  There is the code segment (CS), data segment (DS), stack segment (SS), and extra segment (ES).\n\nSegment registers are 16-bit registers which are ASSUMED to be holding a 20 bit number, because it is assumed you will add a zero to the end.  For example, if CS register is holding the hexadecimal value "13A6", then this value is actually representing the address "13A60".\n\nTo calculate a physical address, you take the address (called the logical address) and add it to the segment address.  For example, if you wanted to calculate the physical address which relates to logical address "1356" in the stack segment - you would also need to know what value is in the SS register, lets assume "2345":\n\nAdd the zero to the end of the segment address:\n23450\nThen add the two addresses together:\n23450 + 1356 = 247A6\n\n----------\n\nAdditional answer:\n\nThe processor uses 20 bit addresses.  The registers in the processor, however, are 16 bit registers (this is so older programs will still run on the system).  A 16 bit address allows you to access 65,535 memory cells.  A 20 bit address allows you to access 1,048,576 memory cells.  By design, the 16 bit registers will not allow all of the 1MB of memory to be accessed.  The answer to this is segment registers.  A segment register holds the address of where a 65K block of memory resides.  The segment register, although is a 16 bit register, is assumed to be holding a 20 bit address because you are supposed to add a zero to the end of whatever 16 bit number is in the segment register.\n\nFor example, if a segment register is holding the value\n"A45C"\nThis 16 bit number is actually representing the 20 bit value:\n"A45C0"\nbecause of adding the zero to the end.\n\nNow, if you have a 16 bit address, let's say "4B32" for example, you have to remember that this address is an offset (or logical) address residing inside a 65K block of memory.  Thus the physical address is calculated by finding out where the segment starts, then adding to it the offset address.  One of the segment registers will tell you where the segment begins.  Let's assume that the segment register is holding the value "A45C".  In this case, the segment begins at the 20 bit address "A45C0".  Add to that the offset address:  A45C0 + 4B32 = A90F2.  Therefore the address A90F2 is the 20 bit physical address that maps to the segment,offset address   A45C:4B32
161686
Easy if you restrict to integer types.\n\nCreate the following macro:\n\n#define IS_SIGNED(type) (((type) 0xFFFFFFFF) < 0)\n\nYou can now use it direction in your code as such:\n\nif (IS_SIGNED (char))\n{\n   stuff if it is signed\n}\nelse\n{\n   stuff if it is unsigned\n}\n\nNote that this implementation assumes that you maximum integer type is 32 bits. Pretty easy to change if it is otherwise though.\n\nI have done a LOT of multiple-platform code, char signing and byte ordering are the two biggest headaches.\n\nHope this helps.
386448
In traditional Dos based systems it is a simple matter of including relevant assembly code in C language. May not be so easy if you are in applicaton mode on other operating systems. Not very difficult, need to know assembly language if you want to directly manipulate, other you can use operating system routines to access it (if your program resides within the kernel).
961194
you can use /, % operator to extract digits. \nyou also have to make two void functions. which will translate numbers into digits. \n\nvoid data(int num)\n{\n  switch(num)             \n{\ncase 0: \n         break;\ncase 1: cout<<"One ";\n         break;\ncase 2: cout<<"Two ";\n         break;\ncase 3: cout<<"Three ";\n         break;\ncase 4: cout<<"Four ";\n         break;\ncase 5: cout<<"Five ";\n         break;\n}\nand just keep going till twenty.\nand then another function which convert numbers from 20-100 into words. \n\nvoid getdata(int num)\n{\n  if(num>=90)                     \n                                  \n{\n cout<<"Ninety ";\n less20(num-90);\n}\nelse if(num>=80)\n{\n cout<<"Eighty ";\n less20(num-80);\n}\nyou have to complete it.\nexample to extract the digits for first and tenth position.\ndigit=number%10;                     \nlast_two=digit;\nnumber=number/10;\ndigit=number%10;\nlast_two=(digit*10)+last_two;\n\nnow just figure out the positions. \nand you are good.
140175
simple binary addition\n 110.0111\n+101.0010\n--------\n1011.1001
389147
PEEK read a 8bit value from any memory address\ninteger_variable = PEEK(address)\n\nPOKE write a 8bit value to a memory address (not all addresses may be written!)\nPOKE address, value
163804
Continuously divide the decimal number by 16 and stack up the remainders at each stage, until you finally reach a divisor that is less than 16. Of course, you have to write the remainders above 9 in the alphabetical form - 10=A, 11=B and so on till 15=F. Finally, string the final divisor followed by the stack of remainders read backwards to obtain your hex number.\n\nAlternately, if you are good at converting between decimal and binary, do that and then read off the binary bits from the end in groups of four in the equivalent hex. For example, if after decimal-to-binary conversion, you were to get\n11100011010101, then group them as\n(0011)(1000)(1101)(0101). Now, this is equivalently 38D5 in hex.
454676
You can't do it from a set of asm instructions directly. \n\nYou have to link to a library and import the file I/O functions (such as the C-Runtime Library's fopen(), fread(), fwrite(), fclose() functions).\n\nThen in assembly, you just jump to those functions with the appropriate parameters (e.g., the filename string or data to write) pushed on the stack.\n\nIf you want to save yourself some time, consider trying this (for Visual Studio and C/C++):\n\n- Write a simple C/C++ program that opens a file, appends a byte to it (like your example from 3 bytes to 4 bytes) and closes it.\n- Set Visual Studio's linker/compiler settings to "Generate Assembly Listing"\n- Build the program and look for the assembler file (*.s) that has the asm instructions.\n\nRemember to use the CRT (C-Runtime) functions, fopen/fread/fwrite/fclose.\n\nEnjoy.
561987
Learn x8086 assembly language and then about \nResource hacker , hex editor,Code fosion ,softice ,etc\n\nYou get lot of good books on x8086 assembly\nBarry B Brey is the Best
774139
For this, the simplest method is to add the input and output up:\n16 + 82 = 98\n34 + 64 = 98\n47 + 51 = 98\n51 + 47 = 98\n63 + 35 = 98\n\nSince they all add up to the same amount, the function is a straight addition/subtraction function. Thus, the function is: r = 98 - a.
622118
16 bit consists of instruction code that are 16 bit in length. And 32 bit contails 32 bit. \n\nSome problems occur when we are migrating from 16 bit to 32 bit. Example...\n\nA programmer was using a pointer (16 bit). He needed to increment the pointer so that the pointer now points to next word. So he wrote the expression like\n\niptr = iptr + 2 (2 bytes means 16 bits).\n\nBut when the compiler design was changed to 32 bit, the program crased. Because the expression that he wrote now made the pointer jump in between the word.\n\nInclude this point dude.