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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old May 24th, 2007, 05:05 PM
esmeco esmeco is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 35 esmeco User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 16 m 54 sec
Reputation Power: 3
Copy string to string destination

Hello!

I was trying to copy the numbers in a string source(si) to a string destination(di),but I think I missed something...After copying the numbers to the screen and showing it correctly I get some 'garbage'...Can you help me solve this problem?Is there anything wrong with the code?
Thanks for the reply!

Code:

.8086
.model	small
.stack	2048

dseg    segment para public 'data'

 	vector1 db ' 2  value 1 value 3',0
        vector2 db ? 


dseg    ends


cseg  segment para public 'code'
	assume  cs:cseg, ds:dseg

compara:
 
      mov al,[si]

      cmp al,0
      je sai
      inc si
      cmp al,'A'
      jae comparag
      jbe copiar

comparag:
 
      cmp al,'Z'
      jbe compara
      jae comparap

comparap:

      cmp al,'a'
      jae comparap2
      jbe copiar

comparap2:

      cmp al,'z'
      jbe compara
      jae copiar

copiar:
     
     mov [di],al
     inc di
     jmp compara

exit:
     mov ah,09				
        mov dx,offset vector2
    int 21h	
  ret
copia endp
main  proc

	mov     ax, dseg
	mov     ds, ax
        lea si,vector1
        lea di,vector2 
	call copia        
       			        			
exitp:
  mov ah,4ch
  mov al,00				
  int 21h

main  endp
cseg            ends
end     Main

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > Copy string to string destination


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