uniquity
11-04-2009, 11:28 PM
i'm trying to write a program which involves two user programs, one trap routine and a interrupt service routine
the first user program simply calls trap routine x26 which waits for input, then enables the interrupt bit on KBSR. once a key is pressed, the second user program is supposed to start while program waits for more input. all the second user program does is output asterisks. its supposed to keep outputting asterisks while user program 1 is waiting for input...once 5 keys are pressed the program is halted
right now, my program only takes in 5 keys and outputs them but the 2nd user program is never called upon and no asterisks are outputted.
below is the code for the trap routine, can anyone help me out and let me know why the 2nd user program is never called? p.s. x3400 is the starting address of the 2nd user program
.ORIG x3300
START LD R4, BIT ; load bit to enable KBSR
STI R7, ADDR ; save PC/R7 to x32FF
WAIT LDI R5, KBSR ; load KBSR to R5
BRzp WAIT ; wait for input
LDI R0, KBDR ; load input to R0
ADD R5, R5, R4 ; enable interrupt bit
STI R5, KBSR ; set KBSR
LD R7, UP2 ; load starting address of UP2
JMP R7 ; return to UP2
ADDR .FILL x32FF ; address to store PC
UP2 .FILL x3400 ; starting address of UP2
KBSR .FILL xFE00 ; address of KBSR
KBDR .FILL xFE02 ; address of KBDR
BIT .FILL #16384 ; bit to enable ready/interrupt
.END
the first user program simply calls trap routine x26 which waits for input, then enables the interrupt bit on KBSR. once a key is pressed, the second user program is supposed to start while program waits for more input. all the second user program does is output asterisks. its supposed to keep outputting asterisks while user program 1 is waiting for input...once 5 keys are pressed the program is halted
right now, my program only takes in 5 keys and outputs them but the 2nd user program is never called upon and no asterisks are outputted.
below is the code for the trap routine, can anyone help me out and let me know why the 2nd user program is never called? p.s. x3400 is the starting address of the 2nd user program
.ORIG x3300
START LD R4, BIT ; load bit to enable KBSR
STI R7, ADDR ; save PC/R7 to x32FF
WAIT LDI R5, KBSR ; load KBSR to R5
BRzp WAIT ; wait for input
LDI R0, KBDR ; load input to R0
ADD R5, R5, R4 ; enable interrupt bit
STI R5, KBSR ; set KBSR
LD R7, UP2 ; load starting address of UP2
JMP R7 ; return to UP2
ADDR .FILL x32FF ; address to store PC
UP2 .FILL x3400 ; starting address of UP2
KBSR .FILL xFE00 ; address of KBSR
KBDR .FILL xFE02 ; address of KBDR
BIT .FILL #16384 ; bit to enable ready/interrupt
.END