|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
About Emu8086 Assembly Code
HELLO,,,, IM NEW IN THIS FORM AND I WANT HELP
I HAVE 2 WRITE ACODE CONVERTING FROM DECIMAL TO BINARY AND TO HEX IF THE USER IN SERT NUMBER GRAETER THAT 15,,, I TRIED TO WRITE IT BUT I COULD'T COMBINE BETWEEN THEM,, SO IF ANY BODY CAN PLEASE HELP ME ,, I SPENT ALOT OF TIME IN CHANGING AND MODIFYING HERE IS THE CODE ======================================= newchar: mov ah, 1h ; keyboard input function int 21h ; execute ^ with dos sub al, 30h ; ascii to binary jl endinpt ; jump if < 0 cmp al, 15d ; is it > 9d? jg endinpt ; yes, not decimal digit cbw ; byte in al to word in ax ; ; digit is now in AX ; multiply number in BX by 10d ; xchg ax, bx ; trade digit and number mov cx, 10d ; put 10d in CX mul cx ; number times 10d xchg ax, bx ; trade number and digit ; ; add digit in AX to number in BX ; add bx, ax ; add digit to number jmp newchar ; get next digit ; ; check to see what they entered ; if nothing, exit ; otherwise, return from process ; endinpt: cmp bx, 0h ; is it 0? jne return ; nope, return from process ;.exit ; yup, exit program return: ret ;read_num endp ; ********************************************* ; print_hex ; prints in hex to the screen the contents of ; BX ; ********************************************* print_hex : mov ch, 5h ; number of digits to print ; start with first digit in BX ; register rotate: mov cl, 5h ; set count to 4 bits rol bx, cl ; left digit to right ; convert to number mov al, bl ; mov to AL and al, 0fh ; mask off left digit add al, 30h ; convert hex to ascii cmp al, 3ah ; is it > 9? jl printit ; jump if digit =0 to 9 add al, 27h ; digit is A to F ; print the digit in ; the AL register printit: mov dl, al ; put ASCII char in DL mov ah, 2h ; display output function int 21h ; call DOS dec ch ; done 4 digits? jnz rotate ; not yet ; fallthrough and return ret print_me: MOV AL, [SI] INT 10h ; print in teletype mode. DEC SI LOOP print_me RET ; return to OS. ; Procedure to convert number in CX ; to its binary equivalent. Result is ; store in "Result" string. =================================== THANKS ALOT MOONA |
|
#2
|
|||
|
|||
|
What part of it doesn't work? Be specific, please.
|
|
#3
|
|||
|
|||
|
specific the part
the next part didnt work starting from newchar
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Other Programming Languages > About Emu8086 Assembly Code |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|