• Aucun résultat trouvé

Purpose: Loads a memory image file into memory.

Versions: Cassette

***

BLOAD filespec [,offset]

filespec

offset

is a string expression for the file specification. In BASIC 2 .

.0

and later releases, it can contain a path. It must conform to the rules outlined under

"N aming Files" in Chapter 3 of the BASIC Handbook; otherwise, an error occurs.

is an integer expression in the range ,0 to 65535. This is an offset at which the file will be loaded into the current segment specified by the latest DEF SEG statement.

If offset is omitted, the offset specified at BSA VE is assumed. That is, the file is loaded into the same location from which it was BSA VED.

When a BLOAD command is executed, the named file is loaded into memory starting at the specified location. If the file is to be loaded from the device CAS 1:, the cassette motor is turned on

automatically.

BLOAD Command

are using Disk BASIC or Advanced BASIC and the device name is omitted, the DOS default drive is used.

BLOAD is intended for use with a file that has previously been saved with BSA VE. BLOAD and BSA VE are useful for loading and saving machine language programs, but they are not restricted to assembly language programs. Any segment can be specified as the target or source for these statements through the DEF SEG statement. You have a useful way of saving and displaying screen images: save from or load to the screen buffer. See also Appendix B, "Assembly Language Subroutines."

Warning:

BASIC does not check the offset of the current segment where you are BLOADing. That is, it is possible to use BLOAD anywhere in memory.

Do not BLOAD over BASIC's stack, BASIC's variable area, or your BASIC program. See the memory map in Appendix B.

Notes when using CAS 1::

1. If you enter the BLOAD command in direct mode, the file names on the tape are displayed on the screen followed by a period C.) and a single letter indicating the type of file. This is followed by the message Skipped for the files not matching the named file, and Found when the named file is found. Types of files and the associated letter are:

.B for BASIC programs in internal format (created with SAVE command)

.P for protected BASIC programs in internal

BLOAD Command

.A for BASIC programs in ASCII format (created with SAVE ,A command) .M for memory image files (created with

BSA VE command)

.D for data files (created by OPEN followed by output statements)

If the BLOAD command is executed in a BASIC program, the file names skipped and found are not displayed on the screen.

2. You can press Ctrl-Break any time during BLOAD. This will cause BASIC to exit the search and return to direct mode between files or after a time-out period. Previous memory

contents do not change.

3. If CAS 1: is specified as the device and the filename is omitted, the next memory image (.M) file on the tape is loaded.

BLOAD Command

Example: This example loads the screen buffer for the Color/Graphics Monitor Adapter, which is at segment address HB8.0.0.0. If you were loading the screen buffer for the IBM Monochrome and Parallel Printer Adapter, you would have to change line 3.0 to read &HB.0.0.0. Line 5.0 loads PICTURE at offset .0, segment &HB8.0.0.

10 'load the screen buffer 20 'point SEG at screen buffer 30 DEF SEG= &HB800

40 'load PICTURE into screen buffer 50 BLOAD "PICTURE",0

The example for the BSAVE command (see the next entry) illustrates how PICTURE was saved.

BSAVE

Command

Purpose: Saves portions of the computer's memory on the specified device.

Versions: Cassette

***

BSAVE filespec, offset, length

filespec

offset

length

is a string expression for the file specification. In BASIC 2 .

.0

and later releases, it can contain a path. It must conform to the rules outlined under

"Naming Files" in Chapter 3 of the BASIC Handbook; otherwise, an error occurs.

is an integer expression in the range

.0

to 65535. This is the offset into the

segment declared by the last DEF SEG.

Saving starts from this location. See

"DEF SEG Statement."

is an integer expression in the range 1 to 65535. This is the length of the

memory image to be saved.

If offset or length is omitted, a Syntax error occurs and the save is canceled.

In Cassette BASIC, if the device name is omitted,

BSAVE

Command

If you are saving to CAS 1:, the cassette motor is turned on and the memory image file is immediately written to the tape.

When you use the DEF SEG statement, you can specify any segment as the source segment for the BSAVE data. For example, you can save an image of the screen by doing a BSA VE of the screen buffer.

Example: As explained under "BLOAD Command", the segment address of the 16K screen buffer for Color/Graphic Monitor Adapter is HBS.0.0.0. The segment address of the 4K screen buffer for the IBM Monochrome Display and Parallel Printer Adapter is HB.000.0.

The DEF SEG statement must be used to set up the segment address to the start of the screen buffer.

The offset of .0 and length &H4.0.0.0 specify that the entire 16K screen buffer is to be saved.

10 'Save the color screen buffer 20 'point segment at screen buffer 30 DEF SEG= &HB800

40 'save buffer in file PICTURE 50 BSAVE "PICTURE",0,&H4000

CALL

Documents relatifs