f



GET, GET# and end of files

This is something I tripped over yesterday.  Many
of my BASIC programs have the following structure:

10 open source and target files

100 clear buffer contents

200 input from a source file, process
    and store data in the buffer

     The above step is repeated while
     space in the buffer is available

300 output data to a target file when the buffer is full.

     continue at lines 100 to 300 until all data
     in the source file has been processed.

400 endjob processing when an end
    of the source file is detected.


Most programmers begin line 200 with code that looks like
        200 GET#4, iolist : S=ST : ...

The value of ST is determined by whether the
end of the source file has has been reached.

The hints & tricks column in a RUN special issue
suggests adding the following commands to line 100
        100 POKE781,4 : SYS65478

Changing line 200 to
        200 GET iolist : S=ST : ...

And adding a SYS65484 prior to any ouput in line 300.

The reasons for these changes are not
important for this message thread.

Attempts to read beyond the end of the source file with GET
replaces the values in the iolist with carriage returns (ASCII
value 13).  When a GET# is used, attempts to read beyond the end
of file do not replace the values in the items in the iolist.
0
r_u_sure
10/30/2003 2:49:10 AM
comp.sys.cbm 14331 articles. 0 followers. dunric (341) is leader. Post Follow

3 Replies
901 Views

Similar Articles

[PageSpeed] 33

"Paul Rosenzweig" <r_u_sure@mybluelight.com> wrote in message
news:dda6e12f.0310291849.701f73e9@posting.google.com...
> Attempts to read beyond the end of the source file with GET
> replaces the values in the iolist with carriage returns (ASCII
> value 13).  When a GET# is used, attempts to read beyond the end
> of file do not replace the values in the items in the iolist.

Returning a carriage return character as an "EOL" character to the GET
routine, instead of setting ST, seems to be reasonable behavior from the
keyboard input routines that GET calls.  Even when using the CMD command,
GET doesn't normally read anything except the keyboard, right?

-- 
White Flame (aka David Holz)
http://www.white-flame.com/
(spamblock in effect)


0
White
10/30/2003 11:29:06 AM
"White Flame \(aka David Holz\)" <whiteflame52@y.a.h.o.o.com> wrote in message news:<bnqrud$27mf$1@barad-dur.nas.com>...
 of file do not replace the values in the items in the iolist.
> 
> Returning a carriage return character as an "EOL" character to the GET
> routine, instead of setting ST, seems to be reasonable behavior from
> the keyboard input routines that GET calls.  Even when using the CMD
> command, GET doesn't normally read anything except the keyboard, right?

The CMD command is equivalent to POKE781, file# : SYS 65481 or
in ML   LDX file#     JSR $FFC9      Both sequences will reroute
output (either from a BASIC PRINT statement or the KERNAL subroutine
$FFD2) from the screen to a file.  I don't know if CMD or any
BASIC instruction will make a file on disk the source of input for
the GET command.  POKE781, file# : SYS65478 or in ML LDX file #
JSR $FFC6  forces (either GET, $FFE4, or $FFCF) retrieval
of input to be from a file rather than from the keyboard.

The hint in RUN was entitled something like 'CMD in reverse'

Reading beyond the end of file results in a line terminator
when GET is used.  That seems reasonable to me as well.  I
would think that GET# should behave the same way.  The
designers of C64 BASIC (MICROSOFT?) must have thought otherwise.
0
r_u_sure
10/30/2003 4:45:15 PM
"White Flame \(aka David Holz\)" <whiteflame52@y.a.h.o.o.com> wrote in message news:<bnqrud$27mf$1@barad-dur.nas.com>...
> 
> <snip> instead of setting ST, <snip>

The value of ST seems to be consistent
with what is intuitive for both GET & GET@
0
r_u_sure
10/30/2003 11:11:19 PM
Reply:

Web resources about - GET, GET# and end of files - comp.sys.cbm

File:Commons-logo.svg - Wikipedia, the free encyclopedia
This image, or parts of it, is an official logo or design used by Wikimedia Foundation or by one of its projects. It is copyrighted by the Wikimedia ...

Computer file - Wikipedia, the free encyclopedia
A computer file is a resource for storing information, which is available to a computer program and is usually based on some kind of durable ...

Department of Justice files motion to force Apple to comply with FBI iPhone backdoor request
... this issue from earlier in the week. It has since come to light that it was the FBI who forced the issue into the public eye ; Apple had filed ...

The Justice Department files a motion compelling Apple to unlock terrorist’s iPhone
... the FBI’s request to unlock a terrorist’s iPhone has taken a new turn. According to CNBC , the Department of Justice has just filed a motion ...

US Department of Justice files motion to force Apple to crack terrorist's iPhone
Apple's complex saga involving data encryption, civil liberties and national security took yet another twist on Friday when the U.S. Department ...

Archery company sues LARPer over patents, then files gag motion to silence him
... over foam arrows. And when he spoke out about the lawsuit, neither he nor his attorney saw what was coming next: the patent-owner filed papers ...

Apple: DOJ Files Motion to Compel Compliance with FBI Request, Says CNBC
CNBC is reporting that the U.S. Department of Justice has filed a motion to compel Apple (AAPL) to comply with the request of the FBI to develop ...

County files manslaughter charge in Calif. commuter train crash
Charge of vehicular manslaughter was filed against a pickup truck driver who crashed into and derailed a commuter train in Oxnard last year

Male Teen Files Lawsuit After He Had Lots Of Sex With Biology Teacher And She Bought Him An Xbox
Male Teen Files Lawsuit After He Had Lots Of Sex With Biology Teacher And She Bought Him An Xbox

Camille Cosby Files Emergency Motion To Postpone Monday Deposition, Fears “Media Circus” & “Security ...
... and could pose a “personal security threat that serves no purpose other than to harass and embarrass her.” Camille Cosby’s lawyers filed the ...

Resources last updated: 2/23/2016 2:15:38 PM