Slashdot Mirror


User: Hal_Porter

Hal_Porter's activity in the archive.

Stories
0
Comments
8,852
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 8,852

  1. Re:Commander Keen on Historians Recreate Source Code of First 4004 Application · · Score: 2, Informative
    Damnit slashdot really doesn't like

    patch1:
        addl ebp,12345678h
    generates some code like this

    81 C5 78 56 34 12
    The first two bytes are addl,ebp and the rest are the constant.

    Now what Carmack wants to do here is to have an extra register to hold a constant so he overwrites the constant in the instruction. Patch1+2 is where the constant is

    movl ebx,[_dc_iscale] // get the constant
        shll ebx,9 // constant <<= 9
        movl eax,OFFSET patch1+2 // get the address of the constant in the instruction
        movl [eax],ebx // overwrite it in the instruction
    So essentially the code becomes

    patch1:
        addl ebp, _dc_iscale << 9
    What I'm not sure is why he didn't do addl ebp,[FractionalIncrement]. That would take the FractionalIncrement from a memory location. Then he wouldn't need the self modifying code, he could just write _dc_iscale << 9 there.

    On the other hand, maybe the code is memory limited anyway and this will slow it down.

    On a recent x86 processor self modifying code will be correct but not too fast. If code is not self modifying it will execute from the instruction cache and writes will be buffered and stored in writeback data cache. Self modifying code screws with this - the write needs to end up in the i cache somehow. And x86 opcodes are converted into a Risc like internal format for execution, and if these are cached you need to flush that cache too. And since they have to do it on old code they have to do all steps automatically with no hints from the programmer.

    On an ARM you just need to clean the dcache, flush the write buffer and flush the icache as ARM instructions are a executed directly. And all these are things the programmer has to ask for explicitly using MCR and MRC instructions. Actually ironically the ARM has more registers 13 instead of 6 so you have less need for this and you can encode shift counts for free, so in ARM you could do this

    patch1:
    ; Rx holds whatever was in ebp
    ; Ry is _dc_iscale
      ldr Rx, [Rx, Ry, lsl #9] // Rx = Rx + (Ry<<9)
  2. Re:Commander Keen on Historians Recreate Source Code of First 4004 Application · · Score: 1

    patch1:
        addl ebp,12345678h
    generates some code like this

    81 C5 78 56 34 12
    The first two bytes are addl,ebp and the rest are the constant.

    Now what Carmack wants to do here is to have an extra register to hold a constant so he overwrites the constant in the instruction. Patch1+2 is where the constant is

    movl ebx,[_dc_iscale] // get the constant
        shll ebx,9 // constant <<= 9
        movl eax,OFFSET patch1+2 // get the address of the constant in the instruction
        movl [eax],ebx // overwrite it in the instruction
    So essentially the code becomes

    patch1:
        addl ebp, _dc_iscale << 9
    What I'm not sure is why he didn't do addl ebp,[FractionalIncrement]. That would take the FractionalIncrement from a memory location. Then he wouldn't need the self modifying code, he could just write _dc_iscale

    patch1:
    ; Rx holds whatever was in ebp
    ; Ry is _dc_iscale
      ldr Rx, [Rx, Ry, lsl #9]
  3. Re:Fear of the fearless on Genetically Engineered Mouse is Not Scared of Cats · · Score: 1

    The thing I think is interesting is that "fear of cats" in mice is actually a misnomer. Fear implies some sort of high level decision. As the researchers pointed out this research shows the behaviour is completely hard wired. Which seems surprising in mammals - it's the sort of thing you'd expect in insects.

  4. Re:Simple solution: on Chinese Sub Pops Up Amid US Navy Exercise · · Score: 5, Interesting

    Well only 25% of US debt is foreign owned and 47% of that is owned by Japan or China

    http://en.wikipedia.org/wiki/United_States_public_debt#Consequences_of_foreign_ownership_of_U.S._debt

    Looking at this

    http://www.ustreas.gov/tic/mfh.txt

    About 40% of that is owned by China. So China owns 25% * 47% * 40%, or about 5% of US debt. Even if by some magical process it evaporated overnight the US would survive. If they sold, the dollar would fall which would improve the trade balance from a US perspective, the US economy would be dinged but China would be desperately short of money. And once they started to sell the price of the remaining bonds would fall - they'd actually cause a crash in the price of the ones they still held.

    None of that is the Chinese interest. Plus the actual money is in the US. So the US government actually owns a chunk of money which China needs.

    Now I hate the Chinese government, but them lending money to the US government doesn't seem like a problem to me. In fact as people have pointed out if China attacked Taiwan I'd expect the US Treasury to seize the money in some way so it acts as a stabilising factor on them.

  5. Re:Simple solution: on Chinese Sub Pops Up Amid US Navy Exercise · · Score: 1

    Actually, I've always thought that the US military is more dependent on procedure than individual intelligence, at least compared to European militaries.

    That's not a bad thing by any means - if you design around swarm intelligence a few lazy people can't cause a catastophe. Systems based around individual intelligence are vulnerable to few screw ups. And screw ups are not exactly uncommon in all militaries.

    Now the swarm intelligence solution is to add some system that detects Chinese subs and have someone stare at 24/7 and take the appropriate simple action. Actually most large American institions seem to be based on this. Disneyland or DHL for example.

    Look on the bright side, swarm intelligence makes the military easier to automate completely, which will be useful when Skynet takes over.

  6. Re:Windows DRM means not free. on NBC Direct Launches With Free Downloads · · Score: 1

    Windows is a tool needed to view the content. You wouldn't claim TV isn't free because you need a piece of non-free hardware to view it, so why take the line that this is non-free just because you need non-free software to view it. Mod parent up - +1 Subtle Troll.
  7. Re:Streaming vs. Downloads... at the cost of DRM on NBC Direct Launches With Free Downloads · · Score: 1

    You misspelled coff.

  8. Re:from the article on US Bot Herder Admits Infecting 250K Machines · · Score: 1

    Is a 60 year prison sentence really a deterrent for a grandmother? If I were a grandfather and I could do something I really believed in the possibility of a lengthy prison sentence or even execution wouldn't bother me because I wouldn't have much life left to lose. Obviously money wouldn't motivate me personally, but I could give it to my children and grandchildren in some untraceable way. Basically I wouldn't have a problem with screwing over people who were unrelated to me in order to help people who were closely related. Any consequences to me don't matter because I'm dead soon anyway. But my genes are immortal and they live on in my family. Richard Dawkins would understand, maybe even approve.

  9. Re:Who cleans them? on MIT Reinvents Transportation With Foldable, Stackable Car · · Score: 1

    Yeah, the idea seems a bit naive. Anyone that's shared a flat knows that even if you share the cars between a group of people that know each other it seems likely that only a minority will take part in the shared cleaning job. Most won't and so the cars will quickly become too foul to drive. The oddest thing is that if you want socialized transport, buses and trains have already solved the problem - just make the vehicle carry more people and run on fixed route and return to a central depot to be cleaned.

    Come to think of it the OLPC seems to be based on similarly naive idea that you can trust third world governments to distribute laptops fairly to people they have neglected since independence.

  10. Re:Interesting on YouTube Video Warned About School Shooting · · Score: 1
    Maybe I'm being unfair to the guy. He did some writing too -

    http://zami.pp.fi/jokela/Attack%20Information.doc

    ATTACK INFORMATION

    Event: Jokela High School Massacre.
    Targets: Jokelan Lukio (High School Of Jokela), students and faculty, society, humanity, human race.
    Date: 11/7/2007.
    Attack Type: Mass murder, political terrorism (altough I choosed the school as target, my motives for the attack are political and much much deeper and therefore I dont want this to be called only as school shooting).
    Location: Jokela, Tuusula, Finland.
    Perpetrators name: Pekka-Eric Auvinen (aka NaturalSelector89, Natural Selector, Sturmgeist89 and Sturmgeist). I also use pseydonym Eric von Auffoin internationally.
    Weapons: Semi-automatic .22 Sig Sauer Mosquito pistol.
  11. Re:Interesting on YouTube Video Warned About School Shooting · · Score: 1

    Yeah, but Dante and Shakespeare spent their time writing or with their friends or families. This dude spent his time alone taking pictures of himself aiming his gun into a camera wearing a 'Humanity is Overrated' T shirt with various blank expressions -

    http://zami.pp.fi/jokela/Natural%20Selector%203.png Mirror

  12. Re:First step for symbian. on Symbian Blasts Google's Phone Initiative · · Score: 1

    Because they're so easy to troll? Other groups are sensible enough to ignore comments like that.

  13. Re:Symbian C++ experience on Symbian Blasts Google's Phone Initiative · · Score: 2, Insightful
    Yup, Symbian C++ Api really, really sucks. It's actually a good deal nastier than MFC and I didn't think that was possible.

    http://www.symbiantutorial.org/symbian-tutorial/?3._Symbian_Fundamentals:3.1_Console_Application

    A console application can be as simple as this (file hello.cpp):

    #include "main.h"
    LOCAL_C void mainL(CConsoleBase* con) {
    _LIT(KTxtHello, "Hello.\n");
    con->Printf(KTxtHello);
    }

    Well, really, I am cheating! There are some complex details, but these are hidden in the "main.h". This is a variation of an example named "CommonFramework.h" that you can find in SOME versions of the sdk (for example in the SDK 6.1). The header follows the VERY BAD practice of including CODE in the header file. CommonFramework.h does so, but unfortunately, since LOCAL_C imply static, you have to write all the code needed to start the application in the same file... or include code! Since I like to reuse main.h, I choose to do the same (but I am not proud of it). The code of "main.h" is shown in detail AT THE end of this chapter, since you cannot understand it without having knowledge of some characteristics of Symbian, which we have to explore in the course of the chapter.

    Hmm, let's look at main.h
    http://www.symbiantutorial.org/symbian-tutorial/?3._Symbian_Fundamentals:Starting_a_Console_application

    #ifndef MAIN_H
    #define MAIN_H
    #include <e32base.h>
    #include <e32cons.h>
    LOCAL_C void mainL(CConsoleBase* con);
    // literals
    _LIT(KTxtTITLE,"Console App");
    _LIT(KTxtOK,"ok");
    _LIT(KTxtPressAnyKey," [press any key]");
    _LIT(KFormatFailed,"failed: leave code=%d");
    // declarations
    LOCAL_C void initConsoleL();
    // main function called by E32
    GLDEF_C TInt E32Main() {
    // mark the head start
    __UHEAP_MARK;
    // create the obligatory cleanup stack
    CTrapCleanup* cleanup=CTrapCleanup::New();
    // execute the init console function, trapped
    TRAPD(error,initConsoleL());
    // no error or panic
    __ASSERT_ALWAYS(!error,User::Panic(KTxtTITLE,error));
    // clean the cleanup stack
    delete cleanup;
    // mark the end
    __UHEAP_MARKEND;
    return 0;
    }
    // Initialize Console
    LOCAL_C void initConsoleL() {
    // create a full screen console object
    CConsoleBase* console = Console::NewL(KTxtTITLE, TSize(KConsFullScreen,KConsFullScreen));
    CleanupStack::PushL(console);
    // execute main application
    TRAPD(error,mainL(console));
    if (error)
    console->Printf(KFormatFailed, error);
    else
    console->Printf(KTxtOK);
    // press a key and wait
    console->Printf(KTxtPressAnyKey);
    console->Getch();
    // cleanup and return
    CleanupStack::PopAndDestroy(); // close console
    }
    #endif

    To build a console application you have to write the E32Main function, since this is the required name for the entry point of an exe. Such a function has to initialize the Cleanup Stack then initialize the console. Since the initialization can generate an exception, you have to move all of it to a separate function, than can be trapped. A few random notes. The function is a Global C function, and this must be explicitly declared. Marks are required to surround the cleanup stack declaration. After initializing the console, we call the real function that does your job (here it is named mainL), then wait

  14. Re:Yet another defender who completely ignores... on Chefs As Chemists · · Score: 1

    You can actually get hold of foie gras that isn't produced by force feeding -

    http://www.telegraph.co.uk/news/main.jhtml?xml=/news/2007/02/18/wfoie18.xml

    I read somewhere that if you put the goose in a pen next surrounded by food it will eat continuously. The end result is the same as gavage, it just takes longer and needs more space. Foie gras produced this way costs about 50% more but if you can afford foie gras you can probably afford the extra 50%.

    In most countries force feeding is illegal, so the only way to produce foie gras is like this. France requires food described as foie gras be produced by force feeding though.

  15. Re:Foie Gras is some nasty shit... on Chefs As Chemists · · Score: 2, Funny

    Highly intelligent grapes were crushed while still alive to make that wine. Bastard.

  16. Re:How is this different than a food chemist? on Chefs As Chemists · · Score: 3, Funny

    That ice cream was spooky stuff though. We tried some at university at a meeting of the Socialist Workers Party. All the people who ate it now work for the Conservative Party. Some of the girls turned up with blue rinse hair and pearls before the end of the week.

  17. Re:Tigger TM&© Disney on Data Loss Bug In OS X 10.5 Leopard · · Score: 1

    Woosh!

  18. Re:Nothing is solved, though on BBC Backpedals On Linux Audience Figures · · Score: 1

    Yes, I think it is. I use Opera which is good but has a minority share. There are few sites like banks which are IE only or IE/Firefox only because they block everything else. So I fire up Firefox or IE because I want to use something which is supported and hopefully tested when I do that stuff. I can imagine what would happen if the bank transferred money to the wrong account because I faked the UA string so Opera worked.

    If I were running Lynx on a Atari 800XL would it reasonable to expect that people support me? It seems inevitable that at some point there just aren't enough users of a platform for website maintainers to bother with it. Especially if they can reach 90% of the population by supporting IE on Windows. Some people like me make simple websites that work on IE/FF/Opera/Lynx/an old GUI browser which will hopefully mean it works on anything because it's interesting to do. Most web designers don't and will struggle to produce something that's a mass of CSS, Javascript and Flash which handles the majority case and leave it at that. Probably they won't even know they are making the choice since they will use some tool which makes it for them. These people are graphic designers after all - they're more interested in making a slick, attractive site quickly than spending time working out what small subset of features is universally supported.

    Ranting and raving on /. about how your preferred minority platform gets ignored won't change that.

  19. Re:Nothing is solved, though on BBC Backpedals On Linux Audience Figures · · Score: 0, Redundant

    Why not just view the site from a Windows machine and IE? It's not like there isn't one on the desk next to you most places you work.

  20. Re:Terrible bug on Data Loss Bug In OS X 10.5 Leopard · · Score: 1

    You're asking if a bug wherein entire folder hierarchies can go *poof* in the event a network share drops should be considered critical? Are you serious?

    It reminds me of this -

    http://www.blazed-up.com/he-hits-me-cuz-he-loves-me/

  21. Re:Tiger has this problem as well!!! on Data Loss Bug In OS X 10.5 Leopard · · Score: 1

    If Apple had called it Tigger this sort of thing would have been more understandable. Macho code names are a bad idea.

  22. Re:Breakthroughs? on Former Intel CEO Rips Medical Research · · Score: 2, Informative
    Crohns disease is very nasty - I've met people who have it.

    Do you know about this

    http://www.ars.usda.gov/research/publications/publications.htm?SEQ_NO_115=159812

    There's a parasitic worm that can reproduce in pig intestines but not in human ones. It knows how to inhibit the host immune system to have a peaceful life. There have been clinical trials of worm eggs as a treatment fo Crohns -

    http://en.wikipedia.org/wiki/Helminthic_therapy

    Hookworm depend upon a period of eight to ten days outside the host within narrow environmental parameters to become infectious after being passed in stool. Trichuris suis is similar to the human whipworm Trichuris trichiura, but its normal host is pigs. T. suis can colonize people but only for a short term and the worms cannot replicate in people.

    For this reason treatment with TSO requires regular doses, at intervals of two weeks. Treatment with hookworm requires inoculation at intervals of approximately five years. This is because the average life expectancy of necator americanus is 3-10 years.

    Crohn's Disease and Ulcerative Colitis Trichuris Suis Ova Trial results

    A 24 week trial with 29 Crohn's disease patients showed remarkable results. After 24 weeks 79.3% of the patients showed a response to the treatment and 72.4% of the patients were in remission. 100% of patients which were on immunosupressive treatment at the time of the study showed a response to the treatment after 24 weeks.

    A double-blind, placebo-controlled trial with 59 Ulcerative Colitis patients was done by the same group of researchers. Combining data of the trial, 47.8% of the patients given helminths showed a response compared to 15.4% of those who received a placebo. No side effects or complications were reported.
  23. Re:Breakthroughs? on Former Intel CEO Rips Medical Research · · Score: 1

    The CIA needs to improve its product cycles. E.g. AIDS version 2.0 should be spread by handshakes, AIDS version 3.0 should be airborn. Version 4.0 should have a bunch of new drug and vaccine avoiding features and be able to infect animals and the 2% of the population immune to 3.0. And each new AIDS should be released no more than five years after the previous version.

  24. Re:Wheels? Where's my air car? on MIT Offers City Car for the Masses · · Score: 1

    It's Funicello.

    Now get off my damn lawn!

  25. Re:carbon credit nonsense on Move to a Mainframe, Earn Carbon Credits · · Score: 1

    No, I want to raise taxes on fuels to discourage unnecessary travel by fossil fuel powered vehicles. That's a bit more benign than you, who want to kill millions of people in lowland coastal areas in the third world. Good luck with that! I'm sure raising taxes will prove to be very popular with the electorate! Any politician advocating punitive levels of taxation to discourage travel would no doubt attract support from Soccer Moms and have no problem at all in primaries. Oh wait, they'd be completely finished if they even hinted at it.

    Luckily it's completely unnecessary.