scene.org File Archive

File download

<root>­/­parties­/­2022­/­vccc22­/­christmas_star_challenge/back2the8bit_c64_basic_vc3-2022.zip

File size:
43 011 bytes (42.00K)
File date:
2022-12-30 11:32:13
Download count:
all-time: 6

Preview

  • christmastar.prg 425B
  • file_id.diz 2.58K
  • list_screenshot.png 5.72K
  • screenshot_animated.gif 49.54K
  • source code.bas 471B

file_id.diz

Crunched Star

Author: Arturo Dente / Back to the 8 bit
Category: Christmas Challenge
System:   C64
Language: BASIC V2
Len source code: 471 bytes (375 if counting real 1 byte / 1 char, taking in account that the .bas has {some_token} tokens that weight more than one char)
Len exe file:    425 bytes
Len code only:   1005 bytes (calculated calling FRE() before and after loading)
Instructions:
Drag and drop the prg on Vice C64 emulator

Description:
I have procedurally created an array a$() of strings whose length is 4 chars, so disposed (first column "i" is the index of a$(i) )

i        a$(i)
--------------
0        ----
1        *---
2        **--
3        ***-
4        ****
5        ****
6        -***
7        --**
8        ---*
9        ----

Then I have defined the string p$ containing the "instructions" to plot the star. Each 4 chars of the string represent an entire row to plot (16+1 chars, that "+1" will be discussed below), and if t is the value of the n-th number of this group of 4, then I am about to print a$(t), according to the table above. 

So, for example, if t=3 and given p$="01800270036004504444644374428441044084417442644344440440036002700180", I have (in pseudo-code)

				              a$(p$.elementAt(t)) = a$(8) = ---*			

I also put a * or a space between the first 8 chars and the second ones (which char to print is calculated basing on which row I'm printing, one of the central ones or not).

Last bytes of the second line of code and the whole third line are to get the colour washing effect up/down. Without that, the code could fit a 255 oneliner (but it crashed for some reason, so I avoided it).
For a completion sake I copy paste in the end the code of the raw star, without colour-washing.

Comments:
I don't know if I have well interpreted how to count the "code only" bytes. Being a basic program, I have measured the memory occupation on Vice before and after loading the program, using the FRE() function and subtracting the initial status to the final status of the memory, so showing the real memory occupation in a "real" machine.

--------------------------------------------------------------
Appendix: code of the no-colour-washing christmas star (241 chars of code, as shown in CBM prg studio)
0pO53281,0:?"{clear}":d$(0,0)="*":d$(0,1)=" ":s$="****":e$="    ":fOt=0to4:a$(t)=leF(s$,t)+leF(e$,4-t):a$(t+5)=leF(e$,t)+leF(s$,4-t):nE:p$="01800270036004504444644374428441044084417442644344440440036002700180":r=0
1fOt=1tolen(p$)stE4:r=r+1:?"{return}"e$e$e$;:fOs=0to3:c=vA(mI(p$,t+s,1)):?"{white}"a$(c)+d$(1+(s=1),-(r<5orr>13));:nE:nE