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

Start
-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
End

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

Recommended Answers

All 4 Replies

Did you try to do it? Or do you just want us to do your homework?

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        
                       
COUNT   SUBI.B  #1,D2
        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
	jmp CONVERT	
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

I am still a n00b with assembly and this is unfamiliar syntax o.O

motorola 68000 brother lol

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.