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

298 lines
8.8 KiB
Plaintext
Raw Permalink 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-16 06:06:02 +00:00
SEL0.START lda RROMBNK2 read ROM
2019-09-13 20:48:05 +00:00
sta CLR80DISP disable 80 col hardware
sta CLRALTCHAR normal LC, flashing UC
sta CLR80STORE disable 80 column store
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
2019-09-10 20:53:18 +00:00
dex
lda #$00
2019-09-13 20:48:05 +00:00
L5A22 sta memmap,x
2019-09-10 20:53:18 +00:00
dex
bpl L5A22
2019-09-13 20:48:05 +00:00
lda #$CF protect zero page, stack and
sta memmap $400-$7FF (text screen display)
L5A2D jsr home clear screen
jsr crout position top/left
2019-09-11 15:53:33 +00:00
ldx #dsp1msg0-dsp1msgs
2019-09-13 20:48:05 +00:00
jsr prntmsg 'enter prefix...'
lda #$03 line 3
2019-09-10 20:53:18 +00:00
sta cv
jsr crout
2019-09-13 20:48:05 +00:00
jsr MLI get prefix
2019-09-12 06:39:47 +00:00
.DA #$C7
.DA dsp1pfx
2019-09-13 20:48:05 +00:00
ldx pbuf get prefix length
lda #$00 put 0 at end of prefix
2019-09-12 06:39:47 +00:00
sta pbuf+1,x
2019-09-13 20:48:05 +00:00
ldx pbuf get length.
beq L5A5D if no prefix to display.
L5A52 lda pbuf,x display prefix directly to screen
ora #$80 normal text
sta vline5-1,x line 5
2019-09-10 20:53:18 +00:00
dex
bne L5A52
2019-09-13 20:48:05 +00:00
L5A5D ldx #$00
2019-09-10 20:53:18 +00:00
dec cv
jsr crout
2019-09-16 06:06:02 +00:00
getkey jsr rdkey input char with cursor
2019-09-13 20:48:05 +00:00
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 ?
2019-09-10 20:53:18 +00:00
beq badkey
2019-09-13 20:48:05 +00:00
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 '.' ?
2019-09-10 20:53:18 +00:00
bcc badkey
2019-09-13 20:48:05 +00:00
cmp #$DB above 'Z' ?
2019-09-10 20:53:18 +00:00
bcs badkey
2019-09-13 20:48:05 +00:00
cmp #$BA below ':' ?
2019-09-10 20:53:18 +00:00
bcc goodkey
2019-09-13 20:48:05 +00:00
cmp #$C1 at or above 'A' ?
2019-09-10 20:53:18 +00:00
bcc badkey
2019-09-13 20:48:05 +00:00
goodkey inx
cpx #$27 more than 39 chars ?
bcs L5A76 then too many, go restart.
sta pbuf,x save it
2019-09-10 20:53:18 +00:00
jsr cout
2019-09-13 20:48:05 +00:00
jmp getkey get another.
L5ABD cpx #$00 prefix length = 0 ?
beq L5AD3 if yes, don't set length.
stx pbuf set prefix length.
jsr MLI call mli to set prefix.
.DA #$C6
.DA dsp1pfx
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.
2019-09-10 20:53:18 +00:00
jsr crout
2019-09-11 15:53:33 +00:00
ldx #disp1msg-dsp1msgs
2019-09-13 20:48:05 +00:00
jsr prntmsg 'enter pathname...'
2019-09-16 06:06:02 +00:00
retryrich lda #$03 line 3
2019-09-10 20:53:18 +00:00
sta cv
jsr crout
ldx #$00
2019-09-16 06:06:02 +00:00
loop1 jsr rdkey input char with cursor.
2019-09-13 20:48:05 +00:00
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 ?
2019-09-10 20:53:18 +00:00
bne L5B07
2019-09-13 20:48:05 +00:00
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
2019-09-10 20:53:18 +00:00
pla
2019-09-13 20:48:05 +00:00
jsr cout print it
2019-09-10 20:53:18 +00:00
inx
2019-09-13 20:48:05 +00:00
cpx #$27 more than 39 chars ?
bcs L5AF6 too long, get pathname again.
sta pbuf,x store it.
jmp loop1 get another char
L5B3C lda #$A0
jsr cout after cr, blank out the cursor.
stx pbuf put length in front of the name.
jsr MLI get file info for pathname in pbuf
.DA #$C4
.DA dsp1info
bcc L5B4F if no errors.
2019-09-10 20:53:18 +00:00
jmp dsp1error
2019-09-13 20:48:05 +00:00
L5B4F lda dsp1type
cmp #$FF is it a SYS file ?
beq L5B5B yes.
lda #$01 not SYS file error.
2019-09-10 20:53:18 +00:00
jmp dsp1error
2019-09-13 20:48:05 +00:00
L5B5B lda #$00 it's a system file
2019-09-10 20:53:18 +00:00
sta dsp1cln
2019-09-13 20:48:05 +00:00
jsr MLI close all open files
.DA #$CC
.DA dsp1cls
2019-09-10 20:53:18 +00:00
bcc L5B6B
jmp dsp1error
2019-09-13 20:48:05 +00:00
L5B6B lda dsp1acess check for proper access.
and #$01 is read disabled ?
bne L5B77 no, access ok.
lda #$27 i/o error
2019-09-10 20:53:18 +00:00
jmp dsp1error
2019-09-13 20:48:05 +00:00
L5B77 jsr MLI open the file
.DA #$C8
.DA dsp1open
2019-09-10 20:53:18 +00:00
bcc L5B82
jmp dsp1error
2019-09-13 20:48:05 +00:00
L5B82 lda dsp1refn copy the reference number
2019-09-10 20:53:18 +00:00
sta dsp1rdn
sta dsp1eofn
2019-09-13 20:48:05 +00:00
jsr MLI get eof
.DA #$D1
.DA dsp1eof
2019-09-16 06:06:02 +00:00
bcs dsp1error
2019-09-13 20:48:05 +00:00
lda dsp1eofb+2 3rd of 3 bytes.
beq L5B9C if 0 then ok
lda #$27 else i/o error because
2019-09-16 06:06:02 +00:00
bne dsp1error file is too large.
2019-09-13 20:48:05 +00:00
L5B9C lda dsp1eofb move eof to # of bytes to read.
2019-09-10 20:53:18 +00:00
sta dsp1cnt
lda dsp1eofb+1
sta dsp1cnt+1
2019-09-13 20:48:05 +00:00
jsr MLI read the file
.DA #$CA
.DA dsp1read
php save the status.
jsr MLI close the file.
.DA #$CC
.DA dsp1cls
2019-09-10 20:53:18 +00:00
bcc L5BBB
2019-09-13 20:48:05 +00:00
L5BB7 plp get status (it is irrelevant now)
2019-09-16 06:06:02 +00:00
bne dsp1error if close generated an error
2019-09-13 20:48:05 +00:00
plp here if close was ok.
L5BBB bcs L5BB7 error.
jmp sysentry execute system file
2019-09-16 06:06:02 +00:00
delchar lda ch is cursor in column 0 ?
2019-09-13 20:48:05 +00:00
beq L5BD3 yes, ignore it.
2019-09-10 20:53:18 +00:00
dex
2019-09-13 20:48:05 +00:00
lda #$A0 blank out the cursor
2019-09-10 20:53:18 +00:00
jsr cout
dec ch
2019-09-13 20:48:05 +00:00
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-09-16 06:06:02 +00:00
prntmsg lda dsp1msgs,x
2019-09-10 20:53:18 +00:00
beq L5BE1
jsr cout
inx
2019-09-16 06:06:02 +00:00
bne prntmsg
2019-09-13 20:48:05 +00:00
L5BE1 rts
2019-04-29 20:36:58 +00:00
* dispatcher 1 error handler
2019-09-16 06:06:02 +00:00
dsp1error sta errnum
2019-09-13 20:48:05 +00:00
lda #$0C display error message on line 13
2019-09-10 20:53:18 +00:00
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-13 20:48:05 +00:00
bne L5C0B handled separately.
L5BF5 cmp #$40 syntax error in pathname ?
2019-09-10 20:53:18 +00:00
beq L5C09
2019-09-13 20:48:05 +00:00
cmp #$44 bad subdirectory path ?
2019-09-10 20:53:18 +00:00
beq L5C09
2019-09-13 20:48:05 +00:00
cmp #$45 volume not found ?
2019-09-10 20:53:18 +00:00
beq L5C09
2019-09-13 20:48:05 +00:00
cmp #$46 file not found ?
2019-09-10 20:53:18 +00:00
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-13 20:48:05 +00:00
L5C09 ldx #dsp1err3-dsp1msgs otherwise display 'file/path not found'
L5C0B jsr prntmsg
jmp retryrich retry for application pathname
2019-09-11 15:53:33 +00:00
2019-09-16 06:06:02 +00:00
dsp1msgs .EQ *
dsp1msg0 .EQ *
2019-09-13 20:48:05 +00:00
.AS -'ENTER PREFIX (PRESS "RETURN" TO ACCEPT)'
.HS 00
2019-09-16 06:06:02 +00:00
disp1msg .AS -"ENTER PATHNAME OF NEXT APPLICATION"
2019-09-13 20:48:05 +00:00
.HS 00
2019-09-16 06:06:02 +00:00
dsp1err1 .DA #$87
2019-09-13 15:39:37 +00:00
.AS -'NOT A TYPE "SYS" FILE'
2019-09-13 20:48:05 +00:00
.HS 00
2019-09-16 06:06:02 +00:00
dsp1err2 .DA #$87
2019-09-13 15:39:37 +00:00
.AS -"I/O ERROR "
2019-09-13 20:48:05 +00:00
.HS 00
2019-09-16 06:06:02 +00:00
dsp1err3 .DA #$87
2019-09-13 15:39:37 +00:00
.AS -"FILE/PATH NOT FOUND "
2019-09-13 20:48:05 +00:00
.HS 00
2019-09-16 06:06:02 +00:00
dsp1info .DA #$0A 10 parameters
2019-09-13 20:48:05 +00:00
.DA pbuf pathname buffer
2019-09-16 06:06:02 +00:00
dsp1acess .HS 00 access
dsp1type .HS 00 file type
2019-09-13 20:48:05 +00:00
.BS 13 the rest are unimportant
2019-09-16 06:06:02 +00:00
dsp1open .HS 03 3 parameters for open
2019-09-12 06:39:47 +00:00
.DA pbuf pathname buffer
2019-09-13 20:48:05 +00:00
.DA fbuf fcb buffer
2019-09-16 06:06:02 +00:00
dsp1refn .HS 00 reference #
dsp1cls .DA #01 1 parameter for close
dsp1cln .HS 00 reference #
dsp1read .HS 04 4 parameters for read
dsp1rdn .HS 00 reference #
2019-09-13 20:48:05 +00:00
.DA sysentry .SYS load address
2019-09-16 06:06:02 +00:00
dsp1cnt .HS 0000 byte count
2019-09-13 20:48:05 +00:00
.HS 0000
2019-09-16 06:06:02 +00:00
dsp1eof .HS 02 2 parameters
dsp1eofn .HS 00 reference #
dsp1eofb .HS 000000 3 byte eof
dsp1pfx .DA #01 1 parameter
2019-09-13 20:48:05 +00:00
.DA pbuf prefix buffer
2019-04-29 20:36:58 +00:00
2019-09-16 06:06:02 +00:00
.BS $1300-* fill to page boundary
2019-04-29 20:36:58 +00:00
* end of obj sel_0
*--------------------------------------
MAN
SAVE usr/src/prodos.203/prodos.s.sel0
LOAD usr/src/prodos.203/prodos.s
2019-04-29 20:36:58 +00:00
ASM