Browse files

Tidied radar.dasm and updated README and APK.

  • Loading branch information...
1 parent 620008b commit 5a074c4ecd133a144e0aea8ab8ec5e8d13414171 @sticksoft committed Apr 15, 2012
Showing with 21 additions and 20 deletions.
  1. BIN ADCPU16Emu.apk
  2. +5 −3 README
  3. +16 −17 res/raw/radar.dasm
BIN ADCPU16Emu.apk
Binary file not shown.
@@ -1,10 +1,10 @@
Android implementation of Notch's DCPU-16 (v1.1) (
-Version 0.15
+Version 0.16
By Andrew "Stick" Boothroyd (@sticksoft)
Latest stable version:
+Don't forget you can post issues / feature requests on GitHub :)
@@ -37,7 +37,7 @@ Pressing "Assemble" will reset the emulator, assemble your program, output the a
Return to the first tab to start it and view changes to the memory.
The third tab displays the text console. This is a work-in-progress and, as such, colours may not be displayed the same as other emulators.
-Keyboard input has not yet been implemented for the console (I'm tidying up and adding other features at the moment) - drop me a line at @sticksoft on Twitter if you're desparate for it!
+Keyboard input has not yet been implemented for the console (I'm tidying up and adding other features at the moment) - drop me a line at @sticksoft or file a feature request if you're desparate for it!
The fourth tab displays a virtual ship! Control it by writing to 0xAD00 (throttle) and 0xAD02 (yaw starboard / port); sample code is included that does this (move.dasm).
Values for these registers are interpreted as signed 2's complement integers; e.g. 0x7FFF = all ahead full, 0x8000 = full reverse, 0x0000 = all stop.
@@ -75,9 +75,11 @@ The asteroids are offset slightly on the radar
Added a sample radar assembly file
Added asteroids
Altered yaw to use angular velocity and a gyro (Thanks, icarroll!)
33 res/raw/radar.dasm
@@ -3,10 +3,9 @@
; Instead of clearing the screen, the old positions are compared with the new positions, and any
; unused ones are removed. This is smoother and faster than doing a fill of 0s each refresh.
-set [0xad00], 100
-set [whichbuffer], 0
-set b, 0x7000
-set c, 0x7100
+set [0xad00], 100 ; Move the ship forwards gently
+set b, 0x7000 ; First position buffer
+set c, 0x7100 ; Second position buffer
@@ -17,30 +16,33 @@ set [0x80e8], 0xf078
; Check for radar contacts
set [0xAD10], 0xffff
-; Get count
-set I, [0xAD11]
; Swap buffers
xor b, c
xor c, b
xor b, c
set [b], 0
+; Get contact count
+set I, [0xAD11]
+; If there are 0 contacts left, goto cleanup
ife 0, I
-set pc, cleanup
+ set pc, cleanup
+; Ask radar about this contact number (index starts at 1; 0 is no-op)
set [0xAD10], I
sub I, 1
; Map x to 0 - 15
-set x, [0xAD12]
+set x, [0xAD12] ; Get contact's x position
shr x, 12
add x, 8
and x, 15
; Map y to 0 - 15, multiply by screen width (32)
-set y, [0xAD14]
+set y, [0xAD14] ; Get contact's z position
shr y, 12
add y, 8
and y, 15
@@ -60,7 +62,7 @@ set [a], x
; Write the blip to the screen
set [x+0x8000], 0xf041
-set pc, loop1 ; continue loop
+set pc, loop1 ; Continue loop
@@ -91,14 +93,13 @@ ife I, c
set pc, break2
set a, [I]
-set x, [0x7200+a]
-ife x, 0
- set [0x8000+a], 0
+ife [0x7200+a], 0 ; If the backbuffer from b is empty at this position...
+ set [0x8000+a], 0 ; ...then clear it from the main buffer as well.
sub I, 1
set pc, loop3
-; Delete the new markers from the 0x7200 buffer
+; Delete the new markers from the 0x7200 buffer, making it ready for next time
set I, [b]
add I, b
@@ -118,6 +119,4 @@ set pc, loop4
set pc, end
-:whichbuffer dat 0x0

0 comments on commit 5a074c4

Please sign in to comment.