Page 4 of 4 FirstFirst ... 234
Results 31 to 40 of 40

Thread: another day, another problem (touchpad).

  1. #31

    another day, another problem (touchpad).

    i have searched for a cpuid-like instruction, but didn't find one (which doesn't
    say anything, because i was short on time).

    if i give you code to determine which processor is running the current
    application, would that help?

  2. #32

    another day, another problem (touchpad).

    i've done it.

    it's really easy :D

    i've got environment-aware programs now (well ... at least it sounds good xD)

  3. #33

    another day, another problem (touchpad).

    Nice! Please, explain now
    Get your fpc4gba copy now!
    Get your fpc4nds copy now!

  4. #34

    another day, another problem (touchpad).

    first i thought about a cpuid-like-instruction, but didn't find anything in the manuals... then i thought it's possible to measure the performance to determine which cpu the code is running on, but that's too complicated.

    so i thought... each processor has features the other doesn't have, so i
    tried this:

    Code:
    var
      Dummy : pcuint16 = pointer($06800000);
      WhichAmI : Boolean; // True = ARM9
    
    begin
      Dummy[0] := 2106;
    
      If (Dummy[0] = 2106) then WhichAmI := True
         Else WhichAmI := False;
    End.
    You see, the ARM7 can't write to bank A of VRAM, but it doesn't give
    any error ... it just doesn't write there... so it's easily determinable
    what CPU is running the code ... do you understand? :D

    btw, tested in no$gba and on real hardware ... and worked.

    does this help you?

    edit: the actual code i've used is different. because i can't do printf on
    arm7 i had to use ipc to tell arm9 if arm7 found itself, but as you want
    the program to know on which CPU it's running, the code above should
    give you what you need. :)

  5. #35
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    another day, another problem (touchpad).

    *high five* 21o6!

    Now thats the kind of pioneering that we love to see at PGD. Nice work.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  6. #36

    another day, another problem (touchpad).

    are you making fun of me? :scratch:

    i'm sorry, i'm really not used to forums :D

    thank you :D

  7. #37
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    another day, another problem (touchpad).

    No, I thought your solution was very innovative. Keep up what you're doing. :thumbup:

    [size=9px](oh and turn on BBCode in your posts if you want to see the smilies. )[/size]
    Jason McMillen
    Pascal Game Development
    Co-Founder





  8. #38

    another day, another problem (touchpad).

    thank you :D

    i hope legolas can use this :)

    (and yeah, i forgot to turn it on. i normally don't like them, but the scratching
    one was really appropriate :D)

  9. #39

    another day, another problem (touchpad).

    The idea beyond your workaround is very good and seems that work fine :clap:
    Btw, this is my modified function I have added to the rtl:
    [pascal]{ CPU detecting function (thanks to 21o6):
    ----------------------------------------
    "You see, the ARM7 can't write to bank A of VRAM, but it doesn't give any
    error ... it just doesn't write there... so it's easily determinable what
    CPU is running the code"}
    function IsARM9(): boolean;
    var
    Dummy : pword absolute $06800000;
    begin
    Dummy^ := $C0DE;
    IsARM9 := Dummy^ = $C0DE;
    end;

    ...

    if IsARM9 then
    fpc_cpucodeinit;[/pascal]
    (Please, note the g33k value :cylon: :mrgreen
    Get your fpc4gba copy now!
    Get your fpc4nds copy now!

  10. #40

    another day, another problem (touchpad).

    \:D/

    thank you for quoting me :D

    using $C0DE was a great idea :DD

Page 4 of 4 FirstFirst ... 234

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
  •