mirror of
https://github.com/Ed94/pikuma_ps1.git
synced 2026-06-01 18:41:13 -07:00
fix fillmem, pics!
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
.psx
|
.psx
|
||||||
.create "fillmem.bin", 0x80010000
|
.create "./build/fillmem.bin", 0x80010000
|
||||||
|
|
||||||
; Entry Point of Code
|
; Entry Point of Code
|
||||||
.org 0x80010000
|
.org 0x80010000
|
||||||
|
|||||||
@@ -0,0 +1,78 @@
|
|||||||
|
.psx
|
||||||
|
.create "./build/hellogpu_instructors.bin", 0x80010000
|
||||||
|
|
||||||
|
.org 0x80010000
|
||||||
|
|
||||||
|
; ---------------------
|
||||||
|
; IO Port
|
||||||
|
; ---------------------
|
||||||
|
IO_BASE_ADDR equ 0x1F80 ; IO Ports Memory map base address
|
||||||
|
|
||||||
|
; ---------------------
|
||||||
|
; GPU Registers
|
||||||
|
; ---------------------
|
||||||
|
GP0 equ 0x1810 ; GP0 @ $1F801810: Rendering data & VRAM Access
|
||||||
|
GP1 equ 0x1814 ; GP1 @ $1F801814: Display Control & Environment setup
|
||||||
|
|
||||||
|
Main:
|
||||||
|
lui $t0, IO_BASE_ADDR ; t0 = I/O Port Base Address (mapped at 0x1F80****)
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; Send commands to GP1 (mapped at 0x1F801814)
|
||||||
|
; These GP1 is for display control and environment setup
|
||||||
|
; (Command = 8-Bit MSB, Parameter = 24-Bit LSB)
|
||||||
|
; CCPPPPPP: CC=Command PPPPPP=Parameter
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
li $t1, 0x00000000 ; 00 = Reset GPU
|
||||||
|
sw $t1, GP1($t0) ; Write to GP1
|
||||||
|
|
||||||
|
li $t1, 0x03000000 ; 03 = Display enable
|
||||||
|
sw $t1, GP1($t0) ; Write to GP1
|
||||||
|
|
||||||
|
li $t1, 0x08000001 ; 08 = Display mode (320x240, 15-bit, NTSC)
|
||||||
|
sw $t1, GP1($t0) ; Write to GP1
|
||||||
|
|
||||||
|
li $t1, 0x06C60260 ; 06 = Horz Display Range - 0bxxxxxxxxxxXXXXXXXXXX (3168..608)
|
||||||
|
sw $t1, GP1($t0) ; Write to GP1
|
||||||
|
|
||||||
|
li $t1, 0x07042018 ; 07 = Vert Display Range - 0byyyyyyyyyyYYYYYYYYYY (264..24)
|
||||||
|
sw $t1, GP1($t0) ; Write to GP1
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; Send commands to GP0 (mapped at 0x1F801810)
|
||||||
|
; These GP0 commands are to setup the drawing area
|
||||||
|
; (Command = 8-Bit MSB, Parameter = 24-Bit LSB)
|
||||||
|
; CCPPPPPP CC=Command PPPPPP=Parameter
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
li $t1, 0xE1000400 ; E1 = Draw Mode Settings
|
||||||
|
sw $t1, GP0($t0) ; Write to GP0
|
||||||
|
|
||||||
|
li $t1, 0xE3000000 ; E3 = Drawing Area TopLeft - 0bYYYYYYYYYYXXXXXXXXXX (10 bits for Y and X)
|
||||||
|
sw $t1, GP0($t0) ; Write to GP0
|
||||||
|
|
||||||
|
li $t1, 0xE403BD3F ; E4 = Drawing area BottomRight - 0bYYYYYYYYYYXXXXXXXXXX (10 bits for X=319 and Y=239)
|
||||||
|
sw $t1, GP0($t0) ; Write to GP0
|
||||||
|
|
||||||
|
li $t1, 0xE5000000 ; E5 = Drawing Offset - 0bYYYYYYYYYYYXXXXXXXXXXXX (X=0, Y=0)
|
||||||
|
sw $t1, GP0($t0) ; Write to GP0
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; Clear the screen (draw a rectangle on VRAM).
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
li $t1, 0x020000FF ; 02 = Fill Rectancle in VRAM (Parameter Color: 0xBBGGRR)
|
||||||
|
sw $t1, GP0($t0) ; Write GP0 Command
|
||||||
|
li $t1, 0x00000000 ; Fill Area, Parameter: 0xYYYYXXXX - Topleft (0,0)
|
||||||
|
sw $t1, GP0($t0) ; Write to GP0
|
||||||
|
|
||||||
|
li $t1, 0x00EF013F ; Fill Area, 0xHHHHWWWW (Height=239, Width=319)
|
||||||
|
sw $t1, GP0($t0) ; Write to GP0
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; TODO: Draw a flat-shaded triangle
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
LoopForever:
|
||||||
|
j LoopForever ; Continuous loop
|
||||||
|
nop
|
||||||
|
|
||||||
|
.close
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 476 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 374 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 370 KiB |
@@ -15,3 +15,9 @@ scoop install lua
|
|||||||
```
|
```
|
||||||
|
|
||||||
[pscx-redux](https://github.com/grumpycoders/pcsx-redux/): A collection of tools, research, hardware design, and libraries aiming at development and reverse engineering on the PlayStation 1.
|
[pscx-redux](https://github.com/grumpycoders/pcsx-redux/): A collection of tools, research, hardware design, and libraries aiming at development and reverse engineering on the PlayStation 1.
|
||||||
|
|
||||||
|
## Gallery
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
|||||||
+6
-6
@@ -32,10 +32,10 @@ function build-program { param(
|
|||||||
write-host 'Done!'
|
write-host 'Done!'
|
||||||
pop-location
|
pop-location
|
||||||
}
|
}
|
||||||
# build-program 'fillmem' 'fillmem'
|
build-program 'fillmem' 'fillmem'
|
||||||
# build-program 'warmup' 'exercise_1'
|
build-program 'warmup' 'exercise_1'
|
||||||
# build-program 'warmup' 'exercise_2'
|
build-program 'warmup' 'exercise_2'
|
||||||
# build-program 'warmup' 'exercise_3'
|
build-program 'warmup' 'exercise_3'
|
||||||
# build-program 'factorial' 'factorial'
|
build-program 'factorial' 'factorial'
|
||||||
# build-program 'graphics_system' 'hellogpu'
|
build-program 'graphics_system' 'hellogpu'
|
||||||
build-program 'graphics_system' 'hello_gouraud'
|
build-program 'graphics_system' 'hello_gouraud'
|
||||||
|
|||||||
Reference in New Issue
Block a user