[net.micro.cbm] Kernal routines - closing a file

Pucc-H:Physics:mal@CS-Mordred.UUCP (05/01/84)

    I've been slowly working my way through the Kernal routines (as quickly
as studies will allow!)  and have run up against a problem with CLOSE/CLALL.
As a little exercise I am attempting to open a file, read it, print it on
the screen, and the close the file - all in machine language.
    Everything is behaving up to the close/reset i/o  portion.  I open file one
to the disk, read until an eof (input device 8, output device 3-screen).

	Then I -     		Done	lda #1
					jsr CLOSE
					jsr CLRCHN
					rts

    Great, right ?  Wrong. The system resets during one of the two Kernal
calls.  The reference manual states that clrchn is called by both close
and clall.  I've used CLRCHN before with success on the PET2001 and closed
the file externally in Basic. Can anyone give the correct protocol for
closing the file and resetting the devices ?  Mail or submit, whichever
you deem appropriate.  Thanks !!!
						Mark Lucas
						The Phriendly Physicist

						mal@pur-phy