diff --git a/code/fillmem/fillmem.s b/code/fillmem/fillmem.s index b94b072..9049826 100644 --- a/code/fillmem/fillmem.s +++ b/code/fillmem/fillmem.s @@ -1,5 +1,5 @@ .psx -.create "fillmem.bin", 0x80010000 +.create "./build/fillmem.bin", 0x80010000 ; Entry Point of Code .org 0x80010000 diff --git a/code/graphics_system/hellogpu_instructors.s b/code/graphics_system/hellogpu_instructors.s new file mode 100644 index 0000000..64d6516 --- /dev/null +++ b/code/graphics_system/hellogpu_instructors.s @@ -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 diff --git a/docs/assets/pcsx-redux.main_2025-08-03_18-02-08.png b/docs/assets/pcsx-redux.main_2025-08-03_18-02-08.png new file mode 100644 index 0000000..6fda33e Binary files /dev/null and b/docs/assets/pcsx-redux.main_2025-08-03_18-02-08.png differ diff --git a/docs/assets/pcsx-redux.main_2025-08-03_19-28-22.png b/docs/assets/pcsx-redux.main_2025-08-03_19-28-22.png new file mode 100644 index 0000000..3da830b Binary files /dev/null and b/docs/assets/pcsx-redux.main_2025-08-03_19-28-22.png differ diff --git a/docs/assets/pcsx-redux.main_2025-08-03_20-45-35.png b/docs/assets/pcsx-redux.main_2025-08-03_20-45-35.png new file mode 100644 index 0000000..ed69c3f Binary files /dev/null and b/docs/assets/pcsx-redux.main_2025-08-03_20-45-35.png differ diff --git a/readme.md b/readme.md index a33b00d..7386caa 100644 --- a/readme.md +++ b/readme.md @@ -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. + +## Gallery + +![clear!](./docs/assets/pcsx-redux.main_2025-08-03_18-02-08.png) +![traingles!](./docs/assets/pcsx-redux.main_2025-08-03_19-28-22.png) +![polys!](./docs/assets/pcsx-redux.main_2025-08-03_20-45-35.png) diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 11b087d..3673626 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -32,10 +32,10 @@ function build-program { param( write-host 'Done!' pop-location } -# build-program 'fillmem' 'fillmem' -# build-program 'warmup' 'exercise_1' -# build-program 'warmup' 'exercise_2' -# build-program 'warmup' 'exercise_3' -# build-program 'factorial' 'factorial' -# build-program 'graphics_system' 'hellogpu' +build-program 'fillmem' 'fillmem' +build-program 'warmup' 'exercise_1' +build-program 'warmup' 'exercise_2' +build-program 'warmup' 'exercise_3' +build-program 'factorial' 'factorial' +build-program 'graphics_system' 'hellogpu' build-program 'graphics_system' 'hello_gouraud'