I have a Net Yaroze which I want to dev on and would like to put in a cdr with my data. It's not chipped so it doesn't read cdr when the lid is opened. I'm not even 100% sure the swap would work, but worth a try! The NY lib has cdrom read access but that's pretty much it.. ie there's no CdControl which includes CdlStop. I found some source for the cdrom control stuff here https://github.com/ColdSauce/psxsdk/tree/master/libpsx/src But I couldn't compile the asm (.s) file with the NY tool chain, I'm guessing it's because the NY toolchain is from the early 90's while everything else is 'newer' ie: sw $s1, 64($sp) = The $ is wrong compiles: sw t1,(t2) // Store in buffer But I'm no asm expect. I also tried link to the psyq object.. but didn't work. So next I built a psyq patched psx.exe (80090000) which just runs CdlStop. I put it in NY RAM (80090000) and tried running it (via exec), but it freezes.. I'm guessing it's using the same stack/heap location? Anyone know how to load/run an exec from ram? Or familiar with old MIPS assembly lol Thanks for any help.
You're getting syntax errors, probably because you're using a different assembler. I am not familar with the PlayStation toolchains, but if it is GCC, you could try assembling the assembly code with gcc instead of as.
Got your link from YouTube. What you have is indeed a syntax error and it's happening even if you're using PSY-Q (I compiled tail's toolchain a long time ago); the latest GCC is kind of different, but not that much if you can operate some manual changes. In my case, I was having issues with kernel functions relying on the BIOS, they wouldn't compile for some reason I can't remember exactly, something about unsupported jump mode possibly. In your case, declare registers with no $ symbol or use $x, where x is the numeric representation of a register index. As for cd rom libraries, I was working on getting some new libs on my own from PSY-Q disassemblies and general updates. Unfortunately that didn't turn out too good, GCC tends to mess around hardware write order.
thanks guys for the reply, I did use gcc and as both failed for the same reasons, I think gcc just runs as in the background anyway. I have some NY asm code which compiles with gcc fine, been trying to spot the difference, I'll put it up tomorrow. It's different to what's on github, which compiles fine with psyq but not on NY. I'll put up the errors also tomorrow, till then.
Okay,so from the asm file: https://github.com/ColdSauce/psxsdk/blob/master/libpsx/src/cdromh.s I add to the top: #include <asm.h> I had to move these comments at 46-48 into a single line: # If the CDROM command isn't direct # (direct = sent by us and not by the BIOS' ISO9660 routines) # exit and let the BIOS do its work. Line 5: cdromh.s:5: Error: illegal operands `addi' -> addi $sp, -112It says: I've googled, and not sure why it's illegal, anyway.. I change it to add and then it says: Error: illegal operands I remove the $ from $sp and it fails on: Error: illegal operands `sw' I do a search (sw $) and replace (sw ) removing the $ It still complains about the sw, Error: illegal operands `sw' So, I guess it's the sp it doesn't like? The sw works in the NY code, not sure what to do :/ This compiles fine with the NY gcc Code: #include <asm.h> #define table 0x8009 .text .align 2 .globl p_asm .set noreorder .set noat // a0 is theta value.. p_asm: la t2,buffer or v0,zero,238*4 // Y count $outer: lui AT,table or AT,AT,v0 lw a2,0(AT) // Cossine[Y] lui a3,table sll AT,a0,2 or a3,a3,AT // &Cossine[theta] lw t0,0(a3) // cossine[theta] (x=0) srl a1,a2,16 add a1,a1,a0 add a1,a1,a0 // 2theta+cos[y] sll a2,a2,16 srl a2,a2,16 // sin[y] or v1,zero,40 // X count $inner: sll AT,t0,16 // sin[thetax] srl AT,AT,16 sub AT,AT,a1 // - c1 and AT,AT,256 srl t1,AT,7 // First bit srl AT,t0,16 // cos[thetax] lw t0,8(a3) // Next cossine add AT,AT,a2 // + c2 and AT,AT,256 srl AT,AT,8 // 2nd bit or t1,t1,AT // First pixel add a1,a1,1 // Increase X for constants add a2,a2,1 sll AT,t0,16 // sin[thetax] srl AT,AT,16 sub AT,AT,a1 // - c1 and AT,AT,256 sll AT,AT,1 // First bit or t1,t1,AT srl AT,t0,16 // cos[thetax] lw t0,16(a3) // Next cossine add AT,AT,a2 // + c2 and AT,AT,256 // 2nd bit or t1,t1,AT // Second pixel add a1,a1,1 // Increase X for constants add a2,a2,1 sll AT,t0,16 // sin[thetax] srl AT,AT,16 sub AT,AT,a1 // - c1 and AT,AT,256 sll AT,AT,9 // First bit or t1,t1,AT srl AT,t0,16 // cos[thetax] lw t0,24(a3) // Next cossine add AT,AT,a2 // + c2 and AT,AT,256 sll AT,AT,8 // 2nd bit or t1,t1,AT // Third pixel add a1,a1,1 // Increase X for constants add a2,a2,1 sll AT,t0,16 // sin[thetax] srl AT,AT,16 sub AT,AT,a1 // - c1 and AT,AT,256 sll AT,AT,17 // First bit or t1,t1,AT srl AT,t0,16 // cos[thetax] lw t0,32(a3) // Next cossine (actually for next loop) add AT,AT,a2 // + c2 and AT,AT,256 sll AT,AT,16 // 2nd bit or t1,t1,AT // Fourth pixel sw t1,(t2) // Store in buffer add t2,t2,4 add a1,a1,1 // Increase X for constants add a2,a2,1 sub v1,v1,1 bne v1,zero,$inner add a3,a3,32 // DELAY slot..executes before jump bne v0,zero,$outer sub v0,v0,8 // DELAY slot..executes before jump BUT after test!! jr ra nop I use the NY GCC: gcc -c -x assembler-with-cpp file.s It works, but both files fail with the as command: as filename
Replace "sw t1,(t2)" with "sw t1, 0(t2)"; the NY toolchain may implicitly declare the index value as 0, but according to the standard you need to make that explicit. As for the addi error, try using addiu instead. addi isn't exactly used anywhere, unless you need overflow exceptions, which you don't. Speaking of add, that can only be used when you're adding registers together, but just like addi, use addu instead as the only difference is still that overflow bit set for exceptions.
Ah your right about addiu! the "at" need to be $at I'm stuck at, line 32 sw $s8, 104($sp) doesn't seem to work with/out the $ sw t1,(t2) works on the NY toolchain, what i'm trying to compile is the cdromh.s Code: #include <asm.h> .global _internal_cdrom_handler .set noat _internal_cdrom_handler: addi $sp, -112 sw $at, 0($sp) sw $v0, 4($sp) sw $v1, 8($sp) sw $a0, 12($sp) sw $a1, 16($sp) sw $a2, 20($sp) sw $a3, 24($sp) sw $t0, 28($sp) sw $t1, 32($sp) sw $t2, 36($sp) sw $t3, 40($sp) sw $t4, 44($sp) sw $t5, 48($sp) sw $t6, 52($sp) sw $t7, 56($sp) sw $s0, 60($sp) sw $s1, 64($sp) sw $s2, 68($sp) sw $s3, 72($sp) sw $s4, 76($sp) sw $s5, 80($sp) sw $s6, 84($sp) sw $s7, 88($sp) sw $t8, 92($sp) sw $t9, 96($sp) sw $gp, 100($sp) sw $s8, 104($sp) sw $ra, 108($sp) # Do not run code if cdrom interrupt is not enabled li $t0, 0x1f801074 lw $t1, 0($t0) andi $t1, $t1, 4 beq $t1, $zero, cdrom_handler_end nop # Do not run code if cdrom interrupt is not pending li $t0, 0x1f801070 lw $t1, 0($t0) andi $t1, $t1, 4 beq $t1, $zero, cdrom_handler_end nop # If the CDROM command isn't direct # (direct = sent by us and not by the BIOS' ISO9660 routines) # exit and let the BIOS do its work. cdrom_check_direct_cmd: la $t0, cdrom_command_direct lw $t1, 0($t0) beq $t1, $zero, cdrom_handler_end nop cdrom_fire_user_handler: la $t0, cdrom_handler_callback lw $t1, 0($t0) jalr $t1 nop # Remove bit for CDROM interrupt (bit 2) from pending interrupts mask. cdrom_handler_remove_pending: li $t0, 0x1f801070 lw $t1, 0($t0) xori $t1, $t1, 4 sw $t1, 0($t0) cdrom_handler_end: lw $at, 0($sp) lw $v0, 4($sp) lw $v1, 8($sp) lw $a0, 12($sp) lw $a1, 16($sp) lw $a2, 20($sp) lw $a3, 24($sp) lw $t0, 28($sp) lw $t1, 32($sp) lw $t2, 36($sp) lw $t3, 40($sp) lw $t4, 44($sp) lw $t5, 48($sp) lw $t6, 52($sp) lw $t7, 56($sp) lw $s0, 60($sp) lw $s1, 64($sp) lw $s2, 68($sp) lw $s3, 72($sp) lw $s4, 76($sp) lw $s5, 80($sp) lw $s6, 84($sp) lw $s7, 88($sp) lw $t8, 92($sp) lw $t9, 96($sp) lw $gp, 100($sp) lw $s8, 104($sp) lw $ra, 108($sp) addi $sp, 112 jr $ra nop
Your problem there is with s8. Replace it with fp, they are the same register. According to this, it's just a macro for some systems using fp in unconventional ways.
Hey Thanks heaps for your help and the link! I got past that cdromh.s file no i'm stuck on : Code: # Exception / Interrupt functions .global EnterCriticalSection .global ExitCriticalSection .global SysEnqIntRP .global SysDeqIntRP EnterCriticalSection: #li $a0, 1 syscall nop #jr $ra nop ExitCriticalSection: #li $a0, 2 syscall nop #jr $ra nop SysEnqIntRP: li $9, 0x02 j 0xc0 nop SysDeqIntRP: li $9, 0x03 j 0xc0 nop in particular these lines two lines: li $a0, 1 jr $ra This is the last asm, I try it out once past these two!
Oh wow sorry I forgot, I was tired :/ both are: Error: illegal operands I tried both with/out $ In the cdromh.s file li had specified an address and the jr ra work but not in this file.
It's because the compiler supplied with the Yaroze toolchain is very old, and doesn't recognize the MIPS alternate register names. The easiest way to fix it is to just change the code to use register numbers instead: EnterCriticalSection: li $4, 1 syscall nop jr $31 nop ExitCriticalSection: li $4, 2 syscall nop jr $31 nop I assume the reason the other code works is that it has that "#include <asm.h>" line - and I guess those alternate names are being defined there.
Thanks heaps for the help guys. It works good! The code is very crappy, it uses my c64 intro and it displays the root content. The only issue is it only works when CdReadSync(0,0) == 0 It just stall otherwise. It works randomly, I tried running the following when != 0, but didn't help VSync(0); _96_remove(); ExitCriticalSection(); Anyway, cheers!