
.psx
.create "\BldPSX\Prog.bin", 0x80010000

.definelabel UserRam,0x00020000


.org 0x80010000 ; Entry Point Of Code


	lui     a0,0x1F80 ;IO_BASE 

; Setup Screen Mode
		;   CCPPPPPP - CC = Command PPPPPP=Parameter
    li t0,0x00000000		;$00=Reset
    sw t0,0x1814(a0)	       ;GP0 Command Control 0x1F801814
	
    li t0,0x03000000		;$03=Display Enable
    sw t0,0x1814(a0)	       ;GP0 Command Control 0x1F801814
	
    li t0,0x08000001		;$80=Display Mode %RwI2VHWW (320x240 16bpp)
    sw t0,0x1814(a0)	       ;GP0 Command Control 0x1F801814
	
    li t0,0x06C60260		;$06= H Display Range 0xXXXxxx	 (3168-608)
    sw t0,0x1814(a0)	       ;GP0 Command Control 0x1F801814
	
    li t0,0x07042018        ;$07= V Display Range %yyyyyyyyyyYYYYYYYYYY	 (264-24)
	sw t0,0x1814(a0)	       ;GP0 Command Control 0x1F801814

	
	li t0,0xE1000400
    sw t0,0x1810(a0)			;GP0 Command Port 0x1F801810
	
	li t0,0xE3000000		;$E3 - Drawing Area TopLeft - %YYYYYYYYYYXXXXXXXXXX
    sw t0,0x1810(a0)			;GP0 Command Port 0x1F801810
	
	li t0,0xE403BD3F		;$E4 - Drawing area Bottom Right - %YYYYYYYYYYXXXXXXXXXX
    sw t0,0x1810(a0)			;GP0 Command Port 0x1F801810
	
	li t0,0xE5000000		;$E5 - Drawing Offset - %YYYYYYYYYYYXXXXXXXXXXXX
    sw t0,0x1810(a0)			;GP0 Command Port 0x1F801810

    li t0,0x02000000		;$02 - Fill Area 1- 0xBBBBBB - Background 
    sw t0,0x1810(a0)			;GP0 Command Port 0x1F801810
    li t0,0x00000000		;$02 - Fill Area 2-0xYYYYXXXX - Topleft
    sw t0,0x1810(a0)			;GP0 Command Port 0x1F801810
    li t0,0x0EF0013F		;$02 - Fill Area 3-0xHHHHWWWW - HeightWidth
	sw t0,0x1810(a0)			;GP0 Command Port 0x1F801810



	li sp,UserRam
	