So I need to write a program..this is the basic outline:

-Print "Enter input:"
-Accept String and store from $2000 -> then print all letters in upper case
-Count String length -> print
-Count lower case letters -> print

**Got to use variables letterstotal = 0 and modifiedtotal = 0.

7 Years
Discussion Span
Last Post by xnutcracker

I've attempted it. All I've done is this..
It's a mess and doesn't work.

START:	 ORG     $1000                   *Start of code location.
	MOVEA.L #PROMPT,A1              *Pointer to start of prompt text
        MOVE.B  #PRTSTR,D0              *Set up print string function
        MOVE.W  #(OUTPUT1-PROMPT),D1     *The Prompt string lenght.
        TRAP    #15                     *Print Prompt.

* 	  Get Sentence
        MOVE.L 	#5,D0               *Pointer to storage for Sentance
       	MOVE.B  #READSTR,D0             *Set up readstring function
        TRAP    #15                     *Get string from KB
        MOVE.W  D1,D2                   *Save Length of input string.

* 	  Count string
        MOVE.L  #1,D6                   *Set character count
        MOVEA.L #LETTERS,A0               *Point to start of string
NEXT    cmpi.b #'a',d1
	blt	display
	cmpi.b	#'z',d1
	bgt	display            
        BEQ     totalletters        
        BNE     NEXT

* 	  Print out put prompt
        MOVEA.L #OUTPUT1,A1              *Pointer to start of prompt text
        MOVE.B  #PRTSTR,D0              *Set up print string function
        MOVE.W  #(LETTERS-OUTPUT1),D1      *The prompt string lenght.
        TRAP    #15                     *Print Prompt.

* 	  Print the number of words in sentence
        MOVE.L  D6,D1                   *Move the count into the print thing.
        MOVE.B  #3,D0                   *Set up Trap 3
        TRAP    #15                     *Print Number of Words
        STOP    #$2700
CONVERT cmpi.b #'a',d1
	blt	display
	cmpi.b	#'z',d1
	bgt	display
	subi.b	#32,d1			;convert lowercase to uppercase
	add.b #1, modifiedletters
display	move.b	#6,d0
	trap	#15
	bra	next	
modifiedletters	addi.b	#1, D3
totalletters   ADDI.B  #1,D6                   *Increace Count
         JMP     COUNT

PROMPT  DC.B 'Enter input:' 
OUTPUT1  DC.B 'Number of letters: ' *Text for out put
OUTPUT2	DC.B	'Number of lower case letters: '
LETTERS   DS.B    99                                      *Thing to store the sentance (max 80)    
PRTSTR  EQU     1                       *Print string function.
READSTR EQU     2                       *Read string function. 
        END     $1000
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.