i have implemented a fast 128x128 Bitmap Screen. < 50 cycles per pixel.
But i need an 184x176 Bitmap screen with the same speed if it possible.
The example code is partly from Codebase64.
Is there anybody outhere he can help me?
My goal is to write an own SuperExpander with some mathematicals function to draw on the screen in pure assembler.
Best regards
Sven
PS: the time measurement can be deleted, of course.
Code: Select all
; 10 SYS8192
*=$1201
dB $0B, $12, $0A, $00, $9E, $38, $31, $39, $32, $00, $00, $00
*=$2000
;sei ; can be enabled, but then you can not measuring the time
init:
; set up screen bitmap (192x160 pixels)
LDA #%00010101 ; 20 lines and double char (y=160 pixel)
STA $9003
LDA #24 ; 24 columns (x=192 pixel)
STA $9002
LDA #204 ; 4096 screen, 4096 charmap
STA $9005
LDA #10 ; Make place for more columns
STA $9000
lda #$26 ; center screen if necessary
sta $9001
lda #$05 ; color of dot´s
sta $20
lda #16 ; first character, we need 256 - 16 = 240 for the whole screen
sta $21
ldx #$00
LoopCharMap:
lda $21
sta $1000+(0*24),x
lda $20
sta $9400+(0*24),x
inc $21
lda $21
sta $1000+(1*24),x
lda $20
sta $9400+(1*24),x
inc $21
lda $21
sta $1000+(2*24),x
lda $20
sta $9400+(2*24),x
inc $21
lda $21
sta $1000+(3*24),x
lda $20
sta $9400+(3*24),x
inc $21
lda $21
sta $1000+(4*24),x
lda $20
sta $9400+(4*24),x
inc $21
lda $21
sta $1000+(5*24),x
lda $20
sta $9400+(5*24),x
inc $21
lda $21
sta $1000+(6*24),x
lda $20
sta $9400+(6*24),x
inc $21
lda $21
sta $1000+(7*24),x
lda $20
sta $9400+(7*24),x
inc $21
inx
cpx #$10
bne LoopCharMap
Cleanupbitmap:
LDA #$00
STA $02
LDX #$11 ; Bitmap start $1100
LDA #0
ilpe2:
STX $03
TAY
ilp3:
DEY
STA ($02),Y
BNE ilp3
INX
CPX #$20
BNE ilpe2
lda #0
sta $A1
sta $A2
ldy #0 ; Max 0 - 127
LoopY:
ldx #0 ; Max 0 - 127
LoopX:
jsr SPlot
inx
cpx #127
bne LoopX
iny
cpy #127
bne LoopY
lda $a2 ; save the jiffies for correct timing
sta $30
lda $a1
sta $31
lda #46 ; reset screen to normal settings
sta $9003
lda #22
sta $9002
lda #192
sta $9005
lda #12
sta $9000
jsr $e55f ; clear screen
lda $30
tax
lda $31
jmp $ddcd ; print solution of jiffies
SPlot:
lda LoByte,x ; 4*
sta $FB ; ZP 3
lda HiByte,x ; 4*
sta $FC ; ZP 3
lda ($FB),y ; 5*
ora BitMask,x ; 4*
sta ($FB),y ; 6
rts ; 6
; --------
; 31 cycles
LoByte:
db $00,$00,$00,$00,$00,$00,$00,$00,$80,$80,$80,$80,$80,$80,$80,$80 ; Column 1-2 Pixel 0-15
db $00,$00,$00,$00,$00,$00,$00,$00,$80,$80,$80,$80,$80,$80,$80,$80 ; Column 3-4 Pixel 16-31
db $00,$00,$00,$00,$00,$00,$00,$00,$80,$80,$80,$80,$80,$80,$80,$80 ; Column 5-6 Pixel 32-47
db $00,$00,$00,$00,$00,$00,$00,$00,$80,$80,$80,$80,$80,$80,$80,$80 ; Column 7-8 Pixel 48-63
db $00,$00,$00,$00,$00,$00,$00,$00,$80,$80,$80,$80,$80,$80,$80,$80 ; Column 9-10 Pixel 64-79
db $00,$00,$00,$00,$00,$00,$00,$00,$80,$80,$80,$80,$80,$80,$80,$80 ; Column 11-12 Pixel 80-95
db $00,$00,$00,$00,$00,$00,$00,$00,$80,$80,$80,$80,$80,$80,$80,$80 ; Column 13-14 Pixel 96-111
db $00,$00,$00,$00,$00,$00,$00,$00,$80,$80,$80,$80,$80,$80,$80,$80 ; Column 15-16 Pixel 112-127
HiByte:
db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ; Column 1-2 ...
db $12,$12,$12,$12,$12,$12,$12,$12,$12,$12,$12,$12,$12,$12,$12,$12 ; Column 3-4
db $13,$13,$13,$13,$13,$13,$13,$13,$13,$13,$13,$13,$13,$13,$13,$13 ; Column 5-6
db $14,$14,$14,$14,$14,$14,$14,$14,$14,$14,$14,$14,$14,$14,$14,$14 ; Column 7-8
db $15,$15,$15,$15,$15,$15,$15,$15,$15,$15,$15,$15,$15,$15,$15,$15 ; Column 9-10
db $16,$16,$16,$16,$16,$16,$16,$16,$16,$16,$16,$16,$16,$16,$16,$16 ; Column 11-12
db $17,$17,$17,$17,$17,$17,$17,$17,$17,$17,$17,$17,$17,$17,$17,$17 ; Column 13-14
db $18,$18,$18,$18,$18,$18,$18,$18,$18,$18,$18,$18,$18,$18,$18,$18 ; Column 15-16
BitMask:
db $80,$40,$20,$10,$08,$04,$02,$01 ; #%100000000, #%01000000, #%00100000, ...
db $80,$40,$20,$10,$08,$04,$02,$01
db $80,$40,$20,$10,$08,$04,$02,$01
db $80,$40,$20,$10,$08,$04,$02,$01
db $80,$40,$20,$10,$08,$04,$02,$01
db $80,$40,$20,$10,$08,$04,$02,$01
db $80,$40,$20,$10,$08,$04,$02,$01
db $80,$40,$20,$10,$08,$04,$02,$01
db $80,$40,$20,$10,$08,$04,$02,$01
db $80,$40,$20,$10,$08,$04,$02,$01
db $80,$40,$20,$10,$08,$04,$02,$01
db $80,$40,$20,$10,$08,$04,$02,$01
db $80,$40,$20,$10,$08,$04,$02,$01
db $80,$40,$20,$10,$08,$04,$02,$01
db $80,$40,$20,$10,$08,$04,$02,$01
db $80,$40,$20,$10,$08,$04,$02,$01