
Monitor:
	mov r4,-(sp)
	mov r3,-(sp)
	mov r2,-(sp)
	mov r1,-(sp)
	mov r0,-(sp)
		mov r2,-(sp)
			mov r1,-(sp)
				mov #'0,r1
				mov r0,r2
				jsr PC,MONREG		
			mov (sp)+,r1
			mov r1,r2
			mov #'1,r1
			jsr PC,MONREG

		mov (sp)+,r2
		inc r1
		jsr PC,MONREG
		
		mov r3,r2
		inc r1
		jsr PC,MONREG
		mov r4,r2
		inc r1
		jsr PC,MONREG
		mov r5,r2
		inc r1
		jsr PC,MONREG
		mov SP,r2
		inc r1
		jsr PC,MONREG
		MOV 12(SP),R2
		sub #4,r2
		inc r1
		jsr PC,MONREG
		
		jsr pc,newline
	mov (sp)+,r0
	mov (sp)+,r1
	mov (sp)+,r2
	mov (sp)+,r3
	mov (sp)+,r4
	RTS PC

; Don't use R6 - Use SP!
MONREG:
	mov r0,-(sp)
	mov r1,-(sp)
	mov r2,-(sp)
		mov #'R,r0
		jsr PC,PrintChar
		mov r1,r0
		jsr PC,PrintChar
		mov #':,r0
		jsr PC,PrintChar
		
		;mov #154321,r2
		
		
		jsr pc,SHOCT16
		mov #' ,r0
		jsr pc,PrintChar
	mov (sp)+,r2
	mov (sp)+,r1
	mov (sp)+,r0
	RTS PC

MemDump:
	mov r4,r2
	jsr PC,SHOCT16
	mov #':,r0
	jsr PC,PrintChar
	
	;jsr pc,NewLine
memdB:
	mov (r4)+,r2
	jsr PC,SHOCT16
	mov #' ,r0
	jsr PC,PrintChar
	dec r3
	bit #7,r3
	bne memdB
	jsr PC,NewLine

	cmp r3,#0
	bne memdump	
	RTS PC
	


SHOCT16:	
		clr r1
		jsr pc,SHOCT
		jsr pc,SHOB
		jsr pc,SHOBP
		
SHOBP:	
	jsr pc,SHOB
SHOB:	
	clr r1
	rol r2		;Get bit 3
	rol r1
	rol r2		;Get bit 2
	rol r1
SHOCT:
	rol r2		;Get Bit 1
	rol r1
	mov r1,r0
	
	add #'0,r0
	jsr PC,PrintChar
	RTS PC


