dhgr: more messing with raster bars

This commit is contained in:
Vince Weaver 2020-10-09 01:06:02 -04:00
parent 454effd51c
commit 10282c73ab
7 changed files with 367 additions and 7 deletions

View File

@ -5,8 +5,12 @@ TOKENIZE = ../asoft_basic-utils/tokenize_asoft
all: dhgr.dsk all: dhgr.dsk
dhgr.dsk: RASTER BITS LOTS dhgr.dsk: RASTER RASTER2 RASTER3 RASTER4 BITS LOTS
cp empty.dsk dhgr.dsk
$(DOS33) -y dhgr.dsk BSAVE -a 0x0300 RASTER $(DOS33) -y dhgr.dsk BSAVE -a 0x0300 RASTER
$(DOS33) -y dhgr.dsk BSAVE -a 0x0300 RASTER2
$(DOS33) -y dhgr.dsk BSAVE -a 0x0300 RASTER3
$(DOS33) -y dhgr.dsk BSAVE -a 0x0300 RASTER4
$(DOS33) -y dhgr.dsk BSAVE -a 0x0300 BITS $(DOS33) -y dhgr.dsk BSAVE -a 0x0300 BITS
$(DOS33) -y dhgr.dsk BSAVE -a 0x0300 LOTS $(DOS33) -y dhgr.dsk BSAVE -a 0x0300 LOTS
@ -18,6 +22,33 @@ RASTER: raster.o
raster.o: raster.s raster.o: raster.s
ca65 -o raster.o raster.s -l raster.lst ca65 -o raster.o raster.s -l raster.lst
###
RASTER2: raster2.o
ld65 -o RASTER2 raster2.o -C ../linker_scripts/apple2_300.inc
raster2.o: raster2.s
ca65 -o raster2.o raster2.s -l raster2.lst
###
RASTER3: raster3.o
ld65 -o RASTER3 raster3.o -C ../linker_scripts/apple2_300.inc
raster3.o: raster3.s
ca65 -o raster3.o raster3.s -l raster3.lst
###
RASTER4: raster4.o
ld65 -o RASTER4 raster4.o -C ../linker_scripts/apple2_300.inc
raster4.o: raster4.s
ca65 -o raster4.o raster4.s -l raster4.lst
### ###
LOTS: lots.o LOTS: lots.o
@ -38,4 +69,4 @@ bits.o: bits.s
#### ####
clean: clean:
rm -f *~ *.o *.lst RASTER BITS LOTS rm -f *~ *.o *.lst RASTER RASTER2 RASTER3 RASTER4 BITS LOTS

BIN
dhgr/empty.dsk Normal file

Binary file not shown.

71
dhgr/raster2.s Normal file
View File

@ -0,0 +1,71 @@
GBASL = $26
GBASH = $27
HGRPAGE = $E6
YPOS = $FE
COLOR = $FF
HGR = $F3E2
HGR2 = $F3D8
HPOSN = $F411
raster:
jsr HGR
jsr HGR2
; sta $C050 ; set graphics
; sta $C057 ; set hires
; sta $C052 ; set fullscreen
sta $C05E ; set double hires
sta $C00D ; 80 column
sta $C001 ; 80 store
lda #$20
sta HGRPAGE
outer_loop:
lda #0
sta YPOS
color_loop:
lda #$22
inc COLOR
lda YPOS
jsr draw_line_color
inc YPOS
lda YPOS
cmp #192
bne color_loop
forever:
jmp outer_loop
;=============================
; draw line of color in COLOR
;=============================
draw_line_color:
ldx #0
ldy #0
jsr HPOSN
ldy #39
loop_it:
; set page2
sta $C055
jsr next_pixel
; set page1
sta $C054
jsr next_pixel
dey
bpl loop_it
rts
next_pixel:
lda COLOR ; 2
sta (GBASL),Y ; 3
cmp #$80 ; 2
rol COLOR ; 2
rts ; 1

104
dhgr/raster3.s Normal file
View File

@ -0,0 +1,104 @@
GBASL = $26
GBASH = $27
HGRPAGE = $E6
LINE = $FD
YPOS = $FE
COLOR = $FF
HGR = $F3E2
HGR2 = $F3D8
HPOSN = $F411
raster:
jsr HGR
jsr HGR2
sta $C05E ; set double hires
sta $C00D ; 80 column
sta $C001 ; 80 store
lda #$20
sta HGRPAGE
sta YPOS
line_loop:
lda #7
sta LINE
lda YPOS
bmi go_neg
cmp #64
bcs do_add
go_pos:
ldx #$1
.byte $2C ; bit trick
go_neg:
ldx #$ff
blah:
stx smc+1
do_add:
clc
smc:
adc #1
sta YPOS
color_loop:
ldx LINE
lda colors,X
beq no_add
ldx smc+1
bmi no_add
clc
adc #$33
no_add:
sta COLOR
lda YPOS
sec
sbc LINE
; jsr draw_line_color
; inline!
;=====================================
;=============================
; draw line of color in COLOR
;=============================
draw_line_color:
ldx #0
ldy #0
jsr HPOSN
ldy #39
loop_it:
; set page2
sta $C055
jsr next_pixel
; set page1
sta $C054
jsr next_pixel
dey
bpl loop_it
;====================================
; rts
dec LINE
bmi line_loop
bpl color_loop
next_pixel:
lda COLOR ; 2
sta (GBASL),Y ; 3
cmp #$80 ; 2
rol COLOR ; 2
rts ; 1
colors:
; .byte $00,$DD,$EE,$FF,$FF,$EE,$DD,$00 ; aqua lblue white
; .byte $00,$AA,$BB,$CC,$CC,$BB,$AA,$00 ; grey yellow mblue
; .byte $00,$77,$88,$99,$99,$88,$77,$00 ; ugly green
; .byte $00,$44,$55,$66,$66,$55,$44,$00 ; purple
.byte $00,$11,$22,$33,$33,$22,$11,$00 ; red

138
dhgr/raster4.s Normal file
View File

@ -0,0 +1,138 @@
GBASL = $26
GBASH = $27
HGRPAGE = $E6
BASE = $FC
LINE = $FD
YPOS = $FE
COLOR = $FF
HGR = $F3E2
HGR2 = $F3D8
HPOSN = $F411
raster:
;=========================
; configure double hires
;=========================
jsr HGR
jsr HGR2
sta $C05E ; set double hires
sta $C00D ; 80 column
sta $C001 ; 80 store
lsr HGRPAGE ; set to $20 (HGR2 set this to $40)
ldy #100
big_loop:
lda #0 ; 2 ; blueline
jsr one_line ; 3
lda #4 ; 2 ; redline
jsr one_line ; 3
tya ; YPOS
bmi go_neg ; if >128, flip to go up
cmp #64 ; if < 64, flip to go down
bcs do_add ; otherwise, nothing
go_pos:
ldx #$c8
.byte $2C ; bit trick
go_neg:
ldx #$88
stx smc
do_add:
clc ; move the bar
smc:
iny ; c8=iny, 88=dey
bne big_loop ; bra
one_line:
sta BASE ; 2
tya ; 1
eor #$10 ; 2
tay ; 1
; fallthrough
;=======================================
draw_raster:
lda #7 ; want 8 lines
sta LINE
color_loop: ; get right color
lda LINE ;(2)
cmp #$4 ;(2)
bcc none ;(2)
eor #$3 ; 00 01 10 11 00 01 10 11
none: ; 11 10 01 00
and #$3 ;(2)
clc
color_smc:
adc BASE
tax
lda colors,X
sta COLOR
tya
pha ; save YPOS
; sec ; c always 0
sbc LINE
;=============================
; draw line of color in COLOR
;=============================
draw_line_color:
ldx #0
ldy #0
jsr HPOSN ; put into GBASL addr of coord (Y,X),A
ldy #39
loop_it:
; set page2
sta $C055 ; 3
jsr next_pixel ; 3
; set page1
sta $C054 ; 3
jsr next_pixel ; 3
dey ; 1
bpl loop_it ; 2
pla
tay
;====================================
dec LINE
bpl color_loop
rts
;==============================
;==============================
next_pixel:
lda COLOR ; 2
sta (GBASL),Y ; 3
cmp #$80 ; 2
rol COLOR ; 2
rts ; 1
colors:
.byte $00,$11,$22,$33 ; red
.byte $00,$DD,$EE,$FF ; blue/white
; .byte $00,$11,$22,$33,$33,$22,$11,$00 ; red
; .byte $00,$DD,$EE,$FF,$FF,$EE,$DD,$00 ; black aqua lblue white
; .byte $00,$AA,$BB,$CC,$CC,$BB,$AA,$00 ; grey yellow mblue
; .byte $00,$77,$88,$99,$99,$88,$77,$00 ; ugly green
; .byte $00,$44,$55,$66,$66,$55,$44,$00 ; purple

View File

@ -7,7 +7,7 @@ all: entropy.dsk convert_to convert_back convert_qkumba
entropy.dsk: ENTROPY ENTROPY.BAS E2.BAS FLAME.BAS FLAME2.BAS \ entropy.dsk: ENTROPY ENTROPY.BAS E2.BAS FLAME.BAS FLAME2.BAS \
CIRCLES.BAS AUTUMN.BAS QKUMBA.BAS ASTEROID.BAS PERSON.BAS SHIP.BAS \ CIRCLES.BAS AUTUMN.BAS QKUMBA.BAS ASTEROID.BAS PERSON.BAS SHIP.BAS \
CONCERT.BAS NYAN.BAS RASTER.BAS LOTS.BAS LOAD CONCERT.BAS NYAN.BAS RASTER.BAS RASTER2.BAS RASTER3.BAS LOTS.BAS LOAD
$(DOS33) -y entropy.dsk BSAVE -a 0x0C00 ENTROPY $(DOS33) -y entropy.dsk BSAVE -a 0x0C00 ENTROPY
$(DOS33) -y entropy.dsk BSAVE -a 0x0300 LOAD $(DOS33) -y entropy.dsk BSAVE -a 0x0300 LOAD
$(DOS33) -y entropy.dsk SAVE A ENTROPY.BAS $(DOS33) -y entropy.dsk SAVE A ENTROPY.BAS
@ -23,6 +23,8 @@ entropy.dsk: ENTROPY ENTROPY.BAS E2.BAS FLAME.BAS FLAME2.BAS \
$(DOS33) -y entropy.dsk SAVE A NYAN.BAS $(DOS33) -y entropy.dsk SAVE A NYAN.BAS
$(DOS33) -y entropy.dsk SAVE A CONCERT.BAS $(DOS33) -y entropy.dsk SAVE A CONCERT.BAS
$(DOS33) -y entropy.dsk SAVE A RASTER.BAS $(DOS33) -y entropy.dsk SAVE A RASTER.BAS
$(DOS33) -y entropy.dsk SAVE A RASTER2.BAS
$(DOS33) -y entropy.dsk SAVE A RASTER3.BAS
$(DOS33) -y entropy.dsk SAVE A LOTS.BAS $(DOS33) -y entropy.dsk SAVE A LOTS.BAS
### ###
@ -141,6 +143,17 @@ RASTER.BAS: raster.bas
#### ####
RASTER2.BAS: raster2.bas
$(TOKENIZE) < raster2.bas > RASTER2.BAS
####
RASTER3.BAS: raster3.bas
$(TOKENIZE) < raster3.bas > RASTER3.BAS
####
LOTS.BAS: lots.bas LOTS.BAS: lots.bas
$(TOKENIZE) < lots.bas > LOTS.BAS $(TOKENIZE) < lots.bas > LOTS.BAS

View File

@ -10,17 +10,20 @@ int main(int argc, char **argv) {
unsigned char in[1024]; unsigned char in[1024];
unsigned char enc[1024]; unsigned char enc[1024];
printf("1REM");
filesize=read(0,in,1024); filesize=read(0,in,1024);
do { do {
enc[e++] = ((in[i + 2] & 3) << 4) + enc[e++] = ((in[i + 2] & 3) << 4) +
((in[i + 1] & 3) << 2) + (in[i + 0] & 3) + 32; ((in[i + 1] & 3) << 2) + (in[i + 0] & 3) + 32;
in[i + 0] = (in[i + 0] >> 2) + 32; if (i<filesize) printf("%c",(in[i + 0] >> 2) + 32);
in[i + 1] = (in[i + 1] >> 2) + 32; if (i + 1 < filesize) printf("%c",(in[i + 1] >> 2) + 32);
in[i + 2] = (in[i + 2] >> 2) + 32; if (i + 2 < filesize) printf("%c",(in[i + 2] >> 2) + 32);
printf("%c%c%c",in[i],in[i+1],in[i+2]);//write(o, in + i, 3);
} while ((i += 3) < filesize); } while ((i += 3) < filesize);
enc[e]=0; enc[e]=0;
printf("%s\n",enc); printf("%s\n",enc);
printf("2FORI=0TO%d:C=INT((PEEK(%d+I/3)-32)/4^(I-INT(I/3)*3)):POKE768+I,((PEEK(2054+I)-32)*4)+C-INT(C/4)*4:NEXT:CALL768\n",
filesize,2054+filesize);
return 0; return 0;
} }