Storing Sprite Data In Binary Files - Commodore 128 System Manual

Table of Contents

Advertisement

Storing Sprite Data in Binary Files

NOTE: The following explanation assumes some knowledge
of machine language, memory locations, binary files and
object code files.
The Commodore 128 has two new commands, BLOAD and
BSAVE, which make handling sprite data neat and easy. The " B"
in BLOAD and BSAVE stand for BINARY. The BSAVE and
BLOAD commands save and load binary files to and from disk. A
binary file consists of either a portion of a machine language
program, or a collection of data within a specified address range.
You may be familair with the SAVE command within the built-in
machine language monitor. When you use this SAVE command,
the resulting file on disk is considered a binary file. A binary file is
easier to work with than an object code file since you can load a
binary file without any further preparation. An object code file
must be loaded with a loader, as in the Commodore 64
Assembler Development System; then the SYSTEM command
(SYS) must be used to execute it. When loading binary files,
remember to load them in either of these two ways:
LOAD " binary filename" ,8,1
or
BLOAD" binary filename",BO,Pstart
where start is 3584 if you are loading sprite data files.
ln the first method you must specify the " ,1 " at the end or else the
computer treats it as a BASIC program file and loads it at the
beginning of BASIC text. The " ,1 " tells the computer to load the
binary file into the same place from which it was stored.
You're probably wondering what this has to do with sprites.
Here's the connection. The Commodore 128 has a dedicated
portion of memory ranging from decimal address 3584 ($0E00)
through 4095 ($0FFF), where sprite data is stored. This portion of
memory takes up 512 bytes. As you know, a sprite is 24 pixels
wide by 21 pixels tall. Each pixel requires one bit of memory. If
the bit in a sprite is off (equal to 0), the corresponding pixel on the
screen is considered off and it takes on the color of the
background. If a pixel within a sprite is on (equal to 1), the
corresponding pixel on the screen is turned on in the foreground
6-33

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

128d

Table of Contents