scene.org File Archive

File download

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

File size:
167 926 bytes (163.99K)
File date:
2022-12-30 11:32:14
Download count:
all-time: 13

Preview

  • file_id.diz 1.78K
  • star-sys265-src.png 160.08K
  • star-sys265.png 2.43K
  • star-sys265.prg 63B
  • star-sys265.s 1.16K

file_id.diz

STAR-SYS265

Author:          Wil / VCC
Category:        Christmas Challenge
System:          C64
Language:        6502 Assembler
Len source code: 1189 bytes
Len exe file:    63 bytes
Len code only:   61 bytes (subtracted 2 bytes for header/start address)
Instructions:
To run the code on the VICE emulator, (i) drag the file onto the emulator, (ii) enter SYS265 and press return (SYS is the command to run assembler programs)
To run the code on a real C64, (i) copy it to a disk, tape, or SD card, (ii) load from the respective drive with LOAD "STAR-SYS265",8,1, (iii) enter SYS265 and press return
Description:
The program contains two lists encoding the star's upper half in the form: number of spaces and number of asterisks. Two such bytes are specified for each line.
The encoding is done in half-bytes (nibbles), where the upper nibble encodes the number of spaces and the lower nibble a negated number of stars.
To process an encoded entry, it is loaded into the X register and the AXS (SBX) unintended opcode is used to count down in steps of 16.
Once the number becomes negative, it counts in 1-steps to draw the specified number of asterisks.
The program iterates through the entries until half of the star is drawn, using the Y register as an indicator of the current line.
When line 9 was drawn, the program self-modifies to count Y down instead of up, this way the lower half of the star is drawn as a mirror of the upper half.

Comments:
It is possible to shift the star more to the center by adding up to 10 spaces in the upper nibbles of table data1.
Since the program modifies itself, it does not work when being re-run. If the program were not partly in zero page, it would be one byte longer.
Based on this challenge: https://logiker.com/Vintage-Computing-Christmas-Challenge-2022