;puts one char on screen(x,y) ;in x,y ;in a = char tile no draw_char: sta draw_char1+1 lda linetab3l,y clc adc collumtabl,x sta v1 lda linetab3h,y adc collumtabh,x sta v1+1 draw_char1 ldy #$ff lda chartabl,y sta v0 lda chartabh,y sta v0+1 ldy #7 draw_char0 lda (v0),y sta (v1),y dey bpl draw_char0 rts
is my "put background tile on screen".
and here is my not optimised to death "sprite" routine just to give you an idea how much code needed to "mimic" 1 sprite on c64... where there you have 2 POKES for positioning (or 2 LDA/STAs for x and ypos (in 256 mode))
; 1000 PROC DRAW_SIMPLE ; 1010 AD=SPR+NO*63 ; 1020 FOR J=0 TO $14 ; 1030 FOR I=0 TO 2 ; 1040 POKE F+J+I*24+Y,PEEK(AD) ; 1045 AD=AD+1 ; 1050 NEXT I ; 1060 NEXT J ; 1100 ENDPROC ;each 4 shifted sprites are in 1 page (64 bytes each) draw_simple: lda #3*8 ;vertical only 3 sprites sta got_abs2+1 lda xpos tax ldy tempfacing cpy #8 bcc draw_simple00 lda ypos draw_simple00 and #3 ;0-3 ora tempfacing tay ;shifted lda spritetabl,y sta simple0+1 clc adc #21 ;y size per stripe sta simple1+1 adc #21 sta simple2+1 lda spritetabh,y sta simple0+2 sta simple1+2 sta simple2+2 txa lsr lsr tax ldy ypos clc lda linetabl,y adc collumtabl,x sta v1 lda linetabh,y adc collumtabh,x sta v1+1 lda v1 clc adc #24 sta v2 lda v1+1 adc #0 sta v2+1 lda v1 clc adc #48 sta v3 lda v1+1 adc #0 sta v3+1 clear_simple: lda yptab,y tay ;now copy 63 bytes = 3 * 21 bytes ldx #0 simple0: lda $ffff,x eor (v1),y sta (v1),y simple1: lda $ffff,x eor (v2),y sta (v2),y simple2: lda $ffff,x eor (v3),y sta (v3),y iny inx cpx #21 bcc simple0 rts ; PROC DRAW_SPLIT ; 2010 EF=F+1024 ; 2020 H1=24-PEEK($7F00+YP) ; 2030 H2=21-H1 ; 2040 AD=SPR+NO*63 ; 2050 FOR J=0 TO H1-1 ; 2060 FOR I=0 TO 2 ; 2070 POKE F+J+I*24+Y,PEEK(AD) ; 2080 AD=AD+1 ; 2090 NEXT I ; 2100 NEXT J ; 2110 FOR J=0 TO H2-1 ; 2120 FOR I=0 TO 2 ; 2130 POKE EF+J+I*24,PEEK(AD) ; 2140 AD=AD+1 ; 2150 NEXT I ; 2160 NEXT J ;2199 ENDPROC draw_split: lda #4*8 sta got_abs2+1 ldy ypos lda h1tab,y sta h1+1 lda xpos tax ldy tempfacing cpy #8 bcc draw_split00 lda ypos draw_split00 and #3 ora tempfacing tay ;shifted lda spritetabl,y sta split0+1 sta split00+1 clc adc #21 ;y size per stripe sta split1+1 sta split11+1 adc #21 sta split2+1 sta split22+1 lda spritetabh,y sta split0+2 sta split1+2 sta split2+2 sta split00+2 sta split11+2 sta split22+2 txa lsr ;div 2 lsr ;div 2 tax ldy ypos lda linetabl,y clc adc collumtabl,x sta v1 lda linetabh,y adc collumtabh,x sta v1+1 lda v1 clc adc #24 sta v2 lda v1+1 adc #0 sta v2+1 lda v1 clc adc #48 sta v3 lda v1+1 adc #0 sta v3+1 clear_split: lda yptab,y tay ldx #0 split0: lda $ffff,x eor (v1),y sta (v1),y split1: lda $ffff,x eor (v2),y sta (v2),y split2: lda $ffff,x eor (v3),y sta (v3),y iny inx h1: cpx #21 bne split0 clc lda v1+1 adc #4 sta v1+1 lda v2+1 adc #4 sta v2+1 lda v3+1 adc #4 sta v3+1 ldy #0 split00: lda $ffff,x eor (v1),y sta (v1),y split11: lda $ffff,x eor (v2),y sta (v2),y split22: lda $ffff,x eor (v3),y sta (v3),y iny inx cpx #21 bne split00 rts clear: ldy ypos lda #21 clc adc yptab,y cmp #25 bcc clear0 jmp clear_split clear0 jmp clear_simple
the Turbo Basic routines there make the code easier to understand. important to understand is the mentioned layout of the screen.















