16
апр
C String To Bcd
Posted:adminString toTBCD (byte tbcd) int size = (tbcd null? + 1)/2; byte buffer = new bytesize; for (int i=0, i1=0, i2=1; ic = tbcd. Hello all, I'm trying to modify some code but I'm having some difficulty - probably because I don't really understand the function in the first place. Its one my supervisor found online that seemed to work fine for the purposes of our test code. However; after some poking around its not working.
Now we will write another Assembly program to convert ASCII code to its BCD equivalent.
Let’s identify variables needed for this program.
First variable will be the one which will hold the values entered at Console in its ASCII code and it will be NUM. Other variable will be holding BCD equivalent of the ASCII code and it will be BCD. Other variable will be holding the Message “ENTER CHARACTER” to be printed for the User, So in all Three variables.
The identified variables are NUM, BCD and MESSAGE.
First Line – DATA SEGMENT
DATA SEGMENT is the starting point of the Data Segment in a Program and DATA is the name given to this segment and SEGMENT is the keyword for defining Segments, Where we can declare our variables.
Next Line – MESSAGE DB “ENTER CHARACTER :$”
X DB ?
MESSAGE DB “ENTER CHARACTER :$” this line is a declaration of Charater Array initialized with “ENTER CHARACTER :$” and $ is used as (n) NULL character in C program. (A Character is of a BYTE Hence we have to use only DB Define Byte ) NUM, BCD to ? (? stands for blank value). Detailed explanation is given below.
Next Line – DATA ENDS
DATA ENDS is the End point of the Data Segment in a Program. We can write just ENDS But to differentiate the end of which segment it is of which we have to write the same name given to the Data Segment.
Now, Selection of data type is DB data type because Character needs BYTE which means DB is sufficient.
In Assembly programming, the variable are all defined by bytes only.
DB – Define Byte (Size – 1 Byte)
DW – Define Word (Size – 2 Byte)
DD – Define Double word (Size – 4 Bytes)
DQ – Define Quad word (Size – 8 Bytes)
DT – Define Ten Bytes (Size – 10 Bytes)
NUMBER SYSTEM in Assembly Programming is Decimal, Octal, Hexadecimal, Binary.
In the Program, We are entering the values for the variables and Do arithmetical Operations like Addition, Subtraction, Multiplication and Division So the Computer should understand which kind of Number is entered. Hence there is a different letters for different Number Systems. O or o stands for Octal, H or h stands for Hexadecimal, B or b stands for Binary, D or dstands for Decimal. By default type of numbering system is Decimal. If you do not specify any letter then the number is understood to be Decimal (By default).
Explanation :
In this Assembly Language Programming, A single program is divided into four Segments which are 1. Data Segment, 2. Code Segment, 3. Stack Segment, and 4. Extra Segment. Now, from these one is compulsory i.e. Code Segment. if at all you don’t need variable(s) for your program. if you need variable(s) for your program you will need two Segments i.e. Code Segment and Data Segment.
Next Line – CODE SEGMENT
Since version 1.1 program can create USB disk with Windows versions which support (U)EFI (Vista x64 SP1 and later x64 versions), which USB disk can be used in both (U)EFI and Legacy BIOS modes.The install Windows from USB project started as a challenge back in 2006 at the msfn.org forum. With the invaluable contribution of several forum members, it was the first method to have regular XP setup run from a USB disk, just like if started from a CD media. WinSetupFromUSB is a Windows program, which prepares or fixed disk to install any Windows versions since 2000/XP, boot various Linux and.BSD flavors, as well as many Windows, Linux, DOS based and other utilities. WinSetupFromUSB Free Download Latest Version for Windows PC. It is full offline setup installer of the app.The program was made later on to offer graphical interface, and program functionality was slowly extended to allow many other sources in a multiboot USB disk.
CODE SEGMENT is the starting point of the Code Segment in a Program and CODE is the name given to this segment and SEGMENT is the keyword for defining Segments, Where we can write the coding of the program.
Next Line – ASSUME DS:DATA CS:CODE
In this Assembly Language Programming, their are Different Registers present for Different Purpose So we have to assume DATA is the name given to Data Segment register and CODE is the name given to Code Segment register (SS,ES are used in the same way as CS,DS )
Next Line – START:
START is the label used to show the starting point of the code which is written in the Code Segment. : is used to define a label as in C programming.
Next Line – MOV AX,DATA
MOV DS,AX
After Assuming DATA and CODE Segment, Still it is compulsory to initialize Data Segment to DS register. MOV is a keyword to move the second element into the first element. But we cannot move DATA Directly to DS due to MOV commands restriction, Hence we move DATA to AX and then from AX to DS. AX is the first and most important register in the ALU unit. This part is also called INITIALIZATION OF DATA SEGMENT and It is important so that the Data elements or variables in the DATA Segment are made accessable. Other Segments are not needed to be initialized, Only assuming is enhalf.
Next Line – LEA DX,MESSAGE
MOV AH,9
INT 21H
The above three line code is used to print String or Message present in the character Array till $ symbol which tells the compiler to stop.
Now, lets understand line by line
LEA DX,MESSAGE in this LEA stands for LOAD EFFECTIVE ADDRESS and it loads the effective address of second element into the first element. This same code can be interchangably written as MOV DX, OFFSET MESSAGE where OFFSET means effective address and MOV means move second element into the first element.
MOV AH,9
INT 21H
The above two line code is used to PRINT the String or Message of the address present in DX register.
Standard Input and Standard Output related Interupts are found in INT 21H which is also called as DOS interrupt. It works with the value of AH register, If the Value is 9 or 9h, That means PRINT the String or Message of the address present in DX register.
Next Line – MOV AH,1
INT 21H
MOV NUM,AL
The above three line code is used to Read a Character from Console and save the value entered in variable NUM in its ASCII form.
Standard Input and Standard Output related Interupts are found in INT 21H which is also called as DOS interrupt. It works with the value of AH register, If the Value is 1 or 1h, That means READ a Character from Console, Echo it on screen and save the value entered in AL register.
MOV NUM,AL means move value in AL register into variable NUM.
Now, lets understand line by line
Next Line – SUB AL,30H
MOV BCD,AL
The above Two line code is used to convert the value entered in variable NUM from ASCII form to its BCD form. This can be done by subtracting 30H i.e. SUB AL,30H. The value coming from Console is Basically in ASCII form. eg. When you enter 5 we see 35H,So by subtracting 30H we get back to value as 5.
SUB AL,30H means subtracting 30H from AL.
MOV BCD,AL means move value in AL register into variable BCD.
Next Line – MOV AH,4CH
INT 21H
The above two line code is used to exit to dos or exit to operating system. Standard Input and Standard Output related Interupts are found in INT 21H which is also called as DOS interrupt. It works with the value of AH register, If the Value is 4ch, That means Return to Operating System or DOS which is the End of the program.
MOV AH,4CH This same code can be interchangably written as MOV AX,4C00H where AX register is initialized with 4C00H which means 4C gets saved in AH register and 00 gets saved in AL register. different books follow different forms.
Next Line – CODE ENDS
CODE ENDS is the End point of the Code Segment in a Program. We can write just ENDS But to differentiate the end of which segment it is of which we have to write the same name given to the Code Segment.
Last Line – END START
END START is the end of the label used to show the ending point of the code which is written in the Code Segment.
Note :- In this Assembly Language Programming, We have Com format and EXE format. We are Learning in EXE format only which simple then COM format to understand and Write. We can write the program in lower or upper case, But i prepare Upper Case.
Screen Shots :-
Output:-
Variables (Before Execution):-
Variables (After Execution):-
Note :- To see the variable and its value you have to click vars button in the emulator.
Note:- To understand program for sequence in detail Please SEARCH numerically example: ASSEMBLY01, ASSEMBLY02, etc.
When I finished calculator Conversion of fractional numbers between numeral systems I thought that this was the final one on numeral systems. However, there appears the reason for another one. As I wrote on the link above, the problem which appears during convertion of fractional numbers from one numeral system to another is the loss of precision.
As example I used decimal 0.8, which can't be translated to binary system without precision error.
Since decimal numbers are 'native' for human, and binary numbers are 'native' for computer, the problem of precision (for these particular numeral systems) once got a solution - invention of binary coded decimal (BCD) format. Idea was simple - use one byte for each decimal digit. And this byte should hold this digit's binary code. Then, for example, 0.8 becomes 0.00001000.
Well, on second thought idea was tuned. Since upper nibble is always empty (since 9, the maximum, is 1001) - let's use only one nibble for each decimal digit. And this was called packed BCD.
In packed BCD our 0.8 becomes 0.1000, and, for example, 6.75 becomes 0110.01110101.
Good idea - no precision loss, convertation can be done with ease, rounding is simple - just shift unnecessary nibble. But it wasn't widely adopted, cause it makes life more difficult.. for computers. BCD means more memory to hold numbers and more complex schemes for numbers operations.
So it is just old curious thing and I haven't known anything about it until I was told by site users.
Here is the calculator for BCD. You could enter decimal or packed BCD and get the conversion. Of course this can be done in mind (and this is the advantage of BCD), but just let the computer do it for you
Popular Posts
String toTBCD (byte tbcd) int size = (tbcd null? + 1)/2; byte buffer = new bytesize; for (int i=0, i1=0, i2=1; ic = tbcd. Hello all, I'm trying to modify some code but I'm having some difficulty - probably because I don't really understand the function in the first place. Its one my supervisor found online that seemed to work fine for the purposes of our test code. However; after some poking around its not working.
Now we will write another Assembly program to convert ASCII code to its BCD equivalent.
Let’s identify variables needed for this program.
First variable will be the one which will hold the values entered at Console in its ASCII code and it will be NUM. Other variable will be holding BCD equivalent of the ASCII code and it will be BCD. Other variable will be holding the Message “ENTER CHARACTER” to be printed for the User, So in all Three variables.
The identified variables are NUM, BCD and MESSAGE.
First Line – DATA SEGMENT
DATA SEGMENT is the starting point of the Data Segment in a Program and DATA is the name given to this segment and SEGMENT is the keyword for defining Segments, Where we can declare our variables.
Next Line – MESSAGE DB “ENTER CHARACTER :$”
X DB ?
MESSAGE DB “ENTER CHARACTER :$” this line is a declaration of Charater Array initialized with “ENTER CHARACTER :$” and $ is used as (n) NULL character in C program. (A Character is of a BYTE Hence we have to use only DB Define Byte ) NUM, BCD to ? (? stands for blank value). Detailed explanation is given below.
Next Line – DATA ENDS
DATA ENDS is the End point of the Data Segment in a Program. We can write just ENDS But to differentiate the end of which segment it is of which we have to write the same name given to the Data Segment.
Now, Selection of data type is DB data type because Character needs BYTE which means DB is sufficient.
In Assembly programming, the variable are all defined by bytes only.
DB – Define Byte (Size – 1 Byte)
DW – Define Word (Size – 2 Byte)
DD – Define Double word (Size – 4 Bytes)
DQ – Define Quad word (Size – 8 Bytes)
DT – Define Ten Bytes (Size – 10 Bytes)
NUMBER SYSTEM in Assembly Programming is Decimal, Octal, Hexadecimal, Binary.
In the Program, We are entering the values for the variables and Do arithmetical Operations like Addition, Subtraction, Multiplication and Division So the Computer should understand which kind of Number is entered. Hence there is a different letters for different Number Systems. O or o stands for Octal, H or h stands for Hexadecimal, B or b stands for Binary, D or dstands for Decimal. By default type of numbering system is Decimal. If you do not specify any letter then the number is understood to be Decimal (By default).
Explanation :
In this Assembly Language Programming, A single program is divided into four Segments which are 1. Data Segment, 2. Code Segment, 3. Stack Segment, and 4. Extra Segment. Now, from these one is compulsory i.e. Code Segment. if at all you don’t need variable(s) for your program. if you need variable(s) for your program you will need two Segments i.e. Code Segment and Data Segment.
Next Line – CODE SEGMENT
Since version 1.1 program can create USB disk with Windows versions which support (U)EFI (Vista x64 SP1 and later x64 versions), which USB disk can be used in both (U)EFI and Legacy BIOS modes.The install Windows from USB project started as a challenge back in 2006 at the msfn.org forum. With the invaluable contribution of several forum members, it was the first method to have regular XP setup run from a USB disk, just like if started from a CD media. WinSetupFromUSB is a Windows program, which prepares or fixed disk to install any Windows versions since 2000/XP, boot various Linux and.BSD flavors, as well as many Windows, Linux, DOS based and other utilities. WinSetupFromUSB Free Download Latest Version for Windows PC. It is full offline setup installer of the app.The program was made later on to offer graphical interface, and program functionality was slowly extended to allow many other sources in a multiboot USB disk.
CODE SEGMENT is the starting point of the Code Segment in a Program and CODE is the name given to this segment and SEGMENT is the keyword for defining Segments, Where we can write the coding of the program.
Next Line – ASSUME DS:DATA CS:CODE
In this Assembly Language Programming, their are Different Registers present for Different Purpose So we have to assume DATA is the name given to Data Segment register and CODE is the name given to Code Segment register (SS,ES are used in the same way as CS,DS )
Next Line – START:
START is the label used to show the starting point of the code which is written in the Code Segment. : is used to define a label as in C programming.
Next Line – MOV AX,DATA
MOV DS,AX
After Assuming DATA and CODE Segment, Still it is compulsory to initialize Data Segment to DS register. MOV is a keyword to move the second element into the first element. But we cannot move DATA Directly to DS due to MOV commands restriction, Hence we move DATA to AX and then from AX to DS. AX is the first and most important register in the ALU unit. This part is also called INITIALIZATION OF DATA SEGMENT and It is important so that the Data elements or variables in the DATA Segment are made accessable. Other Segments are not needed to be initialized, Only assuming is enhalf.
Next Line – LEA DX,MESSAGE
MOV AH,9
INT 21H
The above three line code is used to print String or Message present in the character Array till $ symbol which tells the compiler to stop.
Now, lets understand line by line
LEA DX,MESSAGE in this LEA stands for LOAD EFFECTIVE ADDRESS and it loads the effective address of second element into the first element. This same code can be interchangably written as MOV DX, OFFSET MESSAGE where OFFSET means effective address and MOV means move second element into the first element.
MOV AH,9
INT 21H
The above two line code is used to PRINT the String or Message of the address present in DX register.
Standard Input and Standard Output related Interupts are found in INT 21H which is also called as DOS interrupt. It works with the value of AH register, If the Value is 9 or 9h, That means PRINT the String or Message of the address present in DX register.
Next Line – MOV AH,1
INT 21H
MOV NUM,AL
The above three line code is used to Read a Character from Console and save the value entered in variable NUM in its ASCII form.
Standard Input and Standard Output related Interupts are found in INT 21H which is also called as DOS interrupt. It works with the value of AH register, If the Value is 1 or 1h, That means READ a Character from Console, Echo it on screen and save the value entered in AL register.
MOV NUM,AL means move value in AL register into variable NUM.
Now, lets understand line by line
Next Line – SUB AL,30H
MOV BCD,AL
The above Two line code is used to convert the value entered in variable NUM from ASCII form to its BCD form. This can be done by subtracting 30H i.e. SUB AL,30H. The value coming from Console is Basically in ASCII form. eg. When you enter 5 we see 35H,So by subtracting 30H we get back to value as 5.
SUB AL,30H means subtracting 30H from AL.
MOV BCD,AL means move value in AL register into variable BCD.
Next Line – MOV AH,4CH
INT 21H
The above two line code is used to exit to dos or exit to operating system. Standard Input and Standard Output related Interupts are found in INT 21H which is also called as DOS interrupt. It works with the value of AH register, If the Value is 4ch, That means Return to Operating System or DOS which is the End of the program.
MOV AH,4CH This same code can be interchangably written as MOV AX,4C00H where AX register is initialized with 4C00H which means 4C gets saved in AH register and 00 gets saved in AL register. different books follow different forms.
Next Line – CODE ENDS
CODE ENDS is the End point of the Code Segment in a Program. We can write just ENDS But to differentiate the end of which segment it is of which we have to write the same name given to the Code Segment.
Last Line – END START
END START is the end of the label used to show the ending point of the code which is written in the Code Segment.
Note :- In this Assembly Language Programming, We have Com format and EXE format. We are Learning in EXE format only which simple then COM format to understand and Write. We can write the program in lower or upper case, But i prepare Upper Case.
Screen Shots :-
Output:-
Variables (Before Execution):-
Variables (After Execution):-
Note :- To see the variable and its value you have to click vars button in the emulator.
Note:- To understand program for sequence in detail Please SEARCH numerically example: ASSEMBLY01, ASSEMBLY02, etc.
When I finished calculator Conversion of fractional numbers between numeral systems I thought that this was the final one on numeral systems. However, there appears the reason for another one. As I wrote on the link above, the problem which appears during convertion of fractional numbers from one numeral system to another is the loss of precision.
As example I used decimal 0.8, which can't be translated to binary system without precision error.
Since decimal numbers are 'native' for human, and binary numbers are 'native' for computer, the problem of precision (for these particular numeral systems) once got a solution - invention of binary coded decimal (BCD) format. Idea was simple - use one byte for each decimal digit. And this byte should hold this digit's binary code. Then, for example, 0.8 becomes 0.00001000.
Well, on second thought idea was tuned. Since upper nibble is always empty (since 9, the maximum, is 1001) - let's use only one nibble for each decimal digit. And this was called packed BCD.
In packed BCD our 0.8 becomes 0.1000, and, for example, 6.75 becomes 0110.01110101.
Good idea - no precision loss, convertation can be done with ease, rounding is simple - just shift unnecessary nibble. But it wasn't widely adopted, cause it makes life more difficult.. for computers. BCD means more memory to hold numbers and more complex schemes for numbers operations.
So it is just old curious thing and I haven't known anything about it until I was told by site users.
Here is the calculator for BCD. You could enter decimal or packed BCD and get the conversion. Of course this can be done in mind (and this is the advantage of BCD), but just let the computer do it for you
String toTBCD (byte tbcd) int size = (tbcd null? + 1)/2; byte buffer = new bytesize; for (int i=0, i1=0, i2=1; ic = tbcd. Hello all, I'm trying to modify some code but I'm having some difficulty - probably because I don't really understand the function in the first place. Its one my supervisor found online that seemed to work fine for the purposes of our test code. However; after some poking around its not working.
Now we will write another Assembly program to convert ASCII code to its BCD equivalent.
Let’s identify variables needed for this program.
First variable will be the one which will hold the values entered at Console in its ASCII code and it will be NUM. Other variable will be holding BCD equivalent of the ASCII code and it will be BCD. Other variable will be holding the Message “ENTER CHARACTER” to be printed for the User, So in all Three variables.
The identified variables are NUM, BCD and MESSAGE.
First Line – DATA SEGMENT
DATA SEGMENT is the starting point of the Data Segment in a Program and DATA is the name given to this segment and SEGMENT is the keyword for defining Segments, Where we can declare our variables.
Next Line – MESSAGE DB “ENTER CHARACTER :$”
X DB ?
MESSAGE DB “ENTER CHARACTER :$” this line is a declaration of Charater Array initialized with “ENTER CHARACTER :$” and $ is used as (n) NULL character in C program. (A Character is of a BYTE Hence we have to use only DB Define Byte ) NUM, BCD to ? (? stands for blank value). Detailed explanation is given below.
Next Line – DATA ENDS
DATA ENDS is the End point of the Data Segment in a Program. We can write just ENDS But to differentiate the end of which segment it is of which we have to write the same name given to the Data Segment.
Now, Selection of data type is DB data type because Character needs BYTE which means DB is sufficient.
In Assembly programming, the variable are all defined by bytes only.
DB – Define Byte (Size – 1 Byte)
DW – Define Word (Size – 2 Byte)
DD – Define Double word (Size – 4 Bytes)
DQ – Define Quad word (Size – 8 Bytes)
DT – Define Ten Bytes (Size – 10 Bytes)
NUMBER SYSTEM in Assembly Programming is Decimal, Octal, Hexadecimal, Binary.
In the Program, We are entering the values for the variables and Do arithmetical Operations like Addition, Subtraction, Multiplication and Division So the Computer should understand which kind of Number is entered. Hence there is a different letters for different Number Systems. O or o stands for Octal, H or h stands for Hexadecimal, B or b stands for Binary, D or dstands for Decimal. By default type of numbering system is Decimal. If you do not specify any letter then the number is understood to be Decimal (By default).
Explanation :
In this Assembly Language Programming, A single program is divided into four Segments which are 1. Data Segment, 2. Code Segment, 3. Stack Segment, and 4. Extra Segment. Now, from these one is compulsory i.e. Code Segment. if at all you don’t need variable(s) for your program. if you need variable(s) for your program you will need two Segments i.e. Code Segment and Data Segment.
Next Line – CODE SEGMENT
Since version 1.1 program can create USB disk with Windows versions which support (U)EFI (Vista x64 SP1 and later x64 versions), which USB disk can be used in both (U)EFI and Legacy BIOS modes.The install Windows from USB project started as a challenge back in 2006 at the msfn.org forum. With the invaluable contribution of several forum members, it was the first method to have regular XP setup run from a USB disk, just like if started from a CD media. WinSetupFromUSB is a Windows program, which prepares or fixed disk to install any Windows versions since 2000/XP, boot various Linux and.BSD flavors, as well as many Windows, Linux, DOS based and other utilities. WinSetupFromUSB Free Download Latest Version for Windows PC. It is full offline setup installer of the app.The program was made later on to offer graphical interface, and program functionality was slowly extended to allow many other sources in a multiboot USB disk.
CODE SEGMENT is the starting point of the Code Segment in a Program and CODE is the name given to this segment and SEGMENT is the keyword for defining Segments, Where we can write the coding of the program.
Next Line – ASSUME DS:DATA CS:CODE
In this Assembly Language Programming, their are Different Registers present for Different Purpose So we have to assume DATA is the name given to Data Segment register and CODE is the name given to Code Segment register (SS,ES are used in the same way as CS,DS )
Next Line – START:
START is the label used to show the starting point of the code which is written in the Code Segment. : is used to define a label as in C programming.
Next Line – MOV AX,DATA
MOV DS,AX
After Assuming DATA and CODE Segment, Still it is compulsory to initialize Data Segment to DS register. MOV is a keyword to move the second element into the first element. But we cannot move DATA Directly to DS due to MOV commands restriction, Hence we move DATA to AX and then from AX to DS. AX is the first and most important register in the ALU unit. This part is also called INITIALIZATION OF DATA SEGMENT and It is important so that the Data elements or variables in the DATA Segment are made accessable. Other Segments are not needed to be initialized, Only assuming is enhalf.
Next Line – LEA DX,MESSAGE
MOV AH,9
INT 21H
The above three line code is used to print String or Message present in the character Array till $ symbol which tells the compiler to stop.
Now, lets understand line by line
LEA DX,MESSAGE in this LEA stands for LOAD EFFECTIVE ADDRESS and it loads the effective address of second element into the first element. This same code can be interchangably written as MOV DX, OFFSET MESSAGE where OFFSET means effective address and MOV means move second element into the first element.
MOV AH,9
INT 21H
The above two line code is used to PRINT the String or Message of the address present in DX register.
Standard Input and Standard Output related Interupts are found in INT 21H which is also called as DOS interrupt. It works with the value of AH register, If the Value is 9 or 9h, That means PRINT the String or Message of the address present in DX register.
Next Line – MOV AH,1
INT 21H
MOV NUM,AL
The above three line code is used to Read a Character from Console and save the value entered in variable NUM in its ASCII form.
Standard Input and Standard Output related Interupts are found in INT 21H which is also called as DOS interrupt. It works with the value of AH register, If the Value is 1 or 1h, That means READ a Character from Console, Echo it on screen and save the value entered in AL register.
MOV NUM,AL means move value in AL register into variable NUM.
Now, lets understand line by line
Next Line – SUB AL,30H
MOV BCD,AL
The above Two line code is used to convert the value entered in variable NUM from ASCII form to its BCD form. This can be done by subtracting 30H i.e. SUB AL,30H. The value coming from Console is Basically in ASCII form. eg. When you enter 5 we see 35H,So by subtracting 30H we get back to value as 5.
SUB AL,30H means subtracting 30H from AL.
MOV BCD,AL means move value in AL register into variable BCD.
Next Line – MOV AH,4CH
INT 21H
The above two line code is used to exit to dos or exit to operating system. Standard Input and Standard Output related Interupts are found in INT 21H which is also called as DOS interrupt. It works with the value of AH register, If the Value is 4ch, That means Return to Operating System or DOS which is the End of the program.
MOV AH,4CH This same code can be interchangably written as MOV AX,4C00H where AX register is initialized with 4C00H which means 4C gets saved in AH register and 00 gets saved in AL register. different books follow different forms.
Next Line – CODE ENDS
CODE ENDS is the End point of the Code Segment in a Program. We can write just ENDS But to differentiate the end of which segment it is of which we have to write the same name given to the Code Segment.
Last Line – END START
END START is the end of the label used to show the ending point of the code which is written in the Code Segment.
Note :- In this Assembly Language Programming, We have Com format and EXE format. We are Learning in EXE format only which simple then COM format to understand and Write. We can write the program in lower or upper case, But i prepare Upper Case.
Screen Shots :-
Output:-
Variables (Before Execution):-
Variables (After Execution):-
Note :- To see the variable and its value you have to click vars button in the emulator.
Note:- To understand program for sequence in detail Please SEARCH numerically example: ASSEMBLY01, ASSEMBLY02, etc.
When I finished calculator Conversion of fractional numbers between numeral systems I thought that this was the final one on numeral systems. However, there appears the reason for another one. As I wrote on the link above, the problem which appears during convertion of fractional numbers from one numeral system to another is the loss of precision.
As example I used decimal 0.8, which can't be translated to binary system without precision error.
Since decimal numbers are 'native' for human, and binary numbers are 'native' for computer, the problem of precision (for these particular numeral systems) once got a solution - invention of binary coded decimal (BCD) format. Idea was simple - use one byte for each decimal digit. And this byte should hold this digit's binary code. Then, for example, 0.8 becomes 0.00001000.
Well, on second thought idea was tuned. Since upper nibble is always empty (since 9, the maximum, is 1001) - let's use only one nibble for each decimal digit. And this was called packed BCD.
In packed BCD our 0.8 becomes 0.1000, and, for example, 6.75 becomes 0110.01110101.
Good idea - no precision loss, convertation can be done with ease, rounding is simple - just shift unnecessary nibble. But it wasn't widely adopted, cause it makes life more difficult.. for computers. BCD means more memory to hold numbers and more complex schemes for numbers operations.
So it is just old curious thing and I haven't known anything about it until I was told by site users.
Here is the calculator for BCD. You could enter decimal or packed BCD and get the conversion. Of course this can be done in mind (and this is the advantage of BCD), but just let the computer do it for you