mirror of
https://github.com/A2osX/A2osX.git
synced 2024-10-31 23:09:33 +00:00
298 lines
8.8 KiB
Plaintext
298 lines
8.8 KiB
Plaintext
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.
|
||
|
||
SEL0.START lda RROMBNK2 read ROM
|
||
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
|
||
dex
|
||
lda #$00
|
||
L5A22 sta memmap,x
|
||
dex
|
||
bpl L5A22
|
||
lda #$CF protect zero page, stack and
|
||
sta memmap $400-$7FF (text screen display)
|
||
L5A2D jsr home clear screen
|
||
jsr crout position top/left
|
||
ldx #dsp1msg0-dsp1msgs
|
||
jsr prntmsg 'enter prefix...'
|
||
lda #$03 line 3
|
||
sta cv
|
||
jsr crout
|
||
jsr MLI get prefix
|
||
.DA #$C7
|
||
.DA dsp1pfx
|
||
ldx pbuf get prefix length
|
||
lda #$00 put 0 at end of prefix
|
||
sta pbuf+1,x
|
||
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
|
||
dex
|
||
bne L5A52
|
||
L5A5D ldx #$00
|
||
dec cv
|
||
jsr crout
|
||
getkey 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
|
||
goodkey inx
|
||
cpx #$27 more than 39 chars ?
|
||
bcs L5A76 then too many, go restart.
|
||
sta pbuf,x save it
|
||
jsr cout
|
||
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.
|
||
jsr crout
|
||
ldx #disp1msg-dsp1msgs
|
||
jsr prntmsg 'enter pathname...'
|
||
retryrich lda #$03 line 3
|
||
sta cv
|
||
jsr crout
|
||
ldx #$00
|
||
loop1 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.
|
||
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.
|
||
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
|
||
.DA #$CC
|
||
.DA dsp1cls
|
||
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
|
||
.DA #$C8
|
||
.DA dsp1open
|
||
bcc L5B82
|
||
jmp dsp1error
|
||
L5B82 lda dsp1refn copy the reference number
|
||
sta dsp1rdn
|
||
sta dsp1eofn
|
||
jsr MLI get eof
|
||
.DA #$D1
|
||
.DA dsp1eof
|
||
bcs dsp1error
|
||
lda dsp1eofb+2 3rd of 3 bytes.
|
||
beq L5B9C if 0 then ok
|
||
lda #$27 else i/o error because
|
||
bne dsp1error 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
|
||
.DA #$CA
|
||
.DA dsp1read
|
||
php save the status.
|
||
jsr MLI close the file.
|
||
.DA #$CC
|
||
.DA dsp1cls
|
||
bcc L5BBB
|
||
L5BB7 plp get status (it is irrelevant now)
|
||
bne dsp1error if close generated an error
|
||
plp here if close was ok.
|
||
L5BBB bcs L5BB7 error.
|
||
jmp sysentry execute system file
|
||
delchar 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.
|
||
prntmsg lda dsp1msgs,x
|
||
beq L5BE1
|
||
jsr cout
|
||
inx
|
||
bne prntmsg
|
||
L5BE1 rts
|
||
|
||
* dispatcher 1 error handler
|
||
|
||
dsp1error sta errnum
|
||
lda #$0C display error message on line 13
|
||
sta cv
|
||
jsr crout
|
||
lda errnum
|
||
cmp #$01
|
||
bne L5BF5
|
||
ldx #dsp1err1-dsp1msgs not a type 'sys' file
|
||
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
|
||
ldx #dsp1err2-dsp1msgs if not the errors above then 'i/o error'
|
||
bne L5C0B
|
||
L5C09 ldx #dsp1err3-dsp1msgs otherwise display 'file/path not found'
|
||
L5C0B jsr prntmsg
|
||
jmp retryrich retry for application pathname
|
||
|
||
dsp1msgs .EQ *
|
||
dsp1msg0 .EQ *
|
||
.AS -'ENTER PREFIX (PRESS "RETURN" TO ACCEPT)'
|
||
.HS 00
|
||
disp1msg .AS -"ENTER PATHNAME OF NEXT APPLICATION"
|
||
.HS 00
|
||
dsp1err1 .DA #$87
|
||
.AS -'NOT A TYPE "SYS" FILE'
|
||
.HS 00
|
||
dsp1err2 .DA #$87
|
||
.AS -"I/O ERROR "
|
||
.HS 00
|
||
dsp1err3 .DA #$87
|
||
.AS -"FILE/PATH NOT FOUND "
|
||
.HS 00
|
||
dsp1info .DA #$0A 10 parameters
|
||
.DA pbuf pathname buffer
|
||
dsp1acess .HS 00 access
|
||
dsp1type .HS 00 file type
|
||
.BS 13 the rest are unimportant
|
||
dsp1open .HS 03 3 parameters for open
|
||
.DA pbuf pathname buffer
|
||
.DA fbuf fcb buffer
|
||
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 #
|
||
.DA sysentry .SYS load address
|
||
dsp1cnt .HS 0000 byte count
|
||
.HS 0000
|
||
dsp1eof .HS 02 2 parameters
|
||
dsp1eofn .HS 00 reference #
|
||
dsp1eofb .HS 000000 3 byte eof
|
||
dsp1pfx .DA #01 1 parameter
|
||
.DA pbuf prefix buffer
|
||
|
||
.BS $1300-* fill to page boundary
|
||
|
||
* end of obj sel_0
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE USR/SRC/PRODOS.203/PRODOS.S.SEL0
|
||
LOAD USR/SRC/PRODOS.203/PRODOS.S
|
||
ASM
|