I Am Bismark

2009-09

so i am writing a project report on why i failed at achieving the goals of the project. come on partial credit!

cold and cloudy… debating about whether i want to walk over to the farmers market or not..

late night in the office… really need to start carrying around some cash… vending machines are mocking me and my credit cards..

speaking of obama, i think its time he realizes the obvious: the war in afghanistan needs to end now. i support the troops, bring them home

with all this talk about obama = anti-christ and public options = communism, i’m sure we will hear about it at general conference next week.

my professor called lottery scheduling cute. it was a precious moment in OS class this morning.

hmm. so much for my alarm clock working this morning.

i stopped hiding quizzes on facebook, i started hiding people who do quizzes.

anyone else paying for pandora one? i’m highly considering it for only $3 a month..

polishing off tic tac toe.. ~500 lines of lc-3 assembly. these freshman better enjoy this lab!!!!

game is now turned off. glad that silliness is out of my life. now i can have a peaceful fall semester.

ok, do you really need to wear your workout clothes while riding on a segway? i mean, you are just… standing.

I really wanna watch Harry and the Hendersons. such a classic.

changes on my blog

ok, so for those of you who just read my blog posts in your RSS newsreader, you probably have not noticed that i have undertaken in some cosmetic and layout changes on my blog. these are certainly works in progress (basically just me fiddling around with CSS to see what happens) and a much larger makeover is planned hopefully in the near future. as i add new features and content, i will write posts about them.

additionally, i have now turned off all comments on my blog. this is in now way meant to stifle any discussion; it is meant to encourage it. however, if you want to respond to something i write, i encourage you to write a response post on your own blog. my philosophy on blogs has been evolving, and i feel like any good discussion on a post i write would just get lost in the comments section if left there. posting a response on your own blog (or if you do not have one, writing an email with permission for me to repost it and respond) allows for a much more open discussion. actually my next post is going to be in response to a lengthy comment i received a few days ago.

drawing bitmaps in lc-3 assembly

this semester i am a teaching assistant for cs 252, introduction to computer engineering. to give the students a basic intro to instruction set architectures and assembly, we us the lc-3. since the lc-3 simulator is rather limited in the “cool” things it can do, we have decided this year to use an lc-3 simulator developed at penn called pennsim. the biggest reason for this is because it has memory-mapped video output, meaning we can write games, which are much more interesting to students than say a hungarian notation calculator (like i had to write in the equivalent course back at byu).

i’ve been tasked with writing a tictactoe game using pennsim, and then for the final assignments, i will give the students the code with some logic stripped out that they will have to rewrite. unsurprisingly, getting my brain to think is assembly, especially with such a limited instruction set, has been a bit of a task. so, my idea was to print the board as follows:

tictactoe board

the white lines were easy enough, just a couple of for loops. but numbering each location on the board (so the player can easily select which position they want to play on using the keyboard) was kind of an interesting problem. i decided to store each number as a bitmap. so in my text editor, i wrote these for 1-9 and O and X (this is for 1 if you cannot tell):

0000000110000000
0000001010000000
0000010010000000
0000000010000000
0000000010000000
0000000010000000
0000000010000000
0001111111111000

then i typed up a quick python script to convert these bitmaps into hex numbers:

f = open("bitmaps.txt",'r')
lines = f.read().split("\n")
f.close()
f = open("hexbitmaps.txt",'w')
for line in lines:
    if line is not '':
        f.write(".FILL "+hex(string.atoi(line,base=2))[1:]+"\n")
    else:
    f.write("\n")
f.close()

which gave me the following for the previous bitmap:

.FILL x180
.FILL x280
.FILL x480
.FILL x80
.FILL x80
.FILL x80
.FILL x80
.FILL x1ff8

i copy and pasted the hex numbers right into my assembly code. by now i was feeling pretty proud of myself, until i realized how annoying the lack of useful instructions such bit shifts in the lc-3 was going make things. it took me a few minutes of thinking, but here is how i solved it: i created an array of bit masks like:

1000 0000 0000 0000
0100 0000 0000 0000
...
0000 0000 0000 0001

then i wrote a set of nested for loops. the outer loop incremented through each row (y) of the bitmap and the inner loop would AND each bitmask with the current row to determine if a pixel should be drawn at the current column (x). here is the lc-3 code for those who are interested:

AND R3, R3, #0
ADD R3, R3, #8   ;counter for the 8 rows in the bitmap
BMROWLOOP   LEA R6, BITMASKS    ;store the address of the bitmasks array
AND R7, R7, #0
ADD R7, R7, #15  ;counter for the number of pixels in a row
LDR R4, R1, #0   ;stores one row of the bitmap in R4
BMBITLOOP   LDR R5, R6, #0  ;loads the first bit mask into R5
AND R5, R5, R4   ;AND the bit mask and the current row
BRz NOBIT    ;if the result is zero, skip next instruction
STR R2, R0, #0   ;draw a pixel (R0 holds pointer to video mem)
NOBIT   ADD R0, R0, #1  ;move over one column in the video mem
ADD R6, R6, #1   ;locate the next bit mask
ADD R7, R7, #-1  ;count down until all pixels in a row are done
BRzp BMBITLOOP
LD R5, VERTADD   ;code to move the video mem pointer down a row
ADD R0, R0, #-16
ADD R0, R0, R5
ADD R1, R1, #1   ;increment to next row in the bitmap
ADD R3, R3, #-1  ;count down until all rows are done
BRp BMROWLOOP

probably not the perfect solution, but not bad for just banging away at it at 2 in the morning.

never underestimate how handy a shift instruction can be in your ISA…

facebook meeting’s pizza >> microsoft meeting’s pizza

Microsoft rep at recruiting mtg: “who here has bing as their default search?“… crickets

putting the slapchop rap on my iPod = best idea i’ve had in a long time.

taking part in a rousing discussion about implementing monitors with semaphores.

hmm didn’t think i would have to clarify that my comment about the religious discrimination was tongue in cheek. well, it was.

so the design tool we have to use for the architecture wants me to both register and install crapware. stupidity.

why are almost all windows software downloads through download.com? just as an assurance against spyware?

hmm. i won a free ice tea at subway. they say no substitutions. should i complain about religious discrimination?

read news, read scriptures, ran, ate breakfast, showered. good morning.

about halfway through your money or your life. great book, i highly recommend it. each dollar spent = a spent chunk of your life energy.

came to church early for choir practice. skipped breakfast for it. :(

looks like byu will be ranked at least 8th tomorrow. and if by chance ohio state really sucks it up, they could even move into 7th.

oh sad, not everything is still there. wall posts from friends only back to july 17, 2006.

so if you keep pressing the “load more entries” thing on your facebook wall, it really does go all the way back. january 14th, 2005.

watching the byu game delayed a few minutes on tivo to skip commercials doesn’t work when i keep checking twitter…

drove up to the hometown and did one of my favorite runs. lots if good memories running along that river path.

the guys who wrote unix were so freaking smart.

at the hubbard street diner in middleton. they are matching and donating 100% of the tips tonight to a kid with leukemia.

wow, facebook lite is actually really awesome. its like going back four years to when facebook was useable.

scary surgery

so if you haven’t noticed, i haven’t been posting any new pictures on my blog lately. a few weeks before i left sacramento, i dropped my iphone while getting out of the car. the phone worked fine, but there were a few nasty gashes on the back, including across the camera lens. this sadly made all of the pictures i took look like the lens was covered in vaseline. here are two examples from when i was in utah:

mariam coming up from a cave

this is mariam coming out of a cave we found while hiking in rock canyon.

red lobster virgin drinks

this is cory and laura enjoying good times at RL.

so, as you can see, the pics look all blurry. i didn’t like taking pictures with my phone anymore because it bugged me so much. when i got here to madison, i did some searching around until i found this site. they sell various iphone parts, so i ordered a new lens piece. it arrived today, so using the super useful guides from ifixit, i opened up my phone and replaced the lens. it was pretty freaking scary, but i got everything apart and back together without any leftover screws.

iphone camera scratch

here is a picture where you can kind of make out the scratch on the lens. hurray for a having a working camera once more!

iPhone camera lens showed up. time to do some surgery.

my wallet is so stretched that everything falls out if i hold it upside down. time for a new wallet.

hmm, i just got a really strong urge to play some final fantasy. NOT GOOD.

heckling

so some congressman heckled the president last night during his speech. health care reform is outside of the scope of this blog post (look elsewhere for plenty of commentary and debate), i want to comment quickly about this heckling and other protests that have occurred recently.

two years ago, i took part in protesting dick cheney’s speaking appearance at byu’s commencement ceremonies (some commentary on the topic can be found here). there was a huge amount of uproar and debate on campus then, and honestly i think that debate (despite the fact that i still don’t believe cheney should have been invited) was one of the best things to happen to byu in a long time.

now two years later with a democrat in office, i really wish i would have written down some of the things that i was told from people supportive of cheney. i would love to be able to ask them why the double standard. just for now, let’s set aside the differences between lying in order to enter an unjust war and increasing the national deficit. and also lets set aside the differences between authorizing illegal torture techniques and supporting a public health insurance option. lets pretend that the things people were upset with cheney about are on the same level as the things people are upset with obama about. given that level playing field, let’s talk about protesting: i support it. it’s a constitutional right and despite it not always being efficacious, i think it plays an important role in a democratic society for letting the voice of the people be heard.

despite how many times i was told the contrary by byu college republicans, protesting against the policies of a political leader is not “disrespecting the office.” i bet that i could get 99% agreement from the college republicans on this subject now that a democrat is in the office. on the day of dick cheney’s speech, we held a peace protest on campus. no signs were allowed to be directed at dick cheney himself, they all were positive messages supporting peace and the end of war. we got called all sorts of things from the people driving by (as i discussed here). would those same people be saying the same things to current protestors such as these:

(some of the people in that video actually remind me of the people yelling at us peace protestors.)

like i said, i support those people’s right to protest. however, its hard for me not to contrast our silent protest against cheney and our positive peace protest with some of the people we have been seeing on the news. bringing guns to protest? seriously? remember folks, just because you can doesn’t mean you should.

the people who organized the protests against cheney urged everyone who went to the speech to not disrupt or heckle, but to just listen respectfully. contrast that with the idiot who yelled out something about gadianton robbers at the end of harry reid’s forum speech at byu in fall 2007. and of course, contrast that with the idiot congressman who yelled you “you lie!” during obama’s speech last night (actually obama wasn’t lying). what happened to respecting the office? and i will end on a humorous look at this silliness from this modern world:

protests

i am supportive of anyones right to protest, so protest away against obama. but i can’t help compare our peaceful protest to the gun-toters.

how many times during the byu-cheney incident did i hear “we have to respect the office!” wow, what happened to that idea?

i remember being proud that all of us cheney protestors agreed that jeering cheney during his speech was too disrespectful. silly me.

apple, i really would love tabbed browsing in the itunes store. that is all.

itunes still uses a package installer? how un-mac like…

surprised that the new ipod touches dont have a built in camera.

interesting guest lecture on solving concurrency bugs by constraining thread interleavings to a tested subset. and there were free cookies.

change i can believe in: i am no longer a traitor who should leave the country for criticizing the president! hurray! thanks obama.

not to be a sourpuss, but i don’t think byu’s offense played like a top ten team. too sloppy. hopefully they will prove it against FL state.

so a george foreman grill actually works pretty decently for making toast.

g̖ͣ̔͆̄ͮ̈͊ͧȏ͕̱̣ͦ̈́o͕͙̘͉̗̪̙̭̩̔̓̋ͬ͐ͯ̑d͍̖̻̈̅ͧ̊ͦͫ͐̂n̬̯͓̫̼̎̈́i̱̤̟͖̝̳̚g͍̩̙̳̼̼͕̳̓h̼͓̠̼̣͚̯͊̅̉t̘̦̦̞̩ͨ̃!̹̳̻̐

anyone want my serial codes for the hit list or espresso? i’m not using them.

You Can’t Take It With You

after graduation, i started thinking a lot more about money and goals. yeah, i know i should have done that much earlier (but hey, now i’ve got a few more years before real life here in grad school) but it has definitely made me think about my life much differently. just as a small example: i haven’t spent a single cent on any sort of clothing in the last 4 months. i just haven’t seen the need. every time i think “hmm, i really could use a new pair of dress pants,” i remind myself that i already have what i need. anyone who cares about me wearing the same pair of pants to church this week as i did last week is someone that i really don’t care about pleasing that much.

anyway, today there is a post on one of my new favorite blogs, thesimpledollar.com that really hit home with me. the blogger, trent, talks about how he watched a classic movie called “you can’t take it with you” and what it made him think about. his feelings seem to match almost exactly the way i have started thinking in recent months so i recommend that you go read it now.

working on my new look for my blog… still a work in progress.

well, i suppose i will actually wear my byu shirt with pride next week.

i watched bush #1 when i was a kid in school and look how i turned out.

bad: no convenience store nearby for munchies. good: no convenience store nearby for munchies.

“At level 4 we find the independent user programs and at level 5 the operator (not implemented by us).”

oh dijkstra, that’s a knee slapper.

the greatest enemy to scrambled eggs is the spatula. less stirring means moister, fluffier eggs. come on people.

so looks like i get to write the labs for this class. much better than just being a homework grader.

i refuse to install rosetta. but of course hamachi requires it. so much for remote controlling mariam’s computer for tech support. :/

on to advanced operating systems. now this is what i came for.

first day of classes. going to the 8:50 section of the class I TA for. probably the freshman’s first class ever. how cute.

“stop having boring tuna, stop having a boring life.”

seeing things this like this honestly shocks me.

classes start tomorrow. feeling a bit apprehensive. i could be making a decent amount of money at a real job. hope i made the right choice.

oh people actually use the web based gmail? so clunky and unrefined. its called IMAP people.

hmmm.. how do i prevent twitter from bitly-ifying my urls??

Prev - Archive - Next