diff --git a/code/asmdd/dsl.asm b/code/asmdd/dsl.s similarity index 100% rename from code/asmdd/dsl.asm rename to code/asmdd/dsl.s diff --git a/code/asmdd/gp.asm b/code/asmdd/gp.s similarity index 100% rename from code/asmdd/gp.asm rename to code/asmdd/gp.s diff --git a/code/asmdd/io.asm b/code/asmdd/io.s similarity index 100% rename from code/asmdd/io.asm rename to code/asmdd/io.s diff --git a/code/duffle/gp.h b/code/duffle/gp.h index 3a714bf..322e6d5 100644 --- a/code/duffle/gp.h +++ b/code/duffle/gp.h @@ -85,4 +85,4 @@ typedef def_struct(gp_Vec2) { U16 y; }; -extern void gp_screen_init(); +void gp_screen_init(); diff --git a/code/graphics_hello_psyq/hello_gpu.asm b/code/graphics_hello_psyq/hello_gpu.s similarity index 65% rename from code/graphics_hello_psyq/hello_gpu.asm rename to code/graphics_hello_psyq/hello_gpu.s index 2cbc8bf..690827e 100644 --- a/code/graphics_hello_psyq/hello_gpu.asm +++ b/code/graphics_hello_psyq/hello_gpu.s @@ -1,11 +1,9 @@ -.include "./toolchain/pcsx-redux/src/mips/common/crt0/crt0.s" +// .include "./toolchain/pcsx-redux/src/mips/common/crt0/crt0.s" -.include "./asmdd/dsl.asm" -.include "./asmdd/io.asm" -.include "./asmdd/gp.asm" +.include "./asmdd/dsl.s" +.include "./asmdd/io.s" +.include "./asmdd/gp.s" -#.section .text.gp, "ax, @progbits" -#.align 2 .global gp_screen_init .type gp_screen_init, @function gp_screen_init: @@ -15,7 +13,6 @@ gp_screen_init: #define gp1 gpio_port1(rio_offset) gcmd_push gp1, rtmp_1, gp_Reset - nop; nop; gcmd_push gp1, rtmp_1, gp_DisplayEnabled jump_reg rret_addr; nop diff --git a/scripts/build_psyq.ps1 b/scripts/build_psyq.ps1 index a180db1..1cc7bab 100644 --- a/scripts/build_psyq.ps1 +++ b/scripts/build_psyq.ps1 @@ -17,7 +17,7 @@ if ((test-path $path_build) -eq $false) { # Assumes 'mipsel-none-elf' toolchain is in your system's PATH. $Prefix = "mipsel-none-elf" $Compiler = "$($Prefix)-gcc" -$Assembler = $Compiler +$Assembler = "$($Prefix)-as" $Objcopy = "$($Prefix)-objcopy" # --- GCC/MIPS Flags --- @@ -78,7 +78,7 @@ $f_objcopy_format = "-O" $path_pcsx_redux = join-path $path_toolchain 'pcsx-redux' $path_nugget = join-path $path_pcsx_redux 'src/mips' -# $path_nugget_common = join-path $path_nugget 'common' +$path_nugget_common = join-path $path_nugget 'common' $path_psyq = join-path $path_toolchain 'psyq-4_7' $path_psyq_iwyu = join-path $path_toolchain 'psyq_iwyu' $path_psyq_imyu_inc = join-path $path_psyq_iwyu 'include' @@ -111,7 +111,7 @@ function assemble-unit { param( write-host "Assembling '$unit' -> '$link_module'" -ForegroundColor Cyan $assemble_args | ForEach-Object { Write-Host "`t$_" -ForegroundColor Green } - & $Assembler $assemble_args + & $Compiler $assemble_args if ($LASTEXITCODE -ne 0) { write-error "Compilation failed for $unit. Aborting."; exit 1 } } function compile-unit { param( @@ -147,7 +147,8 @@ function compile-unit { param( $compile_args += $user_compile_args - $compile_args += $f_compile, $unit, ($f_output + $link_module) + $compile_args += $f_compile + $compile_args += $unit, ($f_output + $link_module) write-host "Compiling '$unit' -> '$link_module'" -ForegroundColor Cyan $compile_args | ForEach-Object { Write-Host "`t$_" -ForegroundColor Green } @@ -216,10 +217,14 @@ function link-modules { param( $final_link_args = @($link_args) + ($f_output + $elf) + $base_name = [System.IO.Path]::GetFileNameWithoutExtension($elf) + $dasm = "$(join-path $path_build $base_name).dasm" + write-host "Linking modules into '$elf'" -ForegroundColor Cyan $final_link_args += ($f_link_pass_through_prefix + $f_link_end_group) $final_link_args | foreach-object { write-host $_ } & $Compiler $final_link_args + & mipsel-none-elf-objdump.exe -W $elf >> $dasm if ($LASTEXITCODE -ne 0) { write-error "Linking failed. Aborting."; exit 1 } } function make-binary { param( @@ -270,14 +275,18 @@ function build-graphis_hello { $path_module = join-path $path_code 'graphics_hello_psyq' - $src_asm = join-path $path_module 'hello_gpu.asm' + $src_asm_crt = join-path $path_nugget_common 'crt0/crt0.s' + $module_asm_crt = join-path $path_build 'crt0.o' + + $src_asm = join-path $path_module 'hello_gpu.s' $module_asm = join-path $path_build 'hello_gpu.o' $assemble_args = @() $assemble_args += $f_debug $assemble_args += $f_optimize_none $assemble_args += ($f_include + $path_code) - assemble-unit $src_asm $module_asm $includes $assemble_args + assemble-unit $src_asm_crt $module_asm_crt $includes $assemble_args + assemble-unit $src_asm $module_asm $includes $assemble_args $src_c = join-path $path_module 'hello_gpu.c' $module_c = join-path $path_build 'hello_gpu_c.o' @@ -295,7 +304,7 @@ function build-graphis_hello { $link_args = @() $link_args += $f_debug # $link_args += $f_optimize_size - link-modules @($module_asm, $module_c) $elf $link_args + link-modules @($module_asm_crt, $module_asm, $module_c) $elf $link_args make-binary $elf $exe } build-graphis_hello