A2osX/ProDOS.203/ProDOS.S.SEL0.txt

325 lines
9.1 KiB
Plaintext
Raw Normal View History

2019-04-29 20:36:58 +00:00
NEW
AUTO 3,1
* object code = sel_0
*
* dispatcher 1 - this code org's and operates at 'dispadr' (=$1000) but
* is resident in memory at 'displc2' (=$D100) in the alternate 4k bank
* of the language card. the quit call vectors to a routine high in the
* mli that moves dispatcher 1 down and jumps to it. the move routine
* must remain somewhere between $E000-$F7FF. this routine must be less
* than 3 pages in length.
2019-09-11 15:53:33 +00:00
ofsS .EQ *-dispadr offset to dispatcher org
2019-04-29 20:36:58 +00:00
2019-09-12 06:39:47 +00:00
disp1obj lda RROMBNK2 read ROM
sta CLR80DISP disable 80 col hardware
sta CLRALTCHAR normal LC, flashing UC
sta CLR80STORE disable 80 column store
2019-09-10 20:53:18 +00:00
jsr setnorm set normal text mode
jsr init init text screen
jsr setvid reset output to screen
jsr setkbd reset input to keyboard
ldx #$17 clear the memory bitmap
lda #$01 but protect page $BF00.
sta memmap,x P8 memory bitmap
dex
lda #$00
L5A22 sta memmap,x
dex
bpl L5A22
lda #$CF protect zero page, stack and
sta memmap $400-$7FF (text screen display)
2019-09-12 06:39:47 +00:00
L5A2D jsr home clear screen
2019-09-10 20:53:18 +00:00
jsr crout position top/left
2019-09-11 15:53:33 +00:00
ldx #dsp1msg0-dsp1msgs
2019-09-10 20:53:18 +00:00
jsr prntmsg 'enter prefix...'
lda #$03 line 3
sta cv
jsr crout
jsr MLI get prefix
2019-09-12 06:39:47 +00:00
.DA #$C7
.DA dsp1pfx
ldx pbuf get prefix length
2019-09-10 20:53:18 +00:00
lda #$00 put 0 at end of prefix
2019-09-12 06:39:47 +00:00
sta pbuf+1,x
ldx pbuf get length.
2019-09-10 20:53:18 +00:00
beq L5A5D if no prefix to display.
2019-09-12 06:39:47 +00:00
L5A52 lda pbuf,x display prefix directly to screen
2019-09-10 20:53:18 +00:00
ora #$80 normal text
sta vline5-1,x line 5
dex
bne L5A52
L5A5D ldx #$00
dec cv
jsr crout
2019-04-29 20:36:58 +00:00
getkey .EQ *-ofsS
2019-09-10 20:53:18 +00:00
jsr rdkey input char with cursor
cmp #$8D cr ?
beq L5ABD yes, accept what is entered.
pha no, save the char.
jsr clreol clear rest of line.
pla get char back
cmp #$9B esc ?
beq L5A2D yes, start over
cmp #$98 ctrl-x ?
L5A76 beq L5A2D then start over
cmp #$89 tab ?
beq badkey
cmp #$FF delete ?
beq L5A84 if yes
cmp #$88 backspace ?
bne L5A91 if not
L5A84 cpx #$00 at column 0 ?
beq L5A8B if so, do nothing
dec ch else move left
dex dec char count
L5A8B jsr clreol clear rest of line
jmp getkey get another char
L5A91 bcs L5A99
badkey jsr bell output bell for bad key
jmp getkey and get another.
L5A99 cmp #$DB below 'Z' ?
bcc L5A9F if yes
and #$DF else shift to uppercase.
L5A9F cmp #$AE below '.' ?
bcc badkey
cmp #$DB above 'Z' ?
bcs badkey
cmp #$BA below ':' ?
bcc goodkey
cmp #$C1 at or above 'A' ?
bcc badkey
2019-04-29 20:36:58 +00:00
goodkey inx
2019-09-10 20:53:18 +00:00
cpx #$27 more than 39 chars ?
bcs L5A76 then too many, go restart.
2019-09-12 06:39:47 +00:00
sta pbuf,x save it
2019-09-10 20:53:18 +00:00
jsr cout
jmp getkey get another.
L5ABD cpx #$00 prefix length = 0 ?
beq L5AD3 if yes, don't set length.
2019-09-12 06:39:47 +00:00
stx pbuf set prefix length.
2019-09-10 20:53:18 +00:00
jsr MLI call mli to set prefix.
2019-09-11 15:53:33 +00:00
.DA #$C6
.DA dsp1pfx
2019-09-10 20:53:18 +00:00
bcc L5AD3 if ok, go get filename.
jsr bell if not, ring bell
lda #$00 and try again for prefix.
L5AD1 beq L5A76
L5AD3 jsr home clear screen for application name.
jsr crout
2019-09-11 15:53:33 +00:00
ldx #disp1msg-dsp1msgs
2019-09-10 20:53:18 +00:00
jsr prntmsg 'enter pathname...'
2019-04-29 20:36:58 +00:00
retryrich .EQ *-ofsS
2019-09-10 20:53:18 +00:00
lda #$03 line 3
sta cv
jsr crout
ldx #$00
2019-04-29 20:36:58 +00:00
loop1 .EQ *-ofsS
2019-09-10 20:53:18 +00:00
jsr rdkey input char with cursor.
cmp #$9B esc ?
bne L5AF4 if not esc.
lda ch esc pressed in column 0 ?
bne L5AD3 if not, get pathname again.
beq L5AD1 if so, get prefix again.
L5AF4 cmp #$98 ctrl-x ?
L5AF6 beq L5AD3 then cancel and get pathname again.
cmp #$89 tab ?
beq L5B09 not good.
cmp #$FF delete ?
beq L5B04 delete char.
cmp #$88 backspace ?
bne L5B07
L5B04 jmp delchar delete char.
L5B07 bcs L5B0F if > $88 then char may be acceptable.
L5B09 jsr bell output bell (ctl-G)
jmp loop1 not good.
L5B0F cmp #$8D cr ?
beq L5B3C then done.
cmp #$DB less than 'Z' ?
bcc L5B19 no.
and #$DF make sure it's uppercase.
L5B19 cmp #$AE '.' ?
bcc L5B09 not good if less.
cmp #$DB less than '[' ?
bcs L5B09 not good.
cmp #$BA <= '9' ?
bcc L5B29 then ok.
cmp #$C1 greater than 'A' ?
bcc L5B09 if not, then no good.
L5B29 pha it's good, save it.
jsr clreol clear to end of line
pla
jsr cout print it
inx
cpx #$27 more than 39 chars ?
bcs L5AF6 too long, get pathname again.
2019-09-12 06:39:47 +00:00
sta pbuf,x store it.
2019-09-10 20:53:18 +00:00
jmp loop1 get another char
L5B3C lda #$A0
jsr cout after cr, blank out the cursor.
2019-09-12 06:39:47 +00:00
stx pbuf put length in front of the name.
jsr MLI get file info for pathname in pbuf
2019-09-11 15:53:33 +00:00
.DA #$C4
.DA dsp1info
2019-09-10 20:53:18 +00:00
bcc L5B4F if no errors.
jmp dsp1error
L5B4F lda dsp1type
cmp #$FF is it a SYS file ?
beq L5B5B yes.
lda #$01 not SYS file error.
jmp dsp1error
L5B5B lda #$00 it's a system file
sta dsp1cln
jsr MLI close all open files
2019-09-11 15:53:33 +00:00
.DA #$CC
.DA dsp1cls
2019-09-10 20:53:18 +00:00
bcc L5B6B
jmp dsp1error
L5B6B lda dsp1acess check for proper access.
and #$01 is read disabled ?
bne L5B77 no, access ok.
lda #$27 i/o error
jmp dsp1error
L5B77 jsr MLI open the file
2019-09-11 15:53:33 +00:00
.DA #$C8
.DA dsp1open
2019-09-10 20:53:18 +00:00
bcc L5B82
jmp dsp1error
L5B82 lda dsp1refn copy the reference number
sta dsp1rdn
sta dsp1eofn
jsr MLI get eof
2019-09-11 15:53:33 +00:00
.DA #$D1
.DA dsp1eof
2019-09-10 20:53:18 +00:00
bcs L5BE2
lda dsp1eofb+2 3rd of 3 bytes.
beq L5B9C if 0 then ok
lda #$27 else i/o error because
bne L5BE2 file is too large.
L5B9C lda dsp1eofb move eof to # of bytes to read.
sta dsp1cnt
lda dsp1eofb+1
sta dsp1cnt+1
jsr MLI read the file
2019-09-11 15:53:33 +00:00
.DA #$CA
.DA dsp1read
2019-09-10 20:53:18 +00:00
php save the status.
jsr MLI close the file.
2019-09-11 15:53:33 +00:00
.DA #$CC
.DA dsp1cls
2019-09-10 20:53:18 +00:00
bcc L5BBB
L5BB7 plp get status (it is irrelevant now)
bne L5BE2 if close generated an error
plp here if close was ok.
L5BBB bcs L5BB7 error.
jmp sysentry execute system file
2019-04-29 20:36:58 +00:00
delchar .EQ *-ofsS
2019-09-10 20:53:18 +00:00
lda ch is cursor in column 0 ?
beq L5BD3 yes, ignore it.
dex
lda #$A0 blank out the cursor
jsr cout
dec ch
dec ch point to last char entered
jsr cout and blank it too.
dec ch point to that location.
L5BD3 jmp loop1 get next char.
2019-04-29 20:36:58 +00:00
prntmsg .EQ *-ofsS
2019-09-10 20:53:18 +00:00
L5BD6 lda dsp1msgs,x
beq L5BE1
jsr cout
inx
bne L5BD6
L5BE1 rts
2019-04-29 20:36:58 +00:00
* dispatcher 1 error handler
dsp1error .EQ *-ofsS
2019-09-10 20:53:18 +00:00
L5BE2 sta errnum
lda #$0C display error message on line 13
sta cv
jsr crout
lda errnum
cmp #$01
bne L5BF5
2019-09-11 15:53:33 +00:00
ldx #dsp1err1-dsp1msgs not a type 'sys' file
2019-09-10 20:53:18 +00:00
bne L5C0B handled separately.
L5BF5 cmp #$40 syntax error in pathname ?
beq L5C09
cmp #$44 bad subdirectory path ?
beq L5C09
cmp #$45 volume not found ?
beq L5C09
cmp #$46 file not found ?
beq L5C09
2019-09-11 15:53:33 +00:00
ldx #dsp1err2-dsp1msgs if not the errors above then 'i/o error'
2019-09-10 20:53:18 +00:00
bne L5C0B
2019-09-11 15:53:33 +00:00
L5C09 ldx #dsp1err3-dsp1msgs otherwise display 'file/path not found'
2019-09-10 20:53:18 +00:00
L5C0B jsr prntmsg
jmp retryrich retry for application pathname
2019-09-11 15:53:33 +00:00
2019-04-29 20:36:58 +00:00
dsp1msgs .EQ *-ofsS
dsp1msg0 .EQ *-ofsS
2019-09-13 15:39:37 +00:00
.AS -"ENTER PREFIX (PRESS "RETURN" TO ACCEPT)"
2019-09-10 20:53:18 +00:00
.HS 00
2019-04-29 20:36:58 +00:00
disp1msg .EQ *-ofsS
2019-09-13 15:39:37 +00:00
.AS -"ENTER PATHNAME OF NEXT APPLICATION"
2019-09-10 20:53:18 +00:00
.HS 00
2019-04-29 20:36:58 +00:00
dsp1err1 .EQ *-ofsS
2019-09-11 15:53:33 +00:00
.DA #$87
2019-09-13 15:39:37 +00:00
.AS -'NOT A TYPE "SYS" FILE'
2019-09-10 20:53:18 +00:00
.HS 00
2019-04-29 20:36:58 +00:00
dsp1err2 .EQ *-ofsS
2019-09-11 15:53:33 +00:00
.DA #$87
2019-09-13 15:39:37 +00:00
.AS -"I/O ERROR "
2019-09-10 20:53:18 +00:00
.HS 00
2019-04-29 20:36:58 +00:00
dsp1err3 .EQ *-ofsS
2019-09-11 15:53:33 +00:00
.DA #$87
2019-09-13 15:39:37 +00:00
.AS -"FILE/PATH NOT FOUND "
2019-09-10 20:53:18 +00:00
.HS 00
2019-04-29 20:36:58 +00:00
dsp1info .EQ *-ofsS get file info parms
2019-09-11 15:53:33 +00:00
.DA #$0A 10 parameters
2019-09-12 06:39:47 +00:00
.DA pbuf pathname buffer
2019-04-29 20:36:58 +00:00
dsp1acess .EQ *-ofsS
2019-09-10 20:53:18 +00:00
.HS 00 access
2019-04-29 20:36:58 +00:00
dsp1type .EQ *-ofsS
2019-09-10 20:53:18 +00:00
.HS 00 file type
2019-09-11 15:53:33 +00:00
.BS 13 the rest are unimportant
2019-09-10 20:53:18 +00:00
dsp1open .EQ *-ofsS open file parms
2019-09-11 15:53:33 +00:00
.HS 03 3 parameters for open
2019-09-12 06:39:47 +00:00
.DA pbuf pathname buffer
2019-09-11 15:53:33 +00:00
.DA fbuf fcb buffer
2019-04-29 20:36:58 +00:00
dsp1refn .EQ *-ofsS
2019-09-10 20:53:18 +00:00
.HS 00 reference #
2019-04-29 20:36:58 +00:00
dsp1cls .EQ *-ofsS close file parms
2019-09-11 15:53:33 +00:00
.DA #01 1 parameter for close
2019-04-29 20:36:58 +00:00
dsp1cln .EQ *-ofsS
2019-09-10 20:53:18 +00:00
.HS 00 reference #
2019-04-29 20:36:58 +00:00
dsp1read .EQ *-ofsS
2019-09-11 15:53:33 +00:00
.HS 04 4 parameters for read
2019-04-29 20:36:58 +00:00
dsp1rdn .EQ *-ofsS
2019-09-10 20:53:18 +00:00
.HS 00 reference #
2019-09-11 15:53:33 +00:00
.DA sysentry .SYS load address
2019-04-29 20:36:58 +00:00
dsp1cnt .EQ *-ofsS
2019-09-10 15:46:56 +00:00
.HS 0000 byte count
2019-09-10 20:53:18 +00:00
.HS 0000
2019-04-29 20:36:58 +00:00
dsp1eof .EQ *-ofsS get eof parms
2019-09-11 15:53:33 +00:00
.HS 02 2 parameters
2019-04-29 20:36:58 +00:00
dsp1eofn .EQ *-ofsS
2019-09-10 20:53:18 +00:00
.HS 00 reference #
2019-04-29 20:36:58 +00:00
dsp1eofb .EQ *-ofsS
2019-09-11 15:53:33 +00:00
.HS 000000 3 byte eof
2019-09-10 20:53:18 +00:00
dsp1pfx .EQ *-ofsS get/set prefix parms
2019-09-11 15:53:33 +00:00
.DA #01 1 parameter
2019-09-12 06:39:47 +00:00
.DA pbuf prefix buffer
2019-04-29 20:36:58 +00:00
disp1end .EQ *
2019-09-11 15:53:33 +00:00
.BS $300-disp1end+disp1obj fill to page boundary
2019-04-29 20:36:58 +00:00
* end of obj sel_0
*--------------------------------------
MAN
2019-07-08 12:56:54 +00:00
SAVE USR/SRC/PRODOS.203/PRODOS.S.SEL0
LOAD USR/SRC/PRODOS.203/PRODOS.S
2019-04-29 20:36:58 +00:00
ASM