mirror of
https://github.com/Ed94/pikuma_ps1.git
synced 2026-06-01 18:41:13 -07:00
hello_logo (slightly messed up)
For some reason the resolution on duckstation is 640x464. Does not run in pcsx-redux, known issue based on the discussions
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -35,7 +35,9 @@ gp_HorizontalDisplayRange_3168_608 equ 0x06 << gcmd_offset | 0xC60 << 12 | 0x260
|
|||||||
; 0 - 9 Y1 (NTSC = 88h - (240 / 2), (PAL = A3h - (288 / 2)) ; \ scanline numbers on screen,
|
; 0 - 9 Y1 (NTSC = 88h - (240 / 2), (PAL = A3h - (288 / 2)) ; \ scanline numbers on screen,
|
||||||
; 10 - 19 Y2 (NTSC = 88h + (240 / 2), (PAL = A3h + (288 / 2)) ; / relative to VSYNC
|
; 10 - 19 Y2 (NTSC = 88h + (240 / 2), (PAL = A3h + (288 / 2)) ; / relative to VSYNC
|
||||||
; 20 - 23 Not used (zero)
|
; 20 - 23 Not used (zero)
|
||||||
gp_VerticalDisplayRange_264_24 equ 0x07 << gcmd_offset | 264 << 10 | 24
|
gp_VerticalDiplayRange equ 0x07 << gcmd_offset
|
||||||
|
gp_VerticalDisplayRange_264_24 equ gp_VerticalDiplayRange | 264 << 10 | 24
|
||||||
|
gp_VerticalDisplayRange_504_24 equ gp_VerticalDiplayRange | 504 << 10 | 24
|
||||||
|
|
||||||
; GP1(08h) - Display mode
|
; GP1(08h) - Display mode
|
||||||
; 0-1 Horizontal Resolution 1 (0=256, 1=320, 2=512, 3=640) ;GPUSTAT.17-18
|
; 0-1 Horizontal Resolution 1 (0=256, 1=320, 2=512, 3=640) ;GPUSTAT.17-18
|
||||||
@@ -46,8 +48,18 @@ gp_VerticalDisplayRange_264_24 equ 0x07 << gcmd_offset | 264 << 10 | 24
|
|||||||
; 6 Horizontal Resolution 2 (0=256/320/512/640, 1=368) ;GPUSTAT.16
|
; 6 Horizontal Resolution 2 (0=256/320/512/640, 1=368) ;GPUSTAT.16
|
||||||
; 7 Flip screen horizontally (0=Off, 1=On, v1 only) ;GPUSTAT.14
|
; 7 Flip screen horizontally (0=Off, 1=On, v1 only) ;GPUSTAT.14
|
||||||
; 8-23 Not used (zero)
|
; 8-23 Not used (zero)
|
||||||
@DisplayMode equ 0x08
|
gp_DisplayMode equ 0x8 << gcmd_offset
|
||||||
gp_DisplayMode_320x240_15bit_NTSC equ @DisplayMode << gcmd_offset | 0x0 << 7 | 0x0 << 6 | 0x0 << 5 | 0x0 << 4 | 0x0 << 3 | 0x0 << 2 | 0x1
|
gp_Disp_HRes_256 equ 0x0
|
||||||
|
gp_Disp_HRes_320 equ 0x1
|
||||||
|
gp_Disp_HRes_512 equ 0x2
|
||||||
|
gp_Disp_HRes_640 equ 0x3
|
||||||
|
gp_Disp_VRes_240 equ 0x0 << 2
|
||||||
|
gp_Disp_VRes_480 equ 0x1 << 2
|
||||||
|
gp_Disp_Color15 equ 0x0 << 4
|
||||||
|
gp_Disp_Color24 equ 0x1 << 4
|
||||||
|
gp_Disp_VInterlace equ 0x1 << 5
|
||||||
|
gp_DisplayMode_320x240_15bit_NTSC equ gp_DisplayMode | gp_Disp_HRes_320 | gp_Disp_VRes_240 | gp_Disp_Color15
|
||||||
|
gp_DisplayMOde_640x480_24bbp_NTSC equ gp_DisplayMode | gp_Disp_HRes_640 | gp_Disp_VRes_480 | gp_Disp_Color24 | gp_Disp_VInterlace
|
||||||
|
|
||||||
;GP0(E1h) - Draw Mode setting (aka "Texpage")
|
;GP0(E1h) - Draw Mode setting (aka "Texpage")
|
||||||
; 0 - 3 Texture page X Base (N * 64) (ie. in 64-halfword steps) ; GPUSTAT.0-3
|
; 0 - 3 Texture page X Base (N * 64) (ie. in 64-halfword steps) ; GPUSTAT.0-3
|
||||||
@@ -141,7 +153,8 @@ gp_b10_Y equ 10
|
|||||||
gp_b16_X equ 0
|
gp_b16_X equ 0
|
||||||
gp_b16_Y equ 16
|
gp_b16_Y equ 16
|
||||||
|
|
||||||
gp_pixel equ (2 * byte)
|
gp_pixel16 equ (2 * byte)
|
||||||
|
gp_pixel24 equ (3 * byte)
|
||||||
gp_vec2 equ word
|
gp_vec2 equ word
|
||||||
|
|
||||||
.macro gp_push_pak, port, reg_scratch, packet
|
.macro gp_push_pak, port, reg_scratch, packet
|
||||||
@@ -153,7 +166,8 @@ gp_vec2 equ word
|
|||||||
store_word reg_scratch, port
|
store_word reg_scratch, port
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
.org 0x80010000 + 3000
|
// TODO(Ed): Figure out an auto region?
|
||||||
|
.org 0x80010000 + 2000
|
||||||
|
|
||||||
.func gp_draw_tri_flat ;(
|
.func gp_draw_tri_flat ;(
|
||||||
gp_draw_tri_flat__sp_size equ (3 * gp_vec2)
|
gp_draw_tri_flat__sp_size equ (3 * gp_vec2)
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
.psx
|
||||||
|
.create "./build/hello_logo.bin", 0x80010000
|
||||||
|
|
||||||
|
.include "./code/graphics_system/dsl.s"
|
||||||
|
.include "./code/graphics_system/gp.s"
|
||||||
|
|
||||||
|
Color_RedFF equ 0x0000FF
|
||||||
|
Color_22 equ 0x222222
|
||||||
|
Color_PS_CadmiumRed equ 0x2400DF
|
||||||
|
Color_PS_CelticBlue equ 0x723F00
|
||||||
|
Color_PS_GoldenPoppy equ 0x00C3F3
|
||||||
|
Color_PS_PersianGreen equ 0x9FAC00
|
||||||
|
|
||||||
|
Display_Width equ (640)
|
||||||
|
Display_Height equ (480)
|
||||||
|
Display_HalfWidth equ Display_Width / 2
|
||||||
|
Display_HalfHeight equ Display_Height / 2
|
||||||
|
|
||||||
|
// TODO(Ed): Figure out an auto-region?
|
||||||
|
.org 0x80010000 + 4000
|
||||||
|
|
||||||
|
Image_SizeX equ 640 * 3 / 2 ; 24bbp needs 1.5x
|
||||||
|
Image_SizeY equ 480
|
||||||
|
Image_ByteSize equ Image_SizeX * Image_SizeY * gp_pixel24
|
||||||
|
Image:
|
||||||
|
.incbin "./assets/logo.bin"
|
||||||
|
|
||||||
|
; Entry Point of Code
|
||||||
|
.org 0x80010000
|
||||||
|
main:
|
||||||
|
reg_io_offset equ rtmp_0
|
||||||
|
load_uimm rtmp_0, IO_BASE_ADDR
|
||||||
|
|
||||||
|
gp0 equ gpio_port0(reg_io_offset)
|
||||||
|
gp1 equ gpio_port1(reg_io_offset)
|
||||||
|
|
||||||
|
; Setup Display Control
|
||||||
|
gcmd_push gp1, rtmp_1, gp_Reset
|
||||||
|
gcmd_push gp1, rtmp_1, gp_DisplayEnabled
|
||||||
|
gcmd_push gp1, rtmp_1, gp_DisplayMode | gp_Disp_Color15 | gp_Disp_VInterlace | gp_Disp_VRes_480 | gp_Disp_HRes_640
|
||||||
|
// gcmd_push gp1, rtmp_1, gp_DisplayMode_320x240_15bit_NTSC
|
||||||
|
// gcmd_push gp1, rtmp_1, gp_DisplayMode_640x480_24bbp_NTSC
|
||||||
|
gcmd_push gp1, rtmp_1, gp_HorizontalDisplayRange_3168_608
|
||||||
|
gcmd_push gp1, rtmp_1, gp_VerticalDisplayRange_504_24
|
||||||
|
gcmd_push gp0, rtmp_1, gp_ModeSetting_DipArea
|
||||||
|
gcmd_push gp0, rtmp_1, gp_SetArea_TopLeft | 0 << gp_b10_Y | 0 << gp_b10_X
|
||||||
|
gcmd_push gp0, rtmp_1, gp_SetArea_BottomRight | Display_Height << gp_b10_Y | Display_Width << gp_b10_X
|
||||||
|
gcmd_push gp0, rtmp_1, gp_SetOffset | 0 << gp_b10_Y | 0 << gp_b10_X
|
||||||
|
|
||||||
|
; Copy image contents to vram
|
||||||
|
gcmd_push gp0, rtmp_1, gp_Blit_CPU_VM
|
||||||
|
gcmd_push gp0, rtmp_1, 0 << gp_b16_Y | 0 << gp_b16_X ; Top Left
|
||||||
|
gcmd_push gp0, rtmp_1, Image_SizeY << gp_b16_Y | Image_SizeX << gp_b16_X ; Bottom Right
|
||||||
|
; DMA commands
|
||||||
|
@id equ rtmp_2
|
||||||
|
@img_cursor equ rtmp_3
|
||||||
|
load_imm @id, Image_ByteSize
|
||||||
|
shift_rl @id, @id, (word / 2)
|
||||||
|
load_addr @img_cursor, Image
|
||||||
|
loop_dma:
|
||||||
|
load_word rtmp_1, (@img_cursor) :: nop :: store_word rtmp_1, gp0 ; @img_curor -> gp_dma_cpu_vm(word)
|
||||||
|
add_si @img_cursor, @img_cursor, word ; @img_cursor ++
|
||||||
|
add_ui @id, @id, -1 :: branch_ne_zero @id, loop_dma :: nop ; @id -- :: if != @id, 0 goto loop_dma
|
||||||
|
|
||||||
|
idle:
|
||||||
|
jump idle :: nop
|
||||||
|
|
||||||
|
.close
|
||||||
+2
-1
@@ -40,4 +40,5 @@ function build-program { param(
|
|||||||
# build-program 'graphics_system' 'hellogpu'
|
# build-program 'graphics_system' 'hellogpu'
|
||||||
# build-program 'graphics_system' 'hello_gouraud'
|
# build-program 'graphics_system' 'hello_gouraud'
|
||||||
# build-program 'graphics_system' 'hello_gp_routines'
|
# build-program 'graphics_system' 'hello_gp_routines'
|
||||||
build-program 'graphics_system' 'hello_image'
|
# build-program 'graphics_system' 'hello_image'
|
||||||
|
build-program 'graphics_system' 'hello_logo'
|
||||||
|
|||||||
Reference in New Issue
Block a user