EMAC PRIMER Instruction Manual page 76

Table of Contents

Advertisement

per second and each time will increment the byte at address FF2E.
Type in the program and run it. You will see that the LEDs are displaying the increasing value of the data at address FF2B.
Press the reset button and set a breakpoint at FF20, (the start of the ISR) then run the program. The execution will stop at
FF20, and if you look at the stack contents (S.C.) the value will be the address of the next instruction which the main loop
will execute. If the interrupt occurred during the LDA instruction then S.C. will be FF1B, if during the OUT instruction then
S.C. will be FF1D or if during the JMP instruction S.C. will be FF18. Single step once, then set the breakpoint to FF20
again and then run full speed again. After the program stops, check the value of S.C. it could be any of the three
addresses mentioned above.
vec7hlf
equ
leds
equ
timerlo
equ
timerhi
equ
cmdreg
equ
org
di
lxi
shld
mvi
out
mvi
out
mvi
out
mvi
sim
ei
; this is the main loop that will be interrupted
; by the ISR
loop:
lda
out
jmp
; This ISR increments CNTOUT
ticsub:
push
lda
inr
sta
pop
ei
ret
cntout
ds
end
ADDRESS
FF01
FF02
FF03
FF04
FF05
FF06
FF07
FF08
FF09
FF0A
FF0B
FF0C
FF0D
FF0E
FF0F
FF10
FF11
FF12
FF13
FF14
FF15
continued on next page...
0ffe9h
; vector for 7.5 interrupt
11h
; discrete LED port
; 8155 timer ports
14h
; low byte of timer
15h
; hi byte and mode of timer
10h
; command register
0ff01h
; disable interrupts
h,ticsub
; hl = address of ISR
vec7hlf
; Store in vector
a,0
timerlo
; lo 8 bits of counter are 0
a,7ch
; set 8155 square wave output mode
timerhi
; with timer at 20hz
a,0cdh
cmdreg
; enable the timer
a,11011b
; a 0 bit enables the interrupt
; clear 7.5 interrupt mask
; enable interrupts
cntout
; counter to output to LEDs
leds
; display value of A register
loop
; jump to loop
psw
; save A and flags
cntout
; get counter value
a
; increment it
cntout
; save it back
psw
; restore A and Flags
; Re-enable interrupts
; continue from point of interruption
1
; reserve 1 byte for the counter
DATA
INSTRUCTION
F3
DI
21
LXI
20
FF
22
SHLD
E9
FF
3E
MVI
00
D3
OUT
14
3E
MVI
7C
D3
OUT
15
3E
MVI
CD
D3
OUT
10
3E
MVI
1B
H,FF20
FFE9
A,0
14
A,7C
15
A,CD
10
A,1B
76

Advertisement

Table of Contents
loading

Table of Contents