/**************************************************************************** OS/A65 Version 2.0.0 lib6502 ls program Copyright (C) 1997-1998 Andre Fachat This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ****************************************************************************/ #include "lib6502.i65" main .( .zero argp .word 0 .bss fileno .byt 0 entry .dsb FD_NAME+MAX_FILENAME .text sta argp sty argp+1 ldy #0 l0 lda (argp),y beq first iny bne l0 first iny lda (argp),y bne ok ;usage lda #<usagetxt ; ldy #>usagetxt ; jmp etxtout lda #<joker sta argp lda #>joker sta argp+1 ; always not null bne l1 ok tya clc adc argp sta argp bcc l1 inc argp+1 l1 jsr crlfout lda argp ldy argp+1 jsr fopendir bcc opened rts opened stx fileno rd ldx fileno lda #<entry ldy #>entry jsr freaddir bcs eof lda #<entry+FD_NAME ldy #>entry+FD_NAME jsr txtout jsr crlfout jmp rd eof ldx fileno jsr fclose lda #0 rts crlfout lda #13 sec ldx #STDOUT jsr fputc lda #10 sec jmp fputc txtout .zero tp .word 0 .text ldx #STDOUT .byt $2c etxtout ldx #STDERR sta tp sty tp+1 ldy #0 t0 lda (tp),y beq te sec jsr fputc iny bne t0 te rts joker .asc "*", 0 ;usagetxt ; .byt 13,10,"Usage:",13,10," ls dir1", 13,10,0 .)