Problem Statement Write 8085 Assembly language program to convert ASCII to binary or Hexadecimal character values.Discussion We know that the ASCII of number 00H is 30H (48D), and ASCII of 09H is39H (57D).
The ASCII value of 0AH is 41H (65D) and ASCII of 0FH is 46H (70D), so all other alphabets (B, C, D, E, F) are in the range 41H to 46H. We are checking whether the ASCII value is less than 58H (ASCII of 9 1) When the number is less 58, then it is numeric value. So we simply subtract 30H from the ASCII value, and when it is greater than58H, then it is alphabetical value. Clear the accumulator to 0 and add D to it E number of times. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready. Ascii To Binary Conversion Program In 8085 Code And ItFirst 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. 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. 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 d stands for Decimal. If you do not specify any letter then the number is understood to be Decimal (By default). Extra Segment. Now, from these one is compulsory i.e. Code Segment. if at all you dont need variable(s) for your program. 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. 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. 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. 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. 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. This can be done by subtracting 30H i.e. SUB AL,30H. The value coming from Console is Basically in ASCII form. When you enter 5 we see 35H,So by subtracting 30H we get back to value as 5. 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. ![]() 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.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |