From 809917f13b71a21f188d41b4d458876ae1bbee22 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Mon, 31 Aug 2020 21:38:56 +0200 Subject: [PATCH] version 4.1 --- compiler/res/prog8lib/c64graphics.p8 | 37 ++---- compiler/res/version.txt | 2 +- .../assignment/AugmentableAssignmentAsmGen.kt | 3 +- examples/test.p8 | 110 ------------------ 4 files changed, 9 insertions(+), 143 deletions(-) diff --git a/compiler/res/prog8lib/c64graphics.p8 b/compiler/res/prog8lib/c64graphics.p8 index 79b75c023..0e193f43c 100644 --- a/compiler/res/prog8lib/c64graphics.p8 +++ b/compiler/res/prog8lib/c64graphics.p8 @@ -2,7 +2,7 @@ ; bitmap pixel graphics module for the C64 ; only black/white monchrome for now - ; assumes bitmap screen memory is $2000-$3fff +; assumes bitmap screen memory is $2000-$3fff graphics { const uword bitmap_address = $2000 @@ -228,36 +228,13 @@ _ormask .byte 128, 64, 32, 16, 8, 4, 2, 1 ; note: this can be even faster if we also have a 256 byte x-lookup table, but hey. ; see http://codebase64.org/doku.php?id=base:various_techniques_to_calculate_adresses_fast_common_screen_formats_for_pixel_graphics ; the y lookup tables encodes this formula: bitmap_address + 320*(py>>3) + (py & 7) (y from 0..199) -; TODO can we use an assembler function for this to calc this at assembly-time? -_y_lookup_hi - .byte $20, $20, $20, $20, $20, $20, $20, $20, $21, $21, $21, $21, $21, $21, $21, $21 - .byte $22, $22, $22, $22, $22, $22, $22, $22, $23, $23, $23, $23, $23, $23, $23, $23 - .byte $25, $25, $25, $25, $25, $25, $25, $25, $26, $26, $26, $26, $26, $26, $26, $26 - .byte $27, $27, $27, $27, $27, $27, $27, $27, $28, $28, $28, $28, $28, $28, $28, $28 - .byte $2a, $2a, $2a, $2a, $2a, $2a, $2a, $2a, $2b, $2b, $2b, $2b, $2b, $2b, $2b, $2b - .byte $2c, $2c, $2c, $2c, $2c, $2c, $2c, $2c, $2d, $2d, $2d, $2d, $2d, $2d, $2d, $2d - .byte $2f, $2f, $2f, $2f, $2f, $2f, $2f, $2f, $30, $30, $30, $30, $30, $30, $30, $30 - .byte $31, $31, $31, $31, $31, $31, $31, $31, $32, $32, $32, $32, $32, $32, $32, $32 - .byte $34, $34, $34, $34, $34, $34, $34, $34, $35, $35, $35, $35, $35, $35, $35, $35 - .byte $36, $36, $36, $36, $36, $36, $36, $36, $37, $37, $37, $37, $37, $37, $37, $37 - .byte $39, $39, $39, $39, $39, $39, $39, $39, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a - .byte $3b, $3b, $3b, $3b, $3b, $3b, $3b, $3b, $3c, $3c, $3c, $3c, $3c, $3c, $3c, $3c - .byte $3e, $3e, $3e, $3e, $3e, $3e, $3e, $3e +; We use the 64tass syntax for range expressions to calculate this table on assembly time. + +_plot_y_values := $2000 + 320*(range(200)>>3) + (range(200) & 7) + +_y_lookup_lo .byte <_plot_y_values +_y_lookup_hi .byte >_plot_y_values -_y_lookup_lo - .byte $00, $01, $02, $03, $04, $05, $06, $07, $40, $41, $42, $43, $44, $45, $46, $47 - .byte $80, $81, $82, $83, $84, $85, $86, $87, $c0, $c1, $c2, $c3, $c4, $c5, $c6, $c7 - .byte $00, $01, $02, $03, $04, $05, $06, $07, $40, $41, $42, $43, $44, $45, $46, $47 - .byte $80, $81, $82, $83, $84, $85, $86, $87, $c0, $c1, $c2, $c3, $c4, $c5, $c6, $c7 - .byte $00, $01, $02, $03, $04, $05, $06, $07, $40, $41, $42, $43, $44, $45, $46, $47 - .byte $80, $81, $82, $83, $84, $85, $86, $87, $c0, $c1, $c2, $c3, $c4, $c5, $c6, $c7 - .byte $00, $01, $02, $03, $04, $05, $06, $07, $40, $41, $42, $43, $44, $45, $46, $47 - .byte $80, $81, $82, $83, $84, $85, $86, $87, $c0, $c1, $c2, $c3, $c4, $c5, $c6, $c7 - .byte $00, $01, $02, $03, $04, $05, $06, $07, $40, $41, $42, $43, $44, $45, $46, $47 - .byte $80, $81, $82, $83, $84, $85, $86, $87, $c0, $c1, $c2, $c3, $c4, $c5, $c6, $c7 - .byte $00, $01, $02, $03, $04, $05, $06, $07, $40, $41, $42, $43, $44, $45, $46, $47 - .byte $80, $81, $82, $83, $84, $85, $86, $87, $c0, $c1, $c2, $c3, $c4, $c5, $c6, $c7 - .byte $00, $01, $02, $03, $04, $05, $06, $07 }} } diff --git a/compiler/res/version.txt b/compiler/res/version.txt index 23a343444..7d5c902e7 100644 --- a/compiler/res/version.txt +++ b/compiler/res/version.txt @@ -1 +1 @@ -4.1-SNAPSHOT +4.1 diff --git a/compiler/src/prog8/compiler/target/c64/codegen/assignment/AugmentableAssignmentAsmGen.kt b/compiler/src/prog8/compiler/target/c64/codegen/assignment/AugmentableAssignmentAsmGen.kt index 6a74eda4a..e90d9fa65 100644 --- a/compiler/src/prog8/compiler/target/c64/codegen/assignment/AugmentableAssignmentAsmGen.kt +++ b/compiler/src/prog8/compiler/target/c64/codegen/assignment/AugmentableAssignmentAsmGen.kt @@ -126,7 +126,7 @@ internal class AugmentableAssignmentAsmGen(private val program: Program, ident != null -> inplaceModification_word_variable_to_variable(target.asmVarname, target.datatype, operator, ident) // TODO more specialized code for types such as memory read etc. // value is DirectMemoryRead -> { -// println("warning: slow stack evaluation used (8): $name $operator= ${value::class.simpleName} at ${value.position}") // TODO +// println("warning: slow stack evaluation used (8): $name $operator= ${value::class.simpleName} at ${value.position}") // // assignmentAsmGen.translateOtherAssignment(origAssign) // asmgen.translateExpression(value.addressExpression) // asmgen.out(""" @@ -135,7 +135,6 @@ internal class AugmentableAssignmentAsmGen(private val program: Program, // inx // """) // inplaceModification_word_value_to_variable(name, operator, ) -// // TODO // } value is TypecastExpression -> { if (tryRemoveRedundantCast(value, target, operator)) return diff --git a/examples/test.p8 b/examples/test.p8 index 1e5dfc3ba..c754f42b4 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -10,116 +10,6 @@ main { ; sub color(...) {} ; sub other(ubyte color) {} ; TODO don't cause name conflict - byte b1 - byte b2 - byte b3 - - word w1 - word w2 - word w3 - - - b2 = 13 - b3 = 100 - b1 = b3 / b2 - txt.print_b(b1) - c64.CHROUT('\n') - - b2 = -13 - b3 = 100 - b1 = b3 / b2 - txt.print_b(b1) - c64.CHROUT('\n') - - b2 = 13 - b3 = -100 - b1 = b3 / b2 - txt.print_b(b1) - c64.CHROUT('\n') - - b2 = -13 - b3 = -100 - b1 = b3 / b2 - txt.print_b(b1) - c64.CHROUT('\n') - - - b2 = 13 - b3 = 100 - b3 /= b2 - txt.print_b(b3) - c64.CHROUT('\n') - - b2 = -13 - b3 = 100 - b3 /= b2 - txt.print_b(b3) - c64.CHROUT('\n') - - b2 = 13 - b3 = -100 - b3 /= b2 - txt.print_b(b3) - c64.CHROUT('\n') - - b2 = -13 - b3 = -100 - b3 /= b2 - txt.print_b(b3) - c64.CHROUT('\n') - c64.CHROUT('\n') - - - - - - w2 = 133 - w3 = 20000 - w1 = w3 / w2 - txt.print_w(w1) - c64.CHROUT('\n') - - w2 = -133 - w3 = 20000 - w1 = w3 / w2 - txt.print_w(w1) - c64.CHROUT('\n') - - w2 = 133 - w3 = -20000 - w1 = w3 / w2 - txt.print_w(w1) - c64.CHROUT('\n') - - w2 = -133 - w3 = -20000 - w1 = w3 / w2 - txt.print_w(w1) - c64.CHROUT('\n') - - - w2 = 133 - w3 = 20000 - w3 /= w2 - txt.print_w(w3) - c64.CHROUT('\n') - - w2 = -133 - w3 = 20000 - w3 /= w2 - txt.print_w(w3) - c64.CHROUT('\n') - - w2 = 133 - w3 = -20000 - w3 /= w2 - txt.print_w(w3) - c64.CHROUT('\n') - - w2 = -133 - w3 = -20000 - w3 /= w2 - txt.print_w(w3) c64.CHROUT('\n') } }