
2.4. LOOPING 19
Exercises:
1. Assemble the following code in your PC, transfer the S19 file to HC11, run
the program and write down the output of the program.
;Name:
;email:
;date:
;
OUTA EQU $FFB8
ORG $C100
LDAB #$9 ; USING REGISTER B AS A COUNTER
LDAA #$31 ; OTHER INITIALIZATION
FOO TSTB ; SUBTRACT ZERO FROM B
BEQ BAR ; QUIT IF THE Z FLAG IS SET, I.E. B=0
JSR OUTA ; DO THE TASK
INCA ; RE-INITIALIZE
DECB ; DECREMENT THE COUNTER
BRA FOO ; GO BACK
BAR
SWI
2. Modify the above program so that the program prints the upper case letters
A to Z. Clearly indicate the changes you made.
3. The following function is equivalent to the function shown above
2
.
; continued from the previous function
ORG $C200
LDAB #$9 ; USING REGISTER B AS A COUNTER
LDAA #$31 ; OTHER INITIALIZATION
JUBJUB
JSR OUTA ; DO THE TASK
INCA ; RE-INITIALIZE
DECB ; DECREMENT THE COUNTER
BNE JUBJUB ; GO BACK
2
You can have as many functions as you want in the same file. Make sure that when you
change the ORG, the functions do not overlap. You can determine this by looking at the LST
file
Comentarios a estos manuales