EASy68K
http://www.easy68k.com/EASy68Kforum/

Working with a string in 68k
http://www.easy68k.com/EASy68Kforum/viewtopic.php?f=6&t=1654
Page 1 of 1

Author:  small68brain [ Mon Oct 29, 2018 7:10 pm ]
Post subject:  Working with a string in 68k

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.

Author:  profkelly [ Tue Oct 30, 2018 1:21 pm ]
Post subject:  Re: Working with a string in 68k

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?

Author:  small68brain [ Tue Oct 30, 2018 3:15 pm ]
Post subject:  Re: Working with a string in 68k

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?

Author:  profkelly [ Tue Oct 30, 2018 9:48 pm ]
Post subject:  Re: Working with a string in 68k

Save A1 to another address register before reading the characters of a new word.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/