From 4e8e83cee655aeef26ef28ad1f7d063c4059be6e Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Mon, 26 Jul 2021 01:29:42 -0400 Subject: [PATCH] logo: guess I'll get in on this LOGO action --- graphics/gr/checkers/Makefile | 12 +- graphics/gr/checkers/checkers_2000.s | 98 +++++++++++ linker_scripts/apple2_2000.inc | 4 +- logo/NOTES | 154 ++++++++++++++++ logo/checkers.logo | 12 ++ logo/coord_convert.c | 30 ++++ logo/logo_convert.c | 16 ++ logo/rick.coords | 252 +++++++++++++++++++++++++++ logo/rr.logo | 72 ++++++++ 9 files changed, 647 insertions(+), 3 deletions(-) create mode 100644 graphics/gr/checkers/checkers_2000.s create mode 100644 logo/NOTES create mode 100644 logo/checkers.logo create mode 100644 logo/coord_convert.c create mode 100644 logo/logo_convert.c create mode 100644 logo/rick.coords create mode 100644 logo/rr.logo diff --git a/graphics/gr/checkers/Makefile b/graphics/gr/checkers/Makefile index 68177ea5..a08cd8ad 100644 --- a/graphics/gr/checkers/Makefile +++ b/graphics/gr/checkers/Makefile @@ -9,7 +9,7 @@ TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft all: checkers32.dsk checkers32.dsk: HELLO CHECKERS CHECKERS_SMALL CHECKERS_SMALL2 CHECKERS_LINE \ - CHECKERS_QUESTION CHECKERS_RAINBOW CHECKERS_ORIG + CHECKERS_QUESTION CHECKERS_RAINBOW CHECKERS_ORIG CHECKERS_2000 cp $(EMPTY_DISK) checkers32.dsk $(DOS33) -y checkers32.dsk SAVE A HELLO $(DOS33) -y checkers32.dsk BSAVE -a 0x070 CHECKERS @@ -19,6 +19,7 @@ checkers32.dsk: HELLO CHECKERS CHECKERS_SMALL CHECKERS_SMALL2 CHECKERS_LINE \ $(DOS33) -y checkers32.dsk BSAVE -a 0x070 CHECKERS_RAINBOW $(DOS33) -y checkers32.dsk BSAVE -a 0x070 CHECKERS_QUESTION $(DOS33) -y checkers32.dsk BSAVE -a 0x070 CHECKERS_ORIG + $(DOS33) -y checkers32.dsk BSAVE -a 0x2000 CHECKERS_2000 ### @@ -31,6 +32,15 @@ checkers.o: checkers.s ### +CHECKERS_2000: checkers_2000.o + ld65 -o CHECKERS_2000 checkers_2000.o -C $(LINKER_DIR)/apple2_2000.inc + +checkers_2000.o: checkers_2000.s + ca65 -o checkers_2000.o checkers_2000.s -l checkers_2000.lst + + +### + CHECKERS_SMALL: checkers_small.o ld65 -o CHECKERS_SMALL checkers_small.o -C $(LINKER_DIR)/apple2_70_zp.inc diff --git a/graphics/gr/checkers/checkers_2000.s b/graphics/gr/checkers/checkers_2000.s new file mode 100644 index 00000000..0447930b --- /dev/null +++ b/graphics/gr/checkers/checkers_2000.s @@ -0,0 +1,98 @@ +; Checkers +; vaguely based on a scene in Hellmood's Memories + +; 32 bytes, for Lovebyte 2021 + +; by deater (Vince Weaver) + +; 42 -- original +; 39 -- not fullscreen +; 36 -- now marches oddly +; 32 -- colors now rainbow + +; Zero Page +BASL = $28 +BASH = $29 +H2 = $2C +COLOR = $30 + +X1 = $F0 +X2 = $F1 +Y1 = $F2 +Y2 = $F3 + +TEMP = $FA +TEMPY = $FB +FRAME = $FC +TEMPX = $FD + + +; Soft Switches +KEYPRESS= $C000 +KEYRESET= $C010 +SET_GR = $C050 ; Enable graphics +FULLGR = $C052 ; Full screen, no text +PAGE0 = $C054 ; Page0 +PAGE1 = $C055 ; Page1 +LORES = $C056 ; Enable LORES graphics + +; ROM routines + +PLOT = $F800 ; plot, horiz=y, vert=A (A trashed, XY Saved) +SETCOL = $F864 +TEXT = $FB36 ;; Set text mode +BASCALC = $FBC1 +SETGR = $FB40 +HOME = $FC58 ;; Clear the text screen +WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us +HLINE = $F819 + + +.zeropage + +checkers: + + ;=================== + ; init screen + jsr SETGR ; 3 +; bit FULLGR ; 3 + +checkers_forever: + + inc FRAME ; 2 + + ldx #39 ; 2 +yloop: + ldy #39 ; 2 +xloop: + + ; calculate color + + ; color = (XX-FRAME)^(A) | DB+1 + +; sec ; subtract frame from Y + tya + sbc FRAME + sta X2 + + txa +; sbc #0 + + eor X2 + +; ora #$DB ; needed for solid colors +; adc #1 + + jsr SETCOL + + txa ; A==Y1 ; 1 + jsr PLOT ; plots in (Y,A) ; 3 + + dey ; 1 + bpl xloop ; 2 + + dex ; 1 + bpl yloop ; 2 + + bmi checkers_forever ; 2 + diff --git a/linker_scripts/apple2_2000.inc b/linker_scripts/apple2_2000.inc index faddd191..579d1ab3 100644 --- a/linker_scripts/apple2_2000.inc +++ b/linker_scripts/apple2_2000.inc @@ -1,10 +1,10 @@ MEMORY { ZP: start = $00, size = $1A, type = rw; - RAM: start = $2000, size = $A000, file = %O; + RAM: start = $2000, size = $8000, file = %O; } SEGMENTS { -CODE: load = RAM, type = ro, align=$100; +CODE: load = RAM, type = ro, align = $100; RODATA: load = RAM, type = ro; DATA: load = RAM, type = rw; BSS: load = RAM, type = bss, define = yes; diff --git a/logo/NOTES b/logo/NOTES new file mode 100644 index 00000000..e8fae131 --- /dev/null +++ b/logo/NOTES @@ -0,0 +1,154 @@ +; defualt screen is -140,120 to 140,-120 with SCRUNCH .8 +; 96? -80 if splitscreen + +SCREEN +~~~~~~ +CLEAN -- erase screen +TEXTSCREEN (TS) -- show full screen text +SPLITSCREEN +FULLSCREEN +SETCURSOR x y +CLEARTEXT (CT) +CLEARSCREEN (CS) +FENCE -- enforce screen bounds +WINDOW -- no wrap no bounds +WRAP -- turtle wraps around edge +SETBG -- set background color +SETWIDTH -- 40 or 80 + +GRAPHICS +~~~~~~~~ +BACK (BK) +FORWARD (FD) +HIDETURTLE (HT) +HOME -- move to center (0,0) +LEFT (LT) +RIGHT (RT) +SETHEADING (SETH) -- set direction +SETPOS [x y] -- move to X, Y (drawing if appropriate) +SETX +SETY +SHOWTURTLE (ST) +DOT [x y] -- put dot at x,y w/o moving turtle +SETPC -- set pen color +FILL fill area bounded by color by current color +PENDOWN (PD) +PENERASE (PE) -- erase instead of draw +PENREVERSE (PX) -- xor +PENUP (PU) -- pen up + +LOAD/SAVE +~~~~~~~~~ +CATALOG p 194 -- lists files in current PREFIX +SETPREFIX "BLAH -- sort of like chdir +ERASEFILE (ERF) p 196: ERF "RR +PR ONLINE shows list of volumes + + +READ STATE +~~~~~~~~~~ +POS -- shows position +TOWARDS [X Y] -- returns direction you'd need to point at x,y +XCOR -- print x +YCOR -- print y +BACKGROUND +PEN +PENCOLOR (PC) -- prints pencolor +CURSOR -- get cursor location + + +SCRUNCH factor .8 by default 280x240? + +TOOT = freq duration, duration is 1/60th of second + + +VARIABLES +~~~~~~~~~ +MAKE "A 5 - define var A with value 5 +PR :A - print value of variable A + +FUNCTIONS +~~~~~~~~~ +TO BLAH :PARAM +END + + +TEXT (p67) +~~~~ +( a lot, TODO) +CHAR -- like CHR$ in BASIC + +ASSEMBLY +~~~~~~~~ +- note, PRODOS puts things in language card, have to switch back on + to use ROM routines +.AUXDEPOSIT loc byte - store to AUX mem +.AUXEXAMINE loc +.BLOAD pathname loc +.BSAVE pathname loc len +.CALL loc +.DEPOSIT loc byte +.EXAMINE loc +.QUIT exit back to ProDOS + +STARTUP +~~~~~~~ + can create a file called STARTUP that starts at startup + whatever is in the STARTUP function is run + +FREESPACE +~~~~~~~~~ + internally in nodes. 5 Bytes? + RECYCLE PRINT NODES shows free + +EDITOR +~~~~~~ + EDIT "FUNCTION + open apple-A (ALT-A on applewin) accept + + +References: +https://archive.org/details/Apple_Logo_II_Reference_Manual/page/n260/mode/1up +https://archive.org/details/Learning_With_Apple_Logo_by_Daniel_Watt_1984/page/209/mode/2up + + +Memory Map + +$00 -- zero page +$04-$07 -- text page 1 +$08-$1f -- edit buffer +$20-$3f -- hi-res page1 +$40-$43 -- load/save buffer +$44-$47 -- dribble buffer +$48-$4b -- file buffer 0 +$4c-$4f -- file buffer 1 +$50-$53 -- file buffer 2 +$54-$57 -- file buffer 3 +$58-$5b -- file buffer 4 +$5c-$5f -- file buffer 5 +$60 -- logo data +$61-$BE -- logo code +$BF -- free space / prodos +$C0-$CF -- I/O +$D0-$FF -- ProDOS + +AUX +$00 -- zero page +$20-$3f -- ProDOS +$40-$7f -- text page1 (80 col) +$80-$b6 -- node space? +$b7-$Ba -- main help +$BB-$BE -- editor help +$BF -- prodos +$C0-$CF -- I/O +$D0-$DF -- Logo code +$E0-$FF -- ProDOS + +Info +$300 = max num data files *9 (usually 54) +$10 = pointer to first page beyond node space (usually $B7) +$301 = flag for invalid edit buffer + +Can use edit buffer for temp storage, but mark as invalid when done +Can use the file buffer area, be sure to adjust the max data size +Can adjust node space but have to do it right at startup diff --git a/logo/checkers.logo b/logo/checkers.logo new file mode 100644 index 00000000..57acf6d3 --- /dev/null +++ b/logo/checkers.logo @@ -0,0 +1,12 @@ +{L} +REPEAT 10 [FD 10 RT 45] +MAKE "A [173 130 192 230 252 162 39 160 39 152 229 252] +MAKE "B [133 241 138 69 241 32 100 248 138 32 0 248 136 16 238 202 16 233 48 227] +MAKE "D SENTENCE :A :B +MAKE "I 1 +REPEAT 32 [ .DEPOSIT 8191+:I ITEM :I :D MAKE "I 1+:I] +.DEPOSIT 49238 1 +.CALL 8192 + + +TEXTSCREEN diff --git a/logo/coord_convert.c b/logo/coord_convert.c new file mode 100644 index 00000000..f90c8173 --- /dev/null +++ b/logo/coord_convert.c @@ -0,0 +1,30 @@ +#include +#include + +int main(int argc, char **argv) { + + char string[BUFSIZ]; + char *result; + int x,y; + + while(1) { + result=fgets(string,BUFSIZ,stdin); + if (result==NULL) break; + + if (result[0]==';') continue; + + if (strstr(result,"SETPOS")) { + sscanf(result,"%*s %d %d",&x,&y); + printf("SETPOS [%d %d]\n",x-140,96-y); // 140,96 => 0,0 + } + else if (strstr(result,"FILL")) { + sscanf(result,"%*s %d %d",&x,&y); + printf("FILL [%d %d]\n",x-140,96-y); // 140,96 => 0,0 + } + else { + printf("%s",result); + } + } + + return 0; +} diff --git a/logo/logo_convert.c b/logo/logo_convert.c new file mode 100644 index 00000000..3b0adadb --- /dev/null +++ b/logo/logo_convert.c @@ -0,0 +1,16 @@ +#include + +int main(int argc, char **argv) { + + int result; + + while(1) { + result=getchar(); + if (result<0) break; + + printf("%d ",result); + } + + printf("\n"); + +} diff --git a/logo/rick.coords b/logo/rick.coords new file mode 100644 index 00000000..3eaed207 --- /dev/null +++ b/logo/rick.coords @@ -0,0 +1,252 @@ +FULLSCREEN +SETPC 1 +; COAT +PU +SETPOS 117 111 +PD +SETPOS 145 191 +PU +SETPOS 130 191 +PD +SETPOS 91 120 +PU +SETPOS 91 133 +PD +SETPOS 101 171 +SETPOS 111 191 +PU +SETPOS 100 190 +PD +SETPOS 97 170 +SETPOS 97 184 +SETPOS 93 186 +SETPOS 98 191 +PU +SETPOS 73 191 +PD +SETPOS 65 187 +SETPOS 65 178 +SETPOS 71 172 +SETPOS 71 113 +SETPOS 109 83 +SETPOS 115 113 +SETPOS 129 106 +SETPOS 117 99 +SETPOS 108 84 +PU +SETPOS 140 76 +PD +SETPOS 146 87 +SETPOS 147 101 +SETPOS 142 108 +SETPOS 133 103 +SETPOS 140 77 +SETPOS 184 80 +SETPOS 192 90 +SETPOS 192 100 +SETPOS 199 107 +SETPOS 199 116 +SETPOS 213 126 +SETPOS 212 141 +SETPOS 217 147 +SETPOS 216 182 +SETPOS 211 182 +SETPOS 211 171 +SETPOS 203 163 +SETPOS 195 163 +SETPOS 192 169 +SETPOS 184 169 +SETPOS 180 171 +SETPOS 181 191 +SETPOS 175 191 +SETPOS 146 102 +PU +SETPOS 191 158 +PD +SETPOS 188 123 +SETPOS 192 135 +SETPOS 201 137 +SETPOS 195 141 +SETPOS 208 148 +SETPOS 198 150 +SETPOS 192 148 +SETPOS 197 153 +SETPOS 185 169 +; STRIPES +PU +SETPOS 120 111 +PD +SETPOS 149 109 +PU +SETPOS 151 114 +PD +SETPOS 121 118 +PU +SETPOS 122 122 +PD +SETPOS 152 118 +PU +SETPOS 154 124 +PD +SETPOS 125 128 +PU +SETPOS 127 133 +PD +SETPOS 155 128 +PU +SETPOS 156 132 +PD +SETPOS 128 137 +PU +SETPOS 129 140 +PD +SETPOS 157 136 +PU +SETPOS 159 141 +PD +SETPOS 132 146 +PU +SETPOS 134 149 +PD +SETPOS 161 146 +PU +SETPOS 162 152 +PD +SETPOS 135 155 +PU +SETPOS 137 159 +PD +SETPOS 163 155 +PU +SETPOS 164 158 +PD +SETPOS 138 164 +PU +SETPOS 140 168 +PD +SETPOS 166 162 +PU +SETPOS 167 165 +PD +SETPOS 140 172 +PU +SETPOS 141 176 +PD +SETPOS 159 174 +SETPOS 168 169 +PU +SETPOS 169 172 +PD +SETPOS 157 179 +SETPOS 141 179 +PU +SETPOS 142 183 +PD +SETPOS 158 182 +SETPOS 179 175 +PU +SETPOS 145 191 +PD +SETPOS 171 178 +; PURPLE SKIN +SET PC 3 +PU +SETPOS 109 83 +PD +SETPOS 102 68 +SETPOS 99 68 +SETPOS 96 58 +SETPOS 99 57 +SETPOS 102 68 +SETPOS 94 49 +SETPOS 97 37 +SETPOS 109 36 +SETPOS 111 30 +SETPOS 123 30 +SETPOS 133 50 +SETPOS 138 47 +SETPOS 141 47 +SETPOS 138 61 +SETPOS 127 78 +SETPOS 117 79 +SETPOS 109 78 +PU +SETPOS 135 52 +PD +SETPOS 136 56 +PU +SETPOS 125 49 +PD +SETPOS 118 48 +PU +SETPOS 105 52 +PD +SETPOS 100 54 +PU +SETPOS 110 49 +PD +SETPOS 111 60 +PU +SETPOS 109 63 +PD +SETPOS 111 62 +PU +SETPOS 115 61 +PD +SETPOS 119 61 +PU +SETPOS 116 68 +PD +SETPOS 110 68 +SETPOS 108 69 +SETPOS 116 70 +SETPOS 123 67 +PU +SETPOS 211 183 +PD +SETPOS 207 188 +SETPOS 201 189 +SETPOS 189 184 +SETPOS 202 172 +SETPOS 202 163 +PU +SETPOS 197 168 +PD +SETPOS 198 176 +SETPOS 194 178 +SETPOS 192 169 +; ORANGE HAIR +SET PC 4 +PU +SETPOS 93 48 +PD +SETPOS 90 34 +SETPOS 89 24 +SETPOS 100 16 +SETPOS 122 14 +SETPOS 136 23 +SETPOS 137 44 +PU +SETPOS 99 51 +PD +SETPOS 102 49 +SETPOS 107 49 +PU +SETPOS 113 47 +PD +SETPOS 118 46 +SETPOS 125 46 +; BLUE MIC +SET PC 5 +PU +SETPOS 133 191 +PD +SETPOS 134 86 +SETPOS 130 86 +SETPOS 130 63 +SETPOS 142 63 +SETPOS 142 87 +SETPOS 138 87 +SETPOS 137 191 +SETPOS 133 191 +FILL 136 76 diff --git a/logo/rr.logo b/logo/rr.logo new file mode 100644 index 00000000..b5e4ee5b --- /dev/null +++ b/logo/rr.logo @@ -0,0 +1,72 @@ +TO G :X :Y +MAKE "XY SENTENCE :X :Y +SETHEADING TOWARDS :XY +SETPOS :XY +END + + +TO MUSIC +PU +SETPOS [-80 -70] +SETH 90 +CT +SETCURSOR [8 20] +PR [NEVER GONNA GIVE YOU UP] +TOOT 262 10 +FD 14 +TOOT 294 10 +FD 28 +TOOT 349 10 +FD 21 +TOOT 294 10 +FD 21 +TOOT 440 15 +FD 35 +TOOT 440 15 +FD 28 +TOOT 392 30 +CT +SETCURSOR [8 20] +SETPOS [-80 -70] +PR [NEVER GONNA LET YOU DOWN] +TOOT 262 10 +FD 14 +TOOT 294 10 +FD 28 +TOOT 349 10 +FD 21 +TOOT 294 10 +FD 21 +TOOT 392 15 +FD 28 +TOOT 392 15 +FD 28 +TOOT 349 15 +CT +SETCURSOR [1 20] +SETPOS [-128 -70] +PR [NEVER GONNA RUN AROUND AND DESERT YOU] +TOOT 262 10 +FD 14 +TOOT 294 10 +FD 28 +TOOT 349 10 +FD 21 +TOOT 294 10 +FD 21 +TOOT 349 20 +FD 28 +TOOT 392 10 +FD 7 +TOOT 330 15 +FD 42 +TOOT 294 5 +TOOT 262 20 +FD 28 +TOOT 262 10 +FD 14 +TOOT 392 20 +FD 35 +TOOT 349 40 +END +