From aca81442f5f9b36404220e5421a1f88032eca0a0 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Tue, 5 Jan 2021 18:33:30 -0500 Subject: [PATCH] graphics: working on the graphics dir --- graphics/dhgr/Makefile | 20 +-- graphics/dhgr/README | 4 + graphics/dhgr/encode6.c | 26 ++++ graphics/dhgr/loader.s | 36 +++++ graphics/dhgr/raster4_good.s | 129 ++++++++++++++++++ .../CHANNELWOOD.DGRA | Bin .../CHANNELWOOD.DGRB | Bin graphics/{dgr_view => dhgr_viewer}/MYST.DGRA | Bin graphics/{dgr_view => dhgr_viewer}/MYST.DGRB | Bin graphics/{dgr_view => dhgr_viewer}/Makefile | 11 +- graphics/dhgr_viewer/README | 4 + .../{dgr_view => dhgr_viewer}/SELENETIC.DGRA | Bin .../{dgr_view => dhgr_viewer}/SELENETIC.DGRB | Bin .../{dgr_view => dhgr_viewer}/dgr_view.dsk | Bin graphics/{dgr_view => dhgr_viewer}/dgr_view.s | 0 graphics/{dgr_view => dhgr_viewer}/empty.dsk | Bin graphics/{dgr_view => dhgr_viewer}/zp.inc | 0 joystick/Makefile | 13 +- joystick/README | 2 + linker_scripts/Makefile | 4 + 20 files changed, 228 insertions(+), 21 deletions(-) create mode 100644 graphics/dhgr/README create mode 100644 graphics/dhgr/encode6.c create mode 100644 graphics/dhgr/loader.s create mode 100644 graphics/dhgr/raster4_good.s rename graphics/{dgr_view => dhgr_viewer}/CHANNELWOOD.DGRA (100%) rename graphics/{dgr_view => dhgr_viewer}/CHANNELWOOD.DGRB (100%) rename graphics/{dgr_view => dhgr_viewer}/MYST.DGRA (100%) rename graphics/{dgr_view => dhgr_viewer}/MYST.DGRB (100%) rename graphics/{dgr_view => dhgr_viewer}/Makefile (50%) create mode 100644 graphics/dhgr_viewer/README rename graphics/{dgr_view => dhgr_viewer}/SELENETIC.DGRA (100%) rename graphics/{dgr_view => dhgr_viewer}/SELENETIC.DGRB (100%) rename graphics/{dgr_view => dhgr_viewer}/dgr_view.dsk (100%) rename graphics/{dgr_view => dhgr_viewer}/dgr_view.s (100%) rename graphics/{dgr_view => dhgr_viewer}/empty.dsk (100%) rename graphics/{dgr_view => dhgr_viewer}/zp.inc (100%) create mode 100644 joystick/README create mode 100644 linker_scripts/Makefile diff --git a/graphics/dhgr/Makefile b/graphics/dhgr/Makefile index a6a8323c..48dde762 100644 --- a/graphics/dhgr/Makefile +++ b/graphics/dhgr/Makefile @@ -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 diff --git a/graphics/dhgr/README b/graphics/dhgr/README new file mode 100644 index 00000000..bcb4daf3 --- /dev/null +++ b/graphics/dhgr/README @@ -0,0 +1,4 @@ +routines used for testing out double-hires graphics + +this was used on some of the appleii bot demos + diff --git a/graphics/dhgr/encode6.c b/graphics/dhgr/encode6.c new file mode 100644 index 00000000..3cff676a --- /dev/null +++ b/graphics/dhgr/encode6.c @@ -0,0 +1,26 @@ +#include +#include + +#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"); +} diff --git a/graphics/dhgr/loader.s b/graphics/dhgr/loader.s new file mode 100644 index 00000000..be4e3d6d --- /dev/null +++ b/graphics/dhgr/loader.s @@ -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 " + diff --git a/graphics/dhgr/raster4_good.s b/graphics/dhgr/raster4_good.s new file mode 100644 index 00000000..a1de96a9 --- /dev/null +++ b/graphics/dhgr/raster4_good.s @@ -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 + diff --git a/graphics/dgr_view/CHANNELWOOD.DGRA b/graphics/dhgr_viewer/CHANNELWOOD.DGRA similarity index 100% rename from graphics/dgr_view/CHANNELWOOD.DGRA rename to graphics/dhgr_viewer/CHANNELWOOD.DGRA diff --git a/graphics/dgr_view/CHANNELWOOD.DGRB b/graphics/dhgr_viewer/CHANNELWOOD.DGRB similarity index 100% rename from graphics/dgr_view/CHANNELWOOD.DGRB rename to graphics/dhgr_viewer/CHANNELWOOD.DGRB diff --git a/graphics/dgr_view/MYST.DGRA b/graphics/dhgr_viewer/MYST.DGRA similarity index 100% rename from graphics/dgr_view/MYST.DGRA rename to graphics/dhgr_viewer/MYST.DGRA diff --git a/graphics/dgr_view/MYST.DGRB b/graphics/dhgr_viewer/MYST.DGRB similarity index 100% rename from graphics/dgr_view/MYST.DGRB rename to graphics/dhgr_viewer/MYST.DGRB diff --git a/graphics/dgr_view/Makefile b/graphics/dhgr_viewer/Makefile similarity index 50% rename from graphics/dgr_view/Makefile rename to graphics/dhgr_viewer/Makefile index eb66bdfa..d654835c 100644 --- a/graphics/dgr_view/Makefile +++ b/graphics/dhgr_viewer/Makefile @@ -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 diff --git a/graphics/dhgr_viewer/README b/graphics/dhgr_viewer/README new file mode 100644 index 00000000..9a0eb154 --- /dev/null +++ b/graphics/dhgr_viewer/README @@ -0,0 +1,4 @@ +a simple double-hires viewer + +was used when writing my Kansasfest 2020 talk + diff --git a/graphics/dgr_view/SELENETIC.DGRA b/graphics/dhgr_viewer/SELENETIC.DGRA similarity index 100% rename from graphics/dgr_view/SELENETIC.DGRA rename to graphics/dhgr_viewer/SELENETIC.DGRA diff --git a/graphics/dgr_view/SELENETIC.DGRB b/graphics/dhgr_viewer/SELENETIC.DGRB similarity index 100% rename from graphics/dgr_view/SELENETIC.DGRB rename to graphics/dhgr_viewer/SELENETIC.DGRB diff --git a/graphics/dgr_view/dgr_view.dsk b/graphics/dhgr_viewer/dgr_view.dsk similarity index 100% rename from graphics/dgr_view/dgr_view.dsk rename to graphics/dhgr_viewer/dgr_view.dsk diff --git a/graphics/dgr_view/dgr_view.s b/graphics/dhgr_viewer/dgr_view.s similarity index 100% rename from graphics/dgr_view/dgr_view.s rename to graphics/dhgr_viewer/dgr_view.s diff --git a/graphics/dgr_view/empty.dsk b/graphics/dhgr_viewer/empty.dsk similarity index 100% rename from graphics/dgr_view/empty.dsk rename to graphics/dhgr_viewer/empty.dsk diff --git a/graphics/dgr_view/zp.inc b/graphics/dhgr_viewer/zp.inc similarity index 100% rename from graphics/dgr_view/zp.inc rename to graphics/dhgr_viewer/zp.inc diff --git a/joystick/Makefile b/joystick/Makefile index 8e619a2c..bf37aee0 100644 --- a/joystick/Makefile +++ b/joystick/Makefile @@ -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 diff --git a/joystick/README b/joystick/README new file mode 100644 index 00000000..cad52820 --- /dev/null +++ b/joystick/README @@ -0,0 +1,2 @@ +code for testing out Apple II joystick/paddle support + diff --git a/linker_scripts/Makefile b/linker_scripts/Makefile new file mode 100644 index 00000000..633b5cfa --- /dev/null +++ b/linker_scripts/Makefile @@ -0,0 +1,4 @@ +all: + +clean: + rm -f *~