1 * http://www.xrmx.com
/solutions
/software
/68k
-fe
/samples
/moniker.x68
7 * This will prompt for surname
and firstname
, and check if its uppercase
8 * If it is it prints Initial
+ surname else it repromts.
9 * This program will only exit when nothing is entered
in the surname
or
12 PRTSTR
EQU 1 Print string Function
13 READSTR
EQU 2 Read string function
15 ORG $1000 Start of code location
17 * Print user prompt for
enter the firstname
18 * =========================================
19 START MOVEA.L #PROMPT1
,A1 Pointer to start of prompt text
20 MOVE.B #PRTSTR
,D0 Set up print string function
21 MOVE.W #
(PROMPT2
-PROMPT1
),D1 The prompt string
length
26 MOVEA.L #F_NAME
,A1 Pointer to store teh sentance
27 MOVE.B #READSTR
,D0 Set up readstring function
28 TRAP #
15 Get string from KB
29 MOVE.W D1
,D4 Save
length of input string to d4
32 * Check if Return is pressed
33 CMPI.W #
0,D4 Is the
length = 0
34 BEQ QUIT If
length = 0 then Quit
36 * Set up the stuff to check it the entered
word is
in CAPS
37 * ========================================================
38 MOVEA.L #F_NAME
,A0 Move the first char to A0
39 JSR CHECK2 Check if uppercase
41 CMPI.B #
1,D5 See if all the sentance is CAPS
42 BCS START if it is
'nt then re-enter
45 * Print user prompt for enter the surname
46 * =======================================
47 SURNAME MOVEA.L #PROMPT2,A1 Pointer to start of prompt text
48 MOVE.B #PRTSTR,D0 Set up print string function
49 MOVE.W #(F_NAME-PROMPT2),D1 The prompt string lenght
54 MOVEA.L #S_NAME,A1 Pointer to store the sentance
55 MOVE.B #READSTR,D0 Set up readstring function
56 TRAP #15 Get string from KB
57 MOVE.W D1,D4 Save length on input string
58 MOVE.W D1,D3 Save length of input string to d3
60 * Check is Return is pressed
61 CMPI.W #0,D4 Is the length = 0
62 BEQ QUIT If length = 0 then Quit
64 * Set up the stuff to check it the entered word is in CAPS
65 * ========================================================
66 MOVEA.L #S_NAME,A0 Move the first char to A0
67 JSR CHECK2 Check if uppercase
69 CMPI.B #1,D5 See if all the sentance is CAPS
70 BCS SURNAME if it is'nt then re
-enter
72 * Move the first char for fname
and prints it
(Initial Bit
)
73 * =========================================================
74 INITIAL MOVEA.L #F_NAME
,A1 Move the first char to A1
75 MOVE.B
(A1
),D1 Move the first char of F_NAME to D1
76 MOVE.B #
6,D0 Set up trap number
77 TRAP #
15 Print the Initial
79 PRNSURNAME MOVEA.L #S_NAME
,A1 Pointer to start of prompt text
80 MOVE.B #
0,D0 Set up print string function
81 MOVE.W D3
,D1 The prompt string lenght
84 QUIT STOP #
$2700 Stop the prorgam
89 * This subroutine will return a
1 in, d5 if it
's OK or
90 * return a 0 in d5 if its not ok.
92 CHECK2 CMPI.B #'A
',(A0) Is Char > A ?
93 BCS RETURNFALSE If no then re-enter
94 CMP.B #('Z
'+1),(A0)+ Check if char is < Z
95 BCC RETURNFALSE If it is then it must be a cap
96 SUBI.B #1,D4 Decrease s_name / f_name Length
97 BNE CHECK2 jump if the sentance is not = 0
99 RETURNTRUE MOVE.B #1,D5 Moves a one to D5 to make CAPS ture
100 RTS Jump back to the main program
102 RETURNFALSE MOVE.B #0,D5 Moves a zero to D5 to make CAPS false
103 RTS Jump back to the main program
110 PROMPT1 DC.B 'Please
enter your firstname
(Max
80): '
111 PROMPT2 DC.B 'Please
enter your surname
(Max
80): '
116 END $1000 End of assembley