diff --git a/assets/disk0/dmatest.js b/assets/disk0/dmatest.js new file mode 100644 index 0000000..54f962f --- /dev/null +++ b/assets/disk0/dmatest.js @@ -0,0 +1,20 @@ +let len = 560*448 +let pcnt = (system.maxmem() / len)|0 +if (pcnt < 2) { + printerrln("Not enought RAM on the system to test!") + return +} +let c = 0 +print("Rendering plane ") +for (c = 0; c < pcnt; c++) { + print(`${c} `) + for (let i = 0; i < len; i++) { + sys.poke(c*len + i, c * ((256/pcnt)|0) + 1) + } +} +println("Let's see how fast DMA really is!") +c = 0 +while (1) { + dma.ramToFrame(len * c, 0, len) + c = (c + 1) % pcnt +} \ No newline at end of file diff --git a/assets/disk0/dmatest2.js b/assets/disk0/dmatest2.js new file mode 100644 index 0000000..0d5d428 --- /dev/null +++ b/assets/disk0/dmatest2.js @@ -0,0 +1,20 @@ +con.clear() +com.sendMessage(0, 'CLOSE') +com.sendMessage(0, 'OPENR"fox.bytes"') +let status = com.getStatusCode(0) +if (0 == status) { + println("DMA reading from disk...") + let t1 = sys.nanoTime() + dma.comToRam(0, 0, 0, 560 * 448) + let t2 = sys.nanoTime() + println("DMA copying to the framebuffer...") + let t3 = sys.nanoTime() + dma.ramToFrame(0, 0, 560 * 448) + let t4 = sys.nanoTime() + + println(`DMA disk-to-RAM time: ${(t2 - t1) / 1000000} ms`) + println(`DMA RAM-to-fbuf time: ${(t4 - t3) / 1000000} ms`) +} +else { + printerrln(`File 'fox.bytes' not found on the root of the disk: ${status}`) +} \ No newline at end of file