Hallo Forum,
ich habe mal irgendwann eine funktionierende Routine geschrieben, um eine Map, die im Speicher liegt, auf dem Bildschirm abzubilden. Nun ist mir allerdings aufgefallen, dass diese sehr viel Zeit verbraucht. Beispielsweise benötigt sie ca. 170 Raster Lines um einen 19x13 Zeichen großen Ausschnitt zu zeichnen. Ich wüsste allerdings nicht, was man besser machen könnte. Vielleicht fällt euch etwas ein. Hier ist sie:
Code
- ; Uses:
- ; $02,$03 (for color mem ptr)
- ; Expects:
- ; screen memory location at $0400
- ; map mem pos in $fb
- ; map width in MapWidth
- ; map height in MapHeight
- ; upper left screen mem location in $fd
- DrawMap ; Write color mem addr to $02
- lda $fd
- sta $02
- lda $fe; add $d4 to $fe
- clc
- adc #$d4
- sta $03
- ; Start loop
- ldx MapHeight
- dex
- stx counter
- outer_draw lda MapWidth
- tay
- dey
- draw_map lda ($fb),y
- sta ($fd),y
- ; Adjust color---------
- tax
- lda Colors,x
- sta ($02),y
- ;----------------------
- dey
- bpl draw_map
- ldy MapWidth
- jsr AddYtoFBFC
- ldy #40
- jsr AddYtoFDFE
- jsr AddYto0203
- dec counter
- bpl outer_draw
- rts
- counter !byte 0
- AddYtoFBFC tya
- clc
- adc $fb
- sta $fb
- lda $fc
- adc #0
- sta $fc
- rts
- AddYtoFDFE und AddYto0203 sehen genauso aus.
Colors ist ein Array mit den jeweiligen Farben für die 256 Zeichen im Zeichensatz.