Search found 166 matches

by Newbie
Tue Mar 28, 2017 7:22 pm
Forum: Programming Discussion
Topic: The case of the divide by zero
Replies: 17
Views: 1298

Re: The case of the divide by zero

The manual says clearly that there is a dedicated "divide by zero" exception for FPU. As I do not achieve to trigger "divide by zero", I decide to move to the level up. I said in a earlier post that in SH4 the SR register (Status register) contains a bit in position 15 called FD. This FD bit is "FPU...
by Newbie
Mon Mar 27, 2017 11:12 am
Forum: Programming Discussion
Topic: The case of the divide by zero
Replies: 17
Views: 1298

Re: The case of the divide by zero

Are you sure that GCC is not just optimizing away the division entirely since the result is never actually being used? Have you looked at the assembly output and made sure that it is actually doing the division at all? Well, I thought about this possibility. So to not be "corrupted" by how GCC coul...
by Newbie
Sun Mar 26, 2017 7:06 pm
Forum: Programming Discussion
Topic: The case of the divide by zero
Replies: 17
Views: 1298

The case of the divide by zero

I could not obtain an error when I divide a float value by zero .... I send a little C code that I use to make the test. If you run it : you obtain an exception (quite normal). If you replace in the source code the word "int" by "float" and run it : no error occurs. It seems that for FPU unit, there...
by Newbie
Sun Mar 26, 2017 7:02 pm
Forum: Programming Discussion
Topic: About debugging
Replies: 12
Views: 911

Re: About debugging

Thanks for all : it ends my questions about debugging :)
by Newbie
Fri Mar 17, 2017 9:15 am
Forum: Programming Discussion
Topic: About debugging
Replies: 12
Views: 911

Re: About debugging

Hi, When using irq_set_handler() function in KOS and provide a C function following the appropriate type def as handler, I could use context structure to retrieve registers values. It seems that the registers after leaving handler are restored so no need to save them at all in the handler before usi...
by Newbie
Thu Mar 16, 2017 8:43 am
Forum: Hardware Hacking and Repair
Topic: Disc drive stops working after logo
Replies: 4
Views: 1473

Re: Disc drive stops working after logo

If you put nothing in the Dreamcast (No disc at all) and switch it on, are you able to see the main menu ? If Yes : it close to be a drive issue. In this case, listen to the boot sequence when a disc is in your Dreamcast and you switch it on : if the drive try to move but could not read anything, it...
by Newbie
Mon Mar 06, 2017 11:39 am
Forum: Programming Discussion
Topic: About debugging
Replies: 12
Views: 911

Re: About debugging

Well, I can't really comment too much on the code (I haven't actually had a chance to read/digest it)... Sad, but thanks to give me some clues. I don't know why you pulled code from the GDB stub though for getting the registers, since irq_context_t is actually a type in KOS. Now, what you're doing ...
by Newbie
Sun Mar 05, 2017 4:16 pm
Forum: Programming Discussion
Topic: About debugging
Replies: 12
Views: 911

Re: About debugging

Sorry for the late answer. I try to test a "minimal" debug scenario with UBC. Scenario : The story is to execute a handler function that prints the PC value of each instructions one by one each time before those instructions are executed. It' a a mean of test for accuracy of code behavior. Condition...
by Newbie
Tue Feb 28, 2017 7:25 pm
Forum: Programming Discussion
Topic: About debugging
Replies: 12
Views: 911

Re: About debugging

Your only other option would be to effectively overwrite instructions as you go with trapa, which is just plain ugly to do (you have to deal with flushing the cache every instruction, which, well, is a lot of extra work to be doing). I agree with you, it's painful and ugly :) By the way, I read the...
by Newbie
Tue Feb 28, 2017 5:17 am
Forum: Programming Discussion
Topic: About debugging
Replies: 12
Views: 911

Re: About debugging

Thanks for your answers. I just want to be sure there' s no kind of special interrupt in SH4 like in X86. Effectively, I found three way of doing so : the UBC, JTAG and some kind of trick using TRAPA. On this subject, I suspect KOS using some TRAPA instructions. Is there some number (TRAPA #N) that ...
by Newbie
Mon Feb 27, 2017 1:26 pm
Forum: Programming Discussion
Topic: About debugging
Replies: 12
Views: 911

About debugging

Hello everybody, I know about TRAP #N instruction in SH4 (N between 0-255). But is there something in SH4 like "Single Step (Trace) Exception (INT 1)" in X86 ? To Clarify : The single step exception occurs after every instruction if the trace bit in the flags register is equal to one. Debuggers and ...
by Newbie
Mon Oct 24, 2016 7:10 am
Forum: Programming Discussion
Topic: About "Stack pointer" register in SH4
Replies: 3
Views: 543

Re: About "Stack pointer" register in SH4

Thanks for your answers :)

Now I know that R15 is not a "special stack register" (like in x86).
But as it is used mainly for this purpose in all code I use (like KOS), I could not replace it easily without big bad surprises.

I keep on learning.
Thanks again.
by Newbie
Sun Oct 23, 2016 5:55 pm
Forum: Programming Discussion
Topic: About "Stack pointer" register in SH4
Replies: 3
Views: 543

About "Stack pointer" register in SH4

Hi everybody, I have discovered here with help of wise guys that R15 is used as a stack pointer register. So it could be used to save / restore registers values. I had never seen something about this usage of R15 in the Renesas / Hitachi manuals. So my questions are : Is that really correct that thi...
by Newbie
Mon Sep 26, 2016 12:03 pm
Forum: Programming Discussion
Topic: Source code of _free function
Replies: 2
Views: 672

Re: Source code of _free function

Hi,

Sorry for the late answer.

I am on my way learning SH4 asm step by step.

Now i need to figure out how to allocate / free chunk of ram and all array operations.
So i compare source code (in C) and output in asm.

Free function is interesting.

Thanks.
by Newbie
Fri Sep 23, 2016 2:37 pm
Forum: Programming Discussion
Topic: Source code of _free function
Replies: 2
Views: 672

Source code of _free function

Hi everybody,

Is anybody know where i could find the source code of the _free function used in KOS ?

Thanks.
by Newbie
Fri Sep 09, 2016 6:22 am
Forum: Programming Discussion
Topic: SH4 Interrupt handling
Replies: 4
Views: 749

Re: SH4 Interrupt handling

Thanks a lot.
It is very useful!
Now things are clear :)
by Newbie
Wed Sep 07, 2016 4:27 pm
Forum: Programming Discussion
Topic: SH4 Interrupt handling
Replies: 4
Views: 749

Re: SH4 Interrupt handling

The processor also has a debugging mode which seems to allow single stepping etc but I haven't used it I am not interesting on hardware irq only software ones. Either read the documentation for the SH4 by renesas, or look at the irq*c files and grep for irq in the few assembly. s files. I have read...
by Newbie
Wed Sep 07, 2016 1:36 pm
Forum: Programming Discussion
Topic: SH4 Interrupt handling
Replies: 4
Views: 749

SH4 Interrupt handling

Hi everybody, In X86 architecture, INT instruction is used to generate a software interrupt. The interrupt number is formatted as a byte value. When written in assembly language, the instruction is written like this: INT X. In real mode : the X86 processor calls one of the 256 functions pointed to b...
by Newbie
Wed Aug 17, 2016 7:11 pm
Forum: Programming Discussion
Topic: Timer precision
Replies: 2
Views: 502

Re: Timer precision

It is interesting piece of code, I may test it but it won't compile : First problem : I assume you will put on top of code some define for values you use in your code as : TSTR, TOCR, TCR2, TCOR2, TCNT2, TCR_FREQUENCY_4, TCR_UNIE, TSTR_TMU2, IPRA_TMU2. I found some in KOS like those : #define TSTR 0...
by Newbie
Tue Jul 12, 2016 5:36 pm
Forum: Programming Discussion
Topic: How ObjDump retrieve labels from elf file
Replies: 4
Views: 441

Re: How ObjDump retrieve labels from elf file

Hi, Thanks for answers, I use HXD (https://mh-nexus.de/en/hxd/). Well, I expected a simpler way of reading labels to figure out position code in the elf file. Perhaps even writing some code to obtain it. If it uses something like referencing an id used to retrieve the label string from a far located...