Other Programming Languages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreOther Programming Languages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old November 7th, 2007, 05:20 PM
MOONA85 MOONA85 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2007
Posts: 2 MOONA85 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 41 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old November 7th, 2007, 07:09 PM
Lux Perpetua Lux Perpetua is online now
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Feb 2004
Location: San Francisco Bay
Posts: 1,418 Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level)Lux Perpetua User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 4 m 19 sec
Reputation Power: 334
What part of it doesn't work? Be specific, please.

Reply With Quote
  #3  
Old November 8th, 2007, 12:43 AM
MOONA85 MOONA85 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2007
Posts: 2 MOONA85 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 41 sec
Reputation Power: 0
specific the part

the next part didnt work starting from newchar

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > About Emu8086 Assembly Code


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway