Visual Stack by dagershman
A downloadable tool
===============================================================
Visual Stack
2021 BASIC 10 Liner Submission
By David A. Gershman - @dagershman
===============================================================
Visual Stack is a utility which allows the stack to have a visual aid
using sprites defined within page 1 of the Commodore 64 RAM (the
stack).
===============================================================
Submission Contents
===============================================================
visual_stack.txt : This info file.
visual_stack.d64 : Commodore d64 disk image for use with emulator.
listing_and_execution.gif
: Animated .gif of the tool load, execution, and demo.
program_listing.png
: Screenshot of the listed program. No abbreviations
were needed.
===============================================================
===============================================================
Use Instructions
===============================================================
Upon executing the program, the screen remains blank for a bit and
then the sprites will show on the right and the "Ready." prompt
returned. At this time, "new" can be issued and the utility is ready
for use.
The animated gif provided with this package not only illustrates the
loading and execution of the tool, but also types out some sample
programs showing the effect on the visual stack as BASIC programs are
ran.
Of special interest is the 2nd demo and the flickering pixels at the
upper portion of the visual. These are where BASICv2 stores PETSCII
representation of floating point numbers. Also of interest is the 3rd
demo which shows the exhaustion of the stack.
===============================================================
Program Listing
===============================================================
0 print "{clr}":v=53248 1 x=56334:poke x, peek(x) and 254 2 for i=0to128:poke 256+i,0:next 3 poke x, peek(x) or 1 4 for i=4to7:poke 2040+i,i:next 5 for i=0 to 3: poke 53291+i,1:next 6 poke 53271,255:poke 53277,255:poke 53264,255 7 for i=0to3:poke 53256+2*i,40:poke 53257+2*i,82+i*42:next 8 poke 53269,240
===============================================================
Program Explanation
===============================================================
************
** Line 0 **
************
print "{clr}"
Clear the screen. Not really needed but I'm used to putting this at
the top of my BASIC programs. :)
v=53248
Start of sprite registers and used for preservation of characters
per line. However, the program didn't use it as I was in a rush to
get this written and submitted. *sigh*
************
** Line 1 **
************
x=56334
Register for turning on/off interrupts.
poke x, peek(x) and 254
Turn off Interrupts
************
** Line 2 **
************
for i=0to128:poke 256+i,0:next
Clear the lower-half of the stack. I attempted to clear all of it
as in my ASM version of this program but the BASIC interpreter
chokes. By clearing half, the stack is cleared enough to start
"fresh". Only the "top of the stack" is visible as needed by the
BASIC ROM.
************
** Line 3 **
************
poke x, peek(x) or 1
Turn interrupts back on.
************
** Line 4 **
************
for i=4to7:poke 2040+i,i:next
Set sprite pointers 4-7 to the four portions of the stack at page 1
of RAM.
************
** Line 5 **
************
for i=0 to 3: poke 53291+i,1:next
Set all four sprites to white.
************
** Line 6 **
************
poke 53271,255:poke 53277,255
Expand the sprites in X and Y direction.
poke 53264,255
Set the X position high-bit to 1 since all sprites will be on the
right.
************
** Line 7 **
************
for i=0to3:poke 53256+2*i,40:poke 53257+2*i,82+i*42:next
First poke sets the x-position of all sprites, second poke sets the
y-position of each sprite.
************
** Line 8 **
************
poke 53269,240
Turn on sprites 4 through 7.
===============================================================
Version 2.0
===============================================================
This was a last-minute effort, a port of an ASM program I made, very
near the deadline for submissions. Unfortunately I didn't have time
to create the shortest, most efficient code. Below is a shorter
version but does not reflect the actual submission.
0 z=240:v=53248:x=3086+v:pokex,peek(x)andz+14:fori=0to128:poke z+16+i,0:next
1 pokex,peek(x)or1:pokev+23,z:pokev+29,z:pokev+16,z:fori=0to3
2 poke2040+4+i,4+i:pokev+8+2*i,40:poke v+9+2*i,82+i*42:pokev+43+i,1:next:pokev+21,z
Status | Released |
Category | Tool |
Author | BASIC 10Liner |
Download
Install instructions
Emulator Usage/Loading/Execution
===============================================================
Visual Stack was developed on a Linux host using the VICE C64 Emulator
('x64' binary). To execute the program, it is presumed the
reader/user has knowledge of VICE and mounting of .d64 images.
To run the program, the reader/user must mount the provided .d64 file
using the VICE emulator running the "x64" binary.
After mounting the disk, issue the following commands:
load "*",8 <ENTER>
followed by
run <ENTER>
Leave a comment
Log in with itch.io to leave a comment.