All pastes #912806 Raw Edit

JASON IS GAY

public text v1 · immutable
·published 2008-02-21 17:27 UTC
rendered paste body
        .TITLE "Asign1"
	.PSIZE 1000,1000

	.NOLIST
	.INCLUDE	"..\\include\\ascii.i"
	.LIST
/*************CONSTANT DATA************/
	.TEXT 1
MsgProgramID:	
	.ASCIZ "WELCOME!"
	.BYTE CR,LF,0
MsgKeyPress:
	.ASCIZ "Please Enter A String"
	.BYTE CR,LF,0
MsgExit:
	.ASCIZ "Thank You Come Again!"
	.BYTE CR,LF,0
MsgStrFull:
	.ASCIZ "Sorry your memory is full!"
	.BYTE CR,LF,0
/*******************VARIABLE******************/
	.DATA
string:	.SPACE 1024,0
.EQU 	CLF,0x0D
.EQU 	EOF,0x04
.EQU	PER,0x2E
.EQU	EXP,0x21
.EQU	QUE,0x3F
.EQU	CAP,0X20
CapFlag: .WORD 1
GrammerCount: .WORD 1
/*****************PROCESS****************/
	.TEXT 0
	.GLOBAL Asign1
Asign1:
	Addq.l #1,CapFlag
	move.b #32,D2
	movea.l #MsgProgramID,a0
	jsr PrintMsg
	jsr NewLine
	movea.l #MsgKeyPress,a0
	jsr PrintMsg
	jsr NewLine
	
Get_Cha:
	jsr ConsoleIn |D0
	CMP.L #CLF,D0
	BEQ.W New_Line
	CMP.L #EOF,D0
	BEQ.W End_Of_Reading
	move.b D0,(A1)
	ADDQ.l #1,A1
	ADDQ.l #1,D1
	jsr ConsoleOut
	CMP.L #0,D2
	Sub.b #1,D2
	BEQ.W FULL
	move.b D0,D3
	JMP Get_Cha
New_Line:
	jsr NewLine
	move.b #0x00,D0
	move.b D0,(A1)
	movea.l A1,A3
	Suba.l	D1,A3 |point to start of string
	move.b #0x00,D1
	jsr Grammer_Loop
	Suba.l #GrammerCount,A3
	|Suba.l	D1,A3 
	movea.l A3,A0
	jsr PrintMsg
	jsr NewLine
	jmp Get_Cha
Upper_Case:
	sub.b #32,(A3)
Grammer_Loop:
	cmp.b #0x00,(A3)
	beq.w Exit
	cmp.b #0x61,(A3)
	bge.w Upper_Case
	|cmp.l #1,CapFlag
	|beq.w 
	|jsr Upper_Case
	addq.l #1,GrammerCount
	addq.l #1,A3
	jmp Grammer_Loop
Exit:
	rts
End_Of_Reading:
	jsr ConsoleIn
	movea.l #MsgExit,a0
	jsr PrintMsg
	jsr NewLine
	RTS
FULL:
	movea.l #MsgStrFull,A0
	jsr PrintMsg
	JMP End_Of_Reading

	RTS	| exit program
/************end of program************/