Commits

cheery committed 43a25a5

couple changes, cmovcc, jcc patch.

Comments (0)

Files changed (3)

examples/arm/hello.py

 
 dynamic = Dynamic('arm')
 
-command = Bytes('echo hello arm > /mnt/sd/greeting\n\x00')
-
-gp2x_directory = Bytes('/usr/gp2x\x00')
-gp2x_menu = Bytes('/usr/gp2x/gp2xmenu\x00')
+greeting = Bytes('run this in sterm and smile.\n\x00')
 
 entry = Assembly([
 
     MOV(R0, 0),
-    ADR(R0, command),
+    ADR(R0, greeting),
     MOV(R14, R15),
-    LD(R15, dynamic.extern('system')),
+    LD(R15, dynamic.extern('printf')),
 
     MOV(R0, 0),
-    ADR(R0, gp2x_directory),
-    MOV(R14, R15),
-    LD(R15, dynamic.extern('chdir')),
-
-    MOV(R0, 0),
-    ADR(R0, gp2x_menu),
-    MOV(R1, R0),
-    MOV(R2, 0),
-    MOV(R14, R15),
-    LD(R15, dynamic.extern('execl')),
-
-    MOV(R0, 0),
-    MOV(R14, R15),
-    # for an exception today, PLT should be near enough.
+    MOV(R14, R15), # for an exception today, PLT should be near enough.
     LD(R15, dynamic.extern('exit')),
-
 ])
 
 dynamic.require('libc.so.6')
 executable(
-    open('hello.gpe', 'w'),
+    open('hello.gpu', 'w'),
     [
-        gp2x_directory,
-        gp2x_menu,
-        command,
+        greeting,
         Align(4),
         entry,
     ],
 
     :copyright: 2009 by Henri Tuhola <henri.tuhola@gmail.com>
 """
+from core import (
+    Assembly
+)
 # from core import (
 #     Assembly, Instruction, Register,
 #     Imm32, Imm8, Rel32, IPR32, Indirect,
 
 # conditional execution:
 def cmov(condition, dst, src):
-    return Instruction(chr(0x40 + condition), ModRM(register, operand))
+    return Instruction('\x0f', chr(0x40 + condition), ModRM(register, operand))
 
 def cjump(condition, target):
-    return Instruction(chr(0x80 + condition), Rel32(target))
+    return Instruction('\x0f', chr(0x80 + condition), Rel32(target))