Write assembly in Python!
Multiple things have happened over the last couple of weeks and few months I spent not blogging.
First, I picked this wonderful post by Robert Kern on python mailing list today that made me blog in the first place; Much thanks owes to him for enlightening mere mortals like me. I am still to play around with it but reading the docs is half the battle done. It is all documented at http://www.corepy.org; if you flip over and start reading the "hello world" side of things at http://www.corepy.org/wiki/index.php?title=CorePy_Basics, it looks ridicolously fun and easy again! I think assembly just became fun again :-)
I'll leave it upto you as to basically what you can do them but essentially to do anything substantial you'd have to pump out a lot of asm using CorePy. One could implement some native assembly code in it and use other python libraries to do some really neat stuff. If you only dabble in Assembly like me and wish to not leave the comfortable rear-view seat of Python's high-level world, then CorePy is for you!
Take a look at this snippet:
The code above prints x86 instructions (intel style- "x86_64_Nasm" plugin) and assigns them to a "foobar" function. See below for output. More documentation on CorePy are available at their website.
If you are really into Assembly and Python, I'd recommend you give CorePy a go; do drop a line how it goes. If you're an Assembly/CorePy/Python hacker then please enlighten me :-)
Secondly, I have been working on my Djangle blog engine for the last couple of months on an irregular basis; I'd love to work more on it but due to my day job as a Perl hacker, it's quite hard to find the time commit code. It's also quite a bit of a concern for me as some days I feel utterly tired while the other days I feel exactly the other way around. Anyhow, the things that are on my list to make this a bit more "developer" friendly in near future are-
Do drop a line if you feel something must exist in a blog engine; If it's reasonable and challenging enough, I might skip few of the ones above to implement them :-)
Thirdly, I have been reading a lot of books recently that encompass multiple programming languages, theories and whatnot. I buy using http://www.booko.com.au which is by far the best place to find cheaper books in Australia. Theyt essentially aggregate the price of an item across several stores and sorts them in descending order for you by price! The books I am reading simulaneously for essentially reference purpose, educational learning etc. are -
They are all very interesting but it's kind of hard to squeeze them all into a 24-hour day so, I read them at a very gradual pace using some of them as a good reference on a subject matter.
Fourthly, I have been visiting and meeting some of SyPy, GTUGers at Google for various talks and social gatherings. Some of the talks and hackfests I've been to are:
There were lot of other talks and social "lubrications" I went to that I can't recall. Things of interest though - if you live in Sydney and are into python, linux, opensource software, then do join Sydney Python usergroup, Sydney Linux usergroup, Sydney django usergroup (there are only a table-full people at the moment but given Django's growing popularity, I reckon it will see an increase) and GTUG if you are into Google stuff (I just rocked up for Go! talk by Rob Pike). Go talk was an interesting event but I'd rather stay away from it for the moment. The reason I'd stay away is because firstly, I don't enough time (I have Erlang on my plate!). Secondly, I have too many hobbies (AVR, Software Security, Heavy mathematics yada yada.. on my plate!!). So, sorry Go, you'd have to wait. The language itself is cute though. You can use a C compiler to generate native binaries from Go code (from Ken Thompson and Ian Taylor respectively), do all kinds of funky stuffs with Functional-style programming, do threads and lot more. If you're interested Go is at http://golang.org (http://www.youtube.com/watch?v=rKnDgT73v8s for videos, http://golang.org/doc/ for slides)
Lastly, this blog. My blog runs on my own hand-crafted Python blogging engine still in its infancy and named "Djangle". Named so because it rhymes with Django and Angle - "Angle" because the a blog is an angle of a mind; We project our thoughts into it and make sure it's got an angle to just sufficiently mean the things we want it to mean, to convey something to the inhibitants in our own words and to cover just about enough people's satisfaction like a right-angle ;-)
The source is at http://github.com/ishwor/djangle and if you are good at Python and feel like taking those fingers for a small ride, please by all means join my effort to create a simple, elegant and functional blogging engine using Django; This can be a good experience for us! :-)
import corepy.lib.printer as printer
import corepy.arch.x86_64.platform as env
import corepy.arch.x86_64.isa as x86
from corepy.arch.x86_64.types.registers import *
code = env.InstructionStream()
x86.set_active_code(code)
x86.mov(code.gp_return, 11)
x86.add(code.gp_return, 31)
printer.PrintInstructionStream(code, printer.x86_64_Nasm(function_name="foobar"))
BITS 64
SECTION .text
global foobar
foobar:
PROLOGUE:
push rbp
mov rbp, rsp
push r15
push r14
push r13
push r12
push rbx
BODY:
mov rax, 11
add rax, 31
EPILOGUE:
pop rbx
pop r12
pop r13
pop r14
pop r15
leave
ret
Jotted by ishwor Feb. 24, 2010
Comments
No comment posted yetTrackbacks
No trackbacks yetLeave a Reply/Discuss
Developed using djangle
