Go Back   CodingForums.com > :: Computing & Sciences > Computer Programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Old 11-04-2009, 11:28 PM   PM User | #1
uniquity
New Coder

 
Join Date: Jan 2004
Location: CA
Posts: 48
Thanks: 3
Thanked 0 Times in 0 Posts
uniquity is an unknown quantity at this point
Assembly, programming interrupt service routines

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

Code:
	.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
uniquity is offline   Reply With Quote
Old 11-05-2009, 12:05 AM   PM User | #2
oracleguy
The Spaminator


 
Join Date: Jun 2002
Location: USA
Posts: 7,287
Thanks: 1
Thanked 148 Times in 145 Posts
oracleguy has a spectacular aura aboutoracleguy has a spectacular aura about
What architecture is this for?
__________________
OracleGuy
My Blog

"... the VP of our third biggest account started sweating bullets in our latest project status conference when Roy stood up and asserted: 'We don’t code our products for SMACKTARDS.'" - Daily Victim #564
oracleguy is online now   Reply With Quote
Old 11-05-2009, 12:30 AM   PM User | #3
drhowarddrfine
Senior Coder

 
Join Date: Oct 2005
Posts: 1,066
Thanks: 0
Thanked 39 Times in 38 Posts
drhowarddrfine is an unknown quantity at this point
It looks like ARM.

The only thing I can tell is it looks like the only chance to break out of this loop is if it receives keyboard input. So the obvious question is, are you sure you're getting keyboard data?
drhowarddrfine is offline   Reply With Quote
Old 11-05-2009, 01:45 AM   PM User | #4
uniquity
New Coder

 
Join Date: Jan 2004
Location: CA
Posts: 48
Thanks: 3
Thanked 0 Times in 0 Posts
uniquity is an unknown quantity at this point
i am using an lc-3 simulator for these programs.

drhowarddrfine - yes, its getting keyboard data, everything works fine in my program until you hit the JMP R7 line, which is supposed to jump it to address x3400, but it jumps instead to the interrupt service routine (x3500) without ever going to x3400 (2nd user program)
uniquity is offline   Reply With Quote
Old 11-05-2009, 04:47 AM   PM User | #5
drhowarddrfine
Senior Coder

 
Join Date: Oct 2005
Posts: 1,066
Thanks: 0
Thanked 39 Times in 38 Posts
drhowarddrfine is an unknown quantity at this point
Never heard of this simulator before. This is something you'll have a hard time finding an answer for outside your class.
drhowarddrfine is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:09 AM.

Home - Contact Us - Archives - Link to CF - Resources - Top 

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.