mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-23 11:33:07 +00:00
tfv: initial screen copy routine
This commit is contained in:
parent
225dc6f4cc
commit
4d846e778b
@ -605,23 +605,40 @@ short gr_addr_lookup[48]={
|
|||||||
|
|
||||||
int grsim_put_sprite(unsigned char *sprite_data, int xpos, int ypos) {
|
int grsim_put_sprite(unsigned char *sprite_data, int xpos, int ypos) {
|
||||||
|
|
||||||
int i,j,xsize,ysize;
|
unsigned char i;
|
||||||
unsigned char *ptr;
|
unsigned char *ptr;
|
||||||
short address;
|
short address;
|
||||||
|
|
||||||
ptr=sprite_data;
|
ptr=sprite_data;
|
||||||
xsize=*ptr;
|
x=*ptr;
|
||||||
ptr++;
|
ptr++;
|
||||||
ysize=*ptr;
|
ram[CV]=*ptr;
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
for(j=0;j<ysize;j++) {
|
while(1) {
|
||||||
address=gr_addr_lookup[(ypos+j)/2];
|
address=gr_addr_lookup[ypos/2];
|
||||||
address+=xpos;
|
address+=xpos;
|
||||||
for(i=0;i<xsize;i++) {
|
for(i=0;i<x;i++) {
|
||||||
if (*ptr) ram[address]=*ptr;
|
a=*ptr;
|
||||||
|
if (a==0) {
|
||||||
|
}
|
||||||
|
else if ((a&0xf0)==0) {
|
||||||
|
ram[address]&=0xf0;
|
||||||
|
ram[address]|=a;
|
||||||
|
}
|
||||||
|
else if ((a&0x0f)==0) {
|
||||||
|
ram[address]&=0x0f;
|
||||||
|
ram[address]|=a;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ram[address]=a;
|
||||||
|
}
|
||||||
ptr++;
|
ptr++;
|
||||||
address++;
|
address++;
|
||||||
}
|
}
|
||||||
|
ypos++;
|
||||||
|
ram[CV]--;
|
||||||
|
if (ram[CV]==0) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -6,12 +6,12 @@ PNG2GR = ../gr-utils/png2gr
|
|||||||
all: tfv.dsk
|
all: tfv.dsk
|
||||||
|
|
||||||
tfv.dsk: TITLE.GR TFV ED
|
tfv.dsk: TITLE.GR TFV ED
|
||||||
$(DOS33) -y tfv.dsk BSAVE -a 0xc00 TFV
|
$(DOS33) -y tfv.dsk BSAVE -a 0x1000 TFV
|
||||||
$(DOS33) -y tfv.dsk BSAVE -a 0x400 TITLE.GR
|
$(DOS33) -y tfv.dsk BSAVE -a 0x400 TITLE.GR
|
||||||
$(DOS33) -y tfv.dsk BSAVE -a 0x900 ED
|
$(DOS33) -y tfv.dsk BSAVE -a 0x900 ED
|
||||||
|
|
||||||
TFV: tfv.o
|
TFV: tfv.o
|
||||||
ld65 -o TFV tfv.o -C ./apple2_c00.inc
|
ld65 -o TFV tfv.o -C ./apple2_1000.inc
|
||||||
|
|
||||||
tfv.o: tfv.s title.inc
|
tfv.o: tfv.s title.inc
|
||||||
ca65 -o tfv.o tfv.s -l tfv.lst
|
ca65 -o tfv.o tfv.s -l tfv.lst
|
||||||
@ -27,3 +27,4 @@ TITLE.GR: title.png
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *~ TITLE.GR *.o *.lst ED
|
rm -f *~ TITLE.GR *.o *.lst ED
|
||||||
|
|
||||||
|
12
tfv/apple2_1000.inc
Normal file
12
tfv/apple2_1000.inc
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
MEMORY {
|
||||||
|
ZP: start = $00, size = $1A, type = rw;
|
||||||
|
RAM: start = $1000, size = $8E00, file = %O;
|
||||||
|
}
|
||||||
|
|
||||||
|
SEGMENTS {
|
||||||
|
CODE: load = RAM, type = ro;
|
||||||
|
RODATA: load = RAM, type = ro;
|
||||||
|
DATA: load = RAM, type = rw;
|
||||||
|
BSS: load = RAM, type = bss, define = yes;
|
||||||
|
ZEROPAGE: load = ZP, type = zp;
|
||||||
|
}
|
73
tfv/tfv.s
73
tfv/tfv.s
@ -43,6 +43,10 @@ FIRST EQU $F0
|
|||||||
TEMP EQU $FA
|
TEMP EQU $FA
|
||||||
RUN EQU $FA
|
RUN EQU $FA
|
||||||
TEMP2 EQU $FB
|
TEMP2 EQU $FB
|
||||||
|
INL EQU $FC
|
||||||
|
INH EQU $FD
|
||||||
|
OUTL EQU $FE
|
||||||
|
OUTH EQU $FF
|
||||||
|
|
||||||
;=============================
|
;=============================
|
||||||
; set low-res graphics, page 0
|
; set low-res graphics, page 0
|
||||||
@ -55,6 +59,10 @@ TEMP2 EQU $FB
|
|||||||
;=================
|
;=================
|
||||||
jsr CLRTOP
|
jsr CLRTOP
|
||||||
|
|
||||||
|
lda #$c
|
||||||
|
sta BASH
|
||||||
|
lda #$0
|
||||||
|
sta BASL ; load image off-screen 0xc00
|
||||||
|
|
||||||
lda #>(title_image)
|
lda #>(title_image)
|
||||||
sta GBASH
|
sta GBASH
|
||||||
@ -62,14 +70,22 @@ TEMP2 EQU $FB
|
|||||||
sta GBASL
|
sta GBASL
|
||||||
jsr load_rle_gr
|
jsr load_rle_gr
|
||||||
|
|
||||||
|
jsr gr_copy
|
||||||
|
|
||||||
lda #$4
|
lda #$4
|
||||||
sta BASH
|
sta BASH
|
||||||
lda #$0
|
lda #$0
|
||||||
sta BASL ; 0x400 is GR page 0
|
sta BASL ; restore to 0x400 (page 0)
|
||||||
|
; copy to 0x400 (page 0)
|
||||||
|
|
||||||
|
|
||||||
; Return to BASIC?
|
; Return to BASIC?
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
;=====================================================================
|
||||||
|
;= ROUTINES
|
||||||
|
;=====================================================================
|
||||||
|
|
||||||
;=================
|
;=================
|
||||||
; load RLE image
|
; load RLE image
|
||||||
;=================
|
;=================
|
||||||
@ -184,4 +200,59 @@ set_gr_page0:
|
|||||||
bit GR ; set graphics
|
bit GR ; set graphics
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
;=========================================================
|
||||||
|
; gr_copy
|
||||||
|
;=========================================================
|
||||||
|
; for now copy 0xc00 to 0x400
|
||||||
|
; 2 + 8*38 + 4*80*23 + 4*120*26 + 13 = 20,159 = 20ms = 50Hz
|
||||||
|
gr_copy:
|
||||||
|
ldx #0 ; set y to zero ; 2
|
||||||
|
|
||||||
|
gr_copy_loop:
|
||||||
|
stx TEMP ; save y ; 3
|
||||||
|
txa ; move to A ; 2
|
||||||
|
asl ; mult by 2 ; 2
|
||||||
|
tay ; put into Y ; 2
|
||||||
|
lda gr_offsets,Y ; lookup low byte for line addr ; 5
|
||||||
|
sta OUTL ; out and in are the same ; 3
|
||||||
|
sta INL ; 3
|
||||||
|
lda gr_offsets+1,Y ; lookup high byte for line addr ; 5
|
||||||
|
sta OUTH ; 3
|
||||||
|
adc #$8 ; for now, fixed 0xc ; 2
|
||||||
|
sta INH ; 3
|
||||||
|
ldx TEMP ; restore y ; 3
|
||||||
|
|
||||||
|
ldy #0 ; set X counter to 0 ; 2
|
||||||
|
gr_copy_line:
|
||||||
|
lda (INL),Y ; load a byte ; 5
|
||||||
|
sta (OUTL),Y ; store a byte ; 6
|
||||||
|
iny ; increment pointer ; 2
|
||||||
|
|
||||||
|
cpx #$4 ; don't want to copy bottom 4*40 ; 2
|
||||||
|
bcs gr_copy_above4 ; 3
|
||||||
|
|
||||||
|
gr_copy_below4:
|
||||||
|
cpy #120 ; for early ones, copy 120 bytes ; 2
|
||||||
|
bne gr_copy_line ; 3
|
||||||
|
beq gr_copy_line_done ; 3
|
||||||
|
|
||||||
|
gr_copy_above4: ; for last four, just copy 80 bytes
|
||||||
|
cpy #80 ; 2
|
||||||
|
bne gr_copy_line ; 3
|
||||||
|
|
||||||
|
gr_copy_line_done:
|
||||||
|
inx ; increment y value ; 2
|
||||||
|
cpx #8 ; there are 8 of them ; 2
|
||||||
|
bne gr_copy_loop ; if not, loop ; 3
|
||||||
|
rts ; 6
|
||||||
|
|
||||||
|
; waste memory with a lookup table
|
||||||
|
; maybe faster than using GBASCALC?
|
||||||
|
gr_offsets:
|
||||||
|
.word $400,$480,$500,$580,$600,$680,$700,$780
|
||||||
|
.word $428,$4a8,$528,$5a8,$628,$6a8,$728,$7a8
|
||||||
|
.word $450,$4d0,$550,$5d0,$650,$6d0,$750,$7d0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.include "title.inc"
|
.include "title.inc"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user