FILE00010 ==0801==
   50 sys700
   75 .opt p,oo
   80 ;****************
   81 ;*              *
   82 ;*  lyle giese  *
   83 ;*  version 1.0 *
   84 ;*   06/21/86   *
   85 ;*              *
   86 ;****************
  120 readst = $ffb7
  130 setlfs = $ffba
  140 setnam = $ffbd
  150 open   = $ffc0
  160 close  = $ffc3
  170 chkin  = $ffc6
  180 chkout = $ffc9
  190 clrchn = $ffcc
  200 chrin  = $ffcf
  210 chrout = $ffd2
  220 getin  = $ffe4
  230 clall  = $ffe7
  300 index  = $fb
  310 fnam   = $033c;using cassette buffer to store filenames
  320 flen   = $fd;for length of filename
  330 outfile = $fe
  340 rtemp  = $03ff
  350 atemp  = $03fe
  360 pdev   = $03fd
  370 shflag = $028d
  380 high   = $03fc
  390 low    = $03fb
  490 *= $c000
  500 ;set up screen
  510 start lda #$00;make border and background black
  520 sta $d020
  530 sta $d021
  540 lda #$07;make the characters yellow
  550 sta $0286
  555 ;send first message to screen
  560 lda #<amess
  570 sta index
  580 lda #>amess
  590 sta index+1
  600 jsr messout;send message to screen
  610 ;get filename for disk read
  620 lda #<fnam;load index with location for filename
  630 sta index
  640 lda #>fnam
  650 sta index+1
  660 lda #$00
  670 sta flen
  680 jsr clrchn;make sure screen and keyboard is active
  690 nokey jsr getin;get a char from the keybuf
  700 beq nokey;if nothing is in keybuf a reg will hold a zero
  710 cmp #$14;ck for delete key
  720 bne ckrt
  730 lda flen;before deleting make sure that there
  740 beq nokey;is a char in fnam
  750 lda #$14;delete char on screen
  760 jsr chrout
  770 dec flen
  780 jmp nokey
  790 ckrt cmp #$0d;ck for return to either exit program
  800 bne valkey;or open disk file
  810 lda flen;ck number of char in keybuf
  820 bne dopen;if any chars then open disk file
  830 rts;if return pressed with no char in keybuf then exit routine
  840 valkey ldy flen;load y reg with flen
  850 cpy #$12;ck for max char allowable
  860 beq nokey
  870 sta (index),y;store in fnam buffer
  880 jsr chrout;and echo char to screen
  890 inc flen;inc flen pointer
  900 jmp nokey
  910 dopen ldy flen;add ,s to fnam
  920 lda #","
  930 sta (index),y
  940 iny
  950 lda #"s"
  960 sta (index),y
  970 iny
  980 sty flen
 1000 ;open channels to disk drive
 1010 lda #$00;first command channel
 1020 jsr setnam;no file name needed here
 1030 lda #$0f;open15,8,15
 1040 ldx #$08
 1050 ldy #$0f
 1060 jsr setlfs;open logical file
 1070 jsr open;command channel opened
 1080 bcc ropen;ck if open was ok
 1090 jmp derror;could not open channel
 1100 ropen lda flen;get length of filename
 1110 ldx #<fnam
 1120 ldy #>fnam
 1130 jsr setnam
 1140 lda #$08
 1150 ldx #$08
 1160 ldy #$00
 1170 jsr setlfs
 1180 jsr open;open8,8,8,"fnam,s"
 1190 bcc ckerror
 1200 jmp derror;could not open read file
 1210 ckerror jsr rerror;ck error chan on disk drive
 3000 derror jsr clrchn;make sure i/o initialized
 3010 jsr clall;make sure all open channels are closed
 3020 lda #<cmess;unable to open error chan
 3030 sta index
 3040 lda #>cmess
 3050 sta index
 3060 jsr messout
 3070 rts;this error is fatal and we don't want to try again
 4000 rerror ldx #$0f;read and ck disk error chan
 4010 jsr chkin
 4020 null jsr getin
 4030 beq null
 4040 sta high
 4050 jsr getin
 4060 sta low
 4070 cmp #$30;if first two chars are
 4080 bne ck;ascii zero and zero
 4090 lda high;then no error occured
 4100 cmp #$30;
 4110 beq empty;remove the entire error message
 4120 ck lda #$0d;if not then print error
 4130 jsr chrout;error message
 4140 lda high
 4150 jsr chrout
 4160 lda low
 4170 repeat jsr chrout
 4180 jsr getin
 4190 cmp #$0d
 4200 bne repeat
 4210 pla:pla;remove return address from stack
 4220 jsr clrchn
 4230 lda #$08:jsr close
 4240 lda #$0f:jsr close;close disk chan
 4250 lda #<emess
 4260 sta index
 4270 lda #>emess
 4280 sta index+1
 4290 jsr messout
 4300 ncr jsr getin
 4310 cmp #$0d
 4320 bne ncr
 4330 jmp start
 4340 empty jsr getin;no disk error but
 4350 cmp #$0d;should still read the entire
 4360 bne empty;message out of error chan
 4370 jsr clrchn
 4380 rts
 5000 messout ldy #$00;send message to screen
 5010 lpy lda (index),y;index points to start of message
 5020 beq end;and it must end with a zero byte
 5030 jsr chrout
 5040 iny
 5050 bne lpy;has y looped around to zero
 5060 inc index+1;if it has we must inc
 5070 jmp lpy;the hi byte of our index address
 5080 end rts
 7000 amess =*;opening message
 7010 .byte $93;clear/home
 7020 .byte $0d,$0d,$0d,$0e
 7030 .asc "         SEQUENTIAL FILE READER"
 7040 .byte $0d,$0d
 7050 .asc "             By Lyle Giese"
 7060 .byte $0d,$0d
 7070 .asc " Use the Shift and Shift Lock to pause
 7080 .byte $0d
 7090 .asc " listing. Press the Ctrl and Shift to"
 7100 .byte $0d
 7110 .asc " exit current file. To exit just"
 7120 .byte $0d
 7130 .asc " hit (rvon)return(rvof) at the Filename > prompt."
 7140 .byte $0d,$0d
 7150 .asc " Filename > "
 7160 .byte $00
 7300 cmess =*;unable to open error channel to disk drive
 7310 .byte $0d
 7320 .asc " Unable to open error channel to disk
 7330 .byte $0d
 7340 .asc " drive. Try again later!"
 7350 .byte $0d,$00
 7400 dmess =*;disk error trying to open read channel
 7410 .byte $0d
 7420 .asc " (rvon) DISK ERROR (rvof)"
 7430 .byte $0d,$00
 7500 emess =*;end of file
 7510 .byte $0d
 7520 .asc " (rvon) Press return to continue (rvof) "
 7530 .byte $0d,$00
