scene.org File Archive

File download

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

File size:
9 441 bytes (9.22K)
File date:
2022-12-30 11:32:13
Download count:
all-time: 4

Preview

  • disc_image.ssd 1.50K
  • file_id.diz 2.94K
  • load_1b4f.6502 58B
  • result.png 1.77K
  • source.txt 466B
  • source_result.png 4.94K

file_id.diz

Small Beeb Star

Author: mungre
Category: Christmas Challenge
System:   BBC Micro
Language: 6502 assembler using BBC BASIC's built-in assembler
Len source code: 542
Len exe file:    58
Len code only:   58
Instructions:
The easiest way to run the code is to visit the long URL at the bottom of this
document to use a browser-based emulator.

Alternatively, the file "disc_image.ssd" is a BBC Micro disc image you can
use in any desktop BBC emulator.

For example, install and run BeebEm:
https://github.com/stardot/beebem-windows/releases

On the File menu select "Load Disc 0" and choose the "disc_image.ssd" file.

Type
    CHAIN "SOURCE"
to assemble and run the code or
    *STAR
to run the assembled code directly.

Description:
The code uses X and Y coordinates with the origin at the centre of the star.
For each (X,Y) pair output an asterisk when

    ABS(ABS(Y)-ABS(X))<=4 AND (ABS(X)<=4 OR ABS(Y)<=4)

and a space otherwise.

Each abs is followed by a comparison with 4 so a single subroutine does both.
Branches after each test would cost space so the results of the comparisons
are accumulated into a single value and tested with a single comparison.

oswrch and osnewl are the operating system routines to write a character and a
newline respectively.

Comments:
"source.txt" is 466 bytes but "$.SOURCE" in the disc image is tokenized with
line numbers and comes to 542 bytes, as stated above.

For completeness, the assembled 6502 code (load address 0x1B4F) is in the file
"load_1b4f.6502" but you can't easily do anything with it.  It is identical to
the file "$.STAR" in the disc image.

Visit this URL to run the code in a browser-based emulator:
https://bbc.godbolt.org/?embedBasic=%73%68%69%66%74%3D%26%38%45%0A%61%62%73%78%3D%26%38%46%0A%0A%6F%73%6E%65%77%6C%3D%26%46%46%45%37%0A%6F%73%77%72%63%68%3D%26%46%46%45%45%0A%0A%44%49%4D%20%42%25%20%36%30%0A%46%4F%52%41%25%3D%30%54%4F%32%53%54%45%50%32%0A%50%25%3D%42%25%0A%5B%4F%50%54%41%25%0A%2E%73%74%61%72%74%0A%4C%44%59%20%23%26%31%32%0A%2E%79%6C%6F%6F%70%0A%4C%44%58%20%23%26%31%32%0A%2E%78%6C%6F%6F%70%0A%54%58%41%3A%4A%53%52%20%73%75%62%61%62%73%63%6D%70%0A%53%54%41%20%61%62%73%78%0A%54%59%41%3A%4A%53%52%20%73%75%62%61%62%73%63%6D%70%0A%53%45%43%3A%53%42%43%20%61%62%73%78%0A%4A%53%52%20%61%62%73%63%6D%70%0A%4C%44%41%20%73%68%69%66%74%0A%43%4D%50%20%23%26%36%30%0A%4C%44%41%20%23%33%32%0A%42%43%53%20%75%6E%73%65%74%0A%4C%44%41%20%23%34%32%0A%2E%75%6E%73%65%74%0A%4A%53%52%20%6F%73%77%72%63%68%0A%44%45%58%3A%42%50%4C%20%78%6C%6F%6F%70%0A%4A%53%52%20%6F%73%6E%65%77%6C%0A%44%45%59%3A%42%50%4C%20%79%6C%6F%6F%70%0A%52%54%53%0A%2E%73%75%62%61%62%73%63%6D%70%0A%53%45%43%3A%53%42%43%20%23%26%30%39%0A%2E%61%62%73%63%6D%70%0A%42%50%4C%20%6E%6F%6E%6E%65%67%0A%45%4F%52%20%23%26%46%46%0A%53%45%43%3A%41%44%43%20%23%26%30%30%0A%2E%6E%6F%6E%6E%65%67%0A%43%4D%50%20%23%35%0A%52%4F%52%20%73%68%69%66%74%0A%52%54%53%0A%2E%65%6E%64%0A%5D%0A%4E%45%58%54%0A%43%4C%53%0A%43%41%4C%4C%73%74%61%72%74%0A