version 4.1

This commit is contained in:
Irmen de Jong 2020-08-31 21:38:56 +02:00
parent 2b35498370
commit 809917f13b
4 changed files with 9 additions and 143 deletions

View File

@ -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
}}
}

View File

@ -1 +1 @@
4.1-SNAPSHOT
4.1

View File

@ -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

View File

@ -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')
}
}