region detection, cd states wip, fixes, stuff
[picodrive.git] / platform / gp2x / code940 / 940init.s
index dcf4368..904ccba 100644 (file)
@@ -182,4 +182,14 @@ wait_irq:
 \r
 .pool\r
 \r
+\r
+.global set_if_not_changed @ int *val, int oldval, int newval\r
+\r
+set_if_not_changed:\r
+    swp    r3, r2, [r0]\r
+    cmp    r1, r3\r
+    bxeq   lr\r
+    strne  r3, [r0] @ restore value which was changed there by other core\r
+    bx     lr\r
+\r
 @ vim:filetype=armasm:\r