SunQuest
           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 28th, 2006, 10:35 AM
WalkmanRu WalkmanRu is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2006
Posts: 2 WalkmanRu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 2 sec
Reputation Power: 0
Exclamation Assembly

Hello!
I need to make a programm in assembly (itīs better to use Emu8086) that
recieves the STRING from the keyboard and than compress it in this way: input string--> aaabbcddd output string--> 3a2b1c3d.
I know that it is very simple, but Iīm just a beginner and canīt make it. I have just one day till tomorrow afternoon. Hope Youīll help me. Thnks

I have an exemple of a code here, but it doesnīt work

.model small
.data
inputstr db 80 dup (' '),'$' ;uncompressed input string & read from keyboard
outputstr db 80 dup (' '),'$' ;compressed output string & displayed
.code
start: mov ax,@data ;Prepare access to Data Segment
mov ds,ax
mov ah,0Ah ;DOS function "Read from file or device"
mov bx,0 ;Standard input device (keyboard)
mov cx,80 ;Maximum length of read input string
mov dx,offset inputstr ;Memory address of read input string
int 21h ;Call DOS function dispatcher
sub ax,2 ;Decrement by 2 the actual input string length(EOL)
mov si, offset inputstr
mov di, offset outputstr
L1: mov bx,si ;Check if we arrived the end of input string (While-type loop)
sub bx,offset inputstr
cmp bx,ax ;Compare with the length of read input string
je L4 ;If so jump to finish
mov cl,1 ;initialize the character counter
L2: mov dl,[si] ;Read the character
cmp dl,[si+1] ;Compare with the next character
jne L3 ;If not equal jump to constructing output string
inc cl ;If equal increment counter
inc si ;And address of next character
jmp L2 ;Repeat counting the current character
L3: mov [di],dl ;Construct the compressed output string. Save character
inc di
add cl,'0' ;Simple single digit conversion to ASCII
mov [di],cl ;Save the counter
inc di ;Prepare for next character
inc si ;
jmp L1 ;Repeat for next character (End of While-type loop)
L4: mov ah,09h ;DOS function "Write string to standard output"
mov dx,offset outputstr ;Display decompressed output string
int 21h ;Call DOS function dispatcher
mov ah,4ch ;DOS function "Exit"
int 21h ;Call DOS function dispatcher
end start

Reply With Quote
  #2  
Old May 28th, 2006, 08:06 PM
Schol-R-LEA's Avatar
Schol-R-LEA Schol-R-LEA is offline
Commie Mutant Traitor
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2004
Location: The People's Republic of Berkeley
Posts: 1,082 Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Schol-R-LEA User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 10 h 16 m 50 sec
Reputation Power: 446
Which assembler are you using? There are literally dozens of assemblers for the x86 processors, each of which take a different syntax. From the code, I gather you are using Turbo Assembler, which is fairly widely used in coursework.

The Language Resources thread has an extensive list of we sites for assembly, including some specifically about Turbo (and other common assemblers). A quick review of these may give you some information you could use.
__________________
Rev First Speaker Schol-R-LEA;2 JAM LCF ELF KoR KCO BiWM TGIF
#define KINSEY (rand() % 7) λ Scheme is the Red Pill
Scheme in Short • Understanding the C/C++ Preprocessor
Taming Python • A Highly Opinionated Review of Programming Languages for the Novice, v1.1

FOR SALE: One ShapeSystem 2300 CMD, extensively modified for human use. Includes s/w for anthro, transgender, sex-appeal enhance, & Gillian Anderson and Jason D. Poit clone forms. Some wear. $4500 obo. tverres@et.ins.gov

Reply With Quote
  #3  
Old May 29th, 2006, 03:47 AM
WalkmanRu WalkmanRu is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2006
Posts: 2 WalkmanRu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 2 sec
Reputation Power: 0
I Use o Emu8086. I have the book about it, but I just canīt find out whatīs wrong with this code. The program does not print the final result!!
Thank you for answer.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > Assembly


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 2 hosted by Hostway