<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<feed xmlns="http://www.w3.org/2005/Atom">

	<title>Planet TheIntraWeb</title>
	<link rel="self" href="http://planet.theintraweb.net/atom.xml"/>
	<link href="http://planet.theintraweb.net/"/>
	<id>http://planet.theintraweb.net/atom.xml</id>
	<updated>2012-01-27T20:00:31+00:00</updated>
	<generator uri="http://www.planetplanet.org/">Planet/2.0 +http://www.planetplanet.org</generator>

	<entry xml:lang="en">
		<title type="html">Getting into gamedev [aka Career Motivational Speaker]</title>
		<link href="http://brnz.org/hbr/?p=1062"/>
		<id>http://brnz.org/hbr/?p=1062</id>
		<updated>2012-01-22T22:45:14+00:00</updated>
		<content type="html">&lt;p&gt;Before departing Tasmania, I visited several high schools where I talked about getting into a career in gamedev. That was the premise, at least &amp;#8212; I really talked more about what you can do to get a job doing what you like. Lots of high school students like games and I was getting ready to move for a gamedev job, so it was a good hook.&lt;/p&gt;
&lt;p&gt;The opportunity came about from a conversation (with a high school student) about my upcoming move, what I was doing and how it had come about, and about what part of my experience was relevant to his own. The conversation was had while the Pathway Planning Officer for a local school was nearby, and she invited me to the school to talk to some of the students there.&lt;/p&gt;
&lt;p&gt;The problem then became how to turn a spontaneous conversation into something sufficiently well-prepared and engaging that I could talk to a room of teenagers for up to an hour. I enjoy presenting to/speaking with groups, particularly on topics that I&amp;#8217;m passionate about, but I have little experience talking to teenagers and was somewhat uncertain about what I&amp;#8217;d need to do to get and keep their attention. I like to keep presentations interactive and flexible &amp;#8212; I&amp;#8217;d rather talk about what interests the listeners than about my own prepared material. For that reason, I don&amp;#8217;t tend to use slides and try to be interesting, engaging and memorable all on my own. (there&amp;#8217;s always a risk leaving out something &amp;#8220;important&amp;#8221; &amp;#8212; but as there&amp;#8217;s always far more material than I can cover in a single presentation, if the audience has been interested it&amp;#8217;s probably a nett win :P)&lt;/p&gt;
&lt;p&gt;For all my desire to keep it free-flowing and interactive, to give a talk without a clear idea of what I want to talk about and how it fits together in a coherent and plausible manner, I&amp;#8217;m going to struggle to impart any useful information/knowledge to the students that have so generously taken time out from their Social Science class (or whatever). It&amp;#8217;s hard to evoke passion without passion. I find it easier to convey my excitement and passion for something when I&amp;#8217;m well prepared to talk about it.&lt;/p&gt;
&lt;p&gt;I did some reading in preparation of the talk to make sure that I wouldn&amp;#8217;t be talking nonsense. While I was about to start in the industry, I had not worked in the industry. While I didn&amp;#8217;t think I had many incorrect preconceptions or invalid assumptions about the industry (who would?), my lack of experience was one thing that cropped up repeatedly through recent job applications. I thought it appropriate to do my best to make sure what I had to say would be generally useful.&lt;/p&gt;
&lt;p&gt;I read what I could find, but a couple of sites stood out in particular: there&amp;#8217;s a lot of the great advice on &lt;a href=&quot;http://tinysubversions.com&quot;&gt;tinysubversions.com&lt;/a&gt;, particularly the material on &lt;a href=&quot;http://tinysubversions.com/2005/10/effective-networking-in-the-games-industry-introduction/&quot;&gt;effective networking in the games industry&lt;/a&gt;.  Linked from there, I found a link to a list of &lt;a href=&quot;http://www.chrishecker.com/New_Year%27s_Resolutions_for_Game_Industry_Newbies&quot;&gt;New Year&amp;#8217;s Resolutions for Game Industry Newbies (or people who want to eventually be one)&lt;/a&gt;,  which I basically ripped off to form the core of my presentation (many thanks to Chris Hecker and Jonathan Blow for the list).&lt;/p&gt;
&lt;p&gt;Here&amp;#8217;s an outline of what I talked about:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;who I am&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;always good for the audience to know the name of the guy they&amp;#8217;re listening to.&lt;/li&gt;
&lt;li&gt;talk about my education and work history with emphasis on what are likely to be common points of reference &amp;#8212; educated/live in local area, personal history back to the age of the audience&lt;/li&gt;
&lt;li&gt;upcoming move &amp;#8212; mention Insomniac and the games they&amp;#8217;ve made, find out how many people in the room knew Insomniac IP (lots)&lt;/li&gt;
&lt;li&gt;(made the point that my own education history is not being held up as any ideal for how to get into the industry &amp;#8212; far from it)&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;why I like gamedev (or talk about the sort of gamedev role I aspire to&amp;#8230;)&lt;/li&gt;
&lt;li&gt;the diversity of careers available in gamedev&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;used this to kick of some interaction &amp;#8212; ask the audience &amp;#8220;What goes into making a game? What sort of jobs are there in gamedev?&amp;#8221;&lt;/li&gt;
&lt;li&gt;purpose was to emphasise diversity of opportunity. It&amp;#8217;s not just programmers. (more on that later, though)&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;nature of the industry &amp;#8211;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;games are popular&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;high % of people play electronic games of one kind or another&lt;/li&gt;
&lt;li&gt;lots of money spent on games&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;often unreliable working situation&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;recent history of  gamedev studios in .au (and elsewhere) is not good&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;not many Australian gamedevs&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;estimates of &amp;lt;3,000 gamedevs in .au&lt;/li&gt;
&lt;li&gt;contrast: &amp;gt;300,000 teachers in .au (not sure if it was a useful stat, but I like it :)&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;opportunity in smaller scale&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;low entry options to making games&lt;/li&gt;
&lt;li&gt;no guarantees of success&amp;#8230;&lt;/li&gt;
&lt;li&gt;the indie life is not for everyone&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;li&gt;invite questions&lt;/li&gt;
&lt;li&gt;on to five points (taken from the New Year&amp;#8217;s Resolutions post &amp;#8212; see more there)&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;make things&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;build experience, build portfolio&lt;/li&gt;
&lt;li&gt;good idea, regardless of specialisation or desired industry&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;play games&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;play for purpose of critique, understanding&lt;/li&gt;
&lt;li&gt;what makes this game good? why do I hate this one? how could it be better?&lt;/li&gt;
&lt;li&gt;tie back to point 1 &amp;#8212; make things based on what you&amp;#8217;ve played, remake, modify, extend&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;learn things&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;generally a good idea :)&lt;/li&gt;
&lt;li&gt;learn things that will help get to your desired career &amp;#8212; be selective&lt;/li&gt;
&lt;li&gt;I spruiked the UTas Bachelor of Computing (Games Technology) degree as one option&lt;/li&gt;
&lt;li&gt;more learning -&amp;gt; more understanding (hopefully). Helps with 1 and 2.&lt;/li&gt;
&lt;li&gt;what you know matters&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;people&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;who you know matters&lt;/li&gt;
&lt;li&gt;work with people locally with similar interests &amp;#8212; opportunity now! Useful with 1, 2, 3&lt;/li&gt;
&lt;li&gt;be active in the wider gamedev community e.g. follow gamedevs on twitter. Caveat: don&amp;#8217;t be an annoying fanboi. Read, watch, learn, interact in a civil fashion.&lt;/li&gt;
&lt;li&gt;being visible to people can help when applying for jobs&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;learn to program&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;presented as &amp;#8220;optional&amp;#8221;&lt;/li&gt;
&lt;li&gt;useful skill no matter what &amp;#8212; understand how computers work and how to bend them to your will&lt;/li&gt;
&lt;/ul&gt;
&lt;/ol&gt;
&lt;li&gt;answer questions until time/questions run out&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For all the game-related content in the presentation, it was presented to make clear that these things will work outside the gamedev industry, too &amp;#8212; do things that will help get you a job doing what you want, here are some things that can help.&lt;/p&gt;
&lt;p&gt;Prepare yourself &amp;#8212; opportunities come along from time to time. While you typically can&amp;#8217;t make them happen, you can encourage their arrival. Don&amp;#8217;t expect you can get a job with no experience/training/portfolio/etc &amp;#8211; rather, do what you can to be as ready as you can be for when opportunities arrive.&lt;/p&gt;
&lt;p&gt;(Additional: I was interested to hear TJ Fixman talk about similar ideas when recounting his own gamedev career path in a recent &lt;a href=&quot;http://www.g4tv.com/videos/56800/feedback-looking-ahead-to-2012&quot;&gt;Feedback&lt;/a&gt; episode)&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Some Writing Wisdom from Isobelle Carmody</title>
		<link href="http://feedproxy.google.com/~r/krumpit/~3/NHHXWenRV4c/"/>
		<id>http://www.krumpit.org/?p=797</id>
		<updated>2011-11-01T11:11:23+00:00</updated>
		<content type="html">&lt;p&gt;I haven&amp;#8217;t been able to work on my writing as much as I&amp;#8217;d hoped, this year. After reading a blog post from &lt;a href=&quot;http://tavenmoore.com/2011/a-chat-with-patrick-rothfuss/&quot;&gt;a writing comrade&lt;/a&gt; about attending an author event, I resolved to keep an eye out for similar opportunities. If I don&amp;#8217;t have time to write regularly, the least I could do was attend a once-off event!&lt;/p&gt;
&lt;p&gt;My eye (and brain) had been successfully primed. A few weeks later, I noticed a local bookshop advertising the visit of Isobelle Carmody, the author of one of my favourite book series: the&lt;a href=&quot;http://en.wikipedia.org/wiki/Obernewtyn_Chronicles&quot;&gt; &lt;em&gt;Obernewtyn Chronicles&lt;/em&gt;&lt;/a&gt;. And &lt;a href=&quot;http://en.wikipedia.org/wiki/Isobelle_Carmody#Books&quot;&gt;many, many other books&lt;/a&gt; besides.&lt;/p&gt;
&lt;p&gt;(An aside: &lt;em&gt;Obernewtyn&lt;/em&gt; is a young adult series set in a post-apocalyptic fantasy world. There are adventures with teenage misfits with special mental powers and talking animals! Wonderful! This was the young adult genre before &lt;em&gt;Twilight&lt;/em&gt; and &lt;em&gt;The Hunger Games&lt;/em&gt;, too: think Tamora Pierce, but more depth in storytelling.)&lt;/p&gt;
&lt;p&gt;Her visit to Hobart yesterday was part of a launch tour for her new book: the second-last in the &lt;em&gt;Obernewtyn&lt;/em&gt; series. She talked for an hour about her books and her writing. It was wonderfully inspiring. I was rather in awe. I waited in line for about twenty minutes, offered up my first-edition &lt;em&gt;Obernewtyn&lt;/em&gt; book to be signed, babbled a little, and ran away. *sheepish smile*&lt;/p&gt;
&lt;p&gt;So! Her talk. I wish I&amp;#8217;d thought to bring a pencil and paper to take notes, but instead I&amp;#8217;ve tried to distill some of the key points that stuck with me. I hope someone might appreciate these snippets, rough as they are. My notes are in brackets and italic.&lt;/p&gt;
&lt;h2&gt;Isobelle Carmody says&amp;#8230;&lt;span&gt; &lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;Isobelle says she thinks a lot before writing anything down, because writing things down makes things set and harder to change. When she does write things down, she writes by hand. &lt;em&gt;(Maz: Presumably this means more thinking time?)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;By the time she has finished her first draft, she has forgotten the beginning. Typing up the handwritten manuscript means she can better see the story arc and hold all the pieces in her mind at the same time. She can see where themes have developed, and can begin to sculpt the story.&lt;/p&gt;
&lt;p&gt;Continuing on this line, she says she loves the editing process. Editing is like sculpting &amp;#8211; the first draft is just dragging in the raw lump of stone. From there, it is honing and shaping. &lt;em&gt;(Maz: Writing is a craft&amp;#8230; editing is the true craft of writing.) &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Writing a story is a journey of discovery. There is such joy in the discovery. She says that writers don&amp;#8217;t need to plan themes, they will arise naturally. &lt;em&gt;(Maz: But I suspect you need to recognise the themes and hone and refine them in the editing process.)&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;On inspiration&lt;/h3&gt;
&lt;p&gt;When asked about being continuing writing on such a long series, and over such a long period of time, she says that if you write about your deepest questions &amp;#8211; the questions you think about and worry over, and especially those you don&amp;#8217;t have an answer for (those that &lt;em&gt;no one&lt;/em&gt; has an answer for!) &amp;#8211; they will be the deepest source for your writing and you will never run out. For example, the Obernewtyn series was based on her own questions of belonging and place, as well as the deeper question of whether human morality can evolve.&lt;/p&gt;
&lt;p&gt;When asked about her inspiration for stories, she says inspiration is everywhere, you just need to look and listen. As an example, she says when she and her daughter ride on the bus, they sit in different spots with a notebook and write what they see and hear. When they get to their destination, they compare notes. She&amp;#8217;s always surprised by the things her daughter noticed and she didn&amp;#8217;t. She also takes note of interesting stories people tell her, and snippets of  conversation. &lt;em&gt;(Observation as a skill.)&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;On writing for children&lt;/h3&gt;
&lt;p&gt;Writing for younger children requires a different way of writing. They understand the world differently; in a more poetic way. She likes to listen how they describe something or ask something about the world, as they have a unique way of seeing and making sense of things. They can hold belief and unbelief in their minds at the same time. They constantly ask questions. Her stories are written with these things in mind.&lt;/p&gt;
&lt;p&gt;When she reads her daughter stories, she will stop reading after a chapter or two if she doesn&amp;#8217;t like the story. When asked why she didn&amp;#8217;t like a story, she would say she didn&amp;#8217;t love the character or care about them. When pressed further, she said that the story wasn&amp;#8217;t beautiful, like &lt;em&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/The_Mouse_and_His_Child&quot;&gt;The Mouse and His Child&lt;/a&gt;&lt;/em&gt; was beautiful. Her daughter said, &amp;#8220;Oh yes, &lt;em&gt;The Mouse and His Child&lt;/em&gt; was beautiful.&amp;#8221; So children understand when a story is beautiful and has meaning. You don&amp;#8217;t need to write down for them (that is, simplify things).&lt;/p&gt;
&lt;p&gt;&lt;em&gt;(Maz: I really want to re-read &lt;/em&gt;The Mouse and His Child&lt;em&gt;! I had forgotten what a nice story it is.)&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;On oral storytelling&lt;/h3&gt;
&lt;p&gt;Isobelle thinks oral storytelling is very special, and says that telling a story out loud is saying &amp;#8220;I love you&amp;#8221;. She made up many stories for her daughter, some of which are now books.&lt;/p&gt;
&lt;p&gt;She chooses character and place names according to their sound, and she knows when they are right for the character.&lt;/p&gt;
&lt;h3&gt;On being published and her editors&lt;/h3&gt;
&lt;p&gt;Publishing, for her, was quite an easy process, as she was quickly discovered and accepted. However, even by her third book, she still felt like someone might find her out as a fraud.&lt;/p&gt;
&lt;p&gt;You need to respect and trust your editors, but you should also trust your skills and stay true the story you want to tell, not the story others might like you to tell. There is a skeleton, a core, to a story that you may need to fight for. But fighting for parts of stories &amp;#8211; and the process of working with editors on stories &amp;#8211; definitely makes them better.&lt;/p&gt;
&lt;p&gt;Sometimes editors will ask for the impossible. Her latest manuscript was to be the last book of the &lt;em&gt;Obernewtyn&lt;/em&gt; series. The editor commented that she couldn&amp;#8217;t leave some sections as they were &amp;#8211; she needed to write more about certain characters and story arcs &amp;#8211; but she also said it was too long! Eventually, after much wrangling, Isobelle suggested that the last book be split into two, and they agreed. She needed to reformat the story arcs and create a new ending (for the second-last book) and a new beginning (for the last book), but it has turned out better.&lt;/p&gt;
&lt;p&gt;&amp;#8211;&lt;/p&gt;
&lt;p&gt;If you&amp;#8217;d like to find out more about the books, or Isobelle Carmody herself, here are some links!&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.isobellecarmody.net/&quot;&gt;Isobelle Carmody&amp;#8217;s website&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.obernewtyn.net/e107/e107_plugins/forum/forum_viewtopic.php?255438&quot;&gt;Obernewtyn.net: Information about her books, and availability for purchasing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://tlcbooks.wordpress.com/2011/04/27/author-interview-with-isobelle-carmody/&quot;&gt;TLC Books: Author Interview with Isobelle Carmody&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;img src=&quot;http://feeds.feedburner.com/~r/krumpit/~4/NHHXWenRV4c&quot; height=&quot;1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>krumpit</name>
			<uri>http://www.krumpit.org</uri>
		</author>
		<source>
			<title type="html">krumpit</title>
			<subtitle type="html">the blog of maz musings and ponderings.</subtitle>
			<link rel="self" href="http://www.krumpit.org/?feed=rss2"/>
			<id>http://www.krumpit.org/?feed=rss2</id>
			<updated>2012-01-01T17:00:16+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Assembly Primer Part 7 — Working with Strings — ARM</title>
		<link href="http://brnz.org/hbr/?p=1001"/>
		<id>http://brnz.org/hbr/?p=1001</id>
		<updated>2011-07-20T10:33:19+00:00</updated>
		<content type="html">&lt;p&gt;These are my notes for where I can see ARM varying from IA32, as presented in the video &lt;a href=&quot;http://securitytube.net/Assembly-Primer-for-Hackers-%28Part-7%29-Working-with-Strings-video.aspx&quot;&gt;Part 7 — Working with Strings&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;ve not remotely attempted to implement anything approximating optimal string operations for this part &amp;#8212; I&amp;#8217;m just working my way through the examples and finding obvious mappings to the ARM arch (or, at least what seem to be obvious). When I do something particularly stupid, leave a comment and let me know :)&lt;/p&gt;
&lt;h2&gt;Working with Strings&lt;/h2&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;txt&quot;&gt;.data
     HelloWorldString:
        .asciz &amp;quot;Hello World of Assembly!&amp;quot;
    H3110:
        .asciz &amp;quot;H3110&amp;quot;
&amp;nbsp;
.bss
    .lcomm Destination, 100
    .lcomm DestinationUsingRep, 100
    .lcomm DestinationUsingStos, 100&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Here&amp;#8217;s the storage that the provided example &lt;a href=&quot;http://code.securitytube.net/StringBasics.s&quot;&gt;StringBasics.s&lt;/a&gt; uses. No changes are required to compile this for ARM.&lt;/p&gt;
&lt;h3&gt;1. Simple copying using movsb, movsw, movsl&lt;/h3&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;txt&quot;&gt;    @movl $HelloWorldString, %esi
    movw r0, #:lower16:HelloWorldString
    movt r0, #:upper16:HelloWorldString
&amp;nbsp;
    @movl $Destination, %edi
    movw r1, #:lower16:Destination
    movt r1, #:upper16:Destination
&amp;nbsp;
    @movsb
    ldrb r2, [r0], #1
    strb r2, [r1], #1
&amp;nbsp;
    @movsw
    ldrh r3, [r0], #2
    strh r3, [r1], #2
&amp;nbsp;
    @movsl
    ldr r4, [r0], #4
    str r4, [r1], #4&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;More visible complexity than IA32, but not too bad overall.&lt;/p&gt;
&lt;p&gt;IA32&amp;#8242;s &lt;strong&gt;movs&lt;/strong&gt; instructions implicitly take their source and destination addresses from &lt;strong&gt;%esi&lt;/strong&gt; and &lt;strong&gt;%edi&lt;/strong&gt;, and increment/decrement both. Because of ARM&amp;#8217;s load/store architecture, separate load and store instructions are required in each case, but there is support for indexing of these registers:&lt;/p&gt;
&lt;h4&gt;ARM addressing modes&lt;/h4&gt;
&lt;p&gt;According to ARM A8.5, memory access instructions commonly support three addressing modes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Offset addressing&lt;/strong&gt; &amp;#8212; An offset is applied to an address from a base register and the result is used to perform the memory access. It&amp;#8217;s the form of addressing I&amp;#8217;ve used in previous parts and looks like &lt;strong&gt;[rN, offset]&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Pre-indexed addressing&lt;/strong&gt; &amp;#8212; An offset is applied to an address from a base register, the result is used to perform the memory access and also written back into the base register. It looks like &lt;strong&gt;[rN, offset]!&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Post-indexed addressing&lt;/strong&gt; &amp;#8212; An address is used as-is from a base register for memory access. The offset is applied and the result is stored back to the base register. It looks like &lt;strong&gt;[rN], offset&lt;/strong&gt; and is what I&amp;#8217;ve used in the example above.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;2. Setting / Clearing the DF flag&lt;/h3&gt;
&lt;p&gt;ARM doesn&amp;#8217;t have a DF flag (to the best of my understanding). It could perhaps be simulated through the use of two instructions and conditional execution to select the right direction. I&amp;#8217;ll look further into conditional execution of instructions on ARM in a later post.&lt;/p&gt;
&lt;h3&gt;3. Using Rep&lt;/h3&gt;
&lt;p&gt;ARM also doesn&amp;#8217;t appear to have an instruction quite like IA32&amp;#8242;s &lt;strong&gt;rep&lt;/strong&gt; instruction. A conditional branch and a decrement will be the long-form equivalent. As branches are part of a later section, I&amp;#8217;ll skip them for now.&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;txt&quot;&gt;    @movl $HelloWorldString, %esi
    movw r0, #:lower16:HelloWorldString
    movt r0, #:upper16:HelloWorldString
&amp;nbsp;
    @movl $DestinationUsingRep, %edi
    movw r1, #:lower16:DestinationUsingRep
    movt r1, #:upper16:DestinationUsingRep
&amp;nbsp;
    @movl $25, %ecx # set the string length in ECX
    @cld # clear the DF
    @rep movsb
    @std
&amp;nbsp;
    ldm r0!, {r2,r3,r4,r5,r6,r7}
    ldrb r8, [r0,#0]
    stm r1!, {r2,r3,r4,r5,r6,r7}
    strb r8, [r1,#0]&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;To avoid conditional branches, I&amp;#8217;ll start with the assumption that the string length is known (25 bytes). One approach would be using multiple load instructions, but the &lt;strong&gt;load multiple&lt;/strong&gt; (&lt;strong&gt;ldm&lt;/strong&gt;) instruction makes it somewhat easier for us &amp;#8212; one instruction to fetch 24 bytes, and a &lt;strong&gt;load register byte &lt;/strong&gt;(&lt;strong&gt;ldrb&lt;/strong&gt;) for the last one. Using the &lt;strong&gt;!&lt;/strong&gt; after the source-address register indicates that it should be updated with the address of the next byte after those that have been read.&lt;/p&gt;
&lt;p&gt;The storing of the data back to memory is done analogously. &lt;strong&gt;Store multiple&lt;/strong&gt; (&lt;strong&gt;stm&lt;/strong&gt;) writes 6 registers×4 bytes = 24 bytes (with the &lt;strong&gt;!&lt;/strong&gt; to have the destination address updated). The final byte is written using &lt;strong&gt;strb&lt;/strong&gt;.&lt;/p&gt;
&lt;h3&gt;4. Loading string from memory into EAX register&lt;/h3&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;txt&quot;&gt;    @cld
    @leal HelloWorldString, %esi
    movw r0, #:lower16:HelloWorldString
    movt r0, #:upper16:HelloWorldString
&amp;nbsp;
    @lodsb
    ldrb r1, [r0, #0]
&amp;nbsp;
    @movb $0, %al
    mov r1, #0
&amp;nbsp;
    @dec %esi  @ unneeded. equiv: sub r0, r0, #1
    @lodsw
    ldrh r1, [r0, #0]
&amp;nbsp;
    @movw $0, %ax
    mov r1, #0
&amp;nbsp;
    @subl $2, %esi # Make ESI point back to the original string. unneeded. equiv: sub r0, r0, #2
    @lodsl
    ldr r1, [r0, #0]&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In this section, we are shown how the IA32 &lt;strong&gt;lodsb&lt;/strong&gt;, &lt;strong&gt;lodsw&lt;/strong&gt; and &lt;strong&gt;lodsl&lt;/strong&gt; instructions work. Again, they have implicitly assigned register usage, which isn&amp;#8217;t how ARM operates.&lt;/p&gt;
&lt;p&gt;So, instead of a simple, no-operand instruction like &lt;strong&gt;lodsb&lt;/strong&gt;, we have a &lt;strong&gt;ldrb r1, [r0, #0]&lt;/strong&gt; loading a byte from the address in r0 into r1. Because I didn&amp;#8217;t use post indexed addressing, there&amp;#8217;s no need to dec or subl the address after the load. If I were to do so, it could look like this:&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;txt&quot;&gt;    ldrb r1, [r0], #1
    sub r0, r0, #1
&amp;nbsp;
    ldrh r1, [r0], #2
    sub r0, r0, #2
&amp;nbsp;
    ldr r1, [r0], #4&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you trace through it in gdb, look at how the value in r0 changes after each instruction.&lt;/p&gt;
&lt;h3&gt;5. Storing strings from EAX to memory&lt;/h3&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;txt&quot;&gt;    @leal DestinationUsingStos, %edi
    movw r0, #:lower16:DestinationUsingStos
    movt r0, #:upper16:DestinationUsingStos
&amp;nbsp;
    @stosb
    strb r1, [r0], #1
    @stosw
    strh r1, [r0], #2
    @stosl
    str r1, [r0], #4&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Same kind of thing as for the loads. Writes the letters in r1 (being &amp;#8220;Hell&amp;#8221; &amp;#8212; leftovers from the previous section) into DestinationUsingStos (the result being &amp;#8220;HHeHell&amp;#8221;). String processing on little endian architectures has its appeal.&lt;/p&gt;
&lt;h3&gt;6. Comparing Strings&lt;/h3&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;txt&quot;&gt;    @cld
    @leal HelloWorldString, %esi
    movw r0, #:lower16:HelloWorldString
    movt r0, #:upper16:HelloWorldString
    @leal H3110, %edi
    movw r1, #:lower16:H3110
    movt r1, #:upper16:H3110
&amp;nbsp;
    @cmpsb
    ldrb r2, [r0,#0]
    ldrb r3, [r1,#0]
    cmp r2, r3
&amp;nbsp;
    @dec %esi
    @dec %edi
    @not needed because of the addressing mode used
&amp;nbsp;
    @cmpsw
    ldrh r2, [r0,#0]
    ldrh r3, [r1,#0]
    cmp r2, r3
&amp;nbsp;
    @subl $2, %esi
    @subl $2, %edi
    @not needed because of the addressing mode used
    @cmpsl
    ldr r2, [r0,#0]
    ldr r3, [r1,#0]
    cmp r2, r3&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Where IA32&amp;#8242;s &lt;strong&gt;cmps&lt;/strong&gt; instructions implicitly load through the pointers in &lt;strong&gt;%edi&lt;/strong&gt; and &lt;strong&gt;%esi&lt;/strong&gt;, explicit loads are needed for ARM. The compare then works in pretty much the same way as for IA32, setting condition code flags in the &lt;strong&gt;current program status register&lt;/strong&gt; (&lt;strong&gt;cpsr&lt;/strong&gt;). If you run the above code, and check the status registers before and after execution of the &lt;strong&gt;cmp&lt;/strong&gt; instructions, you&amp;#8217;ll see the zero flag set and unset in the same way as is demonstrated in the video.&lt;/p&gt;
&lt;p&gt;The condition code flags are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;bit 31 &amp;#8212; negative (N)&lt;/li&gt;
&lt;li&gt;bit 30 &amp;#8212; zero (Z)&lt;/li&gt;
&lt;li&gt;bit 29 &amp;#8212; carry (C)&lt;/li&gt;
&lt;li&gt;bit 28 &amp;#8212; overflow (V)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There&amp;#8217;s other flags in that register &amp;#8212; all the details are on page B1-16 and B1-17 in the ARM Architecture Reference Manual.&lt;/p&gt;
&lt;p&gt;And with that, I think we&amp;#8217;ve made it (finally) to the end of this part for ARM.&lt;/p&gt;
&lt;h3&gt;Other assembly primer notes are linked &lt;a href=&quot;http://brnz.org/?page_id=737&quot;&gt;here&lt;/a&gt;.&lt;/h3&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Reviewing my eReader</title>
		<link href="http://feedproxy.google.com/~r/krumpit/~3/J_axMRroBL8/"/>
		<id>http://www.krumpit.org/?p=791</id>
		<updated>2011-05-18T13:05:17+00:00</updated>
		<content type="html">&lt;p&gt;I have been &lt;a href=&quot;http://www.krumpit.org/2011/03/the-allure-of-ereaders/&quot;&gt;using my eBook reader&lt;/a&gt; for about two months now, and, as some of you expressed an interest, I thought I&amp;#8217;d write a little about my experience. I&amp;#8217;ll try and point out a few features that weren&amp;#8217;t obvious to me before buying an eReader.&lt;/p&gt;
&lt;p&gt;The specifics: my eReader is a Sony Reader PRS-350. I use it for just under an hour a day. I&amp;#8217;m very fond of it, but still haven&amp;#8217;t given it a name &amp;#8211; shame on me!&lt;/p&gt;
&lt;div id=&quot;attachment_794&quot; class=&quot;wp-caption aligncenter&quot;&gt;&lt;a href=&quot;http://www.krumpit.org/wp-content/uploads/2011/05/ereader.jpg&quot;&gt;&lt;img class=&quot;size-full wp-image-794&quot; title=&quot;Sony eReader&quot; src=&quot;http://www.krumpit.org/wp-content/uploads/2011/05/ereader.jpg&quot; alt=&quot;&quot; width=&quot;570&quot; height=&quot;270&quot; /&gt;&lt;/a&gt;&lt;p class=&quot;wp-caption-text&quot;&gt;Above: a size comparison, and a classic one-handed pose.&lt;/p&gt;&lt;/div&gt;
&lt;h2&gt;The Good&lt;/h2&gt;
&lt;h3&gt;Small form factor&lt;/h3&gt;
&lt;p&gt;The size of the Sony Reader, with its touch screen and no keyboard, was a large part of the reason why I chose it over other brands. The touch screen means the buttons are small and minimal, unlike those of some other eReaders (such as the Kobo). With a laptop and iPhone for my portable internet needs, using it for email and browsing wasn&amp;#8217;t a priority for me, and therefore an eReader with a keyboard (such as the Kindle 3G) wasn&amp;#8217;t a requirement. Overall, the Sony Reader is amazingly small, slim and light &amp;#8211; it&amp;#8217;s no heavier than my iPhone, and slips easily into my handbag.&lt;/p&gt;
&lt;p&gt;This portability means I can take out my eReader for a quick read while waiting for a takeaway coffee. Reading while waiting feels much more casual than iPhone gaming, which was my previous &amp;#8220;while waiting&amp;#8221; entertainment. With the iPhone, I always felt rushed to launch a game, and it was a pain having to split my attention &amp;#8211; to be ready to react to whatever I was waiting for &amp;#8211; when most games are based on timing and visual cues.&lt;/p&gt;
&lt;p&gt;The lightness and the design of the Sony Reader helps out here, too. I can easily hold it in one hand, and the buttons are positioned so I can easily push the page turn buttons with my thumb. It feels natural and comfortable.&lt;/p&gt;
&lt;h3&gt;Travelling&lt;/h3&gt;
&lt;p&gt;This is probably a more obvious benefit of an eReader, but I still felt pretty gleeful when, the first time I packed to go away for a weekend, I realised that I didn&amp;#8217;t have the usual dilemma of which book (and how many) to bring, and &amp;#8211; this was a concern I hadn&amp;#8217;t realised before &amp;#8211; where to pack them so they wouldn&amp;#8217;t get bent.&lt;/p&gt;
&lt;h3&gt;The Dictionary&lt;/h3&gt;
&lt;p&gt;A small perk that took me by surprise was using the built-in Dictionary to learn new words. Now, looking up words in a Dictionary while reading isn&amp;#8217;t something I&amp;#8217;d normally do, but given it was so easy &amp;#8211; double-tapping on a word brings up a definition &amp;#8211; I didn&amp;#8217;t really have an excuse &lt;em&gt;not &lt;/em&gt;to do it.&lt;/p&gt;
&lt;p&gt;For added nerdiness, I must admit that I did start highlighting each unknown word (using the editor feature), with the aim of glancing through the list later to see if I remembered them. Ahem. Moving on.&lt;/p&gt;
&lt;h2&gt;The Bad&lt;/h2&gt;
&lt;h3&gt;Passive information&lt;/h3&gt;
&lt;p&gt;Two things I really miss are passively knowing how far through the book you are while reading, and passively sharing what you are reading with others.&lt;/p&gt;
&lt;p&gt;On my Sony Reader, the current page and total pages are displayed at the bottom of the screen, but figuring out the ratio in your head really isn&amp;#8217;t the same as seeing and feeling the weight of paper shift from right to left.&lt;/p&gt;
&lt;p&gt;With myself and the boy both embracing ereading, I also miss us being able to know at a glance what book the other is reading. I like sharing books, and the enjoyment of books, and visually displaying what book you are reading is a nice shortcut. We can always talk, but, you know&amp;#8230;&lt;/p&gt;
&lt;h3&gt;Inability to flick around&lt;/h3&gt;
&lt;p&gt;The one thing that really bugs me is how difficult it is to jump around in a eBook. You can&amp;#8217;t easily flick back to the start of a section on a whim, or reference another page.&lt;/p&gt;
&lt;p&gt;Referring to maps at the start of the book &amp;#8211; a staple for fantasy novels &amp;#8211; required bookmarking the page, tapping the custom zoom button, choosing a custom zoom level and dragging a finger around while the E-Ink struggled to keep up. Not very fun.&lt;/p&gt;
&lt;h2&gt;The Indifferent (your mileage may vary)&lt;/h2&gt;
&lt;h3&gt;eBook prices&lt;/h3&gt;
&lt;p&gt;I was disappointed and a little surprised by how expensive eBooks still are. I understand that authors and publishers still need to make the same profits, but are the costs of manufacturing and shipping really that negligible? And, if so, why have book prices in Australia always been so extremely high compared to the UK and the US? I&amp;#8217;m sure the pricing will improve gradually, but in the mean time&amp;#8230; *grumbles*&lt;/p&gt;
&lt;h3&gt;E-Ink refreshing&lt;/h3&gt;
&lt;p&gt;E-Ink screens refresh with a split-second, full-screen flash, and I was worried I&amp;#8217;d find this very annoying. I&amp;#8217;m pleased to say that I barely notice it. The only time I find it annoying is when I scroll around a larger page or image (fantasy maps!).&lt;/p&gt;
&lt;h3&gt;Unlit screen&lt;/h3&gt;
&lt;p&gt;I found the non-backlit screen quite strange at first. I kept trying to read in dim light, wondering why the screen seemed so dark. Once I got over the &amp;#8220;technology &amp;#8211; screen -backlit&amp;#8221; association, however, I stopped expecting it and didn&amp;#8217;t mind turning on a reading light.&lt;/p&gt;
&lt;h3&gt;Frequency of page turning&lt;/h3&gt;
&lt;p&gt;Trying to choose between the Sony Reader PRS-350 and PRS-650 models, I was concerned that I would find the PRS-350&amp;#8242;s smaller screen (5&amp;#8243;) too small. I&amp;#8217;m pleased to say that I really appreciate the small size of the PRS-350 (see above) and that the screen is a very comfortable size. I do need to turn the page more often than a real book, but, as the device is lighter to hold, I think it&amp;#8217;s less strenuous overall. (I am amused by the idea of strenuous reading &lt;img src=&quot;http://www.krumpit.org/wp-includes/images/smilies/icon_biggrin.gif&quot; alt=&quot;:D&quot; class=&quot;wp-smiley&quot; /&gt; )&lt;/p&gt;
&lt;p&gt;Phew! So that is that. I hope some of you might come away convinced to purchase yourselves an eReader. In hindsight, I still think the Sony Reader was a good pick. I would probably also recommend the Kindle 3G for those who want to download new books and do internetty things on the go; the free 3G service seems like amazing value.&lt;/p&gt;
&lt;img src=&quot;http://feeds.feedburner.com/~r/krumpit/~4/J_axMRroBL8&quot; height=&quot;1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>krumpit</name>
			<uri>http://www.krumpit.org</uri>
		</author>
		<source>
			<title type="html">krumpit</title>
			<subtitle type="html">the blog of maz musings and ponderings.</subtitle>
			<link rel="self" href="http://www.krumpit.org/?feed=rss2"/>
			<id>http://www.krumpit.org/?feed=rss2</id>
			<updated>2012-01-01T17:00:16+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Grand Follies</title>
		<link href="http://feedproxy.google.com/~r/krumpit/~3/5RqSGjJw5c0/"/>
		<id>http://www.krumpit.org/?p=776</id>
		<updated>2011-05-01T12:28:54+00:00</updated>
		<content type="html">&lt;p&gt;&lt;!-- p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px} --&gt;The other evening I caught a &lt;a href=&quot;http://en.wikipedia.org/wiki/Oz_and_James's_Big_Wine_Adventure&quot;&gt;TV show&lt;/a&gt; which featured a millionaire who was planting a multi-million-dollar vineyard. He didn&amp;#8217;t think he would make money from it; in fact, he was expecting a loss. He said it was for love, not money. He had also carved out a huge cave in a rock cliff-face in which to live. &lt;a href=&quot;http://notameerkat.wordpress.com/&quot;&gt;The boy&lt;/a&gt;, who was also watching, made a comment about &amp;#8220;the crazy things that people can do with too much money&amp;#8221;.&lt;/p&gt;
&lt;p&gt;What a great thought! It put me in mind of &lt;a href=&quot;http://en.wikipedia.org/wiki/Folly&quot;&gt;follies&lt;/a&gt;, an architectural term for a grand, expensive, and possibly whimsical or fantastical building that has no practical purpose. They were an extravagance, often silly, but they certainly communicate something of the imagination and passions of those that commission them.&lt;/p&gt;
&lt;p&gt;So, imagine that you have a disgusting amount of money. You have already spent money on anything you could possibly wish to spend it on. Cars, houses, ponies. Cars and houses and ponies for your children, and your family and friends, and &lt;em&gt;their &lt;/em&gt;family and friends. Around-the-world trips, donations to charities and worthy causes, paying off debts of struggling countries, research in every field of human endeavour. And yet you still have a never-ending supply of money. What now?&lt;/p&gt;
&lt;div id=&quot;attachment_782&quot; class=&quot;wp-caption aligncenter&quot;&gt;&lt;a href=&quot;http://llamafont.com&quot;&gt;&lt;img class=&quot;size-medium wp-image-782  &quot; src=&quot;http://www.krumpit.org/wp-content/uploads/2011/05/Screen-shot-2011-05-01-at-10.19.19-PM-450x176.png&quot; alt=&quot;&quot; width=&quot;450&quot; height=&quot;176&quot; /&gt;&lt;/a&gt;&lt;p class=&quot;wp-caption-text&quot;&gt;Say it in llama! Did you know that llamas have banana-shaped ears, while an alpaca's are curved? *nods*&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;My first thought was not grandiose architecture, but perhaps a whimsy. I would develop a breed of mini alpacas. What? I adore the idea of a little alpaca romping around our yard! I think it would be grand.&lt;/p&gt;
&lt;p&gt;And then: a breed of large, intelligent rabbits. I like rabbits a lot. And then a breed of conveniently-sized dogs that are intelligent, attractive and not too naughty (this seems to be an unfortunate failing of &lt;a href=&quot;http://en.wikipedia.org/wiki/Shiba_Inu&quot;&gt;dogs&lt;/a&gt; &lt;a href=&quot;http://en.wikipedia.org/wiki/Basenji&quot;&gt;that&lt;/a&gt; &lt;a href=&quot;http://en.wikipedia.org/wiki/Beagle&quot;&gt;fall&lt;/a&gt; between &amp;#8220;small&amp;#8221; and &amp;#8220;medium&amp;#8221; size).&lt;/p&gt;
&lt;p&gt;And so it seems that, in my heart of hearts, I want to be a mad geneticist.&lt;/p&gt;
&lt;p&gt;Three further ideas occurred to me:&lt;/p&gt;
&lt;p&gt;A real-life recreation of The Land of Treats from Enid Blyton&amp;#8217;s &lt;a href=&quot;http://en.wikipedia.org/wiki/The_Faraway_Tree&quot;&gt;&lt;em&gt;The Magic Faraway Tree&lt;/em&gt; stories&lt;/a&gt;, complete with soda rivers and jam tart flowers. I must admit to reading these books over and over as a child, which may explain my great excitability over food as an adult.&lt;/p&gt;
&lt;p&gt;An array of every computer gaming system ever invented, installed with every computer game ever created, that I could peruse at my leisure. (There is this terrible-but-amazing dinosaur-mystery-adventure game called &lt;a href=&quot;http://en.wikipedia.org/wiki/Lost_Eden&quot;&gt;Lost Eden&lt;/a&gt; that I have a yearning to re-play.)&lt;/p&gt;
&lt;p&gt;A chocolate bar invented by myself. This would involve much research, experimentation and expert consultation. Possibly it would be named the &lt;em&gt;Mazfolly&lt;/em&gt;, and involve some combination of raspberry jelly (jello), caramel, peanuts, oats, white chocolate, cookie dough, or cookies.&lt;/p&gt;
&lt;p&gt;What would your grand folly be?&lt;/p&gt;
&lt;img src=&quot;http://feeds.feedburner.com/~r/krumpit/~4/5RqSGjJw5c0&quot; height=&quot;1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>krumpit</name>
			<uri>http://www.krumpit.org</uri>
		</author>
		<source>
			<title type="html">krumpit</title>
			<subtitle type="html">the blog of maz musings and ponderings.</subtitle>
			<link rel="self" href="http://www.krumpit.org/?feed=rss2"/>
			<id>http://www.krumpit.org/?feed=rss2</id>
			<updated>2012-01-01T17:00:16+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">The Goodness of GoodReads</title>
		<link href="http://feedproxy.google.com/~r/krumpit/~3/vjqM5lrME1A/"/>
		<id>http://www.krumpit.org/?p=761</id>
		<updated>2011-04-19T12:04:44+00:00</updated>
		<content type="html">&lt;p&gt;My experience with GoodReads, the &amp;#8220;social cataloguing&amp;#8221; site for book readers, started almost exactly two years ago. I had found my way to Felicia Day&amp;#8217;s blog and started reading &lt;a href=&quot;http://feliciaday.com/blog/packs-o-men&quot;&gt;one of her many book reviews&lt;/a&gt;. She linked to her shelves on GoodReads and I dutifully followed. How could one resist checking out a book collection named &amp;#8220;&lt;a href=&quot;http://www.goodreads.com/review/list/666892?shelf=vaginal-fantasy&quot;&gt;vaginal-fantasy&lt;/a&gt;&amp;#8220;? Oh my!&lt;/p&gt;
&lt;p&gt;I signed up to GoodReads, added a few books, and that was pretty much it. I wanted to be enthralled, but I just wasn&amp;#8217;t. The design was &amp;#8211; as it still is, admittedly &amp;#8211; a little bit brown and dated. And something more shiny had caught my eye: Shelfari.&lt;/p&gt;
&lt;h2&gt;Shiny!&lt;/h2&gt;
&lt;div id=&quot;attachment_764&quot; class=&quot;wp-caption aligncenter&quot;&gt;&lt;a href=&quot;http://www.krumpit.org/wp-content/uploads/2011/04/shiny-shelf.jpg&quot;&gt;&lt;img class=&quot;size-full wp-image-764 &quot; title=&quot;shiny-shelf&quot; src=&quot;http://www.krumpit.org/wp-content/uploads/2011/04/shiny-shelf.jpg&quot; alt=&quot;&quot; width=&quot;560&quot; /&gt;&lt;/a&gt;&lt;p class=&quot;wp-caption-text&quot;&gt;So shiny!&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href=&quot;http://www.shelfari.com/&quot;&gt;Shelfari&lt;/a&gt; was what I was looking for, as a bright-eyed social-networker of the book-reading variety, with a (supposedly somewhat) refined taste in web and user interface design. My shelf was shiny! I could add books to it! And lo, they would look like books! I exported my GoodReads book list and imported it into Shelfari and I was happy with what I saw.&lt;/p&gt;
&lt;p&gt;Two years later, however, Shelfari had barely changed. An iPhone app had been requested by many people, but had never appeared. It was feeling a bit stale and dissatisfying. I hadn&amp;#8217;t noticed any major improvements for a long time, and I found the interface &amp;#8211; though very pretty &amp;#8211; a little awkward in practice. It was time to try out GoodReads again.&lt;/p&gt;
&lt;p&gt;(As an aside, after a bit of digging around, I discovered that Shelfari had been acquired by Amazon a few years back. Having heard about other acquisitions by big companies, I wouldn&amp;#8217;t be surprised if this were a typical case of the parent company taking over and letting the original product languish.)&lt;/p&gt;
&lt;h2&gt;Returning to GoodReads&lt;/h2&gt;
&lt;p&gt;I found returning to GoodReads pleasantly surprising. I logged in and added a new Twitter friend. His updates appeared and I immediately saw some books he&amp;#8217;d commented on that I was interested in reading. Up until that moment, I hadn&amp;#8217;t considered that I might enjoy the social aspect of the site. I was just there for the book-tracking &amp;#8211; or so I thought!&lt;/p&gt;
&lt;div id=&quot;attachment_762&quot; class=&quot;wp-caption alignright&quot;&gt;&lt;a href=&quot;http://www.krumpit.org/wp-content/uploads/2011/04/currently-reading-e1303216946417.jpg&quot;&gt;&lt;img class=&quot;size-full wp-image-762     &quot; title=&quot;currently-reading&quot; src=&quot;http://www.krumpit.org/wp-content/uploads/2011/04/currently-reading-e1303216946417.jpg&quot; alt=&quot;&quot; width=&quot;230&quot; /&gt;&lt;/a&gt;&lt;p class=&quot;wp-caption-text&quot;&gt;Sadly, this book is could not be found.&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;I added the book I was currently reading. It was such a joy to click, type, press enter and have the book appear instantly in my &amp;#8220;currently reading&amp;#8221; section.&lt;/p&gt;
&lt;p&gt;The process is admittedly very similar in Shelfari, but somehow the experience isn&amp;#8217;t quite as smooth. In Shelfari, instead of adding your current book, you search for &lt;em&gt;a&lt;/em&gt; book, and &lt;em&gt;then&lt;/em&gt; specify that you are currently reading it. That distinction seems to matter &amp;#8211; in my mind, at least. Also, during the adding process, you are taken away from the home page and you need to navigate back to see the result. It feels less responsive and immediate.&lt;/p&gt;
&lt;p&gt;And finally, a bonus: GoodReads had an iPhone app! The first time I loaded the app, I clicked my way onto a list of &lt;a href=&quot;http://www.goodreads.com/list/show/147.Best_Kick_Ass_Fantasy_Female_Characters_From_YA_and_Childrens#2767052&quot;&gt;Best Kick-Ass Fantasy Female Characters from YA and Childrens&lt;/a&gt; and added many more books to my &amp;#8220;to read&amp;#8221; shelf in moments.&lt;/p&gt;
&lt;h2&gt;Shelving Shelfari&lt;/h2&gt;
&lt;p&gt;So, I was convinced that GoodReads was the way to go. Shelfari had a last laugh, however: something I had noticed in passing, but dismissed as irrelevant, was Shelfari&amp;#8217;s annoying &amp;#8220;profile completion&amp;#8221; message. It annoyed me as a designer, because it was displayed prominently in the top right of the home page &amp;#8211; prime visual real estate &amp;#8211; and couldn&amp;#8217;t be dismissed. It also annoyed me as a user because, even though I&amp;#8217;d tried, it seemed I couldn&amp;#8217;t complete my profile.&lt;/p&gt;
&lt;div id=&quot;attachment_763&quot; class=&quot;wp-caption alignleft&quot;&gt;&lt;a href=&quot;http://www.krumpit.org/wp-content/uploads/2011/04/profile-incomplete.jpg&quot;&gt;&lt;img class=&quot;size-full wp-image-763 &quot; title=&quot;profile-incomplete&quot; src=&quot;http://www.krumpit.org/wp-content/uploads/2011/04/profile-incomplete.jpg&quot; alt=&quot;&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;p class=&quot;wp-caption-text&quot;&gt;Ugh! How do I get to 100%?&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;When I started looking for how to export my Shelfari books, I couldn&amp;#8217;t find the export link that was supposed to be on the user settings page. I finally discovered that, to export a list of your Shelfari books, your user profile must be &lt;em&gt;90% complete&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;How obscure! I had completed the easy steps to reach 70%, but from that point on, I needed to add friends and add &amp;#8220;facts&amp;#8221; to books. Each fact and friend you invite (and who joins) is worth one percent. I had to edit a book entry 20 times, adding a new character or fact each time.&lt;/p&gt;
&lt;p&gt;Anyway, I passed that trial, and I am now happily ensconced in GoodReads. I would highly recommend it to any and all avid readers &amp;#8211; it&amp;#8217;s a great way to track your reading and discover new books. Even if you don&amp;#8217;t think you&amp;#8217;ll enjoy the social aspects of the site, you might be pleasantly surprised. I certainly was!&lt;/p&gt;
&lt;p&gt;And if you do sign up&amp;#8230; &lt;a href=&quot;http://www.goodreads.com/mazil&quot;&gt;add me&lt;/a&gt;! See you over there!&lt;/p&gt;
&lt;img src=&quot;http://feeds.feedburner.com/~r/krumpit/~4/vjqM5lrME1A&quot; height=&quot;1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>krumpit</name>
			<uri>http://www.krumpit.org</uri>
		</author>
		<source>
			<title type="html">krumpit</title>
			<subtitle type="html">the blog of maz musings and ponderings.</subtitle>
			<link rel="self" href="http://www.krumpit.org/?feed=rss2"/>
			<id>http://www.krumpit.org/?feed=rss2</id>
			<updated>2012-01-01T17:00:16+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Starting Out with Drawing</title>
		<link href="http://feedproxy.google.com/~r/krumpit/~3/An4Qzy05iw0/"/>
		<id>http://www.krumpit.org/2011/04/starting-out-with-drawing/</id>
		<updated>2011-04-04T09:37:21+00:00</updated>
		<content type="html">&lt;p&gt;So! A while ago &lt;a href=&quot;http://www.krumpit.org/2011/01/on-resolutions-and-the-keeping-of-them/&quot;&gt;I was talking about resolutions&lt;/a&gt;. One of my resolutions last year was to improve my drawing. In this post I&amp;#8217;ll have a look at how I did with that, and mention a few things I found useful.&lt;/p&gt;
&lt;p&gt;To begin with, I should explain that I&amp;#8217;ve always loved drawing. When I was young, it was always animals. And then I grew a little older. And I drew more animals.&lt;/p&gt;
&lt;p&gt;In Grade 6, I won an &amp;#8220;illustrate your favourite book&amp;#8221; competition. My entry was an illustration of &lt;em&gt;Watership Down&lt;/em&gt;. The librarian laminated it and put it up on a wall, and there it remained when I left for high school. (I wish now that I&amp;#8217;d thought to ask for it!)  But that was probably the pinnacle of my artistic skills. For some reason, from there, I never really progressed &lt;em&gt; &lt;/em&gt;with my drawing.&lt;/p&gt;
&lt;p&gt;Over the years, I always wished my drawing was better, but I never actually tried to improve it. So that was my resolution: to go back to basics and work on my drawing. It was a fairly loose resolution, but I managed to draw a few times a month for most of last year.&lt;/p&gt;
&lt;h2&gt;Starting Out&lt;/h2&gt;
&lt;p&gt;As is my tendency when starting something new, I first turned the internet for information, ferreting out countless websites, tutorials, forums, books, blogs and videos. Two things stand out for me as being extra inspirational and encouraging at this time: &lt;a href=&quot;http://www.conceptart.org/forums/showthread.php?t=870&quot;&gt;MindCandyMan&amp;#8217;s sketchbook&lt;/a&gt; on the ConceptArt forums, and a book, &lt;a href=&quot;http://www.drawright.com/&quot;&gt;Drawing on the Right Side of the Brain&lt;/a&gt; by Betty Edwards. They are great resources in many ways, but the primary message I took from both of them was: &lt;strong&gt;anyone can draw&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Drawing is not a magical talent that some people have and others lack. Just like any other skill, drawing requires practice to improve (time and effort). This can be a bit daunting, but luckily there are so many resources that can help you out—on the internet, and in the real world.&lt;/p&gt;
&lt;h2&gt;Hard Work&lt;/h2&gt;
&lt;p&gt;The most disheartening aspect of working through my resolution last year was that each drawing was &lt;em&gt;hard&lt;/em&gt;. Each new piece brought a new challenge, a new element to struggle with. Surely, I thought, this should be getting easier?&lt;/p&gt;
&lt;p&gt;Eventually I found an inkling of an answer in this blog post: &lt;a href=&quot;http://dresdencodak.tumblr.com/day/2010/08/06/&quot;&gt;Draftsmanship: Increasing Your Visual Vocabulary&lt;/a&gt;. It really resonated with my decision to &amp;#8220;go back to basics&amp;#8221; with my drawing as well as my ongoing struggle. For any new object that I drew, I needed to study it and learn how to draw it: the sky required studies of clouds, a forest required a study of trees. This was (and is) tiresome, but I think it&amp;#8217;s what is necessary.&lt;/p&gt;
&lt;p&gt;Gradually, I think, you build a strong enough visual foundation in your mind to be able to understand and represent new objects more quickly, based on what you&amp;#8217;ve learnt already. At least, that&amp;#8217;s what I hope, and I hope I&amp;#8217;ll get there.&lt;/p&gt;
&lt;h2&gt;Keeping on Going&lt;/h2&gt;
&lt;p&gt;As mentioned above, there are many resources online to help you with improving your art. Perhaps a little less directly useful than videos, tutorials and online classes, online communities can be invaluable (if a little distracting).&lt;/p&gt;
&lt;p&gt;There&amp;#8217;s nothing like a group of other people to motivate and inspire you, right? Why is that?? Anyway! Go find yourself &lt;a href=&quot;http://www.deviantart.com&quot;&gt;a social network&lt;/a&gt;, &lt;a href=&quot;http://conceptart.org/forums/&quot;&gt;a forum&lt;/a&gt;, or just somewhere to hang out and post your sketches.&lt;/p&gt;
&lt;h2&gt;How I Went&lt;/h2&gt;
&lt;p&gt;So, how did I go? Well, you can see these &lt;a href=&quot;http://mazil.deviantart.com/gallery/&quot;&gt;pieces I&amp;#8217;ve posted on DeviantArt&lt;/a&gt; over the past months (though they are only a small sample), and you can also compare them to this &lt;a href=&quot;http://mazil.deviantart.com/gallery/#/d2histp&quot;&gt;retrospective meme&lt;/a&gt; I put together. I think I have improved a little, but oh so slowly!&lt;/p&gt;
&lt;p&gt;As an aside, I was looking through my files just now and was curious why the drawings seemed to stop in October. And then I realised, &amp;#8220;Oh yeah. That would be four words. Or one long acronym of doom: &lt;a href=&quot;http://www.nanowrimo.org&quot;&gt;NANOWRIMO&lt;/a&gt;.&amp;#8221;&lt;/p&gt;
&lt;p&gt;In what was maybe a fitting return,  early on last year I drew a piece inspired by &lt;em&gt;Watership Down. &lt;/em&gt;Later in the year, I drew a piece inspired by my other favourite book, &lt;em&gt;Duncton Wood&lt;/em&gt;. Neither of them are finished, sadly, but here you go.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.krumpit.org/wp-content/uploads/2011/04/watership1.jpg&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://www.krumpit.org/wp-content/uploads/2011/04/watership1.jpg&quot;&gt;&lt;img class=&quot;alignleft size-medium wp-image-752&quot; title=&quot;On the Downs (sketch)&quot; src=&quot;http://www.krumpit.org/wp-content/uploads/2011/04/watership1-450x281.jpg&quot; alt=&quot;&quot; width=&quot;320&quot; height=&quot;200&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.krumpit.org/wp-content/uploads/2011/04/duncton11.jpg&quot;&gt;&lt;img class=&quot;alignleft size-thumbnail wp-image-755&quot; title=&quot;Waiting on the Slopes (sketch)&quot; src=&quot;http://www.krumpit.org/wp-content/uploads/2011/04/duncton11-200x200.jpg&quot; alt=&quot;&quot; width=&quot;200&quot; height=&quot;200&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/p&gt;
&lt;h2&gt;Resources&lt;/h2&gt;
&lt;p&gt;So finally, here are some resources that I&amp;#8217;ve enjoyed and found useful in the past year. If you&amp;#8217;re on a drawing journey, please share your favourite resources in the comments &lt;img src=&quot;http://www.krumpit.org/wp-includes/images/smilies/icon_smile.gif&quot; alt=&quot;:)&quot; class=&quot;wp-smiley&quot; /&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Books&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;&lt;a href=&quot;http://www.drawright.com/&quot;&gt;Drawing on the Right Side of the Brain&lt;/a&gt; by Betty Edwards&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/Imaginative-Realism-Paint-Doesnt-Exist/dp/0740785508&quot;&gt;Imaginative Realism&lt;/a&gt; by James Gurney&lt;/li&gt;
&lt;li&gt;Anatomy books &amp;#8211; you need to know what&amp;#8217;s going on under the surface!&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Blogs&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://gurneyjourney.blogspot.com/&quot;&gt;Gurney Journey&lt;/a&gt; &amp;#8211; &lt;em&gt;Dinotopia &lt;/em&gt;creator James Gurney (check out his articles on &lt;a href=&quot;http://gurneyjourney.blogspot.com/search/label/Color&quot;&gt;colour&lt;/a&gt; and &lt;a href=&quot;http://gurneyjourney.blogspot.com/search/label/Composition&quot;&gt;composition&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dresdencodak.tumblr.com/&quot;&gt;Indistinguishable from Magic&lt;/a&gt; &amp;#8211; &lt;em&gt;Dresden Codak &lt;/em&gt;creator Aaron Diaz&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://evandahm.tumblr.com/&quot;&gt;Evan Dahm&lt;/a&gt; &amp;#8211; creator of &lt;em&gt;Rice Boy&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Your favourite artists &amp;#8211; invaluable for inspiration and advice&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Communities&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.deviantart.com&quot;&gt;DeviantArt&lt;/a&gt; &amp;#8211; search around for some &lt;a href=&quot;http://fox-orian.deviantart.com/art/Perspective-Composition-Pt-2-125042592&quot;&gt;great tutorials&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://conceptart.org/forums/&quot;&gt;ConceptArt Forums&lt;/a&gt; &amp;#8211; check out the &lt;a href=&quot;http://conceptart.org/forums/forumdisplay.php?f=42&quot;&gt;tutorials&lt;/a&gt; and &lt;a href=&quot;http://conceptart.org/forums/forumdisplay.php?f=30&quot;&gt;references&lt;/a&gt; forums&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Resources&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.posemaniacs.com/blog/thirtysecond&quot;&gt;Pose Maniacs&lt;/a&gt; &amp;#8211; 30 second figure drawings. Great for loosening up and practicing human anatomy.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://images.google.com&quot;&gt;Google Images&lt;/a&gt; &amp;#8211; &lt;em&gt;the&lt;/em&gt; place for reference photos &lt;img src=&quot;http://www.krumpit.org/wp-includes/images/smilies/icon_wink.gif&quot; alt=&quot;;)&quot; class=&quot;wp-smiley&quot; /&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://hippie.nu/~unicorn/tut/xhtml/&quot;&gt;TL;DR (Yet Another Anthro Art Tutorial)&lt;/a&gt; &amp;#8211; Ahem. I think this is a great read for an enthusiastic beginner.&lt;/li&gt;
&lt;/ul&gt;
&lt;img src=&quot;http://feeds.feedburner.com/~r/krumpit/~4/An4Qzy05iw0&quot; height=&quot;1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>krumpit</name>
			<uri>http://www.krumpit.org</uri>
		</author>
		<source>
			<title type="html">krumpit</title>
			<subtitle type="html">the blog of maz musings and ponderings.</subtitle>
			<link rel="self" href="http://www.krumpit.org/?feed=rss2"/>
			<id>http://www.krumpit.org/?feed=rss2</id>
			<updated>2012-01-01T17:00:16+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">{1,2,3,4}</title>
		<link href="http://brnz.org/hbr/?p=1025"/>
		<id>http://brnz.org/hbr/?p=1025</id>
		<updated>2011-03-24T12:46:00+00:00</updated>
		<content type="html">&lt;p&gt;(This is wonderfully obtuse, but amused me :)&lt;/p&gt;
&lt;p&gt;Neil Henning (&lt;a href=&quot;http://twitter.com/sheredom&quot;&gt;@sheredom&lt;/a&gt;) &lt;a href=&quot;http://twitter.com/sheredom/status/50865948349046784&quot;&gt;asked&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;SPU gurus of twitter unite, want a vector unsigned int with {1, 2, 3, 4} in each slot, without putting it in as elf constant, any ideas?&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Interesting question. The SPU ISA generally doesn&amp;#8217;t help build vectors with different values in each slot. In this case, there are only very small values required in each register, so it can be done with a neat little trick.&lt;/p&gt;
&lt;p&gt;My answer:&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;c&quot;&gt;    fsmbi r4&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nu12&quot;&gt;0x7310&lt;/span&gt;  &lt;span class=&quot;co2&quot;&gt;# r4 = {0x00ffffff, 0x0000ffff, 0x000000ff, 0x00000000}&lt;/span&gt;
    clz r5&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; r4        &lt;span class=&quot;co2&quot;&gt;# r5 = {8,16,24,32}&lt;/span&gt;
    rotmi r6&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; r5&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;  &lt;span class=&quot;co2&quot;&gt;# r6 = {1,2,3,4}&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Instructions are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;fsmbi&lt;/strong&gt; &amp;#8212; form select mask byte immediate. Creates a 128 bit mask from a 16 bit value, expanding each bit of input to 8 bits of output.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;clz&lt;/strong&gt; &amp;#8212; count leading zeroes. Counts the number of leading zeros in each word.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;rotmi&lt;/strong&gt; &amp;#8212; rotate and mask word immediate (logical shift right by negative immediate). Shifts each word right by the negation of number of bits specified.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This solution is entirely self contained, required no pre-set state (unlike my first attempt utilising the cbd instruction). In terms of raw instruction size, it&amp;#8217;s a whole eight bytes smaller than storing the vector in memory and loading it when needed (that being 16+4 bytes), and a little slower than using a load instruction.&lt;/p&gt;
&lt;p&gt;(On a cursory re-examination of the SPU ISA, fsmbi is the only instruction that will construct a different value in each word of a register. A specific pattern may be generated with cbd/cbx that can be used for this problem, but it depends on the contents of another register which limits its already limited usefulness. Combining fsmbi with other immediate instructions allows for a wide range of values to be constructed independent of register state and without access to storage)&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">The Allure of eReaders</title>
		<link href="http://feedproxy.google.com/~r/krumpit/~3/dhhZxQxeLws/"/>
		<id>http://www.krumpit.org/2011/03/the-allure-of-ereaders/</id>
		<updated>2011-03-20T10:00:53+00:00</updated>
		<content type="html">&lt;p&gt;I bought &lt;a href=&quot;http://www.sony.com.au/product/prs-350&quot;&gt;an eReader&lt;/a&gt; last week. Weighing in at nearly $250 for the petite device, with a screen that is &lt;a href=&quot;http://en.wikipedia.org/wiki/E_Ink&quot;&gt;effectively black and white&lt;/a&gt; and has something like a 1 frame-per-second refresh rate*, this was not a decision I rushed into. But the idea for purchasing an eReader has stuck in my mind ever since I read a &lt;a href=&quot;http://feliciaday.com/blog/kindle-oh-kindle&quot;&gt;blog post by Felicia Day&lt;/a&gt; about her Kindle two years ago. She wrote:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;The first thing I hear from people who see it, which I was totally on board with before I got the Kindle, is “I like to feel the book in my hand”. I have a HUGE bookshelf in my house of paperbacks and signed hardbacks, so I’m a girl who was also skeptical of the idea of a newfangled electronic thing. Isn’t that what the 2-3 hours a day I spend on the internet is for; reading stuff?! Shouldn’t I reserve my pleasure reading to real life? &amp;#8230; Evidently I could be persuaded otherwise.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Indeed, I was always firmly in the &amp;#8220;but I &lt;em&gt;like &lt;/em&gt;books!&amp;#8221; camp, and this is still the most common reaction I get when discussing eReaders with my book-reading friends. But I think there are two different questions to consider:&lt;/p&gt;
&lt;p&gt;Do you really like reading (and do you want to read more)?&lt;br /&gt;
Do you really like owning books (and do you want to own more)?&lt;/p&gt;
&lt;p&gt;The answer to the first questions, for me, was most definitely yes. The second? Not so much. Yes, I want to own copies of my favourite books: the books that I want to sigh over in happy nostalgia and re-read obsessively every few years and &lt;span&gt;force&lt;/span&gt; pass on to my friends and family. But that paranormal romance that I&amp;#8217;m just a little embarrassed to admit I&amp;#8217;m interested in? Or that non-fiction book I&amp;#8217;d like to read &amp;#8220;one day&amp;#8221;? Or the &lt;a href=&quot;http://www.gutenberg.org/ebooks/1342&quot;&gt;classic novels&lt;/a&gt; that I &lt;em&gt;should&lt;/em&gt; read? Do I want those sitting on my bookshelf for the rest of all time?&lt;/p&gt;
&lt;h2&gt;Getting with the Digital&lt;/h2&gt;
&lt;p&gt;Connecting my eReader to my laptop for the first time, I felt a strange mixture of liberation and loss. It was a similar feeling to when, as a wee teen, I first realised I could download music from the internet. That any music I wanted—and more music than I ever wanted—was at my fingertips (the only limitation being our 56k dialup connection!). And that my CD collection, each CD painstakingly decided upon and saved for, was now redundant.&lt;/p&gt;
&lt;p&gt;I also felt a little gluttonous, which seems fitting, as I think the main benefit of the eReader is consumption. My eReader will allow me to consume far more books than our physical bookshelves at home would allow. It will also allow me to consume more than my finances would otherwise allow (an average paperback in Australia costs around 20 AUD/USD), thanks to &lt;a href=&quot;http://www.gutenberg.org/&quot;&gt;Project Gutenberg&lt;/a&gt; and other sources.&lt;/p&gt;
&lt;p&gt;Hopefully it will also allow me to read more, and more widely. I have already loaded up my little eReader with two fantasy novels, one NaNoWriMo novel, one non-fiction book, one open source novel, and have high hopes of downloading many, many old classics.&lt;/p&gt;
&lt;p&gt;Anyway, it&amp;#8217;s early days yet. If only &lt;a href=&quot;http://www.shelfari.com/mazil&quot;&gt;Shelfari&lt;/a&gt; had a graph feature, it would be interesting to see how my reading rate is affected over the next few months.&lt;/p&gt;
&lt;p&gt;&amp;#8212;&lt;/p&gt;
&lt;p&gt;And just for reference, if anyone&amp;#8217;s curious&amp;#8230;&lt;/p&gt;
&lt;p&gt;Happy nostalgia and obsessive re-reading: &lt;a href=&quot;http://en.wikipedia.org/wiki/Duncton_Wood&quot;&gt;Duncton Wood&lt;/a&gt;&lt;br /&gt;
Paranormal romance: &lt;a href=&quot;http://www.kelleyarmstrong.com/bitten/&quot;&gt;Bitten&lt;/a&gt;&lt;br /&gt;
Non-fiction: &lt;a href=&quot;http://en.wikipedia.org/wiki/Cosmos_(book)&quot;&gt;Cosmos&lt;/a&gt;&lt;br /&gt;
Classic novel: &lt;a href=&quot;http://www.gutenberg.org/ebooks/1342&quot;&gt;Pride &amp;amp; Prejudice&lt;/a&gt;&lt;br /&gt;
Two fantasy novels: &lt;a href=&quot;http://en.wikipedia.org/wiki/Dragonriders_of_Pern&quot;&gt;Dragonriders of Pern&lt;/a&gt;&lt;br /&gt;
NaNoWriMo novel: &lt;a href=&quot;http://kestrelsaerie.com/tag/obsidian-throne/&quot;&gt;Obsidian Throne&lt;/a&gt;&lt;br /&gt;
Non-fiction (the second): &lt;a href=&quot;http://en.wikipedia.org/wiki/The_God_Delusion&quot;&gt;The God Delusion&lt;/a&gt;&lt;br /&gt;
Open-source novel: &lt;a href=&quot;http://craphound.com/littlebrother/download/&quot;&gt;Little Brother&lt;/a&gt;&lt;br /&gt;
Old classics: &lt;a href=&quot;http://www.gutenberg.org/ebooks/5141&quot;&gt;What Katy Did at School&lt;/a&gt; and &lt;a href=&quot;http://www.gutenberg.org/ebooks/2488&quot;&gt;20,000 Leagues Under the Sea&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;* I really don&amp;#8217;t know much about this, but I&amp;#8217;m guessing it&amp;#8217;s low &lt;img src=&quot;http://www.krumpit.org/wp-includes/images/smilies/icon_razz.gif&quot; alt=&quot;:P&quot; class=&quot;wp-smiley&quot; /&gt; &lt;/p&gt;
&lt;img src=&quot;http://feeds.feedburner.com/~r/krumpit/~4/dhhZxQxeLws&quot; height=&quot;1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>krumpit</name>
			<uri>http://www.krumpit.org</uri>
		</author>
		<source>
			<title type="html">krumpit</title>
			<subtitle type="html">the blog of maz musings and ponderings.</subtitle>
			<link rel="self" href="http://www.krumpit.org/?feed=rss2"/>
			<id>http://www.krumpit.org/?feed=rss2</id>
			<updated>2012-01-01T17:00:16+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">TTYtter for the N900</title>
		<link href="http://brnz.org/hbr/?p=1007"/>
		<id>http://brnz.org/hbr/?p=1007</id>
		<updated>2011-03-12T14:06:24+00:00</updated>
		<content type="html">&lt;p&gt;A quick documenting of how I got &lt;a href=&quot;http://www.floodgap.com/software/ttytter/&quot;&gt;TTYtter&lt;/a&gt; running on the N900/Maemo5.&lt;/p&gt;
&lt;h2&gt;0. Missing curl&lt;/h2&gt;
&lt;p&gt;TTYtter requires curl for OAuth, but curl isn&amp;#8217;t packaged in the maemo5 repositories (libcurl is &amp;#8212; which is frustrating. The particular reason for the frustration will be made clear later&amp;#8230;)&lt;/p&gt;
&lt;p&gt;That being the case, let&amp;#8217;s build curl! I grabbed the sources for the version of curl that matched installed libcurl from the relevant source package page on &lt;a href=&quot;http://maemo.org/packages/source/view/fremantle_sdk_free_source/curl/7.18.2-8maemo6+0m5/&quot;&gt;maemo.org&lt;/a&gt;, unpacked the tarball and patch -p1&amp;#8242;d the gunzipped patch.&lt;/p&gt;
&lt;h2&gt;1. What didn&amp;#8217;t work&lt;/h2&gt;
&lt;p&gt;The first half-hearted attempt was to build curl using the cross toolchain I have installed on my gentoo desktop (built with &lt;strong&gt;crossdev -t arm-linux-gnueabi&lt;/strong&gt;). I had little hope that this would just work, and a quick &lt;strong&gt;./configure &amp;#8211;host=arm-linux-gnueabi &amp;#8211;prefix=/home/user/local &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install &amp;amp;&amp;amp; scp -r /home/user/local n900:&lt;/strong&gt; (or something like it) later, it didn&amp;#8217;t &amp;#8212; the foremost hurdle being that maemo5 uses an antiquated glibc-2.5 (2005, yeah!), and my toolchain uses (and thus generates programs that expect) glibc-2.11.3.&lt;/p&gt;
&lt;p&gt;Persisting with my all-too-modern toolchain seemed likely to be a whole lot of effort &amp;#8212; I decided to go with what appeared to be the Official method &amp;#8212; the probability of success seemed marginally higher.&lt;/p&gt;
&lt;h2&gt;2. What worked&lt;/h2&gt;
&lt;p&gt;I installed &lt;a href=&quot;http://www.scratchbox.org&quot;&gt;scratchbox&lt;/a&gt; and built it there.&lt;/p&gt;
&lt;h3&gt;i. Installing scratchbox&lt;/h3&gt;
&lt;p&gt;I first found &lt;a href=&quot;http://www.janerob.com/rob/MaemoOnGentoo.html&quot;&gt;this MaemoOnGentoo outline&lt;/a&gt; which was got me started. Rather than the emerge command listed on that page, I ended up needing something like:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;emerge scratchbox scratchbox-devkit-debian scratchbox-devkit-perl \&lt;br /&gt;
scratchbox-devkit-cputransp scratchbox-devkit-doctools \&lt;br /&gt;
scratchbox-toolchain-cs2007q3-glibc2_5 scratchbox-devkit-qemu\&lt;br /&gt;
scratchbox-devkit-git scratchbox-devkit-svn&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;As per that page, I needed to re-emerge xorg-server with the kdrive USE flag to build xephyr.&lt;/p&gt;
&lt;p&gt;Started scratchbox with &lt;strong&gt;/etc/init.d/scratchbox start&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;From that point on, the &lt;a href=&quot;http://wiki.maemo.org/Documentation/Maemo_5_Final_SDK_Installation#Manual_Installation&quot;&gt;Manual Installation instructions for the SDK from maemo.org&lt;/a&gt; generally worked &amp;#8212; I added a user with &lt;strong&gt;/scratchbox/sbin/sbox_adduser&lt;/strong&gt;, added my user account to the &lt;strong&gt;sbox&lt;/strong&gt; group. (Actually, not really knowing what I was doing, after doing that, I ran the &lt;a href=&quot;http://repository.maemo.org/stable/5.0/maemo-sdk-install_5.0.sh&quot;&gt;maemo-sdk-install_5.0.sh&lt;/a&gt; script, which seemed to do the right thing)&lt;/p&gt;
&lt;p&gt;I needed to manually install the Nokia binaries/apps as per the Manual Installation instructions.&lt;/p&gt;
&lt;p&gt;That done, I was able to &lt;a href=&quot;http://wiki.maemo.org/Documentation/Maemo_5_Final_SDK_Installation#Starting.2FShutting_down_the_SDK_UI&quot;&gt;start the SDK UI inside a xephyr window&lt;/a&gt;. i.e. &lt;strong&gt;Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac&lt;/strong&gt; and (inside a scratchbox prompt) &lt;strong&gt;DISPLAY=:2 af-sb-init.sh start&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;(Having the UI running is the Hello, world! &amp;#8216;proof&amp;#8217; of functionality &amp;#8212; it may not count for much, but it&amp;#8217;s nice to see)&lt;strong&gt;&lt;br /&gt;
&lt;/strong&gt;&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;ii. Building it there&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Once there&amp;#8217;s a functional scratchbox environment, the next thing to do is to build the package.&lt;/p&gt;
&lt;p&gt;I naively followed the relevant parts of &lt;a href=&quot;http://wiki.maemo.org/Packaging#A_concrete_example_-_hello&quot;&gt;the example from the Packaging guide on maemo.org&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Taking the source (as mentioned before &amp;#8212; de-tarballed sources with patch applied) it became apparent that the necessary configuration was already in place to build the desired .deb (so much of the guide was unneeded for this task). In fact, from what I recall, the only command from that guide that was necessary was &lt;strong&gt;dpkg-buildpackage -sa -rfakeroot -k&amp;lt;my email address&amp;gt;&lt;/strong&gt; (run using the FREMANTLE_ARMEL tool config)&lt;/p&gt;
&lt;p&gt;End result: a bunch of files, including &lt;strong&gt;curl_7.18.2-8maemo6+0m5_armel.deb&lt;/strong&gt; &amp;#8212; the frustration mentioned earlier was that the config exists to build this, and that packaging curl for maemo5 would have been approximately zero extra effort.&lt;/p&gt;
&lt;p&gt;(Nothing is ever actually zero extra effort. I know this.)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;scp curl_7.18.2-8maemo6+0m5_armel.deb n900:&lt;/strong&gt;, and install with &lt;strong&gt;dpkg &amp;#8211;install curl_7.18.2-8maemo6+0m5_armel.deb&lt;/strong&gt; and TTYtter gets the curl.&lt;/p&gt;
&lt;h2&gt;3. The final bit&lt;/h2&gt;
&lt;p&gt;TTYtter starts, but it&amp;#8217;s not quite working yet. Maemo5 has a prehistoric perl-5.8.3 (2004, woo!) which appears to lack the kind of UTF8 support that TTYtter wants.&lt;/p&gt;
&lt;p&gt;To work around this, start TTYtter with the &lt;strong&gt;-seven&lt;/strong&gt; option.&lt;/p&gt;
&lt;h2&gt;4. Too long; don&amp;#8217;t care&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;The package is here: &lt;/strong&gt;&lt;a href=&quot;http://brnz.org/f/maemo5/curl_7.18.2-8maemo6+0m5_armel.deb&quot;&gt;&lt;strong&gt;curl_7.18.2-8maemo6+0m5_armel.deb&lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;
(&lt;a href=&quot;http://brnz.org/f/maemo5/&quot;&gt;The original source is here with it&lt;/a&gt;)&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;As root, install the package (&lt;strong&gt;dpkg -i curl_7.18.2-8maemo6+0m5_armel.deb&lt;/strong&gt;) and then (as the regular user) grab and run &lt;strong&gt;ttytter -seven&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;TTYtter is by far the best Twitter client I&amp;#8217;ve used on this phone &amp;#8212; not least because it works.&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">On Resolutions: Keeping on Track</title>
		<link href="http://feedproxy.google.com/~r/krumpit/~3/ZCE_NrYfOeE/"/>
		<id>http://www.krumpit.org/2011/03/on-resolutions-keeping-on-track/</id>
		<updated>2011-03-08T10:00:07+00:00</updated>
		<content type="html">&lt;div id=&quot;attachment_733&quot; class=&quot;wp-caption alignright&quot;&gt;&lt;a href=&quot;http://www.flickr.com/photos/staticgirl/5075282425/&quot;&gt;&lt;img class=&quot;size-medium wp-image-733   &quot; title=&quot;5075282425_91f53bde45_b&quot; src=&quot;http://www.krumpit.org/wp-content/uploads/2011/03/5075282425_91f53bde45_b-e1299581497441-445x450.jpg&quot; alt=&quot;&quot; width=&quot;200&quot; height=&quot;202&quot; /&gt;&lt;/a&gt;&lt;p class=&quot;wp-caption-text&quot;&gt;Badger trail, by staticgirl&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;So, &lt;a href=&quot;http://www.krumpit.org/2011/01/on-resolutions-and-the-keeping-of-them/&quot;&gt;in my last post&lt;/a&gt; I talked about setting your goals and planning how to keep them. I should admit right now that one of the goals was to write regular fortnightly blog posts as part of a newly formed &lt;a href=&quot;http://writeclub.posterous.com/&quot;&gt;Write Club&lt;/a&gt;. Oops. I have also failed to do &lt;em&gt;any &lt;/em&gt;drawing whatsoever, and my poor NaNoWriMo draft is gathering dust on the floor next to the bed.&lt;/p&gt;
&lt;p&gt;Where there are failures there have also been some successes, though. While I have failed to progress on what I &lt;em&gt;thought&lt;/em&gt; were my goals this year, other goals have shouldered their way through. I have finished a large batch of website work for a client—my first &amp;#8220;real&amp;#8221; client. I have nigh-finished work on a new website for my local frisbee association. I&amp;#8217;ve helped organise the frisbee girls team this year too, the largest we&amp;#8217;ve had in Tassie.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m not meaning to brag. I guess I&amp;#8217;m finding it interesting to look back on how things have turned out. As an aside, this might be a bit weird, but I have been known to add things to my to-do list and cross them off straight away, just for the satisfaction of seeing them crossed out&amp;#8230; I wish I could do it in this case! I think you should always keep around a few complete items on any to-do list, just to remind and reassure you that you&amp;#8217;re making progress.&lt;/p&gt;
&lt;p&gt;Perhaps this is another key to being successful in your goals? Retrospection and revision, some satisfaction and a little adjustment. You need to know where you are right now, to know how to best get where you&amp;#8217;re going!&lt;/p&gt;
&lt;img src=&quot;http://feeds.feedburner.com/~r/krumpit/~4/ZCE_NrYfOeE&quot; height=&quot;1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>krumpit</name>
			<uri>http://www.krumpit.org</uri>
		</author>
		<source>
			<title type="html">krumpit</title>
			<subtitle type="html">the blog of maz musings and ponderings.</subtitle>
			<link rel="self" href="http://www.krumpit.org/?feed=rss2"/>
			<id>http://www.krumpit.org/?feed=rss2</id>
			<updated>2012-01-01T17:00:16+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Smokey Beef Chili with Guinness</title>
		<link href="http://brnz.org/hbr/?p=992"/>
		<id>http://brnz.org/hbr/?p=992</id>
		<updated>2011-03-05T01:07:51+00:00</updated>
		<content type="html">&lt;p&gt;This is a recipe I obtained via twitter. I didn&amp;#8217;t make a note of the source, and it was shared as text in an image which I printed. I am now unable to locate the original.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m re-posting it the original text here (none of the comments within are mine) for the people that have asked me about it with thanks to whoever was responsible &amp;#8212; it was enjoyed by my whole family :D&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Smokey Beef Chili with Guiness&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;500 grams of gravy beef&lt;br /&gt;
100 grams of streaky bacon&lt;br /&gt;
3 celery stalks&lt;br /&gt;
2 red chilies&lt;br /&gt;
2 red onions&lt;br /&gt;
2 green capsicums&lt;br /&gt;
8 garlic cloves&lt;br /&gt;
1 can of diced tomatoes&lt;br /&gt;
2 cans of red kidney beans&lt;br /&gt;
150g of tomato paste&lt;br /&gt;
500ml beef stock&lt;br /&gt;
Dried oregano&lt;br /&gt;
Smoked paprika&lt;br /&gt;
Ground cumin&lt;br /&gt;
Tabasco sauce&lt;br /&gt;
Sugar to taste (usually between 1 and 4 teaspoons)&lt;br /&gt;
200ml of Guinness&lt;br /&gt;
(Optional) 1 can of smoked chipotle peppers&lt;/p&gt;
&lt;p&gt;Roughly dice onion, chilies, capsicum and bacon. Finely dice garlic and celery. Add to hot pot with good slug of olive oil and cook until onion becomes semi-transparent.&lt;/p&gt;
&lt;p&gt;Meanwhile, cut gravy beef (or chuck steak, or skirt steak) into large chunks. Whack in a food processor and pulse until half the steak has disintegrated and half has been carved up into various random shapes of random size.&lt;/p&gt;
&lt;p&gt;Once onion is browned (important) add big teaspoon of smoked paprika, flat teaspoon of cumin, 2 teaspoons of dried oregano and solid few shakes of Tabasco sauce. Cook and stir for a few minutes until mixture becomes coloured from the spices cooking through it.&lt;/p&gt;
&lt;p&gt;Add meat and cook until brown.&lt;/p&gt;
&lt;p&gt;Add tomato paste and diced chipotle peppers and cook out until it just starts to caramelise on the walls of the pot. Add the adobo sauce from the chipotle can to taste now as well (warning &amp;#8211; hot!)&lt;/p&gt;
&lt;p&gt;Add can of diced tomatoes (drained) and kidney beans (drain and rinse well first). Cook for a few minutes.&lt;/p&gt;
&lt;p&gt;Add Guinness. Cook until most of the beer has evaporated.&lt;/p&gt;
&lt;p&gt;Add beef stock. Bring to boil. Add sugar until the mix in the pot is slightly less sweet than you want it to be (the sauce will reduce and sweetness will increase at the end). Alternatively, add the sugar when you add the tomato paste (it will add a little to the caramelisation of the paste and add a bit of extra flavour &amp;#8211; best for second time you cook it, so you know how much you need)&lt;/p&gt;
&lt;p&gt;Taste the mix after it starts to boil. Add a teaspoon of dried oregano and a little extra smoked paprika if the mix isn&amp;#8217;t as smokey in flavour as you&amp;#8217;d like. Add tabasco sauce for extra heat.&lt;/p&gt;
&lt;p&gt;Simmer uncovered for 1.5 hours and add the lid when the mix is just a bit wetter than you want. (e.g. you want it wetter for serving with rice than you do for tacos or nachos). Let stand for at least 1/2 hour with heat off and lid on before serving (you can give it a reheat before serving if needed and add a little water to the simmering if it starts to dry out.)&lt;/p&gt;
&lt;p&gt;Some folks stir fresh oregano and diced chili through before serving. It doesn&amp;#8217;t float my boat, but it may well yours.&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Assembly Primer Parts 6 — Moving Data — ARM</title>
		<link href="http://brnz.org/hbr/?p=975"/>
		<id>http://brnz.org/hbr/?p=975</id>
		<updated>2011-03-02T13:05:13+00:00</updated>
		<content type="html">&lt;p&gt;My notes for where ARM differs from IA32 in the &lt;a href=&quot;http://securitytube.net/Assembly-Primer-for-Hackers-(Part-6)-Moving-Data-video.aspx&quot;&gt;Assembly Primer video Part 6 &amp;#8212; Moving Data&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;(There is no separate part 5 post for ARM &amp;#8212; apart from the instructions, it&amp;#8217;s identical to IA32. There&amp;#8217;s even support for the .bss section, unlike SPU and PPC)&lt;/p&gt;
&lt;h2&gt;Moving Data&lt;/h2&gt;
&lt;p&gt;We&amp;#8217;ll look at &lt;a href=&quot;http://code.securitytube.net/MovDemo.s&quot;&gt;MovDemo.s&lt;/a&gt; for ARM. First, the storage:&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;asm&quot;&gt;&lt;span class=&quot;kw4&quot;&gt;.data&lt;/span&gt;
&amp;nbsp;
    HelloWorld&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;ascii &lt;span class=&quot;st0&quot;&gt;&amp;quot;Hello World!&amp;quot;&lt;/span&gt;
&amp;nbsp;
    ByteLocation&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw5&quot;&gt;byte&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;10&lt;/span&gt;
&amp;nbsp;
    Int32&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
    Int16&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw4&quot;&gt;short&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;
    Float&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;float &lt;span class=&quot;nu0&quot;&gt;10.23&lt;/span&gt;
&amp;nbsp;
    IntegerArray&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kw1&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;40&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;50&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It&amp;#8217;s the same as for IA32, PPC and SPU. Like the first two, ARM will cope with the unnatural alignment.&lt;/p&gt;
&lt;h3&gt;1. Immediate value to register&lt;/h3&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;asm&quot;&gt;&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;text
&lt;span class=&quot;sy0&quot;&gt;.&lt;/span&gt;globl _start
_start&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;
    @movl $&lt;span class=&quot;nu0&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;kw3&quot;&gt;eax&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;mov&lt;/span&gt; r0&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;10&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Move the value 10 into register r0.&lt;/p&gt;
&lt;p&gt;Something to note: the ARM assembly syntax has some slightly differences. Where others use &lt;strong&gt;#&lt;/strong&gt; to mark the start of a comment, ARM has &lt;strong&gt;@&lt;/strong&gt; (although &lt;strong&gt;#&lt;/strong&gt; works at the start of a line). Literal values are prefixed with &lt;strong&gt;#&lt;/strong&gt;, which confuses the default syntax highlighting in vim.&lt;/p&gt;
&lt;h3&gt;2. Immediate value to memory&lt;/h3&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;asm&quot;&gt;    @movw $&lt;span class=&quot;nu0&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; Int16
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;mov&lt;/span&gt; r1&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;50&lt;/span&gt;
    movw r0&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; #&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;lower16&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;Int16
    movt r0&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; #&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;upper16&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;Int16
    strh r1&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;r0&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We need to load the immediate value in a register (r1), the address in a register (r0) and then perform the write. To quote the Architecture Reference Manual:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;The ARM architecture &amp;#8230; incorporates &amp;#8230; a load/store architecture, where data processing operations only operate on register contents, not directly on memory contents.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;which is like PPC and SPU, and unlike IA32 &amp;#8212; and so we&amp;#8217;ll see similarly verbose alternatives to the IA32 examples from the video.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m using &lt;strong&gt;movw&lt;/strong&gt;, &lt;strong&gt;movt&lt;/strong&gt; sequence to load the address, rather than &lt;strong&gt;ldr&lt;/strong&gt; (as mentioned in the previous installment).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;strh&lt;/strong&gt; is, in this case, &lt;strong&gt;Store Register Halfword (immediate)&lt;/strong&gt; &amp;#8212; writes the value in r1 to the address computed from the sum of the contents of r0 and the immediate value of 0.&lt;/p&gt;
&lt;h3&gt;3. Register to register&lt;/h3&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;asm&quot;&gt;    @movl &lt;span class=&quot;sy0&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;kw3&quot;&gt;eax&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;kw3&quot;&gt;ebx&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;mov&lt;/span&gt; r1&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;r0&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;mov&lt;/strong&gt; (&lt;strong&gt;Move&lt;/strong&gt;) copies the value from r0 to r1.&lt;/p&gt;
&lt;h3&gt;4. Memory to register&lt;/h3&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;asm&quot;&gt;    @movl Int32&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;kw3&quot;&gt;eax&lt;/span&gt;
&amp;nbsp;
    movw r0&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; #&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;lower16&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;Int32
    movt r0&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; #&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;upper16&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;Int32
    ldr r1&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;r0&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Load the address into r0, load from the address r0+0. Here &lt;strong&gt;ldr&lt;/strong&gt; is &lt;strong&gt;Load Register (immediate)&lt;/strong&gt;.&lt;/p&gt;
&lt;h3&gt;5. Register to memory&lt;/h3&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;asm&quot;&gt;    @movb $&lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;kw3&quot;&gt;al&lt;/span&gt;
    @movb &lt;span class=&quot;sy0&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;kw3&quot;&gt;al&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; ByteLocation
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;mov&lt;/span&gt; r0&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;3&lt;/span&gt;
    movw r1&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; #&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;lower16&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;ByteLocation
    movt r1&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; #&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;upper16&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;ByteLocation
    strb r0&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;r1&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Once again the same kind of thing &amp;#8212; load 3 into r0, the address of ByteLocation into r1, perform the store.&lt;/p&gt;
&lt;h3&gt;6. Register to indexed memory location&lt;/h3&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;asm&quot;&gt;    @movl $&lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;kw3&quot;&gt;ecx&lt;/span&gt;
    @movl $&lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;kw3&quot;&gt;edi&lt;/span&gt;
    @movl $&lt;span class=&quot;nu0&quot;&gt;22&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; IntegerArray&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;kw3&quot;&gt;ecx&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;kw3&quot;&gt;edi&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
    movw r0&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; #&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;lower16&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;IntegerArray
    movt r0&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; #&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;upper16&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;IntegerArray
    &lt;span class=&quot;kw1&quot;&gt;mov&lt;/span&gt; r1&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;mov&lt;/span&gt; r2&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;22&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;str&lt;/span&gt; r2&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;r0&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; r1&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;lsl&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;A little more interesting &amp;#8212; here &lt;strong&gt;str&lt;/strong&gt; is &lt;strong&gt;Store Register (register) &lt;/strong&gt;which accepts two registers and an optional shift operation and amount. Here &lt;strong&gt;lsl&lt;/strong&gt; is &lt;strong&gt;logical shift left&lt;/strong&gt;, effectively multiplying r1 by 4 &amp;#8212; the size of the array elements.&lt;/p&gt;
&lt;p&gt;(GCC puts &lt;strong&gt;asl&lt;/strong&gt; here. Presumably identical to logical shift left, but there&amp;#8217;s no mention of &lt;strong&gt;asl&lt;/strong&gt; in the Architecture Reference Manual. &lt;strong&gt;Update:&lt;/strong&gt; ASL is referenced in the list of errors &lt;a href=&quot;http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0496c/CACHCBBJ.html&quot;&gt;here&lt;/a&gt; as an obsolete name for LSL)&lt;/p&gt;
&lt;p&gt;Two source registers and a shift is still shy of IA32&amp;#8242;s support for an calculating an address from a base address, two registers and a multiply.&lt;/p&gt;
&lt;h3&gt;7. Indirect addressing&lt;/h3&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;asm&quot;&gt;    @movl $Int32&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;kw3&quot;&gt;eax&lt;/span&gt;
    @movl &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;kw3&quot;&gt;eax&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;kw3&quot;&gt;ebx&lt;/span&gt;
&amp;nbsp;
    movw r0&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; #&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;lower16&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;Int32
    movt r0&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; #&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;upper16&lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt;Int32
    ldr r1&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;r0&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;
&amp;nbsp;
    @movl $&lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;kw3&quot;&gt;eax&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
    &lt;span class=&quot;kw1&quot;&gt;mov&lt;/span&gt; r2&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;9&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;str&lt;/span&gt; r2&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#91;&lt;/span&gt;r0&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; #&lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#93;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;More of the same.&lt;/p&gt;
&lt;h2&gt;Concluding thoughts&lt;/h2&gt;
&lt;p&gt;In addition to the cases above, ARM has a number of other interesting addressing modes that I shall consider in more detail in the future &amp;#8212; logical operations, auto-{increment, decrement} and multiples. Combined with conditional execution, there are some very interesting possibilities.&lt;/p&gt;
&lt;h3&gt;Other assembly primer notes are linked &lt;a href=&quot;http://brnz.org/hbr/?page_id=737&quot;&gt;here&lt;/a&gt;.&lt;a href=&quot;http://brnz.org/../?page_id=737&quot;&gt;&lt;br /&gt;
&lt;/a&gt;&lt;/h3&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Assembly Primer Part 4 — Hello World — ARM</title>
		<link href="http://brnz.org/hbr/?p=955"/>
		<id>http://brnz.org/hbr/?p=955</id>
		<updated>2011-02-14T05:49:20+00:00</updated>
		<content type="html">&lt;p&gt;On to &lt;a href=&quot;http://www.securitytube.net/Assembly-Primer-for-Hackers-(Part-4)-Hello-World-video.aspx&quot;&gt;Assembly Primer &amp;#8212; Part 4&lt;/a&gt;. This is where we start writing a small assembly program for the platform. In this case, I don&amp;#8217;t know the language and I don&amp;#8217;t know the ABI. Learning these from scratch ranges from interesting to tedious :)&lt;/p&gt;
&lt;p&gt;Regarding the language (available instructions, mnemonics and assembly syntax): I&amp;#8217;m using the &lt;a href=&quot;http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0406b/index.html&quot;&gt;ARM Architecture Reference Manual&lt;/a&gt; as my reference for the architecture (odd, I know). It&amp;#8217;s very long and the documentation for each instruction is extensive &amp;#8212; which is good because there are a lot of instructions, and many of them do a lot of things at once.&lt;/p&gt;
&lt;p&gt;Regarding the ABI (particularly things like argument passing, return values and system calls): there&amp;#8217;s the &lt;a href=&quot;http://www.google.com/url?sa=t&amp;source=web&amp;cd=1&amp;ved=0CBIQFjAA&amp;url=http%3A%2F%2Finfocenter.arm.com%2Fhelp%2Ftopic%2Fcom.arm.doc.ihi0042d%2FIHI0042D_aapcs.pdf&amp;ei=HbxYTafHCIXCvgPUkun2BA&amp;usg=AFQjCNGR3tBewfkIff4HMlI6mz2s_d4CsA&quot;&gt;Procedure Call Standard for the ARM Architecture&lt;/a&gt;, and there are a few other references I&amp;#8217;ve found, such as the &lt;a href=&quot;http://wiki.debian.org/ArmEabiPort&quot;&gt;Debian ARM EABI Port wiki page&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&amp;#8220;EABI is the new &amp;#8220;Embedded&amp;#8221; ABI by &lt;a href=&quot;http://www.arm.com/&quot;&gt;ARM ltd&lt;/a&gt;. EABI is actually a family of ABI&amp;#8217;s and one of the &amp;#8220;subABIs&amp;#8221; is GNU EABI, for Linux.&amp;#8221;&lt;/p&gt;
&lt;p&gt;- from Debian ARM EABI Port&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2&gt;System Calls&lt;/h2&gt;
&lt;p&gt;To perform a system call using the GNU EABI:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;put the system call number in r7&lt;/li&gt;
&lt;li&gt;put the arguments in r0-r6 (64bit arguments must be aligned to an even numbered register i.e. in r0+r1, r2+r3, or r4+r5)&lt;/li&gt;
&lt;li&gt;issue the &lt;strong&gt;Supervisor Call&lt;/strong&gt; instruction with a zero operand &amp;#8212; &lt;strong&gt;svc #0&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;(&lt;strong&gt;Supervisor Call&lt;/strong&gt; was previously named &lt;strong&gt;Software Interrupt&lt;/strong&gt; &amp;#8212; &lt;strong&gt;swi&lt;/strong&gt;)&lt;/p&gt;
&lt;h2&gt;Just Exit&lt;/h2&gt;
&lt;p&gt;Based on the above, it&amp;#8217;s not difficult to reimplement &lt;strong&gt;JustExit.s &lt;/strong&gt;(&lt;a href=&quot;http://code.securitytube.net/JustExit.s&quot;&gt;original&lt;/a&gt;) for ARM.&lt;/p&gt;
&lt;pre lang=&quot;asm&quot;&gt;.text

.globl _start

_start:
        mov r7, #1
        mov r0, #0
        svc #0
&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;mov&lt;/strong&gt; here is &lt;strong&gt;Move (Immediate)&lt;/strong&gt; which puts the &lt;strong&gt;#&lt;/strong&gt;-prefixed literal into the named register.&lt;/p&gt;
&lt;h2&gt;Hello World&lt;/h2&gt;
&lt;p&gt;Likewise, the conversion of &lt;strong&gt;HelloWorldProgram.s&lt;/strong&gt; (&lt;a href=&quot;http://code.securitytube.net/HelloWorldProgram.s&quot;&gt;original&lt;/a&gt;) is not difficult:&lt;/p&gt;
&lt;pre lang=&quot;asm&quot;&gt;.data 

HelloWorldString:
      .ascii &quot;Hello World\n&quot;

.text 

.globl _start 

_start:
      # Load all the arguments for write () 

      mov r7, #4
      mov r0, #1
      ldr r1,=HelloWorldString
      mov r2, #12
      svc #0

      # Need to exit the program 

      mov r7, #1
      mov r0, #0
      svc #0
&lt;/pre&gt;
&lt;p&gt;This includes the &lt;strong&gt;load register&lt;/strong&gt; pseudo-instruction, &lt;strong&gt;ldr&lt;/strong&gt; &amp;#8212; the compiler stores the address of &lt;strong&gt;HelloWorldString&lt;/strong&gt; into the literal pool, a portion of memory located in the program text, and the 32bit address is loaded from the literal pool (&lt;a href=&quot;http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.kui0100a/armasm_bgbbfgia.htm&quot;&gt;more details&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;When compiling a similar C program with &lt;strong&gt;-mcpu=cortex-a8&lt;/strong&gt;, I notice that the compiler generates &lt;strong&gt;Move (immediate)&lt;/strong&gt; and &lt;strong&gt;Move Top&lt;/strong&gt; &amp;#8212; &lt;strong&gt;movw&lt;/strong&gt; and &lt;strong&gt;movt&lt;/strong&gt; &amp;#8212; instructions to load the address directly from the instruction stream, which is presumably more efficient on that architecture.&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Assembly Primer Parts 1, 2 and 3 — ARM</title>
		<link href="http://brnz.org/hbr/?p=932"/>
		<id>http://brnz.org/hbr/?p=932</id>
		<updated>2011-02-11T14:21:58+00:00</updated>
		<content type="html">&lt;p&gt;I had started a &lt;a href=&quot;http://brnz.org/hbr/?page_id=737&quot;&gt;series of posts on assembly programming&lt;/a&gt; for the Cell BE PPU and SPU, based on the &lt;a href=&quot;http://tools.securitytube.net/index.php?title=Open_Security_Training&quot;&gt;assembly primer video series from securitytube.net&lt;/a&gt;. I have recently acquired a Nokia N900, and so thought I might take the opportunity to continue the series with a look at the ARM processor as well.&lt;/p&gt;
&lt;p&gt;Wikipedia lists the N900&amp;#8242;s processor as a Texas Instruments OMAP3430,	600MHz 	ARMv7 Cortex-A8. I&amp;#8217;m not at all familiar with the processor family, so I&amp;#8217;ll be attempting to find out what all of this means as I go :P&lt;/p&gt;
&lt;p&gt;I&amp;#8217;ve set up a cross compiler on my desktop machine using Gentoo&amp;#8217;s neat crossdev tool (built using &lt;strong&gt;crossdev -t arm-linux-gnueabi&lt;/strong&gt;). The toolchain builds a functional Hello, World!&lt;/p&gt;
&lt;p&gt;(I note that scratchbox appears to be the standard tool/environment used to build apps for Maemo &amp;#8212; I may take a closer look at that at a later date)&lt;/p&gt;
&lt;p&gt;I have whatever the latest public &amp;#8216;stable&amp;#8217; Maemo 5 release is on the N900 (PR 1.3, I think),  with an &lt;strong&gt;apt-get install&lt;/strong&gt; &lt;strong&gt;openssh&lt;/strong&gt; &lt;strong&gt;gdb&lt;/strong&gt; &amp;#8212; thus far, enough to &amp;#8220;debug&amp;#8221; a functional Hello, World!&lt;/p&gt;
&lt;p&gt;What follows are some details of the Cortex-A8 architecture present in the N900, particularly in how it differs from IA32, as presented in the videos &lt;a href=&quot;http://www.securitytube.net/Assembly-Primer-for-Hackers-%28Part-1%29-System-Organization-video.aspx&quot;&gt;Part 1 &amp;#8212; System Organisation&lt;/a&gt;, &lt;a href=&quot;http://www.securitytube.net/Assembly-Primer-for-Hackers-%28Part-2%29-Virtual-Memory-Organization-video.aspx&quot;&gt;Part 2 &amp;#8212; Virtual Memory Organization&lt;/a&gt; and &lt;a href=&quot;http://www.securitytube.net/Assembly-Primer-for-Hackers-%28Part-3%29-GDB-Usage-Primer-video.aspx&quot;&gt;Part 3 &amp;#8212; GDB Usage Primer&lt;/a&gt;. I&amp;#8217;ve packed them all into this post because gdb usage and Linux system usage are largely the same on ARM as they are on PPC and IA32.&lt;/p&gt;
&lt;p&gt;Most of the following information comes from the &lt;a href=&quot;http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0406b/index.html&quot;&gt;ARM Architecture Reference Manual&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;(The number of possible configurations of ARM hardware makes it interesting at times to work out exactly which features are present in my particular processor. From what I can tell, the N900&amp;#8242;s Cortex-A8 is ARMv7-A and includes VFPv3 half, single and double precision float support, and NEON (aka Advanced SIMD). I expect I&amp;#8217;ll find out more when I actually start to try and program the thing. As to which gcc -march, -mcpu or -mfpu options are most correct for the N900 &amp;#8212; I have no idea.)&lt;/p&gt;
&lt;h2&gt;1. Registers&lt;/h2&gt;
&lt;h3&gt;Integer&lt;/h3&gt;
&lt;p&gt;There are sixteen 32bit ARM core registers, R0 to R15, where R0&amp;#8211;R12 are for general use. R13 contains the stack pointer (SP), R14 is the link register (LR), and R15 is the program counter (PC).&lt;/p&gt;
&lt;p&gt;The current program status register (CSPR) contains various status and control bits.&lt;/p&gt;
&lt;h3&gt;VFPv3 (Floating point) &amp;amp; NEON (Advanced SIMD)&lt;/h3&gt;
&lt;p&gt;There are thrirty two doubleword (64bit) registers, that can be referenced in a number of ways.&lt;/p&gt;
&lt;p&gt;NEON instructions can access these as thirty two doubleword registers (D0&amp;#8211;D31) or as sixteen quadword registers (Q0&amp;#8211;Q15), able to be used interchangeably.&lt;/p&gt;
&lt;p&gt;VFP instructions can view the same registers as 32 doubleword registers (again, D0&amp;#8211;D31) or as 32 single word registers (S0&amp;#8211;S31). The single word view is packed into the first 16 doubleword registers.&lt;/p&gt;
&lt;p&gt;Something like this pic (click to embiggen):&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://brnz.org/hbr/wp-content/uploads/2011/02/ARMv7_VFPv3_NEON_extension_registers.png&quot;&gt;&lt;img class=&quot;size-large wp-image-935 aligncenter&quot; title=&quot;ARMv7_VFPv3_NEON_extension_registers&quot; src=&quot;http://brnz.org/hbr/wp-content/uploads/2011/02/ARMv7_VFPv3_NEON_extension_registers-540x89.png&quot; alt=&quot;&quot; width=&quot;540&quot; height=&quot;89&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;VFP in this core (apparently) supports single and double precision floating point data types and arithmetic, as well as half precision (possibly in two different formats&amp;#8230;).&lt;/p&gt;
&lt;p&gt;NEON instructions support accessing values in extension registers as&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;8, 16, 32 or 64bit integer, signed or unsigned,&lt;/li&gt;
&lt;li&gt;16 or 32bit floating point values, and&lt;/li&gt;
&lt;li&gt;8 or 16bit polynomial values.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There&amp;#8217;s also a floating point status and control register (FPSCR).&lt;/p&gt;
&lt;h2&gt;2. Virtual Memory Organisation&lt;/h2&gt;
&lt;p&gt;On this platform, program text appears to be loaded at &lt;strong&gt;0x8000&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;After an &lt;strong&gt;echo 0 &amp;gt; /proc/sys/kernel/randomize_va_space&lt;/strong&gt;, the top of the stack appears to be &lt;strong&gt;0xbf000000&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;3. SimpleDemo&lt;/h2&gt;
&lt;p&gt;Compared to the video, there are only a couple of small differences when running SimpleDemo in gdb on ARM.&lt;/p&gt;
&lt;p&gt;Obviously, the disassembly is not the same as for IA32. Rather than the &lt;strong&gt;call&lt;/strong&gt; instructions noted in the video, you&amp;#8217;ll see &lt;strong&gt;bl&lt;/strong&gt; (Branch with Link) for the various functions called.&lt;/p&gt;
&lt;p&gt;Where the return address is stored on the stack for IA32, the link register (&lt;strong&gt;lr&lt;/strong&gt; in &lt;strong&gt;info registers&lt;/strong&gt; output) stores the return address for the current function, although &lt;strong&gt;lr&lt;/strong&gt; will be pushed to the stack before another function is called.&lt;/p&gt;
&lt;p&gt;(From a cursory googling, it seems that to correctly displaying all VFP/NEON registers requires gdb-7.2 &amp;#8212; I&amp;#8217;m running the 6.8-based build from the maemo repo. crossdev will build me a gdb I can run on my desktop PC &amp;#8212; &lt;strong&gt;crossdev -t arm-linux-gnueabi &amp;#8211;ex-gdb&lt;/strong&gt; &amp;#8212; but I believe I still need to build a newer &lt;strong&gt;gdbserver&lt;/strong&gt; to run on the N900.)&lt;/p&gt;
&lt;h3&gt;Other assembly primer notes are linked &lt;a href=&quot;http://brnz.org/?page_id=737&quot;&gt;here&lt;/a&gt;.&lt;a href=&quot;http://brnz.org/?page_id=737&quot;&gt;&lt;br /&gt;
&lt;/a&gt;&lt;/h3&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;&lt;!-- p { margin-bottom: 0.21cm; } --&gt;&lt;/div&gt;
&lt;p class=&quot;western&quot;&gt;&lt;strong&gt;&lt;span&gt;&lt;span&gt;Proposed updates for praypal.org.au					   2011/02/11&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">On resolutions and the keeping of them</title>
		<link href="http://feedproxy.google.com/~r/krumpit/~3/anhrdKqBysc/"/>
		<id>http://www.krumpit.org/2011/01/on-resolutions-and-the-keeping-of-them/</id>
		<updated>2011-01-25T11:01:47+00:00</updated>
		<content type="html">&lt;p&gt;January is almost over and it seems perhaps a little late to talk about resolutions for the New Year. Before last year, I was always quite sceptical about New Year&amp;#8217;s resolutions. They seemed a &amp;#8220;set and forget&amp;#8221; kind of thing. People would make them, but the required change to underlying habits always seemed too hard.&lt;/p&gt;
&lt;p&gt;But last year I did something slightly different. A friend had mentioned the idea of setting &amp;#8220;half-year resolutions&amp;#8221;&amp;#8230; and this sounded pretty good to me, as there were two areas I wanted to concentrate on: drawing and writing. I&amp;#8217;ll save a review of those for later, but, in summary, I set out last year to work on those and I&amp;#8217;m pretty pleased with what I managed to achieve.&lt;/p&gt;
&lt;p&gt;So basically, I&amp;#8217;m very much in the &amp;#8220;yay resolutions&amp;#8221; camp now. I think resolutions and goals help you review your priorities, re-focus, re-balance and challenge yourself, and generally achieve more in life.&lt;/p&gt;
&lt;h2&gt;Get in line, please&lt;/h2&gt;
&lt;p&gt;Looking back, I think being able to concentrate on one at a time was crucial to the success, given that the scope of my resolutions was so similar—both were creative endeavours, requiring a chunk of uninterrupted time for creative focus and fighting for the same evening and weekend timeslots. When you&amp;#8217;re picking your goals, I think it&amp;#8217;s important to be aware of clashes for your time.&lt;/p&gt;
&lt;h2&gt;Countability and Accountability&lt;/h2&gt;
&lt;p&gt;I also think more concrete resolutions (such as &amp;#8220;draw for one hour each week&amp;#8221;) would have helped me reach higher goals. One great thing about countable goals is that you can track your progress. Tracking your goals gives you immediate feedback, reminds and motivates you if you&amp;#8217;re lagging, and gives you a sense of achievement. My progress graph for &lt;a href=&quot;http://www.nanowrimo.org/&quot;&gt;NaNoWriMo&lt;/a&gt; kept me obsessively checking and updating my progress, and pushing for those last few words to meet my daily target.&lt;/p&gt;
&lt;p&gt;As a more relevant, admirable and inspiring example, &lt;a href=&quot;http://twitter.com/#!/m_fitzpatrick&quot;&gt;@m_fitzpatrick&lt;/a&gt; set himself some very clear and (ac)countable goals for the year and has been tracking his progress on his blog, &lt;a href=&quot;http://www.thisgeeksgoals.com/&quot;&gt;This Geek&amp;#8217;s Goals&lt;/a&gt;. If only there was a website for everyone to do this kind of thing—I assume there isn&amp;#8217;t? Someone really needs to get onto that!&lt;/p&gt;
&lt;p&gt;Tracking your goals in a public space and talking about them to other people also seems to help. If your friends and family aren&amp;#8217;t interested, perhaps you can find a group of like-minded people online. The &lt;a href=&quot;http://saucyforums.arleenbarros.com&quot;&gt;Saucy Wenches Forums&lt;/a&gt; gang has been a great motivation for my writing, and &lt;a href=&quot;http://www.deviantart.com/&quot;&gt;DeviantArt&lt;/a&gt; has served as a pretty good source of inspiration.&lt;/p&gt;
&lt;h2&gt;Getting Serious&lt;/h2&gt;
&lt;p&gt;I think one of the more important things I&amp;#8217;ve realised is that, if you really want to get serious about meeting your goals, then you need to change your day-to-day habits. And that this is a bigger hurdle than actually fulfilling the new goal. (The habit is the process, the goal is the outcome?)&lt;/p&gt;
&lt;p&gt;I think people&amp;#8217;s habits evolve over the years towards an optimum balance of time for each activity according to their priorities. If you take an extra hour out of the day to fit in (or emphasise) an activity, everything else has to shuffle around. Something is going to lose out, so you need to look at your habits and decide what you can change. Do you need to watch TV for two hours every night? Maybe you do, maybe it&amp;#8217;s your bonding time with your partner, or maybe it&amp;#8217;s your relaxation time. But it is worth analysing yourself a little—for instance, maybe your new hobby will also be relaxing, so that time isn&amp;#8217;t as crucial as you thought.&lt;/p&gt;
&lt;p&gt;If you can&amp;#8217;t change anything, then maybe the goal just isn&amp;#8217;t possible and you need to decide to downgrade or postpone. Or maybe you need to up the stakes, to make it a higher priority than another activity. (Why do you want to achieve this goal? What happens if you don&amp;#8217;t? Write that down in your copy book now.)&lt;/p&gt;
&lt;p&gt;Even if the goal isn&amp;#8217;t practical this year, you could set yourself a meta-goal with the aim of setting you up for the next year—for example, if you want to take art classes but don&amp;#8217;t have enough money for the fees, maybe you can aim to set aside enough money in time for next year. (As an aside, I wish real life had achievements and meta-achievements like in &lt;a href=&quot;http://www.worldofwarcraft.com/&quot;&gt;World of Warcraft&lt;/a&gt;, Xbox games and similar.)&lt;/p&gt;
&lt;p&gt;Last year, my new goals luckily coincided with a declining interest in World of Warcraft. Cancelling my account instantly freed up many evening and weekend hours. (Actually, maybe I&amp;#8217;m not giving myself enough credit there—I think my decline in interest was due my decision to prioritise other things.) But my priorities are more difficult to weigh up this year, as I don&amp;#8217;t have a big time-sink that I can push aside.&lt;/p&gt;
&lt;h2&gt;In Summary&lt;/h2&gt;
&lt;p&gt;These are what I&amp;#8217;m going to try and keep in mind when setting my goals this year:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;0. These aren&amp;#8217;t just new goals, they&amp;#8217;re new &lt;em&gt;habits&lt;/em&gt; to achieve these goals.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1. Specify my goals&lt;br /&gt;
&lt;/strong&gt;Make them as concrete as possible. Be realistic, but aim high.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2. Plan to keep the goals&lt;br /&gt;
&lt;/strong&gt; How much time do I need to set aside to make my goal happen? What do I need to give up? (And can I do it?) Look ahead for problems and plan how to avoid them.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3. Track my progress&lt;br /&gt;
&lt;/strong&gt; Find a way to track progress: a website or blog, an app, a diary, a calendar, so I can look at what you have achieved. (I found the &lt;a href=&quot;http://lifehacker.com/5684566/the-habits-calendar-is-seinfelds-productivity-secret-on-steroids&quot;&gt;Don&amp;#8217;t Break the Chain&lt;/a&gt; &lt;a href=&quot;http://gilesbowkett.blogspot.com/2010/02/calendar-win-rapid-course-correction.html&quot;&gt;method&lt;/a&gt; pretty interesting.)&lt;/p&gt;
&lt;p&gt;So, what do you do to achieve your goals? Please share!&lt;/p&gt;
&lt;p&gt;Edit: &lt;a href=&quot;http://www.daytum.com/&quot;&gt;Daytum&lt;/a&gt; (web/&lt;a href=&quot;http://www.daytum.com/about/iphone_app&quot;&gt;iOS&lt;/a&gt;) and &lt;a href=&quot;http://daytaapp.com/&quot;&gt;Dayta&lt;/a&gt; (iOS) look like they could be good options. Thanks &lt;a href=&quot;http://twitter.com/#!/jasedepuit&quot;&gt;@jasedepuit&lt;/a&gt;!&lt;/p&gt;
&lt;img src=&quot;http://feeds.feedburner.com/~r/krumpit/~4/anhrdKqBysc&quot; height=&quot;1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>krumpit</name>
			<uri>http://www.krumpit.org</uri>
		</author>
		<source>
			<title type="html">krumpit</title>
			<subtitle type="html">the blog of maz musings and ponderings.</subtitle>
			<link rel="self" href="http://www.krumpit.org/?feed=rss2"/>
			<id>http://www.krumpit.org/?feed=rss2</id>
			<updated>2012-01-01T17:00:16+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Diamond-Square — Randomness, continuity and animation</title>
		<link href="http://brnz.org/hbr/?p=843"/>
		<id>http://brnz.org/hbr/?p=843</id>
		<updated>2010-12-21T13:23:52+00:00</updated>
		<content type="html">&lt;p&gt;Randomness is nice, except when you have too much.&lt;/p&gt;
&lt;p&gt;It&amp;#8217;s easy to blast random pixels all over the screen, but it&amp;#8217;s much nicer when there&amp;#8217;s some continuity in the randomness.&lt;/p&gt;
&lt;p&gt;For diamond-square interpolation, I was looking for a way to generate (and use) random seed values to produce continuous-looking results within and between calculated tiles, as well as varying these seed values over time in a somewhat appealing fashion.&lt;img class=&quot;alignright size-full wp-image-889&quot; title=&quot;seeds&quot; src=&quot;http://brnz.org/hbr/wp-content/uploads/2010/12/seeds.png&quot; alt=&quot;&quot; width=&quot;131&quot; height=&quot;131&quot; /&gt;&lt;/p&gt;
&lt;p&gt;To calculate the values for a given tile requires the corner values of that tile along with the corner values of the eight surrounding tiles &amp;#8212; that is, all the blue pixels in the picture are needed to calculate the pixels required to calculate the pixels in the centre tile.&lt;/p&gt;
&lt;p&gt;The corner values from one tile effects the calculation of the tiles adjacent.  For this reason, the corner values of each tile are state that must remain constant for the entire frame.&lt;/p&gt;
&lt;p&gt;To render a full 1920x1080 frame, 15x9 tiles are required, with 16x10 corner values.  To calculate the tiles around the frame border, further un-rendered tile data is required to correctly seed each of these border tiles.  The result of this is that 18x12 random pixel values are needed to define the full set of tiles for a 1080p frame, which means the seeds for the tiles of a frame can be stored in 18x12x4 = 864 bytes.  Not unreasonable.&lt;/p&gt;
&lt;p&gt;When rendering each tile, these seed values are first placed in the appropriate 16 locations (taking into account the compressed outer regions), and the interpolation takes place.  (Interpolation is performed on the seed values and, later, using only values calculated during a previous iteration &amp;#8212; which means there&amp;#8217;s no requirement to zero memory between tiles)&lt;/p&gt;
&lt;p&gt;The result with just this looks quite reasonable (imho) &amp;#8212; there&amp;#8217;s decent interpolation of random values across the screen.  These random seed values can also be permuted without too much difficulty between frames &amp;#8212; I&amp;#8217;ve tried some trig-function based methods to give a sense of continuous, directional changes.  It works but I&amp;#8217;m sure there&amp;#8217;s better options.&lt;/p&gt;
&lt;p&gt;As for the random perturbing of interpolated values, I&amp;#8217;ve tried a few methods and not achieved anything that I&amp;#8217;ve been all that happy with.  The problem I&amp;#8217;ve had is finding/generating a suitably random value of appropriate scale, and applying it to the pixel value fast enough.&lt;/p&gt;
&lt;p&gt;(As I reach the end of this, I have the impression that what I&amp;#8217;ve put together is almost, but not entirely unlike, Perlin noise &amp;#8212;  you could possibly say that it has a &lt;em&gt;really&lt;/em&gt; clumsy interpolation function.  I have a much better understanding of Perlin noise than when I began, and it really looks like I should have tried that.  Learning is Good.)&lt;/p&gt;
&lt;p&gt;At some stage in the not too distant future, I hope to perform some screencaps and post some actual images and maybe even a video.  And fwiw I&amp;#8217;ll post the source code, too.&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Diamond-Square — DMA lists and dirty tricks</title>
		<link href="http://brnz.org/hbr/?p=850"/>
		<id>http://brnz.org/hbr/?p=850</id>
		<updated>2010-12-14T11:16:16+00:00</updated>
		<content type="html">&lt;h3&gt;There&amp;#8217;s a hole in my dataset, dear MFC, dear MFC&amp;#8230;&lt;/h3&gt;
&lt;p&gt;There&amp;#8217;s a block of local store that holds a tile of pixels that need to be DMAd  out to main memory.  128 lines makes performing many smaller transfers more complex , so we&amp;#8217;ll try DMA lists why not.  The problem here is that the pixel  data for each line does not match up directly with the next &amp;#8212; between  each is stored the extra lines of extra-tile information that was needed  for the calculation.  When using DMA lists to transfer data to many  memory, the source for each DMA transfer starts where the previous one  ended. This means that between each DMA there&amp;#8217;s (148-128)×4=80 bytes of information that we don&amp;#8217;t want to see on the screen.&lt;/p&gt;
&lt;p&gt;There&amp;#8217;s a lot of things that are &amp;#8220;best-practice&amp;#8221; for SPU DMA, particularly relating to size and alignment of transfers, and I&amp;#8217;m typically a religious adherent.  In this case, I did not comply with best practice and still met my time budget and only feel a small amount of shame :P&lt;/p&gt;
&lt;p&gt;Overall, less time is spent performing DMA than is spent calculating pixels, so further optimising DMA &lt;em&gt;for this particular program&lt;/em&gt; is unnecessary.&lt;/p&gt;
&lt;p&gt;When transferring tiles from the SPU to the framebuffer, there&amp;#8217;s three cases of particular interest:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Tiles on the right edge of the screen&lt;/li&gt;
&lt;li&gt;Tiles on the lower edge of the screen&lt;/li&gt;
&lt;li&gt;The Other Tiles&lt;/li&gt;
&lt;/ol&gt;
&lt;div id=&quot;attachment_852&quot; class=&quot;wp-caption alignright&quot;&gt;&lt;img class=&quot;size-full wp-image-852 &quot; title=&quot;3x3x5p&quot; src=&quot;http://brnz.org/hbr/wp-content/uploads/2010/12/3x3x5p.png&quot; alt=&quot;&quot; width=&quot;111&quot; height=&quot;111&quot; /&gt;&lt;p class=&quot;wp-caption-text&quot;&gt;Tile data in local store&lt;/p&gt;&lt;/div&gt;
&lt;h3&gt;3. The Other Tiles&lt;/h3&gt;
&lt;p&gt;These are the easy ones.  They will never need to be trimmed to fit the screen edges, and if drawn in the right order have the wonderful characteristic that the extra data needed can be DMAd to the framebuffer and will be overwritten by pixel data from a later tile.  There&amp;#8217;s no special case needed, just draw each pixel line and &amp;#8212; all data between pixel lines &amp;#8212; to the screen.&lt;/p&gt;
&lt;div id=&quot;attachment_851&quot; class=&quot;wp-caption alignright&quot;&gt;&lt;img class=&quot;size-full wp-image-851 &quot; title=&quot;3x3x5s&quot; src=&quot;http://brnz.org/hbr/wp-content/uploads/2010/12/3x3x5s.png&quot; alt=&quot;&quot; width=&quot;111&quot; height=&quot;41&quot; /&gt;&lt;p class=&quot;wp-caption-text&quot;&gt;Tile data drawn to screen&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;(For the diagrams, the amount of overdraw is far greater than the actual tile part &amp;#8212; this is a consequence of the small size.  It&amp;#8217;s a much smaller percentage for 128 pixel tiles.  I&amp;#8217;ll post some actual screengrabs here sometime&amp;#8230;)&lt;/p&gt;
&lt;h3&gt;1. Tiles on the right edge of the screen&lt;/h3&gt;
&lt;p&gt;Overdraw isn&amp;#8217;t the answer in this case. It is not possible to overdraw on either the left or right of the rightmost tile in a way that will be correct when the screen is finished.  Instead, the extra information (including any portion that may not fit onto the visible screen) must be dealt with some other way.&lt;/p&gt;
&lt;p&gt;My solution, ugly as it is, is to write each surplus portion of a tile to a scratch location in memory &amp;#8212; every one of them to the same location.  It works :|&lt;/p&gt;
&lt;h3&gt;2. Tiles on the lower edge of the screen&lt;/h3&gt;
&lt;p&gt;These tiles are really just like the others, except they&amp;#8217;ll stop a few lines short.  They&amp;#8217;re still fully calculated, but only the visible lines are transferred.&lt;/p&gt;
&lt;p&gt;(In hindsight, increasing the spacing between lines would help reduce the alignment and size problem here.  Adding an extra 48 bytes to each tile would allow every transfer to be optimally aligned and sized.  And would probably make no measurable difference to the total runtime.  Heck, there&amp;#8217;s probably enough time to repack the data in local store before performing the DMA. There&amp;#8217;s not that much&amp;#8230;)&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Diamond-Square — Tiled rendering and space</title>
		<link href="http://brnz.org/hbr/?p=842"/>
		<id>http://brnz.org/hbr/?p=842</id>
		<updated>2010-12-14T09:17:34+00:00</updated>
		<content type="html">&lt;p&gt;I started with the assumption of 128×128 pixel diamond-square tiles &amp;#8212; they&amp;#8217;re a power of two big (which makes them simpler to calculate), 512 bytes wide, 128 lines tall and 64KB in total size, which means two will fit in local store.&lt;/p&gt;
&lt;p&gt;So, questions: What points outside this area are required to calculate all the points within?  How much space is required to render one of these tiles?&lt;/p&gt;
&lt;p&gt;&lt;img class=&quot;alignright size-full wp-image-845&quot; title=&quot;3x3x5&quot; src=&quot;http://brnz.org/hbr/wp-content/uploads/2010/12/3x3x5.png&quot; alt=&quot;&quot; width=&quot;131&quot; height=&quot;131&quot; /&gt;(There&amp;#8217;s a smaller example pictured, again with a different colour for each iteration of the calculation)&lt;/p&gt;
&lt;p&gt;If the tile is to be 4×4, the centre area is 5×5 with overlap between tiles.  Additionally, to calculate a 4×4 tile, fully calculating a 7×7 area is required, not counting the sparsely calculated pixels around the outside.&lt;/p&gt;
&lt;p&gt;Scaling this up to 128×128 pixel tiles and it should be clear that at least 131×131 pixel area is required, not counting those extras around the outside.  How to deal with those?&lt;/p&gt;
&lt;p&gt;One thing that is clear is that they&amp;#8217;re sparsely filled, and that calculated values only appear on certain lines.  In fact, the number of lines required around the outside of a tile is (1+log&lt;sub&gt;2&lt;/sub&gt;&lt;em&gt;n&lt;/em&gt;) where &lt;em&gt;n&lt;/em&gt; is the tile width.  For the 4×4 tile pictured, three extra lines are needed on each side of the tile.  For a tile 128 lines across, 8 extra lines are needed.&lt;/p&gt;
&lt;p&gt;So all the values to calculate a given tile can be stored in in (129+8+8)×(129+8+8) = 145×145 pixels.  Rounding up to get quadword aligned storage gives a total of 148×145×4 bytes &amp;#8212; 85,840 &lt;img class=&quot;alignright size-full wp-image-875&quot; title=&quot;3x3x5p&quot; src=&quot;http://brnz.org/hbr/wp-content/uploads/2010/12/3x3x5p1.png&quot; alt=&quot;&quot; width=&quot;111&quot; height=&quot;111&quot; /&gt;bytes per tile.  171,680 bytes is a big chunk of local store, but it&amp;#8217;s probably better to be using it for &lt;em&gt;something&lt;/em&gt;&amp;#8230;&lt;/p&gt;
&lt;p&gt;Based on that, it&amp;#8217;s not particularly difficult to generate the data for a tile.  Start the tile with its starting values (more on those in another post) in the corners of the squares (the blue ones in the picture), and then calculate the remaining points.  There&amp;#8217;s some special cases required for each of the sides, but it&amp;#8217;s nothing particularly tricky, just keeping track of row/column indexes for particular iterations.&lt;/p&gt;
&lt;p&gt;The outer points make up only a very small percentage of the total points that need to be calculated &amp;#8212; more than 50% of the points are calculated in the last diamond and square iterations, and due to the proximity and alignment of the points accessed, their calculation can be usefully optimised.  (I might write a post about that sometime&amp;#8230;)&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Diamond-Square — Data dependency and SPU</title>
		<link href="http://brnz.org/hbr/?p=832"/>
		<id>http://brnz.org/hbr/?p=832</id>
		<updated>2010-12-13T20:54:19+00:00</updated>
		<content type="html">&lt;p&gt;To work out a suitable way to divide a 1080p screen into pieces that a SPU could work effectively with for the diamond-square problem took some trial and error.  First, some fundamentals.&lt;/p&gt;
&lt;h3&gt;DMA&lt;/h3&gt;
&lt;p&gt;The SPU interacts with the framebuffer through the use of DMA operations, which have the following characteristics:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;larger transfers are more efficient than smaller ones&lt;/li&gt;
&lt;li&gt;there are alignment constraints&lt;/li&gt;
&lt;li&gt;there can be a tradeoff between performing several small transfers to cope with DMA size/alignment constraints, and fetching a larger aligned area, modifying it and writing it back&lt;/li&gt;
&lt;li&gt;modifying a region of memory requires a DMA get and put operation &amp;#8212; extra work, complexity (buffer management and time)&lt;/li&gt;
&lt;li&gt;a single SPU can have a maximum of 16 transfers in-flight at a given time, and will block if any more are issued&lt;/li&gt;
&lt;li&gt;DMA lists can be used to effectively issue more than 16 transfers at a time, but there are greater restrictions on the placement of data in local store&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Data relationships&lt;/h3&gt;
&lt;p&gt;To calculate each point in diamond-square required the values from four others.&lt;/p&gt;
&lt;p&gt;When calculating the centre point of a square, the four corners are located on two different lines and the centre point is written to the centre line between those two.  (Reading from two lines, writing to one)&lt;/p&gt;
&lt;p&gt;When calculating the centre point of a diamond, the four corners are located on three different input lines and the centre point is located on the same centre line as two of the points (Reading from three lines, writing to one of those)&lt;/p&gt;
&lt;p&gt;For a given iteration of diamond-square, all input data has been generated in a previous iteration &amp;#8212; that is, no point depends on another point calculated in the same iteration of the algorithm.  This gives some flexibility as to the ordering of point calculation.&lt;/p&gt;
&lt;h2&gt;First attempt &amp;#8212; whole lines&lt;/h2&gt;
&lt;p&gt;My first thought was to optimise for DMA throughput: large transfers are much more efficient than smaller ones, and the independence of points in a single iteration means that points can be calculated on a line by line basis.  Pseudo this:&lt;/p&gt;
&lt;pre&gt;square(line_number, square_size)
    top = dma_get(line_number)
    centre = dma_get(line_number + square_size/2)
    bottom = dma_get(line_number + square_size)
    for(i = 0; i &amp;lt; line_length; ++i)
        calculate_square_centre_value(top, centre, bottom, i, square_size)
    dma_put(centre)
&lt;/pre&gt;
&lt;p&gt;Whole lines are fetched, which is reasonably efficient (1920×4 bytes = 7680, 7680%128 = 0, so it&amp;#8217;s a fine size for efficient DMA), and there&amp;#8217;s plenty of scope for optimisation:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;lines may be prefetched&lt;/li&gt;
&lt;li&gt;lines may be reused between iterations: the bottom line for one row of squares is the top line of the next.  For diamonds, two lines are reused from one row to the next&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I spent quite a bit of time on this approach, to try and get it working to my satisfaction, but in the end I discarded it.  The problem for me became one of complexity &amp;#8212; the prefetches, special cases (sides, corners) and line reuse were all written and applied for the general-case implementation (i.e. parameterised by square_size like the pseudo code above). This made it extraordinarily cumbersome to write optimised cases for the smallest square sizes &amp;#8212; where most of the pixels are calculated and thus most runtime is spent.&lt;/p&gt;
&lt;p&gt;In summary, I was optimising the wrong things.&lt;/p&gt;
&lt;p&gt;There were also aspects of the implementation that I had not fully considered with this method, and failed to make progress with, particularly proper handling of the side and corner special cases, and animation.&lt;/p&gt;
&lt;p&gt;(In hindsight, I suspect I could have simplified this approach, solved the other problems and met the time budget &amp;#8212; but probably only knowing what I know from my next attempt.)&lt;/p&gt;
&lt;h2&gt;Second attempt &amp;#8212; tiles &amp;#8212; problems&lt;/h2&gt;
&lt;p&gt;Tiling was an approach I had considered and discarded early on.  Where whole lines are a clear win for DMA efficiency, tiles are much less so &amp;#8212; the largest square tiles I could envision were 128×128 pixels, being 64KB (twice for a double buffered implementation), and the 512B line length is not a great performer.  Additionally, the limit on the number of in-flight DMA transfers makes this method seem more risky &amp;#8212; writing 128 lines per tile requires writing lines as the calculation of each is completed and hoping that computation is slower than DMA, which is probable but not assured.&lt;/p&gt;
&lt;p&gt;DMA lists are promising &amp;#8212; except that diamond-square requires 2&lt;sup&gt;n&lt;/sup&gt;+1 pixel squares, so it&amp;#8217;s actually a 129×129 pixel tile (for calculation), and DMA lists still need to transfer those little extra inner parts between transfers.&lt;/p&gt;
&lt;p&gt;On top of that, recall that diamond-square requires a large number of points from outside a tile to be calculated to be able to complete the points within a tile &amp;#8212; if stored sparsely, 8 times as much space as for the target tile.&lt;/p&gt;
&lt;p&gt;So I didn&amp;#8217;t start with this idea, but after discarding the previous approach I was able to work out ways around these problems and implement a basic and functional implementation in the time I spent flying and waiting in airports on my way home from GCAP.  I&amp;#8217;ll expand on the implementation in a later post.&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Diamond-Square — What can you do in 25 cycles?</title>
		<link href="http://brnz.org/hbr/?p=814"/>
		<id>http://brnz.org/hbr/?p=814</id>
		<updated>2010-12-13T13:07:30+00:00</updated>
		<content type="html">&lt;p&gt;or &amp;#8220;How I got 1080p 60Hz diamond-square plasma from a single SPU&amp;#8221;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;I am primarily writing this &amp;#8212; and subsequent posts &amp;#8212; as a record and exercise for myself, and in case there&amp;#8217;s anyone who attended the &lt;a href=&quot;http://www.tucs.org.au&quot;&gt;TUCS&lt;/a&gt; talk I gave in October that is still interested in the problem and my solution.&lt;br /&gt;
&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I started with a simple (naive) equation:&lt;br /&gt;
3.192×10&lt;sup&gt;9&lt;/sup&gt; cycles / (1920×1080 pixels × 60 frames per second) = 25.66 cycles per pixel&lt;/p&gt;
&lt;p&gt;That is, to update a 1080p screen at 60Hz, there&amp;#8217;s an upper limit of 25 cycles per pixel.&lt;/p&gt;
&lt;p&gt;So, what can you do in 25 cycles?&lt;/p&gt;
&lt;p&gt;Starting with the simple and obvious: On an SPU, writing to local store takes 6 cycles &amp;#8212; that&amp;#8217;s a quarter of the time budget gone, right there.  DMAing that pixel to the framebuffer in system memory will take hundreds of cycles.  Approaching this problem one pixel at a time is clearly not the way to solve it.&lt;/p&gt;
&lt;p&gt;Slightly less simple: A write to local store will be six cycles, and it can be pipelined to give four pixels per cycle.  A single SPU can do DMA at over 16GB/sec.  This should be easy &amp;#8212; and it is if all you want to do is write stuff to memory.  Throw in some computation and data dependencies and things get a lot more interesting.&lt;/p&gt;
&lt;p&gt;So, I chose a problem that is one of my old favorites from Amiga demo days &amp;#8212; plasma.  There&amp;#8217;s a number of ways you can achieve the effect. I chose diamond-square interpolation, which turned out to have some interesting problems to implement for SPU&lt;sup&gt;1&lt;/sup&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img class=&quot;alignright size-full wp-image-819&quot; title=&quot;ds&quot; src=&quot;http://brnz.org/hbr/wp-content/uploads/2010/12/ds.png&quot; alt=&quot;&quot; width=&quot;150&quot; height=&quot;812&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;The Diamond-Square Algorithm&lt;/h2&gt;
&lt;p&gt;The images here show the process of interpolation used for diamond-square (in these diagrams, each interpolation iteration is displayed with a different colour, not the expected calculated colour):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Starting with one or more squares, average the corners (with a random perturbation) of the square to calculate the centre point&lt;/li&gt;
&lt;li&gt;For the diamonds then created, average the corner points (again, with a random perturbation) to calculate their centres&lt;/li&gt;
&lt;li&gt;Later, rinse, repeat until all the gaps are filled.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Seems simple enough, but there&amp;#8217;s some complexity in the implementation.&lt;/p&gt;
&lt;h3&gt;Data points and space requirements&lt;/h3&gt;
&lt;p&gt;For a 9×9 starting grid with 9 points defined, only the innermost 3×3 square is fully filled in.  The remaining un-coloured (white) points cannot be calculated without having more starting values available (or using some other special case method to appropriately generate the missing information).&lt;/p&gt;
&lt;p&gt;Additionally, it can be seen that generate a 3×3 completed pixel region requires the full 9×9 are to start with.  Not particularly space efficient.&lt;/p&gt;
&lt;h3&gt;Data dependency&lt;/h3&gt;
&lt;p&gt;To calculate a point requires the points around it to be fully calculated, and each of those requires the four surrounding it.  This also has consequences when considering how to divide the problem when trying to calculate a large bitmap using a single SPU and its 256KB local store.&lt;/p&gt;
&lt;h3&gt;Animation&lt;/h3&gt;
&lt;p&gt;Producing the same image 60 times a second is not very interesting, so there should be some way to cause it to change over time, in some continuous fashion, where each frame relates to the last in a visually pleasing fashion.  Doing this in practice becomes a question of where the source &amp;#8220;random&amp;#8221; values come from, and how they can be varied over time.  Additionally, the use and generation of source values relates to how the output space is divided.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;ve written previously about some of the issues I encountered when writing this (&lt;a href=&quot;http://brnz.org/hbr/?p=541&quot;&gt;fast averaging&lt;/a&gt;, &lt;a href=&quot;http://brnz.org/hbr/?p=521&quot;&gt;system calls&lt;/a&gt;, &lt;a href=&quot;http://brnz.org/hbr/?p=550&quot;&gt;poorly performing first frame&lt;/a&gt;), and I intend to write about the three areas mentioned above (space requirements, data dependency and animation).&lt;/p&gt;
&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt;Additionally, there&amp;#8217;s better ways to create the plasma effect. I did it all again, I&amp;#8217;d start with Perlin noise, which appears to still have some interesting challenges but is overall better suited to the hardware.&lt;/p&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/div&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Assembly Primer Part 7 — Working with Strings — SPU</title>
		<link href="http://brnz.org/hbr/?p=793"/>
		<id>http://brnz.org/hbr/?p=793</id>
		<updated>2010-12-03T04:13:05+00:00</updated>
		<content type="html">&lt;p&gt;These are my notes for where I can see SPU varying from ia32, as presented in the video &lt;a href=&quot;http://securitytube.net/Assembly-Primer-for-Hackers-%28Part-7%29-Working-with-Strings-video.aspx&quot;&gt;Part 7 — Working with Strings&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The ia32 instructions covered in this video (MOVSx, LODSx, STOSx, CMPSx, CLD, STD) clearly highlight many of the differences between that arch and SPU:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Implied operand registers e.g. MOVSx using %esi and %edi as source and destination addresses.&lt;/li&gt;
&lt;li&gt;Side effects on operands e.g. incrementing addresses while performing reads/writes&lt;/li&gt;
&lt;li&gt;Side effects in the FLAGS register e.g. direction flag, zero flag&lt;/li&gt;
&lt;li&gt;Support for any alignment of data.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I&amp;#8217;ve made less effort to re-implement the full functionality of the ia32 instructions for this part.  There&amp;#8217;s a couple of cases that might be interesting to attempt to do so, but a fully general case can probably just be lifted from &lt;a href=&quot;http://sourceware.org/cgi-bin/cvsweb.cgi/src/newlib/libc/machine/spu/memcpy.c?rev=1.4&amp;content-type=text/x-cvsweb-markup&amp;cvsroot=src&quot;&gt;newlib&amp;#8217;s memcpy() implementation for SPU&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Again,  &lt;a href=&quot;http://brnz.org/cell/doku.php?id=spuinstructions&quot;&gt;this is the quick SPU instruction reference I use&lt;/a&gt;, and I still regularly refer to the &lt;a href=&quot;https://www-01.ibm.com/chips/techlib/techlib.nsf/techdocs/76CA6C7304210F3987257060006F2C44&quot;&gt;SPU ISA doc&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Working with Strings&lt;/h2&gt;
&lt;p&gt;Starting with &lt;a href=&quot;http://code.securitytube.net/StringBasics.s&quot;&gt;StringBasics.s&lt;/a&gt;, firth there&amp;#8217;s some storage:&lt;/p&gt;
&lt;pre&gt; 1 .data
 2     .align 4
 3     HelloWorldString:
 4         .asciz &quot;Hello World of Assembly!&quot;
 5     .align 4
 6     H3110:
 7         .asciz &quot;H3110&quot;
 8     .align 4
 9     shuf_AABABCDghijklmnop:
 10         .int 0x00000100,0x01020317,0x18191a1b,0x1c1d1e1f
 11 #.bss
 12     .comm Destination, 100, 16
 13     .comm DestinationUsingRep, 100, 16
 14     .comm DestinationUsingStos, 100, 16
&lt;/pre&gt;
&lt;p&gt;Notable changes from the original:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Added .align 4 before each label to provide 16 byte alignment&lt;/li&gt;
&lt;li&gt;There&amp;#8217;s a shuffle pattern added that I&amp;#8217;ll write more about later&lt;/li&gt;
&lt;li&gt;.bss is commented out because spu-as doesn&amp;#8217;t like it (I&amp;#8217;m still not clear on why this is the case)&lt;/li&gt;
&lt;li&gt;spu-as doesn&amp;#8217;t support alignment for .lcomm but does for .comm (why?), so .lcomm has been replaced with .comm and the trailing &amp;#8220;, 16&amp;#8243; added to each case to provide 16 byte alignment.&lt;br /&gt;
(learned: .align doesn&amp;#8217;t have an effect on .comm/.lcomm, and .comm&amp;#8217;s alignment isn&amp;#8217;t power of 2, à la .align &amp;#8212; there&amp;#8217;s nothing hard about assembly programming, really :\)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;1. Simple copying using movsb, movsw, movsl&lt;/h3&gt;
&lt;pre&gt; 26         #movl $HelloWorldString, %esi
 27         #movl $Destination, %edi
 28
 29         ila $5,HelloWorldString
 30         ila $6,Destination
 31
 32         #reverse order of instructions to avoid even sillier alignment hassle
 33         #movsw
 34         lqd $7,0($5)
 35         lqd $8,0($6)
 36         rotqby $10,$7,$9
 37         cwd $11,0($6)
 38         shufb $12,$10,$8,$11
 39         stqd $12,0($6)
 40         ai $5,$5,4
 41         ai $6,$6,4
 42
 43         #movsl
 44         lqd $7,0($5)
 45         lqd $8,0($6)
 46         ai $9,$5,-2     # rotate needed to get val into pref slot
 47         rotqby $10,$7,$9
 48         chd $11,0($6)
 49         shufb $12,$10,$8,$11 # shuffle byte into dest
 50         stqd $12,0($6)
 51         ai $5,$5,2
 52         ai $6,$6,2
 53
 54         #movsb
 55         lqd $7,0($5)
 56         lqd $8,0($6)
 57         ai $9,$5,-3     # rotate needed to get val into pref slot
 58         rotqby $10,$7,$9
 59         cbd $11,0($6)
 60         shufb $12,$10,$8,$11 # shuffle byte into dest
 61         stqd $12,0($6)
 62         ai $5,$5,1
 63         ai $6,$6,1
&lt;/pre&gt;
&lt;p&gt;Of the examples in this part, this is my biggest attempt at a &amp;#8220;complete&amp;#8221; implementation of the ia32 instructions, and even then it&amp;#8217;s built on the assumption of natural alignment (of words and halfwords) not present in the ia32 code.  Lots of effort to achieve some simple tasks.&lt;/p&gt;
&lt;p&gt;Making the extra assumption that the alignment of source and destination match, the three MOVS instructions can be combined and simplified to something like:&lt;/p&gt;
&lt;pre&gt; 66         lqa $13,HelloWorldString
 67         lqa $14,Destination
 68         fsmbi $15,0x01ff
 69         selb $16,$13,$14,$15 # copy only desired bytes into destination vector
 70         stqa $14,Destination
&lt;/pre&gt;
&lt;p&gt;With the further assumption that the destination was able to be trashed entirely, this could be reduced to just a load and a store.&lt;/p&gt;
&lt;h3&gt;2. Setting / clearing the DF flag&lt;/h3&gt;
&lt;p&gt;There is no DF flag.  It could be simulated through the use of an offset stored in another register that is added to addresses using &lt;em&gt;lqx&lt;/em&gt; &amp;amp; &lt;em&gt;stqx&lt;/em&gt; instructions, which would achieve the same kind of functionality.&lt;/p&gt;
&lt;h3&gt;3. Using Rep&lt;/h3&gt;
&lt;p&gt;REP is a fascinating little instruction (modifier? Appears to be a single byte in disassembly), but there&amp;#8217;s no direct equivalent for the SPU.  It could be mimicked in a general way on SPU using branches, but branches are a topic of later parts in the series so I&amp;#8217;ll avoid that for now.&lt;/p&gt;
&lt;p&gt;Instead, because the length and alignments of source and destination are known, it can be (effectively) unrolled and branchless :)&lt;/p&gt;
&lt;pre&gt; 85         #movl $HelloWorldString, %esi
 86         #movl $DestinationUsingRep, %edi
 87         #movl $25, %ecx # set the string length in ECX
 88         #cld # clear the DF
 89         #rep movsb
 91
 95         lqa $20,HelloWorldString
 96         lqa $21,HelloWorldString+16
 97         lqa $22,DestinationUsingRep+16
 98         fsmbi $23,0x007f
 99         selb $22,$21,$22,$23
100         stqa $20,DestinationUsingRep
101         stqa $22,DestinationUsingRep+16
&lt;/pre&gt;
&lt;p&gt;A simple load and store for the first quadword, and a merge of the second with its destination.  Again, making further assumptions about the destination memory would remove the need for lines 97&amp;#8211;99.&lt;/p&gt;
&lt;h3&gt;4. Loading string from memory into EAX register&lt;/h3&gt;
&lt;pre&gt;106         #leal HelloWorldString, %esi
107         #lodsb
112         ila $24,HelloWorldString
113         lqa $25,HelloWorldString
114         ai $26,$24,-3
115         rotqby $27,$25,$26
116
117         #dec %esi
118         #lodsw
120         ai $28,$24,-2
121         rotqby $29,$25,$28
122
125         #subl $2, %esi # Make ESI point back to the original string
126         #lodsl
128         rotqby $30,$25,$24
&lt;/pre&gt;
&lt;p&gt;Similar to 1. &amp;#8212; loading data and rotating into the preferred slot of a register.  Assumptions about source offset and that the loaded data doesn&amp;#8217;t span a quadword boundary makes this much simpler than it would otherwise be.&lt;/p&gt;
&lt;h3&gt;5. Storing strings from EAX to memory&lt;/h3&gt;
&lt;pre&gt;
  8     .align 4
  9     shuf_AABABCDghijklmnop:
 10         .int 0x00000100,0x01020317,0x18191a1b,0x1c1d1e1f

133         #leal DestinationUsingStos, %edi
134         #stosb
135         #stosw
136         #stosl
137
141         lqa $31,DestinationUsingStos
142         lqa $32,shuf_AABABCDghijklmnop
143         shufb $33,$30,$31,$32
144         stqa $33,DestinationUsingStos
&lt;/pre&gt;
&lt;p&gt;Rather than more repetitive merging and messing about, I chose to combine the three stores and get the same effect from a single shuffle &amp;#8212; which includes merging with the contents of the destination quadword.&lt;/p&gt;
&lt;p&gt;(The shuffle name reveals the intended function: capital letters refer to bytes from the first register, lower-case from the second.  I picked up this scheme from &lt;a href=&quot;http://www.insomniacgames.com/research_dev/articles/2008/1500765&quot;&gt;Insomniac Games&amp;#8217;s R&amp;amp;D pages&lt;/a&gt;.)&lt;/p&gt;
&lt;h3&gt;6. Comparing strings&lt;/h3&gt;
&lt;pre&gt;149         #cld
150         #leal HelloWorldString, %esi
151         #leal H3110, %edi
152         #cmpsb
153
154         lqa $34,HelloWorldString
155         lqa $35,H3110
156         ceqb $36,$34,$35
&lt;/pre&gt;
&lt;p&gt;There&amp;#8217;s no byte-subtraction instruction for SPU, but &lt;em&gt;ceqb&lt;/em&gt; will compare the bytes in two registers for equality.  That should be enough to work out if two strings match, but doesn&amp;#8217;t give the kind of ordering that you&amp;#8217;ll get from strcmp().   Getting the result from &lt;em&gt;ceqb&lt;/em&gt; and making some kind of use of it may require shifts, rotates or other shenanigans.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://6cycles.maisonikkoku.com/6Cycles/6cycles/Entries/2010/4/17_n00b_tip__Psychic_computing.html&quot;&gt;Jaymin Kessler has a post on scanning through pixel values&lt;/a&gt; that is also relevant for a number of string manipulation problems.&lt;/p&gt;
&lt;h3&gt;Previous assembly primer notes…&lt;/h3&gt;
&lt;p&gt;Part 1 — System Organization — &lt;a href=&quot;http://brnz.org/hbr/?p=631&quot;&gt;PPC&lt;/a&gt; — &lt;a href=&quot;http://brnz.org/hbr/?p=632&quot;&gt;SPU&lt;/a&gt;&lt;br /&gt;
Part 2 — Memory Organisation — &lt;a href=&quot;http://brnz.org/hbr/?p=633&quot;&gt;SPU&lt;/a&gt;&lt;br /&gt;
Part 3 — GDB Usage Primer — &lt;a href=&quot;http://brnz.org/hbr/?p=634&quot;&gt;PPC &amp;amp; SPU&lt;/a&gt;&lt;br /&gt;
Part 4 — Hello World — &lt;a href=&quot;http://brnz.org/hbr/?p=635&quot;&gt;PPC&lt;/a&gt; — &lt;a href=&quot;http://brnz.org/hbr/?p=634&quot;&gt;SPU&lt;/a&gt;&lt;br /&gt;
Part 5 &amp;#8212; Data Types &amp;#8212; &lt;a href=&quot;http://brnz.org/hbr/?p=685&quot;&gt;PPC &amp;amp; SPU&lt;/a&gt;&lt;br /&gt;
Part 6 &amp;#8212; Moving Data &amp;#8212; &lt;a href=&quot;http://brnz.org/hbr/?p=724&quot;&gt;PPC&lt;/a&gt; &amp;#8212; &lt;a href=&quot;http://brnz.org/hbr/?p=701&quot;&gt;SPU&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Assembly Primer Part 6 — Moving Data — PPC</title>
		<link href="http://brnz.org/hbr/?p=724"/>
		<id>http://brnz.org/hbr/?p=724</id>
		<updated>2010-12-01T13:10:46+00:00</updated>
		<content type="html">&lt;p&gt;These are my notes for where I can see PPC varying from ia32, as presented in the video &lt;a href=&quot;http://securitytube.net/Assembly-Primer-for-Hackers-(Part-6)-Moving-Data-video.aspx&quot;&gt;Part 6 — Moving Data&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;There are notable differences between PPC and ia32 when moving/copying data around, although not as much as is the case with SPU &amp;#8212; PPC copes with non-natural alignments (although I&amp;#8217;m not sure what performance penalties there are on Cell or modern ia32 arches for doing so &amp;#8212; at the very least, the cost of the occasional extra cache line), but doesn&amp;#8217;t have the full range of mov instructions supported by ia32.&lt;/p&gt;
&lt;p&gt;(When approaching this part, I wrote the SPU version first because I&amp;#8217;ve had a lot more experience with that arch and I though it would be quicker.  I was wrong.)&lt;/p&gt;
&lt;h2&gt;Moving Data&lt;/h2&gt;
&lt;p&gt;So, let&amp;#8217;s look at &lt;a href=&quot;http://code.securitytube.net/MovDemo.s&quot;&gt;MovDemo.s&lt;/a&gt; for PPC, piece by piece.&lt;/p&gt;
&lt;p&gt;First, the storage:&lt;/p&gt;
&lt;pre&gt;# Demo program to show how to use Data types and MOVx instructions 

.data
    HelloWorld:
        .ascii &quot;Hello World!&quot;

    ByteLocation:
        .byte 10

    Int32:
        .int 2
    Int16:
        .short 3
    Float:
        .float 10.23

    IntegerArray:
        .int 10,20,30,40,50
&lt;/pre&gt;
&lt;p&gt;Same as for ia32 and SPU.  PPC will cope with the lack of alignment.&lt;/p&gt;
&lt;h3&gt;1. Immediate value to register&lt;/h3&gt;
&lt;pre&gt;.text
    .globl _start
    _start:
        #movl $10, %eax
        li 0,10
&lt;/pre&gt;
&lt;p&gt;Simple enough to load a small constant into a register.  Like SPU, there&amp;#8217;s extra work required if trying to load more complex values.&lt;/p&gt;
&lt;p&gt;To load a full 32-bits of immediate data into a register requires two half-word load  instructions for the upper and lower parts (as will be seen for loading addresses).  Loading 64-bit values &lt;a href=&quot;http://www.ibm.com/developerworks/library/l-ppc/&quot;&gt;appears to take five instructions&lt;/a&gt; (four immediate loads and a rotate in the middle).  The joys of 32-bit, fixed-length instructions :)&lt;/p&gt;
&lt;p&gt;Aside:  &lt;em&gt;li&lt;/em&gt; and &lt;em&gt;lis&lt;/em&gt; are extended mnemonics that generate &lt;em&gt;addi &lt;/em&gt;and &lt;em&gt;addsi&lt;/em&gt; instructions &amp;#8212; and if the second operand is zero, these instructions use the value zero, not the value in gpr0.  Special case ftw.&lt;/p&gt;
&lt;p&gt;Speculating: On SPU, loads from local store take 6 cycles, so it will often be quicker to load a value than to generate it.  On PPC, it would seem that even five instructions will complete much faster than a (potential) L2 cache miss.&lt;/p&gt;
&lt;h3&gt;2. Immediate value to memory&lt;/h3&gt;
&lt;pre&gt;#movw $50, Int16

li 1,50
lis 2,Int16@ha
addi 2,2,Int16@l
sth 1,0(2)
&lt;/pre&gt;
&lt;p&gt;There&amp;#8217;s no instruction to write an immediate value directly to memory &amp;#8212; the source for a write must be a register, so we load that first.&lt;/p&gt;
&lt;p&gt;The address is loaded in the following two instructions &amp;#8212; @l is the lower 16 bits of the address.  @ha refers to the upper 16 bits of the address, where the a indicates the value is &amp;#8220;adjusted so that adding the low 16 bits will perform the correct calculation of the address accounting for signed arithmetic&amp;#8221; (from &lt;a href=&quot;http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html#RELOC-TYPE&quot;&gt;here&lt;/a&gt;, where these suffixes and are documented).&lt;/p&gt;
&lt;p&gt;The halfword is then written to the address stored in gpr2.&lt;/p&gt;
&lt;h3&gt;3. Register to register&lt;/h3&gt;
&lt;pre&gt;#movl %eax, %ebx
ori 3,0,0
&lt;/pre&gt;
&lt;p&gt;Like SPU, register copy can be done with Or Immediate against zero.&lt;/p&gt;
&lt;h3&gt;4. Memory to register&lt;/h3&gt;
&lt;pre&gt;#movl Int32, %eax

lis 4,Int32@ha
addi 4,4,Int32@l
lwz 5,0(4)
&lt;/pre&gt;
&lt;p&gt;Easy enough &amp;#8212; load the address, load from the address.&lt;/p&gt;
&lt;h3&gt;5. Register to memory&lt;/h3&gt;
&lt;pre&gt;#movb $3, %al
#movb %al, ByteLocation

li 6,3
lis 7,ByteLocation@ha
addi 7,7,ByteLocation@l
stb 6,0(7)
&lt;/pre&gt;
&lt;p&gt;Again, load the address, store a byte to the address.&lt;/p&gt;
&lt;h3&gt;6. Register to indexed memory location&lt;/h3&gt;
&lt;pre&gt;#movl $0, %ecx
#movl $2, %edi
#movl $22, IntegerArray(%ecx,%edi , 4)

li 7,2
slwi 8,7,2  # extended mnemonic - rlwinm 8,7,2,0,31-2
lis 9,IntegerArray@ha
addi 9,9,IntegerArray@l
lwzx 10,9,8
&lt;/pre&gt;
&lt;p&gt;Load an element offset, shift to get the byte offset, load the address and use the x-form Load Word to fetch from the (base address + offset).&lt;/p&gt;
&lt;p&gt;(The z in that mnemonic refers to zeroing of the upper 32 bits of the 64-bit register.  There appears to be an algebraic load that does sign extension)&lt;/p&gt;
&lt;h3&gt;7. Indirect addressing&lt;/h3&gt;
&lt;pre&gt;#movl $Int32, %eax
#movl (%eax), %ebx

lis 11,Int32@ha
addi 11,11,Int32@l
lwz 12,0(11)

#movl $9, (%eax)

li 13,9
stw 13,0(11)
&lt;/pre&gt;
&lt;p&gt;More of the same kind of thing because that&amp;#8217;s how PPC does loads and stores.&lt;/p&gt;
&lt;h2&gt;Concluding thoughts&lt;/h2&gt;
&lt;p&gt;Reasonably straightforward, a bit more limited than ia32 in addressing modes but nothing too surprising.  Particularly compared to SPU.&lt;/p&gt;
&lt;p&gt;PPC does appear to have some more interesting load and store instructions that I haven&amp;#8217;t tried here &amp;#8212; updating index on load/store stands out as something I&amp;#8217;d like to take a closer look at.  The PPC rotate and mask instructions look like some mind-bending fun to play with, but that&amp;#8217;s something for another time.&lt;/p&gt;
&lt;h3&gt;Previous assembly primer notes…&lt;/h3&gt;
&lt;p&gt;Part 1 — System Organization — &lt;a href=&quot;http://brnz.org/hbr/?p=631&quot;&gt;PPC&lt;/a&gt; — &lt;a href=&quot;http://brnz.org/hbr/?p=632&quot;&gt;SPU&lt;/a&gt;&lt;br /&gt;
Part 2 — Memory Organisation — &lt;a href=&quot;http://brnz.org/hbr/?p=633&quot;&gt;SPU&lt;/a&gt;&lt;br /&gt;
Part 3 — GDB Usage Primer — &lt;a href=&quot;http://brnz.org/hbr/?p=634&quot;&gt;PPC &amp;amp; SPU&lt;/a&gt;&lt;br /&gt;
Part 4 — Hello World — &lt;a href=&quot;http://brnz.org/hbr/?p=635&quot;&gt;PPC&lt;/a&gt; — &lt;a href=&quot;http://brnz.org/hbr/?p=634&quot;&gt;SPU&lt;/a&gt;&lt;br /&gt;
Part 5 &amp;#8212; Data Types &amp;#8212; &lt;a href=&quot;http://brnz.org/hbr/?p=685&quot;&gt;PPC &amp;amp; SPU&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Assembly Primer Part 6 — Moving Data — SPU</title>
		<link href="http://brnz.org/hbr/?p=701"/>
		<id>http://brnz.org/hbr/?p=701</id>
		<updated>2010-12-01T05:26:32+00:00</updated>
		<content type="html">&lt;p&gt;These are my notes for where I can see SPU varying from ia32, as presented in the video &lt;a href=&quot;http://securitytube.net/Assembly-Primer-for-Hackers-(Part-6)-Moving-Data-video.aspx&quot;&gt;Part 6 — Moving Data&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;SPU and ia32 differ significantly when it comes to moving/copying data around, in terms of the ways things can be copied, the alignment of data in memory and the vector nature of SPU registers.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://brnz.org/cell/doku.php?id=spuinstructions&quot;&gt;This is the quick SPU instruction reference I use&lt;/a&gt;.  The &lt;a href=&quot;https://www-01.ibm.com/chips/techlib/techlib.nsf/techdocs/76CA6C7304210F3987257060006F2C44&quot;&gt;SPU ISA doc&lt;/a&gt; is worth having nearby if trying to do silly tricks with SPU instructions.&lt;/p&gt;
&lt;h2&gt;Moving Data&lt;/h2&gt;
&lt;p&gt;Lets consider what &lt;a href=&quot;http://code.securitytube.net/MovDemo.s&quot;&gt;MovDemo.s&lt;/a&gt; might look like for SPU, piece by piece.&lt;/p&gt;
&lt;p&gt;First, the storage:&lt;/p&gt;
&lt;pre&gt;# Demo program to show how to use Data types and MOVx instructions 

.data
    HelloWorld:
        .ascii &quot;Hello World!&quot;

    ByteLocation:
        .byte 10

    Int32:
        .int 2
    Int16:
        .short 3
    Float:
        .float 10.23

    IntegerArray:
        .int 10,20,30,40,50
&lt;/pre&gt;
&lt;p&gt;Icky.  Not naturally aligned for size, and crossing qword boundaries.  This makes the following code particularly messy, because the SPU &lt;em&gt;really&lt;/em&gt; doesn&amp;#8217;t like unaligned data.  Oh well, let&amp;#8217;s begin.&lt;/p&gt;
&lt;h3&gt;1. Immediate value to register&lt;/h3&gt;
&lt;pre&gt;    .align 3  # ensure code is aligned after awkwardly arranged data
.text
    .globl _start
    _start:
        #movl $10, %eax
        il $5, 10
&lt;/pre&gt;
&lt;p&gt;Well, that was easy enough.&lt;/p&gt;
&lt;p&gt;It does get a little trickier if trying to load more complex values.  To load a full 32-bits of immediate data into a register requires two half-word load  instructions for the upper and lower parts.&lt;/p&gt;
&lt;p&gt;Loading arbitrary values spanning multiple words is more  complex, and is often able to be done simply by storing the  constant in .rodata and loading it when needed, although &lt;em&gt;fsmbi&lt;/em&gt; can be useful on occasion.&lt;/p&gt;
&lt;h3&gt;2. Immediate value to local store&lt;/h3&gt;
&lt;pre&gt;#movw $50, Int16

# Write first byte
ila $6,Int16        # load the address of the target
lqa $7,Int16        # load the qword
il $8,0             # load the upper byte of the constant into preferred slot
cbd $9,0($6)        # insertion mask for higher byte
shufb $10,$8,$7,$9  # shuffle the upper byte into the qword
stqa $10,Int16      # write the word back
# Write second byte
il $11,1            # load 1 for address offsetting
cbd $12,1($6)       # insertion mask for lower byte
il $13,50           # load the lower byte of the constant into preferred slot
lqx $14,$6,$11      # load Int16+1
shufb $15,$13,$14,$12 # shuffle lower byte into qword
stqx $15,$6,$11     # write back qword
&lt;/pre&gt;
&lt;p&gt;Writing two bytes to a non-aligned memory location is a messy business.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;All loads and stores transfer 16 bytes of data between registers and 16-byte aligned memory locations.&lt;/li&gt;
&lt;li&gt;The &lt;em&gt;chd&lt;/em&gt; instruction, used to generate masks to be used to shuffle halfwords into a quadword assumes that the halfword is aligned in the first place.  As it is not, and could be crossing a quadword boundary, I write it here as two bytes.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;em&gt;lqa&lt;/em&gt; instruction (a-form) is used for the first load, to fetch from an absolute local store address.  &lt;em&gt;lqx&lt;/em&gt; (x-form) is used for the second load, because the address needs to be offset by one &amp;#8212; on first glance, &lt;em&gt;lqa&lt;/em&gt; and &lt;em&gt;lqd&lt;/em&gt; appeared to be better choices, but these do not store all of the lower bits of the immediate part to be used, which would have prevented the one-byte offset.  So x-form is used as the zeroing of lower bits happens after the addition of the preferred word slots of two registers.&lt;/p&gt;
&lt;p&gt;I suspect that this can be done better.&lt;/p&gt;
&lt;p&gt;(It&amp;#8217;s worth taking a look at &lt;a href=&quot;http://6cycles.maisonikkoku.com/6Cycles/6cycles/Entries/2010/11/27_n00b_tip__Combining_writes.html&quot;&gt;Jaymin&amp;#8217;s post on write-combining&lt;/a&gt; which looks more deeply at this kind of problem)&lt;/p&gt;
&lt;h3&gt;3. Register to registers&lt;/h3&gt;
&lt;pre&gt;#movl %eax, %ebx
ori $16, $5, 0
&lt;/pre&gt;
&lt;p&gt;Using the Or Immediate instruction to perform a bitwise Or against zero to perform the copy.  This can be achieved using the odd pipeline with a quadword shift or rotate immediate instruction.&lt;/p&gt;
&lt;p&gt;Copying smaller portions of a register will require extra instruction(s) for masking or rotation, depending on what exactly needs to be copied and to where.&lt;/p&gt;
&lt;h3&gt;4. Local store to register&lt;/h3&gt;
&lt;pre&gt;#movl Int32, %eax

ila $16,Int32       # load the address
lqa $17,Int32       # load the vector containing the first part
lqa $18,Int32+3     # load the vector containing the second part
fsmbi $19,0xf000    # create a mask for merging them
rotqby $20,$17,$16  # rotate the first part into position
rotqby $21,$18,$16  # rotate the second part into position
rotqby $22,$19,$16  # rotate the select mask into position
selb $23,$20,$21,$22 # select things into the right place.
&lt;/pre&gt;
&lt;p&gt;This one is a different class of fun &amp;#8211; loading four bytes that span two quadwords.  Using &lt;em&gt;fsmbi&lt;/em&gt; to generate a mask that is used to combine bytes from the two quadwords.&lt;/p&gt;
&lt;p&gt;Again, I suspect there&amp;#8217;s a better way to do it.&lt;/p&gt;
&lt;h3&gt;5. Register to local store&lt;/h3&gt;
&lt;pre&gt;#movb $3, %al
#movb %al, ByteLocation

ila $24,ByteLocation
lqa $25, ByteLocation
il $26,3
cbd $27, 0($24)
shufb $28, $26, $25, $27
stqa $28, ByteLocation
&lt;/pre&gt;
&lt;p&gt;Essentially the same problem as 2. on the SPU, but a little simpler because it&amp;#8217;s only a single byte.&lt;/p&gt;
&lt;h3&gt;6. Register to indexed memory location&lt;/h3&gt;
&lt;pre&gt;#movl $0, %ecx
#movl $2, %edi
#movl $22, IntegerArray(%ecx,%edi , 4)
il $29,2                # load the index
ila $30,IntegerArray    # load the address of the array
shli $31,$29,2          # shift two left to get byte offset
lqx $32,$30,$31         # load from the sum of the two addresses
# and then write the data to memory...
&lt;/pre&gt;
&lt;p&gt;This is an attempt at a comparable indexed access to local store.  All I&amp;#8217;ve done here is the address calculation and load &amp;#8212; writing the value is a mess because it&amp;#8217;s not aligned and spans two quadwords, so something like that done in 2. would be required.&lt;/p&gt;
&lt;h3&gt;7. Indirect addressing&lt;/h3&gt;
&lt;pre&gt;movl $Int32, %eax
movl (%eax), %ebx

movl $9, (%eax)
&lt;/pre&gt;
&lt;p&gt;I&amp;#8217;ve done these before (essentially) in 2. and 4.&lt;/p&gt;
&lt;h2&gt;Concluding thoughts&lt;/h2&gt;
&lt;p&gt;Align your data for the SPU.  This would have all been much, much simpler (and not much of a challenge) if the data was aligned and variables were in preferred slots.  I suspect I&amp;#8217;ll simplify the later parts of the series for SPU by aligning the data first.&lt;/p&gt;
&lt;p&gt;I found some useful fragments amongst the Introduction to SPU Optimizations presentations from Naughty Dog &amp;#8212; they&amp;#8217;re a very good read: &lt;a href=&quot;http://brnz.org/hbr/www.naughtydog.com/docs/gdc2010/intro-spu-optimizations-part-1.pdf&quot;&gt;Part 1&lt;/a&gt; &amp;amp; &lt;a href=&quot;http://brnz.org/hbr/www.naughtydog.com/docs/gdc2010/intro-spu-optimizations-part-2.pdf&quot;&gt;Part 2&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Previous assembly primer notes…&lt;/h3&gt;
&lt;p&gt;Part 1 — System Organization — &lt;a href=&quot;http://brnz.org/hbr/?p=631&quot;&gt;PPC&lt;/a&gt; — &lt;a href=&quot;http://brnz.org/hbr/?p=632&quot;&gt;SPU&lt;/a&gt;&lt;br /&gt;
Part 2 — Memory Organisation — &lt;a href=&quot;http://brnz.org/hbr/?p=633&quot;&gt;SPU&lt;/a&gt;&lt;br /&gt;
Part 3 — GDB Usage Primer — &lt;a href=&quot;http://brnz.org/hbr/?p=634&quot;&gt;PPC &amp;amp; SPU&lt;/a&gt;&lt;br /&gt;
Part 4 — Hello World — &lt;a href=&quot;http://brnz.org/hbr/?p=635&quot;&gt;PPC&lt;/a&gt; — &lt;a href=&quot;http://brnz.org/hbr/?p=634&quot;&gt;SPU&lt;/a&gt;&lt;br /&gt;
Part 5 &amp;#8212; Data Types &amp;#8212; &lt;a href=&quot;http://brnz.org/hbr/?p=685&quot;&gt;PPC &amp;amp; SPU&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Assembly Primer Part 5 — Data Types</title>
		<link href="http://brnz.org/hbr/?p=685"/>
		<id>http://brnz.org/hbr/?p=685</id>
		<updated>2010-11-24T22:03:28+00:00</updated>
		<content type="html">&lt;p&gt;These are my notes for where I can see both PPC and SPU varying from ia32, as presented in the video &lt;a href=&quot;http://www.securitytube.net/Assembly-Primer-for-Hackers-%28Part-5%29-Data-Types-video.aspx&quot;&gt;Part 5 — Data Types&lt;/a&gt;.   There&amp;#8217;s not a lot to be said about this one, so there&amp;#8217;s just the one post for both PPC and SPU architectures.&lt;/p&gt;
&lt;p&gt;The main problem with assembling the provided &lt;a href=&quot;http://code.securitytube.net/VariableDemo.s&quot;&gt;VariableDemo.s&lt;/a&gt; is that gas doesn&amp;#8217;t seem to like the .bss section for either PPC or SPU, producing an error.  To be able to assemble this file on these architectures, I removed the .bss line and (obviously) removed (replaced) the ia32 asm instructions.  objdump shows that &amp;#8220;.comm LargeBuffer 10000&amp;#8243; is placed in .bss, as intended.&lt;/p&gt;
&lt;p&gt;(At this point, I&amp;#8217;m quite out of my depth as to why this difference between the architectures exists &amp;#8212; if someone can enlighten me, that&amp;#8217;d be great :)&lt;/p&gt;
&lt;p&gt;I was interested to see that gdb has no problem accessing the unaligned variables on the SPU.  It&amp;#8217;s worth noting that the assembler is quite happy to let you place data wherever you like (with great power comes great etc.).  And I think I need to take a closer look at the .align directive.&lt;/p&gt;
&lt;h3&gt;Previous assembly primer notes…&lt;/h3&gt;
&lt;p&gt;Part 1 — System Organization — &lt;a href=&quot;http://brnz.org/hbr/?p=631&quot;&gt;PPC&lt;/a&gt; — &lt;a href=&quot;http://brnz.org/hbr/?p=632&quot;&gt;SPU&lt;/a&gt;&lt;br /&gt;
Part 2 — Memory Organisation — &lt;a href=&quot;http://brnz.org/hbr/?p=633&quot;&gt;SPU&lt;/a&gt;&lt;br /&gt;
Part 3 — GDB Usage Primer — &lt;a href=&quot;http://brnz.org/hbr/?p=634&quot;&gt;PPC &amp;amp; SPU&lt;/a&gt;&lt;br /&gt;
Part 4 — Hello World — &lt;a href=&quot;http://brnz.org/hbr/?p=635&quot;&gt;PPC&lt;/a&gt; — &lt;a href=&quot;http://brnz.org/hbr/?p=634&quot;&gt;SPU&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Assembly Primer Part 4 — Hello World — SPU</title>
		<link href="http://brnz.org/hbr/?p=636"/>
		<id>http://brnz.org/hbr/?p=636</id>
		<updated>2010-11-24T06:35:13+00:00</updated>
		<content type="html">&lt;p&gt;These are my notes for where I can see SPU varying from ia32, as presented in the video &lt;a href=&quot;http://www.securitytube.net/Assembly-Primer-for-Hackers-(Part-4)-Hello-World-video.aspx&quot;&gt;Part 4 — Hello World&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;&lt;span&gt;I&amp;#8217;ve written about syscalls on SPU before, &lt;a href=&quot;http://brnz.org/hbr/?p=521&quot;&gt;here&lt;/a&gt;.  System calls can be performed using appropriately packed data and stopcode 0x2104, which is intercepted by the kernel.&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;The &lt;a href=&quot;http://code.securitytube.net/JustExit.s&quot;&gt;JustExit.s&lt;/a&gt; example in the video uses the exit syscall, which is &lt;a href=&quot;http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=arch/powerpc/platforms/cell/spu_callbacks.c;h=fec1495e6b12f98a8a12e9c9436fa2f2fdc76782;hb=HEAD#l16&quot;&gt;explicitly excluded&lt;/a&gt; from being called by the SPU.  For the sake of the example, we can use the time syscall instead, and so a simple syscall looks something like this:&lt;/p&gt;
&lt;pre&gt;.data
syscall_time:
    .quad 13 # syscall number and return value
    .quad 0  # parameters
    .quad 0
    .quad 0
    .quad 0
    .quad 0
    .quad 0

.text
.globl _start
_start:
    stop 0x2104
    .int syscall_time&lt;/pre&gt;
&lt;p&gt;syscall_time is the structure used by the syscall (see &lt;a href=&quot;http://sourceware.org/cgi-bin/cvsweb.cgi/src/newlib/libc/machine/spu/sys/linux_syscalls.h?rev=1.3&amp;content-type=text/x-cvsweb-markup&amp;cvsroot=src&quot;&gt;struct spu_syscall_block&lt;/a&gt; and &lt;a href=&quot;http://sourceware.org/cgi-bin/cvsweb.cgi/src/libgloss/spu/linux_syscalls.c?rev=1.2&amp;content-type=text/x-cvsweb-markup&amp;cvsroot=src&quot;&gt;__linux_syscall()&lt;/a&gt;) with 13 in the first unsigned long long. (&amp;#8220;Obviously&amp;#8221;, .quad is 8 bytes :\).  If there were arguments to pass to the syscall, they would be placed in the six following .quads.&lt;/p&gt;
&lt;p&gt;The address of the syscall block must follow directly after the stop instruction.  (I did wonder if there would be some trick to mixing the address with the program code &amp;#8212; as you can see, no trick needed)&lt;/p&gt;
&lt;p&gt;The syscall&amp;#8217;s return value is placed in the first 8 bytes of the syscall block.&lt;/p&gt;
&lt;p&gt;While it&amp;#8217;s possible to use the write syscall, it&amp;#8217;s rather painful as it requires a valid char* ea to be passed to be written, which is not readily accessible from the SPU.  The alternative is to use the &lt;a href=&quot;http://sourceware.org/cgi-bin/cvsweb.cgi/src/libgloss/spu/syscalls.c?rev=1.9&amp;content-type=text/x-cvsweb-markup&amp;cvsroot=src&quot;&gt;__send_to_ppe()&lt;/a&gt; function &amp;#8212; &lt;a href=&quot;http://sourceware.org/cgi-bin/cvsweb.cgi/src/libgloss/spu/write.c?rev=1.5&amp;content-type=text/x-cvsweb-markup&amp;cvsroot=src&quot;&gt;write()&lt;/a&gt; is one of the POSIX1 functions handled by newlib+libspe.  Of course, it has a slightly different calling mechanism to to __linux_syscall(), uses the JSRE_POSIX1 stopcode of 0x2101.  This works:&lt;/p&gt;
&lt;pre&gt;.data

HelloWorldString:
    .ascii &quot;Hello world\n&quot;

send_to_ppe_write:
    .int 1 # stdout
    .int 0 # pad
    .int 0 # pad
    .int 0 # pad
    .int HelloWorldString # char* in local store
    .int 0 # pad
    .int 0 # pad
    .int 0 # pad
    .int 12 # length
    .int 0 # pad
    .int 0 # pad
    .int 0 # pad

.text
.globl _start

_start:
    stop 0x2101
    .int send_to_ppe_write+0x1b000000&lt;/pre&gt;
&lt;p&gt;Although I&amp;#8217;m sure it can be expressed more elegantly.&lt;/p&gt;
&lt;p&gt;The magic number 0x1b000000 added to the address of send_to_ppe_write is derived from the &amp;#8220;combined&amp;#8221; variable from &lt;a href=&quot;http://sourceware.org/cgi-bin/cvsweb.cgi/src/libgloss/spu/syscalls.c?rev=1.9&amp;content-type=text/x-cvsweb-markup&amp;cvsroot=src&quot;&gt;__send_to_ppe()&lt;/a&gt; with the values from &lt;a href=&quot;http://sourceware.org/cgi-bin/cvsweb.cgi/src/libgloss/spu/jsre.h?rev=1.22&amp;content-type=text/x-cvsweb-markup&amp;cvsroot=src&quot;&gt;jsre.h&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Alternatively&amp;#8230;&lt;/h2&gt;
&lt;p&gt;I just realised that this works: if /proc/sys/kernel/randomize_va_space is zero, the address of the mapped SPU LS (from /proc/$PID/maps, as seen &lt;a href=&quot;http://brnz.org/hbr/?p=633&quot;&gt;here&lt;/a&gt;) of 0xf7f70000 can be used as an offset to anything in local store, so the syscall will work with offset pointers:&lt;/p&gt;
&lt;pre&gt;.data

HelloWorldString:
    .ascii &quot;Hello World\n&quot;

syscall_write:
    .quad 4 # write
    .quad 1 # stdout
    .int  0 # gas doesn't seem to like doing the arithmetic in a .quad
    .int 0xf7f70000 + HelloWorldString # mapped address of string
    .quad 12 # length
    .quad 0
    .quad 0
    .quad 0

.text

.globl _start

_start:
    stop 0x2104
    .int syscall_write&lt;/pre&gt;
&lt;p&gt;Hideous :)&lt;/p&gt;
&lt;h3&gt;Previous assembly primer notes…&lt;/h3&gt;
&lt;p&gt;Part 1 — System Organization — &lt;a href=&quot;http://brnz.org/hbr/?p=631&quot;&gt;PPC&lt;/a&gt; — &lt;a href=&quot;http://brnz.org/hbr/?p=632&quot;&gt;SPU&lt;/a&gt;&lt;br /&gt;
Part 2 — Memory Organisation — &lt;a href=&quot;http://brnz.org/hbr/?p=633&quot;&gt;SPU&lt;/a&gt;&lt;br /&gt;
Part 3 &amp;#8212; GDB Usage Primer &amp;#8212; &lt;a href=&quot;http://brnz.org/hbr/?p=634&quot;&gt;PPC &amp;amp; SPU&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Assembly Primer Part 4 — Hello World — PPC</title>
		<link href="http://brnz.org/hbr/?p=635"/>
		<id>http://brnz.org/hbr/?p=635</id>
		<updated>2010-11-23T22:20:52+00:00</updated>
		<content type="html">&lt;h2&gt;&lt;span&gt;These are my notes for where I can see PPC varying from ia32, as presented in the video &lt;a href=&quot;http://www.securitytube.net/Assembly-Primer-for-Hackers-(Part-4)-Hello-World-video.aspx&quot;&gt;Part 4 — Hello World&lt;/a&gt;.  Let me know if I’ve missed something important, obvious or got something wrong.&lt;/span&gt;&lt;/h2&gt;
&lt;h2&gt;&lt;span&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/library/l-ppc/&quot;&gt;http://www.ibm.com/developerworks/library/l-ppc/&lt;/a&gt; gives a good starting overview of PPC asm, including syscalls.  The syscall number goes into gpr0 and the args in gpr3 and following, so &lt;a href=&quot;http://code.securitytube.net/JustExit.s&quot;&gt;JustExit.s&lt;/a&gt; becomes:&lt;/span&gt;&lt;/h2&gt;
&lt;pre&gt;.text
.globl _start

_start:
    li 0,1 # load 1 into reg 0
    li 3,0 # load 0 into reg 3
    sc     # system call&lt;/pre&gt;
&lt;p&gt;Simple enough.&lt;/p&gt;
&lt;p&gt;Modifying the provided &lt;a href=&quot;http://code.securitytube.net/HelloWorldProgram.s&quot;&gt;HelloWorldProgram.s&lt;/a&gt; example (and using the example from the above link) yields&lt;/p&gt;
&lt;pre&gt;.data

HelloWorldString:
    .ascii &quot;Hello World\n&quot;

.text

.globl _start

_start:
    # Load all the arguments for write ()

    li   0, 4  # syscall number of 4 (write)
    li   3, 1  # filenumber 1 (stdout)
    lis  4, HelloWorldString@ha   # load upper 16 bits of addr
    addi 4, 4, HelloWorldString@l # add lower 16 bits of addr
    li   5, 12 # length of string
    sc

    # exit the program
    li 0,1
    li 3,0
    sc&lt;/pre&gt;
&lt;p&gt;There&amp;#8217;s some subtlety in the @ha and @l high and low parts of addresses that I don&amp;#8217;t yet have my head around fully, but I&amp;#8217;ll be coming back to this in a later part.&lt;/p&gt;
&lt;h3&gt;Previous assembly primer notes…&lt;/h3&gt;
&lt;p&gt;Part 1 — System Organization — &lt;a href=&quot;http://brnz.org/hbr/?p=631&quot;&gt;PPC&lt;/a&gt; — &lt;a href=&quot;http://brnz.org/hbr/?p=632&quot;&gt;SPU&lt;/a&gt;&lt;br /&gt;
Part 2 — Memory Organisation — &lt;a href=&quot;http://brnz.org/hbr/?p=633&quot;&gt;SPU&lt;/a&gt;&lt;br /&gt;
Part 3 &amp;#8212; GDB Usage Primer &amp;#8212; &lt;a href=&quot;http://brnz.org/hbr/?p=634&quot;&gt;PPC &amp;amp; SPU &lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Assembly Primer Part 3 — GDB Usage Primer</title>
		<link href="http://brnz.org/hbr/?p=634"/>
		<id>http://brnz.org/hbr/?p=634</id>
		<updated>2010-11-23T08:50:33+00:00</updated>
		<content type="html">&lt;p&gt;These are my notes for where I can see both PPC and SPU varying from ia32, as presented in the video &lt;a href=&quot;http://www.securitytube.net/Assembly-Primer-for-Hackers-%28Part-3%29-GDB-Usage-Primer-video.aspx&quot;&gt;Part 3 &amp;#8212; GDB Usage Primer&lt;/a&gt;.  The usage of gdb is effectively the same for all three architectures &amp;#8212; I&amp;#8217;ve noted here some of the differences in the program being debugged.&lt;/p&gt;
&lt;p&gt;In the ia32 disassembly of &lt;a href=&quot;http://code.securitytube.net/SimpleDemo.c&quot;&gt;SimpleDemo.c&lt;/a&gt;, the &lt;em&gt;call&lt;/em&gt; instruction is generated for function calls.&lt;/p&gt;
&lt;p&gt;When compiled for PPC, I see &lt;em&gt;bl&lt;/em&gt; &amp;#8212; branch to address offset from &lt;em&gt;bl&lt;/em&gt; instruction, placing the address of the following instruction in the link register (lr).&lt;/p&gt;
&lt;p&gt;When compiled for SPU, I see &lt;em&gt;brsl&lt;/em&gt; &amp;#8212; branch to address offset from brsl instruction, placing the address of the following instruction into the specified register (typically r0, used as link register).&lt;/p&gt;
&lt;p&gt;Neither PPC nor SPU pass args on the stack (at least not for two scalar args as for the add function in SimpleDemo.c).  Those values can still be seen as being present on the stack when examining it in gdb.  The reason appears to be that when compiled with no optimisation, a number of registers are pushed to the stack that are not needed.  Compiling at -O1 eliminates the superfluous pushes, so the args are no longer visible there, being present in the appropriate registers when the function is called.&lt;/p&gt;
&lt;p&gt;(&lt;a href=&quot;http://software.intel.com/sites/products/documentation/studio/composer/en-us/2011/compiler_c/bldaps_cls/common/bldaps_calling_conv.htm&quot;&gt;This document on calling conventions from Intel&lt;/a&gt; seems to say that args get passed to functions in regs where possible on ia32 as well&amp;#8230; I can see it happening for amd64, not ia32)&lt;/p&gt;
&lt;p&gt;As noted above, PPC and SPU store the function return address in the link register (lr or r0), not on the stack.&lt;/p&gt;
&lt;p&gt;All three architectures appear to put the return value in a register (eax or r3).&lt;/p&gt;
&lt;h3&gt;Previous assembly primer notes…&lt;/h3&gt;
&lt;p&gt;Part 1 — System Organization — &lt;a href=&quot;http://brnz.org/hbr/?p=631&quot;&gt;PPC&lt;/a&gt; — &lt;a href=&quot;http://brnz.org/hbr/?p=632&quot;&gt;SPU&lt;/a&gt;&lt;br /&gt;
Part 2 &amp;#8212; Memory Organisation &amp;#8212; &lt;a href=&quot;http://brnz.org/hbr/?p=633&quot;&gt;SPU&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Assembly Primer Part 2 — Memory Organisation — SPU</title>
		<link href="http://brnz.org/hbr/?p=633"/>
		<id>http://brnz.org/hbr/?p=633</id>
		<updated>2010-11-23T00:32:58+00:00</updated>
		<content type="html">&lt;p&gt;These are my notes for where I can see SPU varying from ia32, as presented in the video &lt;a href=&quot;http://www.securitytube.net/Assembly-Primer-for-Hackers-%28Part-2%29-Virtual-Memory-Organization-video.aspx&quot;&gt;Part 2 &amp;#8212; Virtual Memory Organization&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;(I didn&amp;#8217;t notice see any significant differences between the presented information for ia32 and PPC &amp;#8212; apart from what was noted from the first presentation &amp;#8212; so there&amp;#8217;s no separate post for that arch).&lt;/p&gt;
&lt;p&gt;To compile &lt;a href=&quot;http://code.securitytube.net/SimpleDemo.c&quot;&gt;SimpleDemo.c&lt;/a&gt; to examine on the SPU, you&amp;#8217;ll need to add the -mstdmain option to spu-gcc (or spu-elf-gcc) so that the program will correctly receive the command line options.&lt;/p&gt;
&lt;p&gt;If you examine the /proc/$PID/maps file when running a standalone SPU program, you&amp;#8217;ll see something like this:&lt;/p&gt;
&lt;pre&gt;00100000-00120000 r-xp 00000000 00:00 0       [vdso]
0fd70000-0fd90000 r-xp 00000000 fe:02 1590608 /lib/libgcc_s.so.1
0fd90000-0fda0000 rw-p 00010000 fe:02 1590608 /lib/libgcc_s.so.1
0fdb0000-0fdd0000 r-xp 00000000 fe:02 292441  /lib/libpthread-2.11.2.so
0fdd0000-0fde0000 rw-p 00010000 fe:02 292441  /lib/libpthread-2.11.2.so
0fdf0000-0fe00000 r-xp 00000000 fe:02 292418  /lib/librt-2.11.2.so
0fe00000-0fe10000 rw-p 00000000 fe:02 292418  /lib/librt-2.11.2.so
0fe20000-0ff90000 r-xp 00000000 fe:02 292437  /lib/libc-2.11.2.so
0ff90000-0ffa0000 rw-p 00160000 fe:02 292437  /lib/libc-2.11.2.so
0ffa0000-0ffb0000 rw-p 00000000 00:00 0
0ffc0000-0ffe0000 r-xp 00000000 fe:02 1590211 /usr/lib/libspe2.so.2.2.80
0ffe0000-0fff0000 rw-p 00010000 fe:02 1590211 /usr/lib/libspe2.so.2.2.80
10000000-10010000 r-xp 00000000 fe:02 1821445 /usr/bin/elfspe
10010000-10020000 rw-p 00000000 fe:02 1821445 /usr/bin/elfspe
10020000-10050000 rwxp 00000000 00:00 0       [heap]
f7f60000-f7f70000 rw-p 00000000 00:00 0
f7f70000-f7fb0000 rw-s 00000000 00:13 9086
                                       /spu/spethread-2971-268566640/mem
f7fb0000-f7fc0000 rw-p 00000000 fe:02 1463963
                     /home/jonathan/AssemblyLanguagePrimer/SimpleDemoSPU
f7fc0000-f7fe0000 r-xp 00000000 fe:02 292430  /lib/ld-2.11.2.so
f7fe0000-f7ff0000 rw-p 00020000 fe:02 292430  /lib/ld-2.11.2.so
ffea0000-ffff0000 rw-p 00000000 00:00 0       [stack]&lt;/pre&gt;
&lt;p&gt;This is the information for the elfspe loader for the SPU program.&lt;/p&gt;
&lt;p&gt;(The SPU&amp;#8217;s local store is mapped into elfspe&amp;#8217;s address space at 0xf7f7000.  This is with randomize_va_space set to zero, so it should always be in that location. This is possibly useful&amp;#8230;)&lt;/p&gt;
&lt;p&gt;There is no equivalent of this for the SPU program itself as there is no virtual memory mapping required (or possible) within the local store.  The state of the SPU&amp;#8217;s memory state may be examined externally through the spufs interface provided (in this case, the file /spu/spethread-2971-268566640/mem from the above listing may be used to access the current SPU LS state). Or, of course, using gdb.&lt;/p&gt;
&lt;h3&gt;Previous assembly primer notes&amp;#8230;&lt;/h3&gt;
&lt;p&gt;Part 1 &amp;#8212; System Organization &amp;#8212; &lt;a href=&quot;http://brnz.org/hbr/?p=631&quot;&gt;PPC&lt;/a&gt; &amp;#8212; &lt;a href=&quot;http://brnz.org/hbr/?p=632&quot;&gt;SPU&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Assembly Primer Part 1 — System Organization — SPU</title>
		<link href="http://brnz.org/hbr/?p=632"/>
		<id>http://brnz.org/hbr/?p=632</id>
		<updated>2010-11-22T11:28:37+00:00</updated>
		<content type="html">&lt;p&gt;The platform I&amp;#8217;m using is Debian Sid on a PS3 (3.15 OtherOS) with the spu-gcc toolchain.&lt;/p&gt;
&lt;p&gt;These are my notes for where I can see the SPU varying from the ia32, as presented in the video &lt;a href=&quot;http://www.securitytube.net/Assembly-Primer-for-Hackers-%28Part-1%29-System-Organization-video.aspx&quot;&gt;Part 1 &amp;#8212; System Organization&lt;/a&gt;.  Let me know if I&amp;#8217;ve missed something important, obvious or got something wrong.&lt;/p&gt;
&lt;p&gt;For reference, I&amp;#8217;m using the SPU &lt;a href=&quot;https://www-01.ibm.com/chips/techlib/techlib.nsf/techdocs/02E544E65760B0BF87257060006F8F20&quot;&gt;ABI&lt;/a&gt; and &lt;a href=&quot;https://www-01.ibm.com/chips/techlib/techlib.nsf/techdocs/76CA6C7304210F3987257060006F2C44&quot;&gt;ISA&lt;/a&gt; docs.&lt;/p&gt;
&lt;h2&gt;General Purpose Registers&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;128 128bit registers, treated as different data types depending on the instruction used.
&lt;ul&gt;
&lt;li&gt;r0 (LR) &amp;#8212; Return Address / Link Register&lt;/li&gt;
&lt;li&gt;r1 (SP) &amp;#8212; Stack pointer information.
&lt;ul&gt;
&lt;li&gt;Word 0 &amp;#8212; current stack pointer (always 16-byte aligned, grows down)&lt;/li&gt;
&lt;li&gt;Word 1 &amp;#8212; bytes of available stack space&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;r2 &amp;#8212; Environment pointer (for languages that use one)&lt;/li&gt;
&lt;li&gt;r3&amp;#8211;r74 &amp;#8212; First 72 qwords of a function&amp;#8217;s argument list and its return value&lt;/li&gt;
&lt;li&gt;r75&amp;#8211;r79 &amp;#8212; Scratch registers&lt;/li&gt;
&lt;li&gt;r80&amp;#8211;r127 &amp;#8212; Local variable registers.  Preserved across function calls.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;FPSCR &amp;#8212; Floating-Point Status and Control Register&lt;/li&gt;
&lt;li&gt;Channels &amp;#8212; Used for various DMA operations, access to the decrementer, mailboxes and signalling.&lt;/li&gt;
&lt;li&gt;SRR0 &amp;#8212; Used to store the address of next instruction upon interrupt&lt;/li&gt;
&lt;li&gt;LSLR &amp;#8212; Local Store Limit Register.  0x0003ffff == 2&lt;sup&gt;18&lt;/sup&gt;-1 == 262143&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Memory model&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;.text at address 0&lt;/li&gt;
&lt;li&gt;Bottom of stack at 0x3ffff, effectively earlier if using -mstdmain.  (at least, afaict &amp;#8212; could look more closely at how -mstdmain actually works&amp;#8230;)&lt;/li&gt;
&lt;/ul&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Assembly Primer Part 1 — System Organization — PPC</title>
		<link href="http://brnz.org/hbr/?p=631"/>
		<id>http://brnz.org/hbr/?p=631</id>
		<updated>2010-11-22T11:10:44+00:00</updated>
		<content type="html">&lt;p&gt;I found the videos introducing assembly language &lt;a href=&quot;http://tools.securitytube.net/index.php?title=Open_Security_Training&quot;&gt;here&lt;/a&gt; to be of interest as my own understanding and experience with assembly is quite limited.  The videos are focussed on the ia32 architecture and reverse engineering, particularly for security exploits, and while these aspects don&amp;#8217;t really excite me, the videos are well made and clear and the &amp;#8220;Assembly Primer for Hackers&amp;#8221; videos cover general assembly programming and details of machine architecture that are more broadly applicable.&lt;/p&gt;
&lt;p&gt;I thought it would be interesting to work from these videos and make some notes on applying the concepts to the Cell BE&amp;#8217;s PPU and SPU.&lt;/p&gt;
&lt;p&gt;The platform I&amp;#8217;m using is Debian Sid on a PS3 (3.15 OtherOS) with the standard system toolchain.&lt;/p&gt;
&lt;p&gt;These are my notes for where I can see the PPU varying from the ia32, as presented in the video &lt;a href=&quot;http://www.securitytube.net/Assembly-Primer-for-Hackers-%28Part-1%29-System-Organization-video.aspx&quot;&gt;Part 1 &amp;#8212; System Organization&lt;/a&gt;.  Let me know if I&amp;#8217;ve missed something important, obvious or got something wrong.&lt;/p&gt;
&lt;p&gt;For reference, I&amp;#8217;m using the &lt;a href=&quot;http://www.ibm.com/developerworks/systems/library/es-archguide-v2.html&quot;&gt;PPC Architecture Books&lt;/a&gt; (also found in the Cell SDK) and &lt;a href=&quot;http://refspecs.linuxfoundation.org/ELF/ppc64/&quot;&gt;documentation for the PPC64 ABI&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Registers&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Branch Processor&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;CR Condition Register &amp;#8212; 32-bit. Provides a mechanism for testing (and branching). Eight 4-bit fields.
&lt;ul&gt;
&lt;li&gt;CR0&amp;#8211;CR1 &amp;#8212; Volatile condition code register fields&lt;/li&gt;
&lt;li&gt;CR2&amp;#8211;CR4 &amp;#8212; Nonvolatile condition code register fields&lt;/li&gt;
&lt;li&gt;CR5&amp;#8211;CR7 &amp;#8212; Volatile condition code register fields&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;LR Link Register (volatile) &amp;#8212; 64-bit.  Can be used to provide branch target address for Branch Conditional to Link Register instruction&lt;/li&gt;
&lt;li&gt;CTR Count Register (volatile) &amp;#8212; 64-bit.  Can be used to hold a loop count that can be decremented during execution of Branch instructions containing appropriately coded BO field.  Also can be used to provide branch target address for the Branch Conditional to Count Register instruction.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Fixed-Pt Processing&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;GPR0&amp;#8211;GPR31 &amp;#8212; 64-bit General Purpose registers. Byte, halfword, word or doubleword, depending on instruction flags.  Supports byte, halfword, word, doubleword operand fetches and stores to storage.
&lt;ul&gt;
&lt;li&gt;r0 &amp;#8212; Volatile register used in function prologs&lt;/li&gt;
&lt;li&gt;r1 &amp;#8212; Stack frame pointer&lt;/li&gt;
&lt;li&gt;r2 &amp;#8212; TOC pointer&lt;/li&gt;
&lt;li&gt;r3 &amp;#8212; Volatile parameter and return value register&lt;/li&gt;
&lt;li&gt;r4&amp;#8211;r10 &amp;#8212; Volatile registers used for function parameters&lt;/li&gt;
&lt;li&gt;r11 &amp;#8212; Volatile register used in calls by pointer and as an environment pointer for languages which require one&lt;/li&gt;
&lt;li&gt;r12 &amp;#8212; Volatile register used for exception handling and glink code&lt;/li&gt;
&lt;li&gt;r13﻿ ﻿&amp;#8212; Reserved for use as system thread ID&lt;/li&gt;
&lt;li&gt;r14&amp;#8211;r31 &amp;#8212; Nonvolatile registers used for local variables&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;XER Fixed-Point Exception Register (volatile) &amp;#8212; 64-bit.  Book I, p 32 has the details on this one.&lt;/li&gt;
&lt;li&gt;MSR Machine State Register &amp;#8212; 64-bit.  Defines the state of the processor. See Book III, p 10.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Float-Pt Processing&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;FPR0&amp;#8211;FPR31 Floating-Point Registers &amp;#8212; 64-bit. Single or double precision, depending on instruction flags.  Supports word and doubleword operand fetches and stores to storage.
&lt;ul&gt;
&lt;li&gt;f0 &amp;#8212; Volatile scratch register&lt;/li&gt;
&lt;li&gt;f1&amp;#8211;f4 &amp;#8212; Volatile floating point parameter and return value registers&lt;/li&gt;
&lt;li&gt;f5&amp;#8211;f13 &amp;#8212; Volatile floating point parameter registers&lt;/li&gt;
&lt;li&gt;f14&amp;#8211;f31 &amp;#8212; Nonvolatile registers&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;FPSCR Floading-Point Status and Control Register (volatile) &amp;#8212; 32-bit. Status and control bits. See Book1, pp 87&amp;#8211;89.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;VMX&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;v0&amp;#8211;v1 &amp;#8212; Volatile scratch registers&lt;/li&gt;
&lt;li&gt;v2&amp;#8211;v13 &amp;#8212; Volatile vector parameters registers&lt;/li&gt;
&lt;li&gt;v14&amp;#8211;v19 &amp;#8212; Volatile scratch registers&lt;/li&gt;
&lt;li&gt;v20&amp;#8211;v31 &amp;#8212; Non-volatile registers&lt;/li&gt;
&lt;li&gt;vrsave &amp;#8212; Non-volatile 32-bit register&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Privileged&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;SRR0 &amp;amp; SRR1 Machine Status Save/Restore registers &amp;#8212; 64-bit. Used to store machine state when an interrupt occurs.&lt;/li&gt;
&lt;li&gt;DAR Data Address Register &amp;#8212; 64-bit. Set by various interrupts to effective address associated with interrupt.&lt;/li&gt;
&lt;li&gt;DSISR Data Storage Interrupt Status Register &amp;#8212; 32-bit. Set to indicate the cause of various interrupts.&lt;/li&gt;
&lt;li&gt;SPRG0&amp;#8211;SPRG3 Software-use SPRs &amp;#8212; 64-bit.  For use by privileged software.&lt;/li&gt;
&lt;li&gt;CTRL Control Register &amp;#8212; 32-bit. Controls an external I/O pin.&lt;/li&gt;
&lt;li&gt;PVR Processor Version Register &amp;#8212; 32-bit. Read-only.&lt;/li&gt;
&lt;li&gt;PIR Processor Identification Register &amp;#8212; 32-bit.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;(there&amp;#8217;s some hypervisor regs not listed here, and probably others&amp;#8230;)&lt;/p&gt;
&lt;h2&gt;Virtual Memory Model&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Default/standard location for .text appears to be 0x1000000&lt;/li&gt;
&lt;li&gt;stack starts at 0xffffffff&lt;/li&gt;
&lt;/ul&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Enter the NaNo!</title>
		<link href="http://feedproxy.google.com/~r/krumpit/~3/zjns4pwu0eU/"/>
		<id>http://www.krumpit.org/2010/11/enter-the-nano/</id>
		<updated>2010-11-20T00:53:52+00:00</updated>
		<content type="html">&lt;p&gt;Some of you may know that I have been taking part in the craziness that is &lt;a href=&quot;http://www.nanowrimo.org/&quot;&gt;National Novel Writing Month&lt;/a&gt; (also known as NaNoWriMo, or just &amp;#8220;NaNo&amp;#8221;). It has been, at times, invigorating, exhilarating, rewarding, tiring, challenging, difficult, but mostly, &lt;em&gt;incredibly fun!&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;As Steve from &lt;a href=&quot;http://kestrelsaerie.com/&quot;&gt;Kestrel&amp;#8217;s Aerie&lt;/a&gt; has mentioned—the only regret I have is that I didn&amp;#8217;t take part last year. I would strongly recommend it to anyone who has ever said they would write a story &amp;#8220;one day&amp;#8221;. And to do it with a good support base. The gang over at the &lt;a href=&quot;http://saucyforums.arleenbarros.com/&quot;&gt;Saucy Wenches Forums&lt;/a&gt; have been my greatest source of inspiration, advice and encouragement. But, even if you don&amp;#8217;t have a captive audience of forum-goers that you can pounce on, NaNo has this &amp;#8220;built in&amp;#8221;—there are official community and regional forums that you can take part in.&lt;/p&gt;
&lt;p&gt;In no particular order, here are a few things I have learnt from NaNoWriMo.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3. I can write.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Not necessarily well, but I can sit down for hours upon hours and &lt;em&gt;write&lt;/em&gt;. And, more importantly, enjoy it. I think both of those are a great first step. Though I do harbour a small hope that other people will enjoy my writings too&amp;#8230;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2. Things that are worth doing take time and effort (and a dose of stubborn).&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt; &lt;/strong&gt;I have read some blog posts recently about &lt;a href=&quot;http://www.clockworkhare.com/2010/10/this-is-a-special-note-to-all-my-creative-friends.html&quot;&gt;creativity&lt;/a&gt; and &lt;a href=&quot;http://tamimoore.com/2010/motivation-is-a-skill-not-a-gift/&quot;&gt;achieving your goals&lt;/a&gt; that both really resonated with me. NaNoWriMo has also highlighted what has been filtering through my brain for a little while—that you need to work for your goals and stick to them, even when things seem hard. Sometimes you will need to give things up temporarily to keep your path and vision clear. Sometimes you might need to downgrade your goal. But the stubbornness, or obsessiveness, or self-motivation is—I think, I hope—what will get you where you want to be.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1. If I want to do something, I &lt;em&gt;can&lt;/em&gt; do it.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt; &lt;/strong&gt;A month ago I thought I could only barely make the 25,000 word mark for my novel writing. I actually sat down and calculated the time I had during the week, estimated how long it would take me to write. I thought 25,000 words would be&amp;#8230; possible. Yet here I am, sailing past 27,000 words, on track to meet the grand 50,000 word goal just handful of days past the end-of-month deadline. And I am still sane. Mostly &lt;img src=&quot;http://www.krumpit.org/wp-includes/images/smilies/icon_biggrin.gif&quot; alt=&quot;:D&quot; class=&quot;wp-smiley&quot; /&gt; &lt;/p&gt;
&lt;p&gt;So, to anyone who might be reading who has toyed with the idea of writing a story one day: you can do it! And there is no better time than November.&lt;/p&gt;
&lt;img src=&quot;http://feeds.feedburner.com/~r/krumpit/~4/zjns4pwu0eU&quot; height=&quot;1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>krumpit</name>
			<uri>http://www.krumpit.org</uri>
		</author>
		<source>
			<title type="html">krumpit</title>
			<subtitle type="html">the blog of maz musings and ponderings.</subtitle>
			<link rel="self" href="http://www.krumpit.org/?feed=rss2"/>
			<id>http://www.krumpit.org/?feed=rss2</id>
			<updated>2012-01-01T17:00:16+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Frame times are like pancakes</title>
		<link href="http://brnz.org/hbr/?p=550"/>
		<id>http://brnz.org/hbr/?p=550</id>
		<updated>2010-10-31T14:05:44+00:00</updated>
		<content type="html">&lt;p&gt;&lt;em&gt;Time to generate image data, no DMA:&lt;/em&gt; 0.015962s&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Time to generate data, with DMA to framebuffer:&lt;/em&gt; 0.048529s.  That&amp;#8217;s not good.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Total amount of data transferred:&lt;/em&gt; one 1080p frame &amp;#8212; ~8MB.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Measured average latency of 4*16KB DMA puts:&lt;/em&gt; 577µs &amp;#8212; ~1000 times slower than expected.  Something&amp;#8217;s really not right.&lt;/p&gt;
&lt;p&gt;&amp;#8230;&lt;/p&gt;
&lt;p&gt;Oh.&lt;/p&gt;
&lt;p&gt;First accesses to memory will be more expensive.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Time to generate and DMA first frame:&lt;/em&gt; 0.048529s&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Time to generate and DMA second frame:&lt;/em&gt; 0.016370s&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Time to generate and DMA subsequent frames:&lt;/em&gt; 0.015944s &amp;#8212; slightly faster than with no DMA.&lt;/p&gt;
&lt;p&gt;There&amp;#8217;s still plenty of work to be done before it&amp;#8217;s functional and interesting, but I may yet hit my goal of 60 fps for this project :)&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Averaging more unsigned chars</title>
		<link href="http://brnz.org/hbr/?p=541"/>
		<id>http://brnz.org/hbr/?p=541</id>
		<updated>2010-10-29T13:43:48+00:00</updated>
		<content type="html">&lt;p&gt;Some further thoughts, continuing on from my previous &lt;a href=&quot;http://brnz.org/hbr/?p=508&quot;&gt;average post&lt;/a&gt;&amp;#8230;&lt;/p&gt;
&lt;h3&gt;Alternate methods&lt;/h3&gt;
&lt;p&gt;sumb (sum bytes in halfwords) was an instruction I had overlooked,  and was pointed out to me by ralferoo.  sumb calculates the sums of the  four bytes of each word in two quadwords at a time. An add, rotate  and shuffle would be all that would be needed to turn the result from  two sumb calls into the desired averages.&lt;/p&gt;
&lt;p&gt;Unfortunately, the input  format I&amp;#8217;m using isn&amp;#8217;t well suited to sumb and it would appear to  require a prohibitive number of shuffles to prepare the data  appropriately &amp;#8211; that said, there&amp;#8217;s at least one place where I shuffle  data before calling average4() that may be able to utilise sumb, so I intend to keep it in mind.&lt;/p&gt;
&lt;p&gt;The avgb instruction calculates the average of the bytes in two quadwords.  It would be nice to be able to call avgb(avgb(a,b),avgb(c,d)) and to have the final result in 9 cycles, but there&amp;#8217;s a fix-up necessary to correct the rounding that takes place in the calculation of the first two averages, and I&amp;#8217;ve not yet been able to wrap my head around the correct method to do so.&lt;/p&gt;
&lt;h3&gt;Approximating&lt;/h3&gt;
&lt;p&gt;There are plenty of ways to very quickly get a result that is often &amp;#8212; but not always &amp;#8212; correct (like avgb).  One of these methods may be suitable for my particular needs, but I won&amp;#8217;t know until later.  My goal for now is to attain a result that is as correct as possible and consider ways of speeding it up later, if needed.&lt;/p&gt;
&lt;h3&gt;Adding&lt;/h3&gt;
&lt;p&gt;I&amp;#8217;m annoyed with myself that I missed this one, as I&amp;#8217;ve seen it several times recently: rounding can be performed correctly with an addition and truncation. Where I had&lt;/p&gt;
&lt;pre&gt;    // add up the lower bits
    qword L = si_a(si_a(si_andbi(a,3),si_andbi(b,3)),
                   si_a(si_andbi(c,3),si_andbi(d,3)));

    // shift right 2 bits, again masking out shifted-in high bits
    R = si_a(R, si_andbi(si_rotqmbii(L,-2), 3));

    // shift right and mask for the rounding bit
    R = si_a(R, si_andbi(si_rotqmbii(L,-1), 1));&lt;/pre&gt;
&lt;p&gt;adding 2 to each uchar before truncating with rotqmbii means that the last line can be eliminated altogether, so the whole function now looks like:&lt;/p&gt;
&lt;pre&gt;qword average4(qword a, qword b, qword c, qword d) {
    // shift each right by 2 bits, masking shifted-in bits from the result
    qword au = si_andbi(si_rotqmbii(a, -2), 0x3f);
    qword bu = si_andbi(si_rotqmbii(b, -2), 0x3f);
    qword cu = si_andbi(si_rotqmbii(c, -2), 0x3f);
    qword du = si_andbi(si_rotqmbii(d, -2), 0x3f);

    // add them all up
    qword R = si_a(si_a(au,bu), si_a(cu,du));

    // add up the lower bits
    qword L = si_a(si_a(si_andbi(a,3),si_andbi(b,3)),
                   si_a(si_andbi(c,3),si_andbi(d,3)));

    // add 2
    L = si_a(L, si_ilh(0x202));

    // shift right 2 bits, again masking out shifted-in high bits
    R = si_a(R, si_andbi(si_rotqmbii(L,-2), 3));

    return R;
}&lt;/pre&gt;
&lt;p&gt;The difference is pretty minor &amp;#8212; a couple of instructions and (when not inlined) it&amp;#8217;s no faster.  For the program it&amp;#8217;s used in I&amp;#8217;m seeing around a 1.5% runtime reduction.&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">ioctl() and the spu — a tale of many magics</title>
		<link href="http://brnz.org/hbr/?p=521"/>
		<id>http://brnz.org/hbr/?p=521</id>
		<updated>2010-10-28T03:44:20+00:00</updated>
		<content type="html">&lt;p&gt;I&amp;#8217;d achieved a working implementation of the small spu project I&amp;#8217;ve been messing around with and wanted to move on to start pushing particular pixels (rather than debugging in &lt;a href=&quot;http://pastie.org/1252592&quot;&gt;text mode&lt;/a&gt;). My program, up to this point, has been a simple spu-only piece of code (launched via the elfspe loader under Linux), and I was reluctant to tack on a some kind of ppu manager just to set up the framebuffer &amp;#8212; so, I though, why not do it from the spu itself? (Why not? Because it&amp;#8217;s a stupid idea and so on.)&lt;/p&gt;
&lt;p&gt;What&amp;#8217;s needed to &amp;#8220;set up the framebuffer&amp;#8221;?  Magic.  Fortunately, the magic has been well documented by Mike Acton and you can get the source &lt;a href=&quot;http://cellperformance.beyond3d.com/articles/2007/03/handy-ps3-linux-framebuffer-utilities.html&quot;&gt;here&lt;/a&gt;. The trick becomes merely to get those files compiled for the spu, and the biggest barrier to doing that is the &lt;a href=&quot;http://http://www.kernel.org/doc/man-pages/online/pages/man2/ioctl.2.html&quot;&gt;ioctl() system call&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;There was no existing way to call ioctl() directly from the spu and several possible approaches were apparent.&lt;/p&gt;
&lt;h3&gt;Callback handler in libspe&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;http://sourceforge.net/projects/libspe/&quot;&gt;libspe&lt;/a&gt; provides a number of callback functions for spu programs, allowing them some degree of access to and control of the wider system.  These are built on the &lt;a href=&quot;http://sourceware.org/cgi-bin/cvsweb.cgi/src/libgloss/spu/syscalls.c?rev=1.9&amp;content-type=text/x-cvsweb-markup&amp;cvsroot=src&quot;&gt;__send_to_ppe() function&lt;/a&gt; found in newlib. __send_to_ppe() packs up a function&amp;#8217;s arguments and stops the spu, signaling to libspe which of several handlers should be utilised.&lt;/p&gt;
&lt;p&gt;My first partially-working attempt to access ioctl() used this approach, and once I&amp;#8217;d worked out how to debug my way into libspe and back to the spu the solution was quite straightforward.  Particularly, libspe mmaps the spu&amp;#8217;s local store, making it possible to pass a pointer to the spu&amp;#8217;s local store directly to ioctl().&lt;/p&gt;
&lt;p&gt;The third argument to ioctl() can be a pointer or a value and so some decoding of the &amp;#8216;request&amp;#8217; argument would be required to handle particular cases correctly. While that&amp;#8217;s probably not too difficult (probably &amp;#8212; I&amp;#8217;m not clear on the details), it&amp;#8217;s beyond what I was interested in pursuing. For syscalls, though, there is a &amp;#8216;better&amp;#8217; way&amp;#8230;&lt;/p&gt;
&lt;h3&gt;Stopcode 0x2104&lt;/h3&gt;
&lt;p&gt;With __send_to_ppe(), newlib provides a similar &lt;a href=&quot;http://sourceware.org/cgi-bin/cvsweb.cgi/src/libgloss/spu/linux_syscalls.c?rev=1.2&amp;content-type=text/x-cvsweb-markup&amp;cvsroot=src&quot;&gt;__linux_syscall()&lt;/a&gt; function.  I couldn&amp;#8217;t make much sense of it when I first looked at it as the 0x2104 stopcode it uses is not intercepted by libspe. Instead, it is magic and is &lt;a href=&quot;http://lkml.org/lkml/2006/1/17/288&quot;&gt;intercepted directly by the kernel&lt;/a&gt; for the express purpose of handling syscalls. Hooray?&lt;/p&gt;
&lt;p&gt;Almost. If the third argument to ioctl() is a pointer, it needs to contain a valid ea. Unfortunately, there appears to be no sane way for a spu to mmap it&amp;#8217;s own local store, meaning an lsa cannot be converted to a valid ea without some external assistance, and so we must consider other options&amp;#8230;&lt;/p&gt;
&lt;h3&gt;__ea&lt;/h3&gt;
&lt;p&gt;Named address spaces are an extension to the C language that provide a way to access eas from a spu in a somewhat transparent fashion.  On the spu, these work by qualifying pointers with __ea to indicate that they contain an ea, and the complier handles the intervening magic (gcc-4.5 and the various versions of gcc and xlc that have shipped with the IBM SDK have support for this extension).&lt;/p&gt;
&lt;p&gt;While this method might work, I didn&amp;#8217;t want to give up a chunk of my local store for the software cache that the implementation in gcc uses &amp;#8212; I have a hunch that I&amp;#8217;ll will almost run out of space when I add some extra DMA buffers to this program. (And I&amp;#8217;m not sure what&amp;#8217;s needed to get  __ea storage working correctly without a separate ppu context).&lt;/p&gt;
&lt;h3&gt;A more convoluted method&lt;/h3&gt;
&lt;p&gt;In the absence of a neater approach, here&amp;#8217;s how I got it working:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;mmap some scratch space in main memory (using mmap_eaddr() from newlib)&lt;/li&gt;
&lt;li&gt;call ioctl() with the address of that scratch space&lt;/li&gt;
&lt;li&gt;DMA the data from the scratch space to local store&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Something like:&lt;/p&gt;
&lt;pre&gt;void* scratch = (void*)(uint32_t)mmap_eaddr(0ULL, size, PROT_READ|PROT_WRITE,
                                            MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
ioctl(fb_fd, FBIOGET_VBLANK, scratch);
struct fb_vblank vblank;
spu_mfcdma32(&amp;amp;vblank, (uint32_t)scratch, ROUNDUP16(sizeof(vblank)),
             0, MFC_GET_CMD);
mfc_write_tag_mask(1);
spu_mfcstat(MFC_TAG_UPDATE_ALL);&lt;/pre&gt;
&lt;p&gt;And so, ugly as it is, I can now call ioctl() from spu code.  Lather, rinse &amp;amp; repeat as desired.&lt;/p&gt;
&lt;p&gt;Of course, there were a few other problems to solve: because I was compiling cp_{fb,vt}.c for the spu but using the (ppu) system headers to get the fb defns, the compiler sees the prototypes for the system mmap, munmap, printf and snprintf functions. Extra wrappers are needed for each of those (and so I now know about the v*printf family).&lt;/p&gt;
&lt;p&gt;Once all that is done, it works. I can push pixels to the screen from the spu.&lt;/p&gt;
&lt;p&gt;Flipping and vsync is an interesting, and slightly awkward, case as they are passed the address of a value, not the value itself (for no readily apparent reason), so the values are allocated early on and referenced as needed.&lt;/p&gt;
&lt;p&gt;The implementation can be found &lt;strong&gt;&lt;a href=&quot;http://brnz.org/f/fb_spu_test.tar.gz &quot;&gt;here&lt;/a&gt;&lt;/strong&gt;. It&amp;#8217;s functional. :)  There are many opportunities to tidy it up and simplify it. Right now it&amp;#8217;s a fairly direct and naive port from the original.&lt;/p&gt;
&lt;p&gt;My thanks to Mike Acton for the original setup code, and to Ken Werner for helping me get my head around the problem and its possible solutions.&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Averaging unsigned chars</title>
		<link href="http://brnz.org/hbr/?p=508"/>
		<id>http://brnz.org/hbr/?p=508</id>
		<updated>2010-10-24T15:26:20+00:00</updated>
		<content type="html">&lt;p&gt;I&amp;#8217;ve been toying with implementing the diamond-square algorithm (for a colourful plasma effect) on the spu. The value of each pixel is calculated by averaging values of the pixels around it.&lt;/p&gt;
&lt;p&gt;Originally, I toyed with calculating the average by unpacking the pixel uchars, converting to float, performing the calculations, converting back and repacking. This seemed to work and made the calculation nice and simple. (And the scaling factor provided by cuflt/cfltu meant I could avoid some other computation when randomly-perturbing the result, which was nice). Regardless, I did wonder what it would take to process the uchars directly.&lt;/p&gt;
&lt;p&gt;To begin with, it is clear that (a + b + c + d)/4 = (a/4 + b/4 + c/4 + d/4). Division by powers of two are able to be quickly approximated with shifts, and doing so will prevent overflow in the case that (a + b + c + d)&amp;gt;255, so we get&lt;/p&gt;
&lt;pre&gt;R = (a&amp;gt;&amp;gt;2) + (b&amp;gt;&amp;gt;2) + (c&amp;gt;&amp;gt;2) + (d&amp;gt;&amp;gt;2);&lt;/pre&gt;
&lt;p&gt;but R will be as much as 3 less than the actual average.  To fix this up, the average of the lower two bits can be calculated and added back to the result.&lt;/p&gt;
&lt;pre&gt;L = (a&amp;amp;3) + (b&amp;amp;3) + (c&amp;amp;3) + (d&amp;amp;3); // sum the lower two bits of each point
R += (L&amp;gt;&amp;gt;2);   // divide by four and add to the result
R += (L&amp;gt;&amp;gt;1)&amp;amp;1; // round up based on the sum of lower bits&lt;/pre&gt;
&lt;p&gt;R should be an accurate average of the four uchars, without overflow.&lt;/p&gt;
&lt;p&gt;Because there&amp;#8217;s no overflow, this will work with sixteen uchars at a time &amp;#8211; with a little care to deal with the lack of certain byte-centric spu instructions.&lt;/p&gt;
&lt;pre&gt;qword average4(qword a, qword b, qword c, qword d) {
    // shift each right by 2 bits, masking shifted-in bits from the result
    qword au = si_andbi(si_rotqmbii(a, -2), 0x3f);
    qword bu = si_andbi(si_rotqmbii(b, -2), 0x3f);
    qword cu = si_andbi(si_rotqmbii(c, -2), 0x3f);
    qword du = si_andbi(si_rotqmbii(d, -2), 0x3f);

    // add them all up
    qword R = si_a(si_a(au,bu), si_a(cu,du));

    // add up the lower bits
    qword L = si_a(si_a(si_andbi(a,3),si_andbi(b,3)),
                   si_a(si_andbi(c,3),si_andbi(d,3)));

    // shift right 2 bits, again masking out shifted-in high bits
    R = si_a(R, si_andbi(si_rotqmbii(L,-2), 3));

    // shift right and mask for the rounding bit
    R = si_a(R, si_andbi(si_rotqmbii(L,-1), 1));
    return R;
}&lt;/pre&gt;
&lt;p&gt;(24 instructions &amp;#8211; 20ish cycles)&lt;/p&gt;
&lt;p&gt;While it is fast enough for my present use, I&amp;#8217;m sure it&amp;#8217;s ripe for improvement.&lt;/p&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;
&lt;pre&gt;qword&lt;/pre&gt;
&lt;/div&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">The Power is Yours…. The O advantage</title>
		<link href="http://notameerkat.wordpress.com/2010/09/28/the-power-is-yours-the-o-advantage/"/>
		<id>http://notameerkat.wordpress.com/2010/09/28/the-power-is-yours-the-o-advantage/</id>
		<updated>2010-09-28T13:00:04+00:00</updated>
		<content type="html">I have received a lot of advice about Ultimate Frisbee in the years that I have been playing. Due to the nature of our community much of this advice has been welcome and positive. I&amp;#8217;ve definitely been able to develop my game based upon things that other players have said to me. That said, certain [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=notameerkat.wordpress.com&amp;blog=7367898&amp;post=131&amp;subd=notameerkat&amp;ref=&amp;feed=1&quot; width=&quot;1&quot; height=&quot;1&quot; /&gt;</content>
		<author>
			<name>Not a Meerkat</name>
			<uri>http://notameerkat.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Not a Meerkat</title>
			<subtitle type="html">Jase's life, the universe and everything..</subtitle>
			<link rel="self" href="http://notameerkat.wordpress.com/feed/rss/"/>
			<id>http://notameerkat.wordpress.com/feed/rss/</id>
			<updated>2010-09-28T13:00:04+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">It’s official, running with a backpack sucks!</title>
		<link href="http://notameerkat.wordpress.com/2010/09/22/its-official-running-with-a-backpack-sucks/"/>
		<id>http://notameerkat.wordpress.com/2010/09/22/its-official-running-with-a-backpack-sucks/</id>
		<updated>2010-09-22T08:00:03+00:00</updated>
		<content type="html">I have often seen people running with a backpack and thought that it would be extremely annoying. As a kid I ran with a backpack a few times and found it to be very uncomfortable. However, I thought that with a decent backpack and some running experience maybe it wouldn&amp;#8217;t be so bad. I can [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=notameerkat.wordpress.com&amp;blog=7367898&amp;post=130&amp;subd=notameerkat&amp;ref=&amp;feed=1&quot; width=&quot;1&quot; height=&quot;1&quot; /&gt;</content>
		<author>
			<name>Not a Meerkat</name>
			<uri>http://notameerkat.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Not a Meerkat</title>
			<subtitle type="html">Jase's life, the universe and everything..</subtitle>
			<link rel="self" href="http://notameerkat.wordpress.com/feed/rss/"/>
			<id>http://notameerkat.wordpress.com/feed/rss/</id>
			<updated>2010-09-28T13:00:04+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">What the Brownlow Medal isn’t</title>
		<link href="http://ireckon.net/2010/09/what-the-brownlow-medal-isnt/"/>
		<id>http://ireckon.net/?p=363</id>
		<updated>2010-09-21T14:04:43+00:00</updated>
		<content type="html">&lt;p&gt;So, &lt;a href=&quot;https://secure.wikimedia.org/wikipedia/en/wiki/Chris_Judd&quot;&gt;Chris Judd&lt;/a&gt; has won the 2010 &lt;a href=&quot;https://secure.wikimedia.org/wikipedia/en/wiki/Brownlow_Medal&quot;&gt;Chas Brownlow Trophy&lt;/a&gt;, and some people aren&amp;#8217;t very happy about it. I reckon this is because they misunderstand what the award is.&lt;/p&gt;
&lt;h4&gt;The Brownlow Medal&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;is&lt;/strong&gt; an award given to an AFL player in recognition of a good season. It&amp;#8217;s considered to be the highest individual award in the competition, which is more due to its history and status (not to mention how much the media loves to pump it up) than any other consideration.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;isn&amp;#8217;t&lt;/strong&gt; an accurate indication of the &amp;#8220;best&amp;#8221; player of the year. The winner is always among the best players and in some years we might agree that the winner was the very best, but that&amp;#8217;s not too often.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Chris Judd is a champion and his great year has been recognised. Good, he deserves it. I&amp;#8217;ve always been a critic of the Brownlow, though &amp;#8211; not of the medal itself, but of what it&amp;#8217;s held up to be. Footy followers think that it should always be awarded to the best player of the year (and they always claim know who that player is!) but there are two big problems that hinder it from happening.&lt;/p&gt;
&lt;h4&gt;Problem 1: The umpires cast the votes&lt;/h4&gt;
&lt;p&gt;The umpires have a lot to do during a match, and they spend most of it chasing after the ball. Consequently they see a lot of action from the midfielders, and may miss some of the more subtle parts of the game. They also have a different interest in the game than the average viewer, and they&amp;#8217;re charged with finding the &amp;#8220;fairest and best&amp;#8221; player of the match, so they probably take things other than sheer brilliance into account. Finally, the Brownlow is an individual medal in a team game, which is  always  problematic. Individual skill needs to be recognised, but I think the  way they execute their team plan should also be considered, and the umpire can&amp;#8217;t  possibly  judge that.&lt;/p&gt;
&lt;h4&gt;Problem 2: It has a poor voting system&lt;/h4&gt;
&lt;p&gt;At the end of a game, the umpires allocate their 3-2-1 votes to three separate players. This is the case regardless of whether a match is marked by a big team effort, or whether a few players did all the work. There aren&amp;#8217;t enough votes to go around &amp;#8211; some good players miss out entirely, and sometimes three votes aren&amp;#8217;t enough to measure the influence a player had on the game.&lt;/p&gt;
&lt;h4&gt;The Solution&lt;/h4&gt;
&lt;p&gt;We already have an award that does a pretty good job of finding the best player of the year, and it&amp;#8217;s the &lt;em&gt;&lt;a href=&quot;http://aflca.com.au/&quot;&gt;AFL Coaches Association&lt;/a&gt; Champion Player of the Year&lt;/em&gt;. What makes this award so good is that it addresses both of the above problems. It&amp;#8217;s voted by the coaches, who have the perfect understanding of how well each player filled their given role. They also know which opposition players caused them the most problems. Although the flashier players will usually still get more votes, this opens it up a little more to the less glamorous roles, like defenders.&lt;/p&gt;
&lt;p&gt;It also has a reasonable scoring system. Each coach picks five players to award votes on a 5-4-3-2-1 scale. That&amp;#8217;s a total of thirty votes between the two coaches. Sometimes the two coaches&amp;#8217; choices overlap, sometimes not. The high scoring system separates the best from the rest in a more definite way than the lower-scored Brownlow. It&amp;#8217;s still not ideal, but it&amp;#8217;s an improvement. It did a good job at ranking the best players this year:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;2010 AFLCA Champion Player of the Year&lt;/strong&gt;&lt;br /&gt;
114 &amp;#8211; &lt;a href=&quot;https://secure.wikimedia.org/wikipedia/en/wiki/Dane_Swan&quot;&gt;Dane Swan&lt;/a&gt; (Collingwood)&lt;br /&gt;
88 &amp;#8211; &lt;a href=&quot;https://secure.wikimedia.org/wikipedia/en/wiki/Luke_Hodge&quot;&gt;Luke Hodge&lt;/a&gt; (Hawthorn)&lt;br /&gt;
80 &amp;#8211; &lt;a href=&quot;https://secure.wikimedia.org/wikipedia/en/wiki/Joel_Selwood&quot;&gt;Joel Selwood&lt;/a&gt; (Geelong)&lt;br /&gt;
75 &amp;#8211; &lt;a href=&quot;https://secure.wikimedia.org/wikipedia/en/wiki/Aaron_Sandilands&quot;&gt;Aaron Sandilands&lt;/a&gt; (Fremantle)&lt;br /&gt;
71 &amp;#8211; &lt;a href=&quot;https://secure.wikimedia.org/wikipedia/en/wiki/Chris_Judd&quot;&gt;Chris Judd&lt;/a&gt; (Carlton)&lt;br /&gt;
70 &amp;#8211; &lt;a href=&quot;https://secure.wikimedia.org/wikipedia/en/wiki/Gary_Ablett,_Jr.&quot;&gt;Gary Ablett&lt;/a&gt; (Geelong)&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;But even the AFLCA put Judd in the top five for 2010, so those who claimed that Judd didn&amp;#8217;t even deserve to make the &lt;a href=&quot;https://secure.wikimedia.org/wikipedia/en/wiki/2010_All-Australian_team&quot;&gt;All-Australian team&lt;/a&gt; can get stuffed.&lt;/p&gt;
&lt;h4&gt;Sad face&lt;/h4&gt;
&lt;p&gt;The stature of the Brownlow drowns out the other awards, and so everyone &amp;#8211; the public, the media, the players &amp;#8211; puts their faith in the Brownlow and demands that it be awarded to the clear player of the year. We don&amp;#8217;t always see eye-to-eye on who that player is, but in 2010 everyone seems to agree that it was &lt;a href=&quot;https://secure.wikimedia.org/wikipedia/en/wiki/Dane_Swan&quot;&gt;Dane Swan&lt;/a&gt;, so the knockers have been more vocal than usual. Swan did have a great year, and Brownlow night must have been a terrible let-down given that the media had already awarded it to him. But that doesn&amp;#8217;t make Judd any less a champion: he had a great year, and he deserves his award. It&amp;#8217;s a shame to see people attacking him with their &lt;a href=&quot;http://ireckon.net/uploads/2010/09/eddiebrownlow.jpg&quot;&gt;disappointment&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The Brownlow simply isn&amp;#8217;t the award that the public wants it to be. It awards something unique &amp;#8211; something you can&amp;#8217;t quite &lt;a href=&quot;http://ireckon.net/uploads/2010/09/pressurepoint.jpg&quot;&gt;put your finger on&lt;/a&gt; &amp;#8211; and it would be great if people recognised and appreciated that. It would also be great if the coaches award was elevated to a higher importance to fill the &amp;#8220;best player&amp;#8221; void. The TV networks wouldn&amp;#8217;t go much on it &amp;#8211; the count would probably be decided earlier in the evening and the winner would rarely be a surprise &amp;#8211; but the public would get the result they want. And maybe they&amp;#8217;d stop knocking champions for their success.&lt;/p&gt;
&lt;p&gt;But that probably won&amp;#8217;t happen as long as there are Collingwood supporters.&lt;/p&gt;</content>
		<author>
			<name>i reckon</name>
			<uri>http://ireckon.net</uri>
		</author>
		<source>
			<title type="html">i reckon</title>
			<subtitle type="html">but i'm no authority</subtitle>
			<link rel="self" href="http://ireckon.net/feed/"/>
			<id>http://ireckon.net/feed/</id>
			<updated>2011-03-06T11:00:06+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Focusing on the positives….</title>
		<link href="http://notameerkat.wordpress.com/2010/09/21/focusing-on-the-positives/"/>
		<id>http://notameerkat.wordpress.com/2010/09/21/focusing-on-the-positives/</id>
		<updated>2010-09-21T09:00:05+00:00</updated>
		<content type="html">Last night I played in the grand final for our Tasmanian Ultimate Challenge (TUC) league. This league is considered the &amp;#8220;premier&amp;#8221; league of Ultimate in Tasmania which essentially means that it is the highest skill level game you&amp;#8217;re going to get without joining a state team and heading to a mainland tournament. The team I [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=notameerkat.wordpress.com&amp;blog=7367898&amp;post=124&amp;subd=notameerkat&amp;ref=&amp;feed=1&quot; width=&quot;1&quot; height=&quot;1&quot; /&gt;</content>
		<author>
			<name>Not a Meerkat</name>
			<uri>http://notameerkat.wordpress.com</uri>
		</author>
		<source>
			<title type="html">Not a Meerkat</title>
			<subtitle type="html">Jase's life, the universe and everything..</subtitle>
			<link rel="self" href="http://notameerkat.wordpress.com/feed/rss/"/>
			<id>http://notameerkat.wordpress.com/feed/rss/</id>
			<updated>2010-09-28T13:00:04+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">“Layers are Leaking”</title>
		<link href="http://brnz.org/hbr/?p=491"/>
		<id>http://brnz.org/hbr/?p=491</id>
		<updated>2010-08-12T01:20:01+00:00</updated>
		<content type="html">&lt;p&gt;Andrew Richards (&lt;a href=&quot;http://twitter.com/codeandrew&quot;&gt;@codeandrew&lt;/a&gt;), the CEO of Codeplay posted an article &lt;a href=&quot;http://www.codeplay.com/en/resources/technical-articles/226-layers-are-leaking&quot;&gt;&amp;#8220;Layers are Leaking&amp;#8221;&lt;/a&gt;, which inspired some thoughts &amp;#8211; tangential and perpendicular &amp;#8211;  beyond what I could reasonably fit into a stream of tweets (not that that stopped me trying).&lt;/p&gt;
&lt;p&gt;From the article:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;If you look at any computer system architecture diagram (and there are many) you will almost always see a series of &amp;#8220;layers&amp;#8221; on top of each other. Each layer is based on a layer underneath. It is a very common pattern in computers, and I believe that it is fundamental to the success of the development of computer technology. What layers allow you to do, is let individual people concentrate on only one part of a problem.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;This brought to mind the &lt;a href=&quot;http://research.microsoft.com/en-us/um/people/gbell/Computer_Structures__Readings_and_Examples/00000023.htm&quot;&gt;first chapter&lt;/a&gt; of Bell &amp;amp; Newell&amp;#8217;s Computer Structures book from 1971, which illustrates this kind of layering idea.  Additionally, I was reminded of Jeannette Wing&amp;#8217;s excellent &lt;a href=&quot;http://www.cs.cmu.edu/afs/cs/usr/wing/www/publications/Wing06.pdf&quot;&gt;Computational Thinking&lt;/a&gt; article which (amongst other things) makes the case that this type of thinking, associated with computer science, is something that is worth teaching and applying more widely.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;But, recently, the layers have started leaking.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I don&amp;#8217;t really agree that this is a recent thing (layers leak, abstractions change &amp;#8211; some leaks are more obvious than others), but the article refers to the significant changes that have come about in the eternal quest for faster computation, and the difficulties involved in replacing established abstractions. Renegotiating the interface between two layers is difficult when the people responsible for each layer don&amp;#8217;t speak the same technical language. What&amp;#8217;s worse is trying to change the interface to one layer without adequately considering the consequences to other layers in the system. I think time-consuming discussion and debate is inevitable, and it is not inherently a reason to avoid changing an otherwise broken abstraction.&lt;/p&gt;
&lt;p&gt;A number of the problems (or &amp;#8211; dare I cliché it &amp;#8211; opportunities) that are appearing with regard to increasingly parallel computation are not new. Consider Peter Denning&amp;#8217;s &lt;a href=&quot;http://cacm.acm.org/magazines/2010/6/92479-the-resurgence-of-parallelism/fulltext&quot;&gt;recent article&lt;/a&gt;. I find it interesting that a number of the suggested solutions involve changes to deeply ingrained abstractions (like programming languages) for which there would be (is) significant resistance to change.&lt;/p&gt;
&lt;p&gt;I read an &lt;a href=&quot;http://www.wired.com/magazine/2010/07/ff_fred_brooks/&quot;&gt;interview&lt;/a&gt; with Fred Brooks recently, and the following quote stood out:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Software is not the exception; hardware is the exception. No technology in history has had the kind of rapid cost/performance gains that computer hardware has enjoyed. Progress in software is more like progress in automobiles or airplanes: We see steady gains, but they’re incremental.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Which echoes something that Andrew said in another article (&amp;#8220;Why Intel Larrabee Really Stumbled&amp;#8221; &amp;#8211; google cache is &lt;a href=&quot;http://webcache.googleusercontent.com/search?q=cache:YRV_rqy6i6kJ:www.brightsideofnews.com/print/2010/5/27/why-intel-larrabee-really-stumbled-developer-analysis.aspx&quot;&gt;here&lt;/a&gt;)&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Infinite Truth: Software takes longer to develop than Hardware&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;A lot of time has been spent on steady, incremental gains for software that attempts to work around the limitations of many common layer abstractions &amp;#8211; examples that spring to mind include compiling general purpose programs for small register sets, converting scalar programs to utilise vector instructions, and trying to make parallelism out of inherently single threaded code. We can&amp;#8217;t necessarily redesign our systems to make these problems go away, but I think we can strive to address these problems in the best way possible &amp;#8211; which will likely involve reshuffling some layers in the process. It&amp;#8217;s likely to be messy, time consuming, and require a lot of hard work.&lt;/p&gt;
&lt;p&gt;Sounds like fun :)&lt;/p&gt;
&lt;p&gt;My thanks to Andrew for his thought-provoking article.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Additional:&lt;/em&gt;&lt;br /&gt;
Stephen Hill (&lt;a href=&quot;http://twitter.com/self_shadow&quot;&gt;@self_shadow&lt;/a&gt;) &lt;a href=&quot;http://twitter.com/self_shadow/status/20935841301&quot;&gt;tweeted&lt;/a&gt; links to wikipedia on &lt;a href=&quot;http://en.wikipedia.org/wiki/Leaky_abstraction&quot;&gt;Leaky abstractions&lt;/a&gt;, and &lt;a href=&quot;http://www.joelonsoftware.com/articles/LeakyAbstractions.html&quot;&gt;a related article&lt;/a&gt; by Joel Spolsky.&lt;/p&gt;
&lt;div id=&quot;_mcePaste&quot;&gt;But, recently, the layers have started leaking.&lt;/div&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">This is now the old blog.</title>
		<link href="http://forumjoe.wordpress.com/2010/06/10/thisistheoldblog/"/>
		<id>http://forumjoe.wordpress.com/2010/06/10/thisistheoldblog/</id>
		<updated>2010-06-10T01:00:14+00:00</updated>
		<content type="html">I&amp;#8217;ve moved and renamed my blog. You can find it here: http://joeapproachesinfinity.wordpress.com/ I will not be posting on this one anymore. If you are subscribed, please unsubscribe and subscribe to my new one. Thanks. Filed under: Uncategorized&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=forumjoe.wordpress.com&amp;blog=8455381&amp;post=143&amp;subd=forumjoe&amp;ref=&amp;feed=1&quot; /&gt;</content>
		<author>
			<name>This is my old blog.</name>
			<uri>http://forumjoe.wordpress.com</uri>
		</author>
		<source>
			<title type="html">This is my old blog.</title>
			<subtitle type="html">go to http://joeapproachesinfinity.wordpress.com/</subtitle>
			<link rel="self" href="http://forumjoe.wordpress.com/feed/rss/"/>
			<id>http://forumjoe.wordpress.com/feed/rss/</id>
			<updated>2010-06-10T01:00:14+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">International Comparisons of Maths Teachers</title>
		<link href="http://forumjoe.wordpress.com/2010/05/19/international-comparisons-of-maths-teachers/"/>
		<id>http://forumjoe.wordpress.com/2010/05/19/international-comparisons-of-maths-teachers/</id>
		<updated>2010-05-19T01:00:18+00:00</updated>
		<content type="html">I'm going to be creating a survey.  Here are the questions, give me feedback on the survey before I publish it.&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=forumjoe.wordpress.com&amp;blog=8455381&amp;post=103&amp;subd=forumjoe&amp;ref=&amp;feed=1&quot; /&gt;</content>
		<author>
			<name>This is my old blog.</name>
			<uri>http://forumjoe.wordpress.com</uri>
		</author>
		<source>
			<title type="html">This is my old blog.</title>
			<subtitle type="html">go to http://joeapproachesinfinity.wordpress.com/</subtitle>
			<link rel="self" href="http://forumjoe.wordpress.com/feed/rss/"/>
			<id>http://forumjoe.wordpress.com/feed/rss/</id>
			<updated>2010-06-10T01:00:14+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Steven Strogatz’s Opinionator – NY Times</title>
		<link href="http://forumjoe.wordpress.com/2010/05/18/steven-strogatzs-opinionator-ny-times/"/>
		<id>http://forumjoe.wordpress.com/2010/05/18/steven-strogatzs-opinionator-ny-times/</id>
		<updated>2010-05-18T12:00:18+00:00</updated>
		<content type="html">I&amp;#8217;ve just spent an evening reading and re-reading Steven Strogatz series of Opinionator editorials in the new york times: http://opinionator.blogs.nytimes.com/category/steven-strogatz/ I&amp;#8217;m absolutely amazed at Strogatz&amp;#8217;s ability to explain complex mathematical topics in a way that is understandable by most adults.  The links he provides in his notes sections go to incredible websites that provide hours [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=forumjoe.wordpress.com&amp;blog=8455381&amp;post=100&amp;subd=forumjoe&amp;ref=&amp;feed=1&quot; /&gt;</content>
		<author>
			<name>This is my old blog.</name>
			<uri>http://forumjoe.wordpress.com</uri>
		</author>
		<source>
			<title type="html">This is my old blog.</title>
			<subtitle type="html">go to http://joeapproachesinfinity.wordpress.com/</subtitle>
			<link rel="self" href="http://forumjoe.wordpress.com/feed/rss/"/>
			<id>http://forumjoe.wordpress.com/feed/rss/</id>
			<updated>2010-06-10T01:00:14+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">spu_µopt[0] // shifting and arrays</title>
		<link href="http://brnz.org/hbr/?p=468"/>
		<id>http://brnz.org/hbr/?p=468</id>
		<updated>2010-05-07T02:08:21+00:00</updated>
		<content type="html">&lt;p&gt;There are a couple of mostly-obvious SPU micro-optimisation tricks that I&amp;#8217;ve learned.  Here&amp;#8217;s one.&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;qword a[128];
qword f(int i) {
    return a[i&amp;gt;&amp;gt;4];
}
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;Simple enough code. spu-gcc -O3 produces&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;f:                                                                                                                                                                                                                                                                                                                          
    ila     $2,a                                                                                                                                                                                                                                                                                                        
    andi    $3,$3,-16                                                                                                                                                                                                                                                                                                   
    lqx     $3,$2,$3                                                                                                                                                                                                                                                                                                    
    bi      $lr
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;And it&amp;#8217;s worse if the shift is not 4 &amp;#8211; here&amp;#8217;s the result of using 5:&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;f:
    rotmai  $4,$3,-5
    ila     $2,a
    shli    $3,$4,4
    lqx     $3,$2,$3
    bi      $lr&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;Which is pretty ugly.&lt;/p&gt;
&lt;p&gt;The compiler is doing what it has been asked to do, but doesn&amp;#8217;t appear to know that SPU load and store instructions force the four rightmost bits of the calculated address to zero.  Which means the andi masking can be removed from the first case, and in the second the shift right and shift left instructions could be replaced with a single shift right &amp;#8211; without changing the result.&lt;/p&gt;
&lt;p&gt;How to avoid it?  I&amp;#8217;ve used manual pointer arithmetic to get around this compiler feature, e.g.&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;return *(qword*)((uint)a+i)
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;Which is pretty ugly.&lt;/p&gt;
&lt;p&gt;I don&amp;#8217;t know what that sort of thing does for the compiler&amp;#8217;s alias analysis. Probably nothing good (judicious use of restrict might help&amp;#8230;).  si_lqx() would also work, but my  experience &amp;#8211; without in-depth  examination &amp;#8211; is that measured performance  gets worse when using load  and store intrinsics. I&amp;#8217;m not sure if it&amp;#8217;s something to do with  scheduling, aliasing or programmer competence.&lt;/p&gt;
&lt;p&gt;When would this ever matter? I&amp;#8217;ve run into this in some very hot lookup table access. Two or four less cycles can make a big difference. Sometimes. (If it really matters, rewriting the whole thing in assembly can work, too)&lt;/p&gt;
&lt;p&gt;It&amp;#8217;s a micro-optimisation &amp;#8211; measure often, use with care.&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Deleting a Facebook Account</title>
		<link href="http://wilde.id.au/?p=52"/>
		<id>http://wilde.id.au/?p=52</id>
		<updated>2010-04-26T08:27:57+00:00</updated>
		<content type="html">&lt;p&gt;Is a lot harder than you would think.  I decided to delete mine today, and couldn&amp;#8217;t find a way of doing it from within facebook.    I hardly use it anymore, and there have been some worrisome changes made to the facebook settings recently (not just the latest one, but over the last year or so).  So basically I don&amp;#8217;t really trust having any info stored in facebook anymore &amp;#8230;. it might be time to checkout twitter &lt;img src=&quot;http://wilde.id.au/wp-includes/images/smilies/icon_wink.gif&quot; alt=&quot;;)&quot; class=&quot;wp-smiley&quot; /&gt; &lt;/p&gt;
&lt;p&gt;You can delete your facebook account by logging into facebook and then cutting and pasting this link : &lt;strong&gt;&lt;a title=&quot;http://www.facebook.com/help/contact.php?show_form=delete_account&quot; rel=&quot;nofollow&quot; href=&quot;http://www.facebook.com/help/contact.php?show_form=delete_account&quot;&gt;http&lt;/a&gt;&lt;/strong&gt;&lt;a title=&quot;http://www.facebook.com/help/contact.php?show_form=delete_account&quot; rel=&quot;nofollow&quot; href=&quot;http://www.facebook.com/help/contact.php?show_form=delete_account&quot;&gt;://www.facebook.com/help/contact.php?show_form=delete_account&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I took the precaution of deleting other info, and changing privacy settings to maximum before I deleted, not that I&amp;#8217;m sure it makes any difference (or that using the delete link above removes it from history)&lt;/p&gt;</content>
		<author>
			<name>Wilde On!</name>
			<uri>http://wilde.id.au</uri>
		</author>
		<source>
			<title type="html">Wilde On!</title>
			<subtitle type="html">&lt;h1&gt;It works!&lt;/h1&gt;</subtitle>
			<link rel="self" href="http://wilde.id.au/?feed=rss2"/>
			<id>http://wilde.id.au/?feed=rss2</id>
			<updated>2010-04-28T23:00:11+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Matt and Trace’s Wedding</title>
		<link href="http://forumjoe.wordpress.com/2010/03/28/matt-and-traces-wedding/"/>
		<id>http://forumjoe.wordpress.com/2010/03/28/matt-and-traces-wedding/</id>
		<updated>2010-03-27T23:00:12+00:00</updated>
		<content type="html">Welcome, everyone, to this day of fun
Set-up in this delightful marquee
Today it's my pleasure, to make this party a treasure
for the afternoon I'll be your EMCEE&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=forumjoe.wordpress.com&amp;blog=8455381&amp;post=97&amp;subd=forumjoe&amp;ref=&amp;feed=1&quot; /&gt;</content>
		<author>
			<name>This is my old blog.</name>
			<uri>http://forumjoe.wordpress.com</uri>
		</author>
		<source>
			<title type="html">This is my old blog.</title>
			<subtitle type="html">go to http://joeapproachesinfinity.wordpress.com/</subtitle>
			<link rel="self" href="http://forumjoe.wordpress.com/feed/rss/"/>
			<id>http://forumjoe.wordpress.com/feed/rss/</id>
			<updated>2010-06-10T01:00:14+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">20100319 photographs</title>
		<link href="http://brnz.org/hbr/?p=447"/>
		<id>http://brnz.org/hbr/?p=447</id>
		<updated>2010-03-18T13:09:51+00:00</updated>
		<content type="html">&lt;p&gt;On Australia Day this year I climbed to the summit of &lt;a href=&quot;http://maps.google.com.au/maps/place?oe=utf-8&amp;rls=org.gentoo:en-US:unofficial&amp;client=firefox-a&amp;um=1&amp;ie=UTF-8&amp;q=cradle+mountain&amp;fb=1&amp;gl=au&amp;ftid=0xaa7ae84c88b830f9:0xefe9e09237d3c4fb&amp;ei=TyKiS4C_FcyLkAWO_LC6CA&amp;sa=X&amp;oi=geocode_result&amp;ct=title&amp;resnum=1&amp;ved=0CBEQ8gEwAA&quot;&gt;Cradle Mountain&lt;/a&gt; with some friends.  Here are some of the photos that I took before the clouds rolled in and the rain came down.&lt;/p&gt;
&lt;p&gt;It&amp;#8217;s a great place to take a long walk  :)&lt;/p&gt;
&lt;p&gt;Photos taken on 20100126. Click any image for a giant version.&lt;a href=&quot;http://creativecommons.org/licenses/by-nc-sa/2.5/au/&quot;&gt;&lt;br /&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://brnz.org/hbr/wp-content/uploads/2010/03/CRW_35800.jpg&quot;&gt;&lt;img class=&quot;aligncenter size-large wp-image-449&quot; title=&quot;CRW_35800&quot; src=&quot;http://brnz.org/hbr/wp-content/uploads/2010/03/CRW_35800-540x359.jpg&quot; alt=&quot;&quot; width=&quot;540&quot; height=&quot;359&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://brnz.org/hbr/wp-content/uploads/2010/03/CRW_35807.jpg&quot;&gt;&lt;img class=&quot;aligncenter size-large wp-image-450&quot; title=&quot;CRW_35807&quot; src=&quot;http://brnz.org/hbr/wp-content/uploads/2010/03/CRW_35807-540x303.jpg&quot; alt=&quot;&quot; width=&quot;540&quot; height=&quot;303&quot; /&gt;&lt;/a&gt;&amp;#8220;Wombat Pool&amp;#8221;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://brnz.org/hbr/wp-content/uploads/2010/03/CRW_35823.jpg&quot;&gt;&lt;img class=&quot;aligncenter size-large wp-image-451&quot; title=&quot;CRW_35823&quot; src=&quot;http://brnz.org/hbr/wp-content/uploads/2010/03/CRW_35823-540x359.jpg&quot; alt=&quot;&quot; width=&quot;540&quot; height=&quot;359&quot; /&gt;&lt;/a&gt;The mountain. You could see the top at this stage in the day.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://brnz.org/hbr/wp-content/uploads/2010/03/CRW_35855.jpg&quot;&gt;&lt;img class=&quot;aligncenter size-large wp-image-452&quot; title=&quot;CRW_35855&quot; src=&quot;http://brnz.org/hbr/wp-content/uploads/2010/03/CRW_35855-533x800.jpg&quot; alt=&quot;&quot; width=&quot;533&quot; height=&quot;800&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;
&lt;p&gt;&lt;a rel=&quot;license&quot; href=&quot;http://creativecommons.org/licenses/by-nc-sa/2.5/au/&quot;&gt;&lt;img src=&quot;http://i.creativecommons.org/l/by-nc-sa/2.5/au/88x31.png&quot; alt=&quot;Creative Commons License&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
All  photos are licensed under a &lt;a rel=&quot;license&quot; href=&quot;http://creativecommons.org/licenses/by-nc-sa/2.5/au/&quot;&gt;Creative  Commons Attribution-Noncommercial-Share Alike 2.5 Australia License&lt;/a&gt;.&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">2 Minute Musing: Creative Endeavours</title>
		<link href="http://feedproxy.google.com/~r/krumpit/~3/ZfFdXsiTbDo/"/>
		<id>http://www.krumpit.org/2010/03/2-minute-muse-creative-endeavours/</id>
		<updated>2010-03-11T10:13:49+00:00</updated>
		<content type="html">&lt;p&gt;Creative endeavours balance the art of creation and the art of taking away.&lt;/p&gt;
&lt;p&gt;Writing a story is partly the creation of a new world in your mind, but for each creative decision, you are defining what is &lt;em&gt;not&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;When I start writing, the world is wide with possibilities. The map of possibilities for each character is endless. As the character takes form, as I pin down the details, these possibilities &amp;#8211; the infinite alternative dimensions &amp;#8211; narrow down into one possibility, one dimension. &lt;em&gt;The&lt;/em&gt; dimension. The way things are in the universe that is the story.&lt;/p&gt;
&lt;p&gt;The best artwork and designs are also an act of taking away. The question is not how the lines should be drawn, but whether a line should be drawn at all.&lt;/p&gt;
&lt;p&gt;In creative work, it is worth questioning: Why that line? Why that reality?&lt;/p&gt;
&lt;img src=&quot;http://feeds.feedburner.com/~r/krumpit/~4/ZfFdXsiTbDo&quot; height=&quot;1&quot; width=&quot;1&quot; /&gt;</content>
		<author>
			<name>krumpit</name>
			<uri>http://www.krumpit.org</uri>
		</author>
		<source>
			<title type="html">krumpit</title>
			<subtitle type="html">the blog of maz musings and ponderings.</subtitle>
			<link rel="self" href="http://www.krumpit.org/?feed=rss2"/>
			<id>http://www.krumpit.org/?feed=rss2</id>
			<updated>2012-01-01T17:00:16+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Back at school – Day 0</title>
		<link href="http://forumjoe.wordpress.com/2010/02/03/back-at-school-day-0/"/>
		<id>http://forumjoe.wordpress.com/2010/02/03/back-at-school-day-0/</id>
		<updated>2010-02-03T02:00:07+00:00</updated>
		<content type="html">So, over the holidays I did lots of things, but not much of them to do with teaching or planning. I&amp;#8217;m now at my new school, and this is day 0. The last two days have been staff only days with lots of seminars and meetings and stuff, and this afternoon, finally, I get some [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=forumjoe.wordpress.com&amp;blog=8455381&amp;post=95&amp;subd=forumjoe&amp;ref=&amp;feed=1&quot; /&gt;</content>
		<author>
			<name>This is my old blog.</name>
			<uri>http://forumjoe.wordpress.com</uri>
		</author>
		<source>
			<title type="html">This is my old blog.</title>
			<subtitle type="html">go to http://joeapproachesinfinity.wordpress.com/</subtitle>
			<link rel="self" href="http://forumjoe.wordpress.com/feed/rss/"/>
			<id>http://forumjoe.wordpress.com/feed/rss/</id>
			<updated>2010-06-10T01:00:14+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">I Hate Vista</title>
		<link href="http://wilde.id.au/?p=51"/>
		<id>http://wilde.id.au/?p=51</id>
		<updated>2010-01-31T08:12:17+00:00</updated>
		<content type="html">&lt;p&gt;But somehow I reinstalled it (over my linux partition) in a drunken fit of trying to get Dragon Age sound working.  I really need to put a breathalyser on computer to stop me doing silly things to it whilst drunk &lt;img src=&quot;http://wilde.id.au/wp-includes/images/smilies/icon_sad.gif&quot; alt=&quot;:(&quot; class=&quot;wp-smiley&quot; /&gt; &lt;/p&gt;</content>
		<author>
			<name>Wilde On!</name>
			<uri>http://wilde.id.au</uri>
		</author>
		<source>
			<title type="html">Wilde On!</title>
			<subtitle type="html">&lt;h1&gt;It works!&lt;/h1&gt;</subtitle>
			<link rel="self" href="http://wilde.id.au/?feed=rss2"/>
			<id>http://wilde.id.au/?feed=rss2</id>
			<updated>2010-04-28T23:00:11+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Icewind Dale 2</title>
		<link href="http://wilde.id.au/?p=50"/>
		<id>http://wilde.id.au/?p=50</id>
		<updated>2010-01-20T09:36:53+00:00</updated>
		<content type="html">&lt;p&gt;I installed Icewind Dale 2 yeaterday and ran into a few issues: the first one was the game would crash everytime I got the the character creation, this is a bug in the game itself, and is fixed by downloading and running the V2.01 patch.&lt;/p&gt;
&lt;p&gt;The next one presents in a similar way (as a crash) but it can be worked around by deleting the default.tot file in the temp and tempsave directories.  Then you create the a directory called the same (default.tot) in the temp directory (wierd I know) but it works. &lt;/p&gt;</content>
		<author>
			<name>Wilde On!</name>
			<uri>http://wilde.id.au</uri>
		</author>
		<source>
			<title type="html">Wilde On!</title>
			<subtitle type="html">&lt;h1&gt;It works!&lt;/h1&gt;</subtitle>
			<link rel="self" href="http://wilde.id.au/?feed=rss2"/>
			<id>http://wilde.id.au/?feed=rss2</id>
			<updated>2010-04-28T23:00:11+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">A glass of wine ….</title>
		<link href="http://wilde.id.au/?p=48"/>
		<id>http://wilde.id.au/?p=48</id>
		<updated>2010-01-20T09:31:27+00:00</updated>
		<content type="html">&lt;p&gt;I&amp;#8217;ve been working on moving everything over to linux, my Windows 7 beta is due to run out soon.  This is about a once yearly move (before trudging back to windows) but this time has been surprisingly good.  Hats off to the wine developers, they have come leaps and bounds in the last few years, pretty much every application (which admittedly are mostly games) run without flaw.  Plus gentoo finally unmasked kde 4 &amp;#8230; the combination is &amp;#8230;.. good.  I am planning on posting my wine encounters as they pop up.&lt;/p&gt;</content>
		<author>
			<name>Wilde On!</name>
			<uri>http://wilde.id.au</uri>
		</author>
		<source>
			<title type="html">Wilde On!</title>
			<subtitle type="html">&lt;h1&gt;It works!&lt;/h1&gt;</subtitle>
			<link rel="self" href="http://wilde.id.au/?feed=rss2"/>
			<id>http://wilde.id.au/?feed=rss2</id>
			<updated>2010-04-28T23:00:11+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Professional Links</title>
		<link href="http://forumjoe.wordpress.com/2010/01/07/professional-links/"/>
		<id>http://forumjoe.wordpress.com/2010/01/07/professional-links/</id>
		<updated>2010-01-07T06:00:07+00:00</updated>
		<content type="html">A quick post to let you know that I&amp;#8217;ve edited my main pages to link to all the blogs and websites that I&amp;#8217;m currently subscribed to. &amp;#8220;Teach&amp;#8220;, for example, now shows all the Maths teaching blogs that I read regularly. You might find some interesting things there that you weren&amp;#8217;t aware of, so have a [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=forumjoe.wordpress.com&amp;blog=8455381&amp;post=88&amp;subd=forumjoe&amp;ref=&amp;feed=1&quot; /&gt;</content>
		<author>
			<name>This is my old blog.</name>
			<uri>http://forumjoe.wordpress.com</uri>
		</author>
		<source>
			<title type="html">This is my old blog.</title>
			<subtitle type="html">go to http://joeapproachesinfinity.wordpress.com/</subtitle>
			<link rel="self" href="http://forumjoe.wordpress.com/feed/rss/"/>
			<id>http://forumjoe.wordpress.com/feed/rss/</id>
			<updated>2010-06-10T01:00:14+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Start here…</title>
		<link href="http://forumjoe.wordpress.com/2010/01/07/start-here/"/>
		<id>http://forumjoe.wordpress.com/2010/01/07/start-here/</id>
		<updated>2010-01-07T02:00:07+00:00</updated>
		<content type="html">For the record, so I can look back and see where I was at professionally it&amp;#8217;s this: After one year in the profession, I don&amp;#8217;t think I&amp;#8217;m a very good teacher. Sure, lots of my kids got good marks last year, and I think I developed a good professional relationship with my peers and my [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=forumjoe.wordpress.com&amp;blog=8455381&amp;post=81&amp;subd=forumjoe&amp;ref=&amp;feed=1&quot; /&gt;</content>
		<author>
			<name>This is my old blog.</name>
			<uri>http://forumjoe.wordpress.com</uri>
		</author>
		<source>
			<title type="html">This is my old blog.</title>
			<subtitle type="html">go to http://joeapproachesinfinity.wordpress.com/</subtitle>
			<link rel="self" href="http://forumjoe.wordpress.com/feed/rss/"/>
			<id>http://forumjoe.wordpress.com/feed/rss/</id>
			<updated>2010-06-10T01:00:14+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Disconnected Metablogging</title>
		<link href="http://forumjoe.wordpress.com/2010/01/07/disconnected-metablogging/"/>
		<id>http://forumjoe.wordpress.com/2010/01/07/disconnected-metablogging/</id>
		<updated>2010-01-07T02:00:07+00:00</updated>
		<content type="html">This is the blogging I'll do in January.  Disconnected.  Writing posts without looking at the internet, then just uploading them when I next check my email.  It will be a challenge, but hopefully it will be useful.  Maybe the following morning I'll post a followup, finding the links, paying my dues.  Maybe I won't.  But I am determined to keep this up. &lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=forumjoe.wordpress.com&amp;blog=8455381&amp;post=78&amp;subd=forumjoe&amp;ref=&amp;feed=1&quot; /&gt;</content>
		<author>
			<name>This is my old blog.</name>
			<uri>http://forumjoe.wordpress.com</uri>
		</author>
		<source>
			<title type="html">This is my old blog.</title>
			<subtitle type="html">go to http://joeapproachesinfinity.wordpress.com/</subtitle>
			<link rel="self" href="http://forumjoe.wordpress.com/feed/rss/"/>
			<id>http://forumjoe.wordpress.com/feed/rss/</id>
			<updated>2010-06-10T01:00:14+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Disabling a Windows Application, the nasty way</title>
		<link href="http://wilde.id.au/?p=47"/>
		<id>http://wilde.id.au/?p=47</id>
		<updated>2010-01-07T01:14:58+00:00</updated>
		<content type="html">&lt;p&gt;If you aren&amp;#8217;t a Domain Admin and can&amp;#8217;t do a group policy, then this might work for you, I stumbled across this a few years ago when I was a programmer, and it comes in handy now working as an admin and trying to stop people from using old applications (that are no longer supported or licensed) that they seem to have made external copies of &amp;#8230; as they seem to keep reappearing&lt;/p&gt;
&lt;p&gt;Registry edit :&lt;/p&gt;
&lt;p&gt;HKLM/Software/Microsoft/Windows NT/CurrentVersion/Image File Exectution Options//Debugger/&lt;/p&gt;
&lt;p&gt;You can do the official way which is the DisallowRun key, but from what I can figure it only works for the loggedon user at the time you do it, if someone else logs in I suspect they will be able to run the application until you do the DisallowRun edit for them too.  When I tried doing DisallowRun in HKLM hive it didn&amp;#8217;t appear to work.&lt;/p&gt;
&lt;p&gt;Doing it the above way tries to attach a debugger to the executable, if the debugger doesn&amp;#8217;t exist then windows complains and bails out &amp;#8230; its rather funny clicking on an application icon and have windows tell you it can&amp;#8217;t find it &lt;img src=&quot;http://wilde.id.au/wp-includes/images/smilies/icon_razz.gif&quot; alt=&quot;:P&quot; class=&quot;wp-smiley&quot; /&gt; &lt;/p&gt;</content>
		<author>
			<name>Wilde On!</name>
			<uri>http://wilde.id.au</uri>
		</author>
		<source>
			<title type="html">Wilde On!</title>
			<subtitle type="html">&lt;h1&gt;It works!&lt;/h1&gt;</subtitle>
			<link rel="self" href="http://wilde.id.au/?feed=rss2"/>
			<id>http://wilde.id.au/?feed=rss2</id>
			<updated>2010-04-28T23:00:11+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Time Flies…</title>
		<link href="http://jerrykan.theintraweb.net/blog/2009/12/time-flies/"/>
		<id>http://jerrykan.theintraweb.net/blog/?p=84</id>
		<updated>2009-12-13T12:54:20+00:00</updated>
		<content type="html">&lt;p&gt;It has been quite a while since I last posted something (how often to do see that comment made by someone on their blog?), in fact 4 months today. I&amp;#8217;ve really had a lot on during that time including, ,helping to organise/run a Ultimate tournament for ~370 people (which also included training for, and playing in), attending conferences, trying to set up a new website for the &lt;a href=&quot;http://tua.afda.com/&quot;&gt;TUA&lt;/a&gt; (as well as keep up with other admin), not to mention how busy work has been. It probably hasn&amp;#8217;t helped that my body clock has been out of sync with the rest of the world lately, as my girlfriend isn&amp;#8217;t around to encourage me to go to bed/get up at reasonable hours of the day. Luckily Christmas is fast approaching and it will give me chance to have a  bit of a break from work (and non-work work) and recharge my batteries a bit.&lt;/p&gt;
&lt;p&gt;During the last few months I didn&amp;#8217;t manage to squeeze in a quick holiday in Victoria, heading down the Great Ocean Road. It is a really nice part of the world, and has inspired me to try an see a bit more of my of own country, instead of constantly going overseas for Holidays. The shorter flights also seem like a definite bonus. Here are a few nice panaroma I took on the trip (and stitched together using Hugin)&lt;br /&gt;
&lt;a href=&quot;http://jerrykan.theintraweb.net/blog/wp-content/uploads/2009/12/apostles_large.jpg&quot;&gt;&lt;img class=&quot;size-medium wp-image-86 aligncenter&quot; title=&quot;apostles_large&quot; src=&quot;http://jerrykan.theintraweb.net/blog/wp-content/uploads/2009/12/apostles_large-300x90.jpg&quot; alt=&quot;The Twelve Apostles (Eastern View)&quot; width=&quot;300&quot; height=&quot;90&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://jerrykan.theintraweb.net/blog/wp-content/uploads/2009/12/loch_ard_gorge_large.jpg&quot;&gt;&lt;img class=&quot;size-medium wp-image-87 aligncenter&quot; title=&quot;loch_ard_gorge_large&quot; src=&quot;http://jerrykan.theintraweb.net/blog/wp-content/uploads/2009/12/loch_ard_gorge_large-300x35.jpg&quot; alt=&quot;Loch Ard Gorge&quot; width=&quot;300&quot; height=&quot;35&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The first shot is of The Twelve Apostles, which are pretty well know (at least the Western View is), but the second shot inside Loch Ard Gorge (just to the west of the apostles) was also a very nice little spot. Click on the images for much large versions, though be aware that are fairly large in size (600k &amp;amp; 1000k).&lt;/p&gt;
&lt;p&gt;I was also really impressed with how Hugin handled the merging of the waves at different spots between the photos.&lt;/p&gt;</content>
		<author>
			<name>Old, and Stupid!</name>
			<uri>http://jerrykan.theintraweb.net/blog</uri>
		</author>
		<source>
			<title type="html">Old, and Stupid!</title>
			<subtitle type="html">Forcing uninformed opinions upon the Internet</subtitle>
			<link rel="self" href="http://jerrykan.theintraweb.net/blog/feed/"/>
			<id>http://jerrykan.theintraweb.net/blog/feed/</id>
			<updated>2009-12-14T00:00:03+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">“premature optimization”</title>
		<link href="http://brnz.org/hbr/?p=437"/>
		<id>http://brnz.org/hbr/?p=437</id>
		<updated>2009-11-24T14:12:42+00:00</updated>
		<content type="html">&lt;p&gt;Here is an except from Donald Knuth&amp;#8217;s 1974 paper &amp;#8220;Structured Programming with go to Statements&amp;#8221;.  There is a well known quote at the end of the second paragraph :&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;The improvement in speed from Example 2 to Example 2a is only about 12%, and many people would pronounce that insignificant.  The conventional wisdom shared by many of today&amp;#8217;s software engineers calls for ignoring efficiency in the small; but I believe this is simply an overreaction to the abuses they see being practiced by penny-wise-and-pound-foolish programmers, who can&amp;#8217;t debug or maintain their &amp;#8220;optimized&amp;#8221; programs. In established engineering disciplines a 12% improvement, easily obtained, is never considered marginal; and I believe the same viewpoint should prevail in software engineering. Of course I wouldn&amp;#8217;t bother making such optimizations on a one-shot job, but when it&amp;#8217;s a question of preparing quality programs, I don&amp;#8217;t want to restrict myself to tools that deny me such efficiencies.&lt;/p&gt;
&lt;p&gt;There is no doubt that the grail of efficiency leads to abuse. Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We &lt;em&gt;should&lt;/em&gt; forget about &lt;em&gt;small&lt;/em&gt; efficiencies, say about 97% of the time: premature optimization is the root of all evil.&lt;/p&gt;
&lt;p&gt;Yet we should no pass up our opportunities in that critical 3%. A good programmer will not be lulled into complacency by such reasoning, he will be wise to look carefully at the critical code; but only &lt;em&gt;after&lt;/em&gt; that code has been identified. It is often a mistake to make a priori judgments about what parts of a program are really critical, since the universal experience of programmers who have been using measurement tools has been that their intuitive guesses fail. After working with such tools for seven years, I&amp;#8217;ve become convinced that all compilers written from now on should be designed to provide all programmers with feedback indicating what parts of their programs are costing the most; indeed, this feedback should be supplied automatically unless it has been specifically turned off.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;The quote to which I am referring &amp;#8211; that &amp;#8220;premature optimization is the root of all evil&amp;#8221; &amp;#8211; is, from time to time, used fait accompli to assert that any time spent optimising is time wasted &amp;#8211; something that is clearly not the case when considering the quote in context.&lt;/p&gt;
&lt;p&gt;There are a lot of other good ideas in Knuth&amp;#8217;s article, many still quite relevant to software engineering. The full article (which can be obtained via &lt;a href=&quot;http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.103.6084&amp;rep=rep1&amp;type=pdf&quot;&gt;citeseerx&lt;/a&gt;) is, primarily, a contribution to a  discussion of the time on the use of go to statements &amp;#8211; another topic often reduced to a simple, extreme position, attributed to Edsger Dijkstra.  Knuth&amp;#8217;s paper makes it clear that Dijkstra did not hold so tightly to that position himself.&lt;/p&gt;
&lt;p&gt;This is the sort of paper that I find to be a fascinating read, with  both historical and technical value.&lt;/p&gt;
&lt;p&gt;The final page of the article contains the following quote :&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;A disturbingly large percentage of the students ran into situations that require &lt;strong&gt;go to&lt;/strong&gt;&amp;#8216;s, and sure enough, it was often because &lt;strong&gt;while&lt;/strong&gt; didn&amp;#8217;t work well to their plan, but almost invariably because their plan was poorly thought out.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Which brought to mind another quote that I had seen recently, this one from George Orwell :&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;A man may take to drink because he feels himself to be a failure, and then fail all the more completely because he drinks. It is rather the same thing that is happening to the English language. It becomes ugly and inaccurate because our thoughts are foolish, but the slovenliness of our language makes it easier for us to have foolish thoughts.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;It seems quite valid to say that there is a connection between our language and our expression (in terms of ideas, spoken word, programs, and more).&lt;/p&gt;
&lt;p&gt;When trying to find a source for Orwell&amp;#8217;s words (which you can find &lt;a href=&quot;http://www.george-orwell.org/Politics_and_the_English_Language/0.html&quot;&gt;here&lt;/a&gt;), I was heartened to find these sentences follow those quoted above :&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;The point is that the process is reversible.   Modern English, especially written English, is full of bad habits  which spread by imitation and which can be avoided if one is willing to  take the necessary trouble.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Which I believe is also applicable to the expression and optimisation of computer programs.&lt;/p&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Some Linux on PS3 updates</title>
		<link href="http://brnz.org/hbr/?p=430"/>
		<id>http://brnz.org/hbr/?p=430</id>
		<updated>2009-11-22T11:32:08+00:00</updated>
		<content type="html">&lt;p&gt;I&amp;#8217;ve updated the &lt;a href=&quot;http://brnz.org/hbr/?page_id=346&quot;&gt;Linux distros page&lt;/a&gt; with links to articles about installing Ubuntu 9.10 [&lt;a href=&quot;http://joepcremers.nl/wordpress/?p=1595&quot;&gt;Joep Cremers Weblog&lt;/a&gt;] and Fedora 12 [&lt;a href=&quot;http://www.kernel.org/pub/linux/kernel/people/geoff/cell/ps3-howto/ps3-fedora-install-howto.txt&quot;&gt;Geoff Levand&lt;/a&gt;, &lt;a href=&quot;http://www.elliptique.net/wiki/doku.php?id=fedora12-ps3&quot;&gt;Ken Werner&lt;/a&gt;] on the Playstation 3.&lt;/p&gt;
&lt;p&gt;In mosty unrelated news,&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;IBM will not be releasing a previously planned successor to the PowerXCell 8i [&lt;a href=&quot;http://www.heise.de/newsticker/meldung/SC09-IBM-laesst-Cell-Prozessor-auslaufen-864497.html&quot;&gt;heise online&lt;/a&gt;,&lt;a href=&quot;http://www.playstationuniversity.com/ibm-cancels-cell-processor-development-1295/&quot;&gt; Playstation University&lt;/a&gt;]&lt;br /&gt;
(neither article conveys particularly clear information to me &amp;#8211; not least because I have only a machine translation of the first one)&lt;/li&gt;
&lt;li&gt;Playstation 3 firmware version 3.10 seems to have added ABC iView and BBC iPlayer support to the XMB (the presence of which *may* be related to your PSN region, geographical restrictions to accessing video content still seem to apply). If you can&amp;#8217;t see it in the TV column of your XMB, try rebooting&amp;#8230;&lt;/li&gt;
&lt;/ul&gt;</content>
		<author>
			<name>hbr » general</name>
			<uri>http://brnz.org/hbr</uri>
		</author>
		<source>
			<title type="html">hbr » general</title>
			<subtitle type="html">Hint for Branch (r-form)</subtitle>
			<link rel="self" href="http://brnz.org/hbr/?cat=5&amp;feed=rss2"/>
			<id>http://brnz.org/hbr/?cat=5&amp;feed=rss2</id>
			<updated>2012-01-22T23:00:12+00:00</updated>
		</source>
	</entry>

</feed>

