can i write a assemly language programs in python

member thudfoo thudfoo at opensuse.us
Fri Jul 10 13:24:22 EDT 2009


On Fri, Jul 10, 2009 at 5:37 AM, Tim Chase<python.list at tim.thechases.com> wrote:
> m.reddy prasad reddy wrote:
>>
>> can any one tell me how to write assembly language programs in python...if
>> no is there any other way to write the programs in python
>
> Bah, writing assembly language is easy in Python:
>
>  print("MOV EAX, [EBX]")
>  print("XOR EBX, EBX")
>
> Just adjust the strings for your favorite processor architecture and Python
> will produce the assembly code you want.
>
> Now compiling assembly to *machine* code...or calling between Python and
> assembly...that's another matter.  But writing assembly language programs in
> Python?  Easy. ;-)
>

"PyASM is a full-featured dynamic assembler written entirely in
Python. By dynamic, I mean that it can be used to generate and execute
machine code in python at runtime without requiring the generation of
object files and linkage. It essentially allow 'inline' assembly in
python modules on x86 platforms.

"PyASM can also generate object files (for windows) like a traditional
standalone assembler, although you're probably better off using one of
the many freely available assemblers if this is you primary goal."

http://members.verizon.net/~olsongt/usersGuide.html



More information about the Python-list mailing list