Results 1 to 9 of 9

Thread: SH4 Assembly

                  
   
  1. #1
    DCEmu Newbie mrclean's Avatar
    Join Date
    Jul 2005
    Location
    California
    Posts
    6
    Rep Power
    0

    Default SH4 Assembly

    Hi,

    I remember a while back Mekanaizer was working on a SH4 assembly tutorial. Did he ever finish it? If not, could anyone direct me to a good resource for learning SH4 assembly? I can't find any books on the subject in the bookstore or library. Thank you

  2. #2

    Default

    You should read the SH4 programming manual. I couldn't find a copy on Hitachi's homepage anymore, but here's a cached copy:

    http://mc.pp.se/dc/files/h14tp003d2.pdf

  3. #3
    Dream Coder
    Join Date
    Apr 2004
    Location
    Miami, FL
    Age
    37
    Posts
    4,675
    Rep Power
    50

    Default

    The best way to learn is to write some simple piece of code in C that highlights the majority of things you would do, then just pass it though gcc to get the asm equivilant and study it.

  4. #4

    Default

    EDITED


    I disagree, it wouldn't be a good asm code. The idea of using asm should be to learn how to be better than the compiler so what you really need to know it's a lot of the hardware you are using so you can write optimized code. I think the good way could be to familiarize with very simple examples and easy architectures to learn, like the PICs 16FXXX, M+ (plus machine), M++, just to get a basic idea, then try to move to the architecture of your interest or a similar one

    A very simple example in x86 asm (linux) to show the differences between an asm code and the asm you get from the C compiler it could be this:

    C code
    Code:
    /* hello.c */
    #include 
    
    main()
    {
    	printf("hello\n")
    }
    asm code,i think this is the good one but my x86 asm level sucks so...

    Code:
    
    section .text
    global _start
    msg db 'Hello, world!', 0Ah
    len equ $ - msg
    _start:
            mov edx,len
            mov ecx,msg
            mov ebx,1
            mov eax,4
            int 80h
            mov eax,1
            int 80h
    asm code, reverted using gdb
    Edit: I realized the gdb code i pasted was wrong. Anyway here's the good one (with a tutorial explaining how to use gdb, so nice site to visit :-D ): http://lab46.corning-cc.edu/Document...B_Debugger.php



    As you can see even in something so simple like this you'll find differences: no something important for this but imagine the so much differences you'll find in big programs ;-)

  5. #5
    DCEmu Newbie mrclean's Avatar
    Join Date
    Jul 2005
    Location
    California
    Posts
    6
    Rep Power
    0

    Default

    Thanks guys, very useful advice. I guess I'll start learning, I have the rest of the summer

  6. #6
    Dream Coder
    Join Date
    Apr 2004
    Location
    Miami, FL
    Age
    37
    Posts
    4,675
    Rep Power
    50

    Default

    bender: i meant mostly for syntax and a general grasp of what opcodes do what. For the second thing, you would want to read the hitachi programmers manual that was already linked. It describes the features of the processor, cache, and how the pipelining system works with the different opcode sets.

  7. #7

    Default

    oh, sorry. I wish my english was better so i can understand always ok. Anyway, i've seen speaking you in spanish at dciberia and it's ... , just kidding
    your spanish it's pretty nice and it surprised me a lot, better than my english, man ;-)

  8. #8
    Dream Coder
    Join Date
    Apr 2004
    Location
    Miami, FL
    Age
    37
    Posts
    4,675
    Rep Power
    50

    Default

    pude hablarlo mejor antes, pero pase un año sin hablar o escribirlo. tambien no sepo como añadir los accentos (`).

    your english is very good, I did not notice you were not a native speaker, I simply wasn't clear in what I meant.

  9. #9

    Default

    hehe, your spanish it's pretty nice.
    For accents first push the accent key, then a vocal and you will have your accented vocal ;-) á é í ó ú

    @mrclean, back on topic, you probably know about the guys who started reversing the DC. Dan Potter, AndrewK (have a look at burritro's perhaps) and Marcus Comstedt probably have some useful info about sh asm in their respective sites. There's also fame, the main cpu core of superfamicast/dreamspec, bor and now Holly3D for some sh asm code ;-)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •