Other Programming Languages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

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:
  #1  
Old November 12th, 2006, 10:08 AM
bunker17 bunker17 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 144 bunker17 User rank is Sergeant (500 - 2000 Reputation Level)bunker17 User rank is Sergeant (500 - 2000 Reputation Level)bunker17 User rank is Sergeant (500 - 2000 Reputation Level)bunker17 User rank is Sergeant (500 - 2000 Reputation Level)bunker17 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 7 h 7 m 25 sec
Reputation Power: 16
8086 String Input

For one of my classes we got an assignment of emulating the MIPS IO functions into the 8086 intsruction set the problem im having is that in mips you can input an aparently endless string while i haven't been able to find a way to this in 8086. I someone could give me some info on string handling on 8086 much apreciated.
My idea:
1. get char one by one
2. store in memory one after another and end with $ sign

The problem:
Not really sure how to do the second.
I think the second time calling the proc it would get erased since it would write in the same place.


Code:
.model small
.stack 100h
.data
endline db 10 , 13 ,'$'
mess db 'Got Micro?$' 
marca db 'A$'
.code
main proc
	mov ax,@data   ;moves data into ax     
	mov ds,ax      ;places it in the data segment	
	mov dx, OFFSET mess     ;places in dx address from the start of mess
	
	mov ah,9   ;  puts in ah the value for call to display a string
	int 21h
	mov dx, OFFSET endline
	mov ah,9   ;  puts in ah the value for call to display a enterline
	int 21h
	;mov ah,2 moves cursor
	;int 10h
	mov di, 0  ; makes cx a 0
	pur:
	mov ah,1 ; takes a char from the input
	int 21h
	mov marca[bx+di] , Al
	inc di
	cmp Al , 13 
	JNE pur
	mov marca[bx+di] , '$'
	mov dx, OFFSET marca ;places in dx address from the start of mess
	mov ah,9   ;  puts in ah the value for call to display a string
	int 21h
	;jnz pur
	mov ax, 4c00h ; return to ms-dos
	int 21h
main endp
end main

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > 8086 String Input

Developer Shed Advertisers and Affiliates



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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap