diff --git a/assets/bios/pipcode.bas b/assets/bios/pipcode.bas index 6212a49..a21e4bd 100644 --- a/assets/bios/pipcode.bas +++ b/assets/bios/pipcode.bas @@ -2,11 +2,12 @@ 20 s=cput(1,"POLL") 30 if s><0 then goto 900 40 l=cget(1,0) -41 print("length: "+l+", pixels: "+l/3) -50 for i=0 to l step 3 +41 REM print("length: "+l+", pixels: "+l/3) +50 for i=0 to l-1 step 3 60 m=peek(i)*160+peek(i+1) 62 p=peek(i+2) 63 poke(-1048576-m,p) 70 next -899 end +80 REM poke(-1070977,0) +90 goto 20 900 print("Polling failed: "+s) diff --git a/src/net/torvald/terrarum/modulecomputers/tsvmperipheral/WorldRadar.kt b/src/net/torvald/terrarum/modulecomputers/tsvmperipheral/WorldRadar.kt index 37cd8ca..e9211be 100644 --- a/src/net/torvald/terrarum/modulecomputers/tsvmperipheral/WorldRadar.kt +++ b/src/net/torvald/terrarum/modulecomputers/tsvmperipheral/WorldRadar.kt @@ -77,6 +77,8 @@ class WorldRadar(pngfile: FileHandle) : BlockTransferInterface(false, true) { return sendSize } + private var oldCmdbuf = HashMap(1024) + override fun writeoutImpl(inputData: ByteArray) { val inputString = inputData.trimNull().toString(VM.CHARSET) @@ -116,8 +118,8 @@ class WorldRadar(pngfile: FileHandle) : BlockTransferInterface(false, true) { } }} - cmdbuf.keys.sorted().forEach { key -> - val value = cmdbuf[key]!!.toInt() + (oldCmdbuf.keys union cmdbuf.keys).sorted().forEach { key -> + val value = (cmdbuf[key] ?: AIR_OUT).toInt() val x = key % 256 val y = key / 256 messageComposeBuffer.write(y) @@ -125,6 +127,7 @@ class WorldRadar(pngfile: FileHandle) : BlockTransferInterface(false, true) { messageComposeBuffer.write(value) } + oldCmdbuf = cmdbuf } } } \ No newline at end of file diff --git a/test_assets/test_terrain.png b/test_assets/test_terrain.png index 45e5cf4..ae15ca7 100644 Binary files a/test_assets/test_terrain.png and b/test_assets/test_terrain.png differ