A2osX/ProDOS.FX/ProDOS.S.SEL1.txt

457 lines
12 KiB
Plaintext
Raw Normal View History

2019-10-16 06:09:13 +00:00
NEW
AUTO 3,1
* object code = sel_1
* Bird's Better Bye at org = dispadr
*--------------------------------------
2019-11-01 20:06:04 +00:00
SEL1.START
2019-10-16 06:09:13 +00:00
birdbye cld
lda RROMBNK2 read ROM
stz softev
2019-11-06 20:48:15 +00:00
lda #$10 set reset vector to 'dispadr'
sta softev+1
jsr setpwrc create power-up byte
2019-10-16 06:09:13 +00:00
lda #$A0
jsr $C300 initialize 80 column text card
ldx #$17
* set up memory bitmap in global page
2019-11-09 12:19:41 +00:00
L5D16 stz MEMTABL,x P8 memory bitmap
2019-10-16 06:09:13 +00:00
dex
bpl L5D16
2019-11-09 12:19:41 +00:00
inc MEMTABL+$17 protect global page
2019-10-16 06:09:13 +00:00
lda #$CF protect zero page, stack and page 1
2019-11-09 12:19:41 +00:00
sta MEMTABL
2019-10-16 06:09:13 +00:00
lda #$02
sta smparms init set mark parms pcount.
* drive selector
2019-11-09 12:19:41 +00:00
ldx DEVCNT get device count and
2019-10-16 06:09:13 +00:00
stx lstpntr store in zero page.
lda devnum get last slot/drive
bne volname
ds2 ldx lstpntr get device list pointer.
2019-11-09 12:19:41 +00:00
lda DEVLST,x get unit number from list.
2019-10-16 06:09:13 +00:00
cpx #$01 make sure it's real.
bcs L5D3F if so, change list pointer.
2019-11-09 12:19:41 +00:00
ldx DEVCNT get device count.
2019-10-16 06:09:13 +00:00
inx
L5D3F dex decrement list pointer and restore.
stx lstpntr
* get and store volume name
volname sta ol_unit store unit number for online.
jsr MLI
2019-11-06 20:48:15 +00:00
.DA #MLIONLINE
2019-10-16 06:09:13 +00:00
.DA ol_parms
bcs ds2 error check.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
stz dlevel haven't read root directory yet.
lda pbuf+1 load description byte.
and #$0F mask for name length.
beq ds2 if 0, then try next unit.
adc #$02 add 2 to length.
tax name length in x.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
vnam1 stx pbuf save the name length
lda #$2F '/'
sta pbuf+1 slash before and
sta pbuf,x after name.
stz pbuf+1,x null after complete name.
* open and read directory
jsr MLI
2019-11-06 20:48:15 +00:00
.DA #MLIOPEN
2019-10-16 06:09:13 +00:00
.DA op_parms
bcc L5D7F good open.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
lda dlevel trying to open root directory ?
beq ds2 yes, just move to next volume.
jsr bell1 no, generate bell tone
jsr popdir and stay at same level.
stx pbuf
jmp keyloop
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
L5D7F inc dlevel
stz filecount zero file count.
lda op_refn get file reference number
sta rd_refn store in read
sta sm_refn and setmark parm lists.
lda #$2B set read parm list for
sta dhdr_len directory header length.
stz dhdr_len+1
jsr doread read directory
bcs L5DB3
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
ldx #$03
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
L5D9A lda sysentry+$23,x copy directory info
sta entlen,x to zero page.
dex
bpl L5D9A
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
sta dhdr_len put entry length in read parm list.
lda #$01 set block file counter to 1.
sta blkfl
stz fpos_mid zero out msb's of file position
stz fpos_hi in setmark parm list.
lda filecnt any files in directory ?
ora filecnt+1
bne L5DB5 if so, continue
L5DB3 bra L5E29 else go close directory file.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
L5DB5 bit filecnt+1 check msb of file count.
bmi L5DB3 if set then done.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
L5DB9 lda fpos_mid get mid byte of setmark file position.
and #$FE reset lsb
sta fpos_mid and save.
ldy blkfl block file counter
lda #$00
cpy entblk have we read all entries in this block ?
bcc L5DCE if not, continue.
tay if so, zero y-reg and
sty blkfl reset block counter / flag
inc fpos_mid
* set up setmark parameters for next file to be read.
* if transfer to second sector, handle it.
L5DCC inc fpos_mid
L5DCE dey decrement file block counter
clc
bmi L5DD8
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
adc entlen add entry length to acc.
bcc L5DCE determine if we flopped into 2nd half of
bcs L5DCC block, if so inc mid byte position.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
L5DD8 adc #$04 add 4 and put in
sta fpos_lo low byte of setmark.
jsr MLI call mli
2019-11-06 20:48:15 +00:00
.DA #MLISETMARK
2019-10-16 06:09:13 +00:00
.DA #smparms parameters address = $0060
.HS 00
bcs L5DB3 error
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
jsr doread
bcs L5DB3 error.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
inc blkfl increase count of files read.
lda sysentry file type/length.
and #$F0 mask off high nibble.
beq L5DB9 deleted file, try next one.
dec filecnt decrement low file count.
bne L5DF8
dec filecnt+1 and high if necessary.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
L5DF8 ror sysentry+$1E check access bit.
bcc L5DB5 if no read, try next file.
lda sysentry+$10 get file type.
cmp #$0F directory file ?
beq L5E08 then continue.
cmp #$FF system file ?
bne L5DB5 no, read next file.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
L5E08 ldx filecount get valid files read.
cpx #$80 if greater than size of filename buffer
bcs L5E29 then close directory
sta filetyps,x else store filetype in zero page
jsr namecalc and go set up storage area.
ldy #$0F
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
L5E15 lda sysentry,y get byte of filename
sta (fnstore),y store in directed area
dey
bpl L5E15
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
iny y = 0
and #$0F mask off low nibble (name length)
sta (fnstore),y restore in name buffer
inc filecount increment valid file counter
bne L5DB5 get next file (branch always)
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
L5E26 jmp ds2 error. try next unit.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
L5E29 jsr MLI close directory file
2019-11-06 20:48:15 +00:00
.DA #MLICLOSE
2019-10-16 06:09:13 +00:00
.DA cl_parms
bcs L5E26 error.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
jsr settxt use full screen for windows
jsr home
lda #$17 cursor at bottom of screen.
jsr TABV set vertical position.
ldy #$00
lda #$14 horizontal position.
jsr sethorz print message.
jsr homecurs cursor to upper/left.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
ldx #$00
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
L5E48 lda pbuf+1,x
beq showfiles
jsr output
inx
bne L5E48
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
showfiles stz valcnt
stz topname init top filename index.
lda filecount # of valid files.
beq keyloop if no files.
cmp #$15 more than what will fit on screen ?
bcc L5E61 no.
lda #$14 limit to 20 files on the screen.
L5E61 sta gp_cnt
lda #$02 set window dimensions
sta wndtop
sta wndlft
lda #$16
sta wndwdth
sta wndbtm
L5E6F jsr nameprnt output filename to screen
inc valcnt
dec gp_cnt file counter.
bne L5E6F continue printing names.
stz valcnt
beq L5EAA if last file, it needs to be inverse.
uparrow jsr nameprnt print old name in normal.
ldx valcnt get old name number.
beq L5EAA if already at the top name
dec valcnt else fix index.
lda cv current cursor line.
cmp #$02 at top line of window ?
bne L5EAA no, move up normally.
dec topname fix offset index
lda #$16 else sroll windows down a line.
bne L5EA7 branch always.
dnarrow jsr nameprnt print old name in normal.
ldx valcnt get old name number.
inx add one.
cpx filecount
bcs L5EAA if already at last filename
stx valcnt else update index.
lda cv current cursor line.
cmp #$15 at bottom line of window ?
bne L5EAA no, move cursor normally.
inc topname update offset index
lda #$17 else scroll up a line.
L5EA7 jsr cout
L5EAA jsr setinv set inverse text mode.
jsr nameprnt output last filename.
keyloop lda kbd get keyboard input.
bpl keyloop loop until key pressed.
sta KBDSTROBE clear strobe.
jsr setnorm set normal text mode.
ldx filecount are any files displayed ?
beq L5ECB no, don't accept arrow keys or return.
cmp #$8D return ?
beq L5EF4 then run selected file.
cmp #$8A down ?
beq dnarrow move down a name.
cmp #$8B up ?
beq uparrow move up a name.
L5ECB cmp #$89 tab ?
beq L5EED new volume.
cmp #$9B esc ?
bne keyloop no, try again else pop up a directory.
* pop a directory level
jsr popdir
dec dlevel
bra L5EF1
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
popdir ldx pbuf
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
L5EDD dex
lda pbuf,x
cmp #$2F slash
bne L5EDD
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
cpx #$01
bne L5EEC
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
ldx pbuf
L5EEC rts
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
L5EED jmp ds2 set up new unit number.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
L5EF0 inx
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
L5EF1 jmp vnam1 get new directory info.
* run selected file
2019-11-06 20:48:15 +00:00
L5EF4 jsr MLI
.DA #MLISETPREFIX
2019-10-16 06:09:13 +00:00
.DA pf_parms
bcs L5EED error.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
ldx valcnt get name number.
jsr namecalc set up name storage area (on return y=0)
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
ldx pbuf get prefix length.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
L5F04 iny start at y = 1.
lda (fnstore),y get character of name.
inx
sta pbuf,x store in prefix buffer.
cpy namelen check length of name.
bcc L5F04 loop until all transferred.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
stx pbuf put prefix length into buffer.
ldy valcnt get file number.
lda filetyps,y get file type.
bpl L5EF0 branch if directory.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
jsr settxt reset to full window.
jsr home makes for no flash.
lda #$95 ctrl-u
jsr cout turn off 80 columns.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
jsr MLI open file
2019-11-06 20:48:15 +00:00
.DA #MLIOPEN
2019-10-16 06:09:13 +00:00
.DA op_parms
bcs L5EED if error.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
lda op_refn move reference number
sta rd_refn for read.
lda #$FF read the entire file.
sta dhdr_len
sta dhdr_len+1
jsr doread read selected file.
php save possible error.
jsr MLI close file. ignore any error from close
2019-11-06 20:48:15 +00:00
.DA #MLICLOSE
2019-10-16 06:09:13 +00:00
.DA cl_parms
plp restore status from read.
bcs L5EED if any errors.
jmp sysentry execute selected system file.
* output messages. on entry: acc = horizontal position,
* y = index to message teminated by 0.
sethorz sta ch
msgout lda dsp2msg,y
beq L5F57
jsr cout
iny
bne msgout
L5F57 rts
* name pointer calculator for name storage area
namecalc stz fnstore+1 init high byte of 16-bit shift
txa
asl shift to high nibble
rol fnstore+1
asl
rol fnstore+1
asl
rol fnstore+1
asl
rol fnstore+1
sta fnstore low pointer
lda /iobuf
clc
adc fnstore+1
sta fnstore+1
ldy #$00
lda (fnstore),y file name length
sta namelen
rts
* output a filename line
nameprnt lda #$02
sta ch80col horizontal position = 2.
ldx valcnt filename number
txa
sec
sbc topname calculate line # to display name
inc
inc
jsr TABV set vertical position.
lda filetyps,x get filetype (x is unchanged by tabv).
bmi L5F99 branch if system file.
stz ch80col adjust cursor position.
lda invflg ave current inverse setting
pha
ldy #fldrmsg-dsp2msg
jsr msgout display the folder.
pla restore inverse setting.
sta invflg
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
L5F99 jsr outsp output a space.
jsr namecalc calc name location.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
L5F9F iny y = 1 (first time).
lda (fnstore),y get name character.
jsr output put on screen.
cpy namelen end of name ?
bcc L5F9F no.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
outsp lda #$A0
bne L5FB1 branch always.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
homecurs lda #$99
output ora #$80 set high bit.
L5FB1 jmp cout output to screen.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
doread jsr MLI mli read call
2019-11-06 20:48:15 +00:00
.DA #MLIREAD
2019-10-16 06:09:13 +00:00
.DA rd_parms
rts
* data area
dsp2msg .AS -"RETURN: Select | TAB: Chg Vol | "
.AS -"ESC: Back"
.DA #$00
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
fldrmsg .DA #$0F inverse control code
.HS 1B enable mousetext
.AS -"XY" folder characters
.HS 18 disable mousetext
.HS 0E normal control code
.HS 00
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
op_parms .DA #$03 3 parms
.DA pbuf pathname
.DA op_buf file buffer
op_refn .HS 00 reference number
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
cl_parms .HS 01 1 parm
.HS 00 reference number.
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
ol_parms .HS 02 2 parms
ol_unit .HS 60 unit number, default = s6, d1
.DA pbuf+1 data buffer
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
pf_parms .DA #01 one parm
.DA pbuf pathname
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
rd_parms .DA #04 4 parms
rd_refn .HS 01 reference number
.DA sysentry data buffer
* these last 2 parms (4 bytes) may extend past $300 length limit since
* the request count is set prior to using the parm block and the transfer
* count isn't used at all (except by prodos)
2019-11-06 20:48:15 +00:00
.DUMMY
.BS 2 requested length
.BS 2 actual length
dhdr_len .BS 1 directory header length (actually uses 2 bytes)
.ED
2019-10-16 06:09:13 +00:00
*--------------------------------------
2019-11-04 07:21:40 +00:00
SEL1.LEN .EQ *-SEL1.START
2019-10-16 06:09:13 +00:00
MAN
SAVE USR/SRC/PRODOS.FX/PRODOS.S.SEL1
LOAD USR/SRC/PRODOS.FX/PRODOS.S
ASM