tdone.s 869 Bytes

 ##########################################################################
 #
 # TASKDONE CODE
 #
 ##########################################################################

	
.name	dramp, $19
.name	dmemp, $20
.name	dmasz, $18
.name	iswrite, $17
	
TaskDone: 	# all done, return to executive:	
	#
	# If we sent output to the DRAM, update the counter
	# in DRAM
	#
		lw	dramp, RSP_STATE_DRAM_OUTP(rsp_state)
		beq	dramp, zero, TaskHalt
		addi	dmemp, rsp_state, RSP_STATE_DRAM_OUT_LEN
		lw	dramp, RSP_STATE_DRAM_OUT_LENP(rsp_state)
		addi	iswrite, zero, 1
		jal	DMAproc
		addi	dmasz, zero, 7	# delay slot
.unname	dramp
.unname	dmemp
.unname	dmasz
.unname	iswrite
	
.name yield,	$2

TaskHalt:
		jal	DMAwait
		ori	yield, zero, SP_SET_TASKDONE	# delay slot
	
		mtc0	yield, SP_STATUS		# DONE, not a BP
		break					# tell cpu we are done
		nop					# and HALT
.unname yield