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

509 lines
13 KiB
Plaintext
Raw Normal View History

2019-10-16 06:09:13 +00:00
NEW
AUTO 3,1
*--------------------------------------
2019-10-16 06:09:13 +00:00
* object code = sel_1
* Bird's Better Bye at org = dispadr
*--------------------------------------
SEL1.START cld
bit RROMBNK2 read ROM
2019-10-16 06:09:13 +00:00
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
* set up memory bitmap in global page
ldx #0
jsr GP.TOOLBOX reset MEMTABL
2019-10-16 06:09:13 +00:00
lda #$02
sta smparms init set mark parms pcount.
*--------------------------------------
2019-10-16 06:09:13 +00:00
* drive selector
*--------------------------------------
2019-11-09 12:19:41 +00:00
ldx DEVCNT get device count and
.1 lda DEVLST,x
and #$F0
cmp DEVNUM
beq SEL1.VolName
dex
bra .1
SEL1.NextVol ldx lstpntr get device list pointer.
bne .1
2019-10-16 06:09:13 +00:00
2019-11-09 12:19:41 +00:00
ldx DEVCNT get device count.
2019-10-16 06:09:13 +00:00
inx
.1 dex
lda DEVLST,x get unit number from list.
2019-10-16 06:09:13 +00:00
SEL1.VolName stx lstpntr
sta ol_unit store unit number for online.
2019-10-16 06:09:13 +00:00
jsr MLI
2019-11-06 20:48:15 +00:00
.DA #MLIONLINE
2019-10-16 06:09:13 +00:00
.DA ol_parms
bcs SEL1.NextVol 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 SEL1.NextVol if 0, then try next unit.
2019-10-16 06:09:13 +00:00
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 SEL1.NextVol yes, just move to next volume.
2019-10-16 06:09:13 +00:00
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 rd_reqlen directory header length.
stz rd_reqlen+1
jsr SEL1.ReadEntry read directory
2019-10-16 06:09:13 +00:00
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
sta rd_reqlen put entry length in read parm list.
2019-10-16 06:09:13 +00:00
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
2019-10-16 06:09:13 +00:00
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.
2019-10-16 06:09:13 +00:00
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
2019-10-16 06:09:13 +00:00
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
.DA #MLISETMARK
.DA #smparms parameters address = $0060
2019-10-16 06:09:13 +00:00
.HS 00
bcs L5DB3 error
2019-11-06 20:48:15 +00:00
jsr SEL1.ReadEntry
2019-10-16 06:09:13 +00:00
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.
2019-10-16 06:09:13 +00:00
dec filecnt decrement low file count.
bne L5DF8
2019-10-16 06:09:13 +00:00
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.
2019-10-16 06:09:13 +00:00
lda sysentry+$10 get file type.
cmp #$0F directory file ?
beq L5E08 then continue.
2019-10-16 06:09:13 +00:00
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
2019-10-16 06:09:13 +00:00
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
L5E26 jmp SEL1.NextVol 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
2019-10-16 06:09:13 +00:00
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.
2019-10-16 06:09:13 +00:00
cmp #$15 more than what will fit on screen ?
bcc L5E61 no.
2019-10-16 06:09:13 +00:00
lda #$14 limit to 20 files on the screen.
2019-10-16 06:09:13 +00:00
L5E61 sta gp_cnt
lda #$02 set window dimensions
sta wndtop
sta wndlft
lda #$16
sta wndwdth
2020-08-30 17:50:57 +00:00
sta wndbot
2019-10-16 06:09:13 +00:00
L5E6F jsr nameprnt output filename to screen
inc valcnt
dec gp_cnt file counter.
bne L5E6F continue printing names.
2019-10-16 06:09:13 +00:00
stz valcnt
beq L5EAA if last file, it needs to be inverse.
2019-10-16 06:09:13 +00:00
uparrow jsr nameprnt print old name in normal.
ldx valcnt get old name number.
beq L5EAA if already at the top name
2019-10-16 06:09:13 +00:00
dec valcnt else fix index.
lda cv current cursor line.
cmp #$02 at top line of window ?
bne L5EAA no, move up normally.
2019-10-16 06:09:13 +00:00
dec topname fix offset index
lda #$16 else sroll windows down a line.
bne L5EA7 branch always.
2019-10-16 06:09:13 +00:00
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
2019-10-16 06:09:13 +00:00
stx valcnt else update index.
lda cv current cursor line.
cmp #$15 at bottom line of window ?
bne L5EAA no, move cursor normally.
2019-10-16 06:09:13 +00:00
inc topname update offset index
lda #$17 else scroll up a line.
2019-10-16 06:09:13 +00:00
L5EA7 jsr cout
L5EAA jsr setinv set inverse text mode.
jsr nameprnt output last filename.
2019-10-16 06:09:13 +00:00
keyloop lda kbd get keyboard input.
bpl keyloop loop until key pressed.
2019-10-16 06:09:13 +00:00
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.
2019-10-16 06:09:13 +00:00
cmp #$8D return ?
beq L5EF4 then run selected file.
2019-10-16 06:09:13 +00:00
cmp #$8A down ?
beq dnarrow move down a name.
2019-10-16 06:09:13 +00:00
cmp #$8B up ?
beq uparrow move up a name.
2019-10-16 06:09:13 +00:00
L5ECB cmp #$89 tab ?
beq L5EED new volume.
2019-10-16 06:09:13 +00:00
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
L5EED jmp SEL1.NextVol 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
L5EF4 jsr MLI
2019-11-06 20:48:15 +00:00
.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 rd_reqlen
* sta rd_reqlen+1
dec rd_reqlen+1 was $002B, now $FF2B
jsr SEL1.Read read selected file.
2019-10-16 06:09:13 +00:00
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
2019-10-16 06:09:13 +00:00
msgout lda dsp2msg,y
beq L5F57
2019-10-16 06:09:13 +00:00
jsr cout
iny
bne msgout
2019-10-16 06:09:13 +00:00
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
2019-10-16 06:09:13 +00:00
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.
2019-10-16 06:09:13 +00:00
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
.HS 2C BIT ABS
2019-11-06 20:48:15 +00:00
2019-10-16 06:09:13 +00:00
homecurs lda #$99
2019-10-16 06:09:13 +00:00
output ora #$80 set high bit.
jmp cout output to screen.
SEL1.ReadEntry jsr SEL1.Read
bcs SEL1.Read.RTS
ldy #sysentry
lda /sysentry
ldx #2
jmp GP.TOOLBOX
2019-11-06 20:48:15 +00:00
SEL1.Read 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
SEL1.Read.RTS rts
*--------------------------------------
2019-10-16 06:09:13 +00:00
* data area
*--------------------------------------
dsp2msg .AS -"RETURN: Select | TAB: Chg Vol | ESC: Back"
.HS 00
2019-10-16 06:09:13 +00:00
fldrmsg .HS 0F inverse control code
2019-10-16 06:09:13 +00:00
.HS 1B enable mousetext
.AS -"XY" folder characters
.HS 18 disable mousetext
.HS 0E normal control code
.HS 00
*--------------------------------------
op_parms .DA #3 3 parms
2019-10-16 06:09:13 +00:00
.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
*--------------------------------------
.LIST ON
SEL1.LEN .EQ *-SEL1.START
.LIST OFF
*--------------------------------------
2019-10-16 06:09:13 +00:00
* 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
rd_reqlen .BS 2 requested length
2019-11-06 20:48:15 +00:00
.BS 2 actual length
.ED
2019-10-16 06:09:13 +00:00
*--------------------------------------
MAN
2020-08-30 17:50:57 +00:00
SAVE usr/src/prodos.fx/prodos.s.sel1
LOAD usr/src/prodos.fx/prodos.s
2019-10-16 06:09:13 +00:00
ASM