From 5f3a9e189af182563c1895c1e9f18bf19184e58a Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Thu, 26 Mar 2020 01:20:04 +0100 Subject: [PATCH] doc --- docs/source/todo.rst | 2 +- examples/invalid_assembly.p8 | 2 +- examples/test.p8 | 77 ++++++++++++++++++++++++++++++++---- 3 files changed, 72 insertions(+), 9 deletions(-) diff --git a/docs/source/todo.rst b/docs/source/todo.rst index 0608f896d..abba832f0 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -2,7 +2,7 @@ TODO ==== -- fix the invalid assembly generation problem (invalid_assembly.p8) +- fix the invalid assembly generation problem for several direct memory operations (invalid_assembly.p8 / todo.p8) - implement the asm for bitshift on arrays (last missing assembly code generation) diff --git a/examples/invalid_assembly.p8 b/examples/invalid_assembly.p8 index eb3d8764c..d9fb7c00a 100644 --- a/examples/invalid_assembly.p8 +++ b/examples/invalid_assembly.p8 @@ -58,7 +58,7 @@ main { sub plot(uword px, ubyte py, ubyte color) { uword addr = 320 - A=@(addr) ; TODO invalid assemlby generated lda (addr),y something to do with zeropage allocation???? + A=@(addr) ; TODO invalid assemlby generated lda (addr),y something to do with zeropage allocation???? or simply direct memory write/read wrong translations? @(addr) = A } diff --git a/examples/test.p8 b/examples/test.p8 index bce031b8f..f3428164d 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -4,21 +4,84 @@ main { - uword[2] array1 = 1 - - sub start() { uword addr = $c000 - &uword addr2 = $c100 + &ubyte addr2 = $c100 - ; not sure if these are okay: + uword border = $d020 + &ubyte borderptr = $d020 +; @($d020) = 0 +; @(border) = 1 +; borderptr=2 + +; @($d020)+=9 +; @($d020)-=9 + @(border)+=9 ; TODO fix wrong assembly code + @(border)-=9 ; TODO fix wrong assembly code +; borderptr+=9 +; borderptr-=9 + + @($c000) |= 8 ; ok? + addr2 |= 8 ; ok? + @(addr) |= 8 ; ok? + + + + ; TODO Verify memory augmented assignment operations. addr2 = 0 - addr2 |= 128 + addr2 |= 8 + addr2 |= 2 + addr2 |= 2 + + c64scr.print_ub(addr2) + c64.CHROUT('\n') + if(addr2 != 10) { + c64scr.print("error1\n") + } addr2 += 1 + addr2 *=10 + c64scr.print_ub(addr2) + c64.CHROUT('\n') + if(addr2 != 110) { + c64scr.print("error2\n") + } + + @($c000) = 0 + @($c000) |= 8 ; TODO FIX result of memory-OR/XOR and probably AND as well + @($c000) |= 2 ; TODO FIX result of memory-OR/XOR and probably AND as well + @($c000) |= 2 ; TODO FIX result of memory-OR/XOR and probably AND as well + c64scr.print_ub( @($c000) ) + c64.CHROUT('\n') + if(@($c000) != 10) { + c64scr.print("error3\n") + } + + @($c000) += 1 ; TODO fix result of memory += 1 + @($c000) *=10 + c64scr.print_ub( @($c000) ) + c64.CHROUT('\n') + if(@($c000) != 110) { + c64scr.print("error4\n") + } + @(addr) = 0 - @(addr) |= 128 ; TODO FIX result of memory-OR/XOR and probably AND as well + @(addr) |= 8 ; TODO FIX result of memory-OR/XOR and probably AND as well + @(addr) |= 2 ; TODO FIX result of memory-OR/XOR and probably AND as well + @(addr) |= 2 ; TODO FIX result of memory-OR/XOR and probably AND as well + c64scr.print_ub( @(addr) ) + c64.CHROUT('\n') + if(@(addr) != 10) { + c64scr.print("error5\n") + } + @(addr) += 1 ; TODO fix result of memory += 1 + @(addr) *= 10 + c64scr.print_ub( @(addr) ) + c64.CHROUT('\n') + if(@(addr) != 110) { + c64scr.print("error6\n") + } } }