
	.LIST
	.ASECT
	.=001000
	;-------------------------------------------------------------------------------
START:

	mov #377,r0			;Load OCTAL 377 into R0 
							;(decimal 255 - #^O377 works too)
	
	mov #^x0C7,r1		;Load HEXADECIMAL C7 into R1 
							;(307 in octal)
							
	mov #1234.,r2		;Load 1234 into R2 
							;(2322 in octal - #^d1234 works too)
							
	mov #'A,r3			;Load ASCII A into R3 
							;(101 in octal)
							
	mov #^b111000111,r4	;Load BINARY 111000111 
							;(707 in octal - #^b111000111 works too)
	
	movb #^o377,r5		;Move 255 ($FF) into R5 (8 bit) 
							;sign extends to 177777 ($FFFF = 65535)
	
	jsr pc,Monitor
	
	.radix 2			;Binary
	mov #100,r0			;100 in binary (4 in octal)
	
	.radix 8			;Octal
	mov #100,r1			;100 in Octal
	
	.radix 10			;Decimal
	mov #100,r2			;100 in decimal (144 in octal)
	
	.radix 16			;Hexadecimal (400 in hex)
	mov #100,r3
	
	.radix 8			;Back to octal
	jsr pc,Monitor		
	
	
	mov r4,r0			;Move R4 into R0
	
	movb r5,r1			;Move low byte of R5 into R1
	
	clr r4				;Clear R4
	
	clrb r5				;Clear the low byte of R5
	
	jsr pc,Monitor
	
	mov #254.,r0	;366 in OCT
	jsr pc,MonR0
	inc r0			;Add 1 to R0
	jsr pc,MonR0
	inc r0			;Add 1 to R0
	jsr pc,MonR0
	dec r0			;Subtract 1 from R0
	jsr pc,MonR0	
	dec r0			;Subtract 1 from R0
	jsr pc,MonR0
	
	jsr pc,newline 
	
	mov #254.,r0		
	jsr pc,MonR0
	incb r0			;Add 1 to R0 (8 Bit)
	jsr pc,MonR0
	incb r0			;Add 1 to R0 (8 Bit)
	jsr pc,MonR0
	decb r0			;Subtract 1 to R0 (8 Bit)
	jsr pc,MonR0
	decb r0			;Subtract 1 to R0 (8 Bit)
	jsr pc,MonR0
	jsr pc,newline 
	
	jsr pc,MonR0
	add #100,r0		;add 100 to r0 (in octal)
	jsr pc,MonR0
	sub #10,r0		;subtract 10 from r0 (in octal)
	jsr pc,MonR0
	
	jsr pc,newline 	;Call Newline function
	
	jsr pc,SubT1	;Call Subroutine T1... push PC onto stack
	
	call SubT2		;Same as jsr pc,SubT2
	
	jsr r4,SubT3	;Call Subroutine T3... push R4 onto stack PC->R4
		
		
	jsr pc,newline 
	jsr pc,newline 
	
	jsr pc,Monitor

	call MemTest
	
	mov #123456,r0		;Test Word
	mov r0,@#TestRam	;Save To TestRam
	
	call MemTest
infloop:
	JMP infloop

TestRam:
	.byte 0,0,0,0,0,0,0,0	;Define 8 bytes of ram
;	.word 0,0,0,0			;Define 4 words (8 bytes)
	.even					;Word align memory

MemTest:
	mov #TestRam,r4		;Source address to show
	mov #4.,r3			;Number of words 
	jsr pc,MemDump		;Show memory onscreen
	return
	
SubT1:	;SubTest1		
		mov #'A,r0
		jsr pc,PrintChar
	RTS PC			;Return From Subroutine, POP PC off stack
	
SubT2:	;SubTest2		
		mov #'B,r0
		Call PrintChar		
	RETURN 					;Same as RTS PC
	
SubT3:	;SubTest3		
		mov #'C,r0
		jsr pc,PrintChar
		mov #' ,r0
		jsr pc,PrintChar
		call monitor
	RTS r4			;Return From Subroutine, POP R4 off stack R4->PC
	
	.INCLUDE /Funct.mac/
	.INCLUDE /Monito.mac/
	
MonR0:
	mov r2,-(sp)
	mov r1,-(sp)	
		mov #'0,r1
		mov r0,r2
		jsr PC,MONREG		
	mov (sp)+,r1
	mov (sp)+,r2
	RTS PC



	.EVEN			
;Space for Stack - Stack starts at end of program
	.BLKB 128.	

	.END    START
