EASy68K  
It is currently Fri Aug 23, 2019 5:44 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Mon Oct 29, 2018 7:10 pm 
Offline

Joined: Mon Oct 29, 2018 5:57 pm
Posts: 2
I have to write a program that loads a string terminated by a full stop from a text file and prints the number of vowels and words with less than 3 vowels.
Ive managed to do the first part but i dont know how to go back to print the word with less than 3 vowels because i can only know if a word has 3 or less vowels after ive gone through the words byte by byte?!
This is my first time ever working with assembler so any help would be greatly appreciated.

Heres what ive got so far: https://pastebin.com/XpGDbcJw

Ive added comments which tell where part1 which ive done starts and where part2 starts which is work in progress.


Top
 Profile  
 
PostPosted: Tue Oct 30, 2018 1:21 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1101
Use 3 counters;

totalVowels
vowelsThisWord
wordsWith3orLessVowels

Do you need to display the actual words with 3 or less vowels or just a count of those words?

_________________
Prof. Kelly


Top
 Profile  
 
PostPosted: Tue Oct 30, 2018 3:15 pm 
Offline

Joined: Mon Oct 29, 2018 5:57 pm
Posts: 2
I need to display the words with less than 3 vowels.
Ive managed to write and display the total number of vowels in the entire string, using a counter loop which compares each byte (letter) with possible vowels untill it reaches a full stop and prints the total number. Im using MOVE.B (A1)+, D1 and then compare the content of D1 with each possible vowel. A1 contains the address of the loaded string.

My problem is with the second part of the code where i have to print words with less than 3 vowels because i dont know how to print the word after ive read it byte by byte and concluded it has less than 3 vowels. Again im using the MOVE.B (A1)+, D1 syntax and a counter for vowels but when i reach space which means the word has ended how do i print the word since A1 is now incremented by the number of bytes ive read?


Top
 Profile  
 
PostPosted: Tue Oct 30, 2018 9:48 pm 
Offline
User avatar

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1101
Save A1 to another address register before reading the characters of a new word.

_________________
Prof. Kelly


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group