graphics: working on the graphics dir

This commit is contained in:
Vince Weaver 2021-01-05 18:33:30 -05:00
parent 3537900858
commit aca81442f5
20 changed files with 228 additions and 21 deletions

View File

@ -1,7 +1,7 @@
include ../Makefile.inc
include ../../Makefile.inc
DOS33 = ../dos33fs-utils/dos33
TOKENIZE = ../asoft_basic-utils/tokenize_asoft
DOS33 = ../../utils/dos33fs-utils/dos33
TOKENIZE = ../../utils/asoft_basic-utils/tokenize_asoft
all: dhgr.dsk
@ -17,7 +17,7 @@ dhgr.dsk: RASTER RASTER2 RASTER3 RASTER4 BITS LOTS
###
RASTER: raster.o
ld65 -o RASTER raster.o -C ../linker_scripts/apple2_300.inc
ld65 -o RASTER raster.o -C ../../linker_scripts/apple2_300.inc
raster.o: raster.s
ca65 -o raster.o raster.s -l raster.lst
@ -26,7 +26,7 @@ raster.o: raster.s
###
RASTER2: raster2.o
ld65 -o RASTER2 raster2.o -C ../linker_scripts/apple2_300.inc
ld65 -o RASTER2 raster2.o -C ../../linker_scripts/apple2_300.inc
raster2.o: raster2.s
ca65 -o raster2.o raster2.s -l raster2.lst
@ -35,7 +35,7 @@ raster2.o: raster2.s
###
RASTER3: raster3.o
ld65 -o RASTER3 raster3.o -C ../linker_scripts/apple2_300.inc
ld65 -o RASTER3 raster3.o -C ../../linker_scripts/apple2_300.inc
raster3.o: raster3.s
ca65 -o raster3.o raster3.s -l raster3.lst
@ -43,7 +43,7 @@ raster3.o: raster3.s
###
RASTER4: raster4.o
ld65 -o RASTER4 raster4.o -C ../linker_scripts/apple2_300.inc
ld65 -o RASTER4 raster4.o -C ../../linker_scripts/apple2_300.inc
raster4.o: raster4.s
ca65 -o raster4.o raster4.s -l raster4.lst
@ -52,7 +52,7 @@ raster4.o: raster4.s
###
LOTS: lots.o
ld65 -o LOTS lots.o -C ../linker_scripts/apple2_300.inc
ld65 -o LOTS lots.o -C ../../linker_scripts/apple2_300.inc
lots.o: lots.s
ca65 -o lots.o lots.s -l lots.lst
@ -61,7 +61,7 @@ lots.o: lots.s
###
BITS: bits.o
ld65 -o BITS bits.o -C ../linker_scripts/apple2_300.inc
ld65 -o BITS bits.o -C ../../linker_scripts/apple2_300.inc
bits.o: bits.s
ca65 -o bits.o bits.s -l bits.lst
@ -69,4 +69,4 @@ bits.o: bits.s
####
clean:
rm -f *~ *.o *.lst RASTER RASTER2 RASTER3 RASTER4 BITS LOTS
rm -f *~ *.o *.lst RASTER RASTER2 RASTER3 RASTER4 BITS LOTS encode6

4
graphics/dhgr/README Normal file
View File

@ -0,0 +1,4 @@
routines used for testing out double-hires graphics
this was used on some of the appleii bot demos

26
graphics/dhgr/encode6.c Normal file
View File

@ -0,0 +1,26 @@
#include <stdio.h>
#include <unistd.h>
#define MAXSIZE 4096
int main(int argc, char **argv) {
unsigned char in[MAXSIZE],a,b,c,d;
int len,i;
len=read(0,in,MAXSIZE);
// 000000 001111 111122 222222
// 012345 670123 456701 234567
i=0;
while(1) {
a=(in[i]>>2)+' ';
b=((in[i]&0x3)<<4)+(in[i+1]>>4)+' ';
c=(in[i+1]&0xf<<2)+(in[i+2]>>6)+' ';
d=(in[i+2]&0x3f)+' ';
printf("%c%c%c%c",a,b,c,d);
i=i+3;
if (i>len) break;
}
printf("\n");
}

36
graphics/dhgr/loader.s Normal file
View File

@ -0,0 +1,36 @@
; XX012345 XX67ABCD XXEFGH01 XX234567
; XX012345 XX67ABCD XXEFGH01 XX234567
; XX012345 XX67ABCD XXEFGH01 XX234567
a b c d
a*4+b/16
b*16+c/4
c*64+d
loader:
ldy #0 ; 2
loop:
rol offset+1,Y ; XX0123456 X789ABCX XXEFGHIJ XXKLMNOP
rol offset+1,Y ; XX0123456 789ABCXX XXEFGHIJ XXKLMNOP
rol offset+1,Y
rol offset,Y ; X01234567 89ABCXXX XXEFGHIJ XXKLMNOP
rol offset,Y; ; 012345678 9ABCXXXX XXEFGHIJ XXKLMNOP
rol offset+1,Y
rol offset,Y
iny
bne loop
jmp
offset:
.byte "(.CS(-;SC5? C0/ C0# 1NF@9*H (#P#J0$@, "
.byte 34,"8, ')0+P(HL(LHH*.+0 8R-3CA?^8212HJ0&%_:G]R0&0 D(#*0 89?^JO7X#A"
.byte "?^82.G]H@",34,"@ ",34,"@1]*@GC57 ('P#C57 ('P#B!3Q:*K&_13+8*G_D2G)@"
.byte 34,"G_8 1(CP W>O_8!8 "

View File

@ -0,0 +1,129 @@
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
lsr HGRPAGE ; set to $20 (HGR2 set this to $40)
sta YPOS
;forever_loop:
; jmp forever_loop
draw_raster:
line_loop:
lda #7 ; want 8 lines
sta LINE
lda YPOS ; check bounds
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 #$1
.byte $2C ; bit trick
go_neg:
ldx #$ff
stx smc+1
do_add:
clc ; move the bar
smc:
adc #1
sta YPOS
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)
; ldx LINE
; lda order,X
clc
color_smc:
adc #0
tax
lda colors,X
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
;
; x-4 = fc fd fe ff 0 1 2 3
; 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)
;order:
; .byte 0,1,2,3,3,2,1,0
colors:
.byte $00,$11,$22,$33 ; red
; .byte $00,$11,$22,$33,$33,$22,$11,$00 ; red
; .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

View File

@ -1,8 +1,9 @@
include ../Makefile.inc
include ../../Makefile.inc
DOS33 = ../dos33fs-utils/dos33
PNG2GR = ../gr-utils/png2gr
PNG2RLE = ../gr-utils/png2rle
DOS33 = ../../utils/dos33fs-utils/dos33
PNG2GR = ../../utils/gr-utils/png2gr
PNG2RLE = ../../utils/gr-utils/png2rle
TOKENIZE = ../../utils/asoft_basic-utils/tokenize_asoft
all: dgr_view.dsk
@ -14,7 +15,7 @@ dgr_view.dsk: $(DOS33) DGR_VIEW
###
DGR_VIEW: dgr_view.o
ld65 -o DGR_VIEW dgr_view.o -C ../linker_scripts/apple2_1000.inc
ld65 -o DGR_VIEW dgr_view.o -C ../../linker_scripts/apple2_1000.inc
dgr_view.o: dgr_view.s
ca65 -o dgr_view.o dgr_view.s -l dgr_view.lst

View File

@ -0,0 +1,4 @@
a simple double-hires viewer
was used when writing my Kansasfest 2020 talk

View File

@ -1,11 +1,12 @@
include ../Makefile.inc
DOS33 = ../dos33fs-utils/dos33
DOS33_RAW = ../dos33fs-utils/dos33_raw
PNG_TO_40x96 = ../gr-utils/png_to_40x96
PNG_TO_40x48D = ../gr-utils/png_to_40x48d
PNG2RLE = ../gr-utils/png2rle
B2D = ../bmp2dhr/b2d
DOS33 = ../utils/dos33fs-utils/dos33
DOS33_RAW = ../utils/dos33fs-utils/dos33_raw
PNG_TO_40x96 = ../utils/gr-utils/png_to_40x96
PNG_TO_40x48D = ../utils/gr-utils/png_to_40x48d
PNG2RLE = ../utils/gr-utils/png2rle
B2D = ../utils/bmp2dhr/b2d
TOKENIZE = ../utils/asoft_basic-utils/tokenize_asoft
all: js.dsk

2
joystick/README Normal file
View File

@ -0,0 +1,2 @@
code for testing out Apple II joystick/paddle support

4
linker_scripts/Makefile Normal file
View File

@ -0,0 +1,4 @@
all:
clean:
rm -f *~