home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transactor
/
Transactor_27_1988_Transactor_Publishing.d64
/
shellram.sda
/
DOLOAD.A
< prev
next >
Wrap
Text File
|
2023-02-26
|
4KB
|
285 lines
;
; shellram
;
; By: Adrian Pepper
; Toronto, Ontario
;
; based on, but heavily modified from
; the Pro-Line/Spinnaker
; C POWER/POWER C shell for the
; Commodore 64 home computer.
;
; The shell was modified to reduce
; the size of the code, and arrange
; things so memory page 22 (hex $16)
; will be free for use as a "RAMdisk
; Interface Page", for use with the
; Commodore 1764 256K RAM expander
; for the Commodore 64
;
; This (basically) allows all programs
; designed to run under the shell to
; operate with the RAM disk
;
;
; doload.a
;
; doload, tryload;
; load executable programs from drives
;
; also getflnm
; ostdin
; ostdout
; oprout
;
;
;
.ref sysdev
.ref sysdrv
.ref wrkdev
.ref wrkdrv
.ref stdinfl
.ref stdoufl
;
; kernal routines, etc
;
.ref setlfs
.ref setnam
.ref open
.ref chkout
.ref clrchn
.ref load
;
;
;
.def getflnm
.def ostdin
.def ostdout
.def cmdchk
.def oprout
.def doload
.def tryload
;
.ref curcmdn
.ref strac ;; same as prfbuf, remember
;
.ref strload
.ref strapnd
.ref strend
.ref streq
.ref strfopn
.ref strechn
.ref strbout
.ref cmdlbuf
.ref strout
;
; getflnm - copies from cmdlbuf,x
; to strac, prepending <drv>:
;
; for ostdin, ostdout
;
getflnm clc
lda wrkdrv
adc #'0
sta strac
lda #':
sta strac+1
t1070b inx
lda cmdlbuf,x
bne t1080f
sec
rts
t1080f cmp #$20
beq t1090f
cmp #$a0
t1090f beq t1070b
ldy #2
t1100b lda cmdlbuf,x
beq t1110f
cmp #$20
beq t1110f
cmp #$a0
beq t1110f
sta strac,y
iny
inx
bne t1100b
t1110f lda #0
sta strac,y
dex
stx $2a
clc
rts
;
; ostdin - open stdin
; (process <filename)
;
ostdin lda #$01
sta stdinfl
sty $2b
jsr getflnm
bcc t0980f
rts
t0980f lda #$01
ldx wrkdev
ldy #$02
jsr strfopn ; open 1,wrkdev,2,strac
bcc t0990f
rts
t0990f ldx wrkdev
jmp cmdchk ; and return
;
; ostdout - open stdout
; (process >filename)
;
scoms .byte ",s"
.byte 0
scomw .byte ",w"
.byte 0
ostdout lda #$01
sta stdoufl
sty $2b
jsr getflnm
bcc t1000f
rts
t1000f ldx #0
jsr strend
dex
dex
lda strac,x
cmp #',
beq t1010f
ldx #<scoms
ldy #>scoms
jsr strapnd
t1010f ldx #<scomw
ldy #>scomw
jsr strapnd
lda #2
ldx wrkdev
ldy #3
jsr strfopn ;; open 2,<wrk>,3,strac
bcc t1020f
rts
t1020f ldx wrkdev
;
; cmdchk - get command channel line
; into echnbuf;
; output and set carry if non-zero code
; also restore x,y from $2a,$2b
;
cmdchk jsr strechn
bcc t1030f
jsr strbout
sec
t1030f ldx $2a
ldy $2b
rts
;
; oprout - open printer (dev 4)
; as stdout (process >>)
;
oprout stx $2a
sty $2b
lda #1
sta stdoufl
lda #2
ldx #4
ldy #7
jsr setlfs
lda #0
jsr setnam
jsr open
bcs t1120f
ldx #2
jsr chkout
t1120f php
jsr clrchn
plp
ldx $2a
ldy $2b
rts
;
; doload - loads name represented by string at (x,y)
;
doload stx $2a
sty $2b
jsr strload
ldx #<curcmdn
ldy #>curcmdn
jsr streq ; cmp with curcmdn
bne t0870f
clc
rts
t0870f ldx wrkdev
ldy wrkdrv
jsr tryload ; try work disk!
bcc t0880f
ldx sysdev
ldy sysdrv
cpx wrkdev ; don't redo same disk!
bne t0875f
cpy wrkdrv
beq t0876f
t0875f jsr tryload ; try system disk!
bcc t0880f
t0876f ldx #<scmdnf
ldy #>scmdnf
jsr strout
sec
rts
scmdnf .byte "command not found"
.byte $0d,0
t0880f ldy #$13
t0890b lda ($2a),y
sta curcmdn,y
dey
bpl t0890b
clc
rts
;
; tryload - attempt load of ($2a,$2b)
; from device x, drive y
;
szero .byte "0:"
.byte 0
sdotsh .byte ".sh"
.byte 0
;
tryload stx vtrydev
tya
clc
adc #'0
sta szero
ldx #<szero
ldy #>szero
jsr strload
ldx $2a
ldy $2b
jsr strapnd
ldx #<sdotsh
ldy #>sdotsh
jsr strapnd
ldx #0
jsr strend
txa
ldx #<strac
ldy #>strac
jsr setnam
ldx vtrydev
lda #$04
tay
jsr setlfs ; load 4,dev,4,nambuf
lda #$00
jsr load
bcc t0970f
cmp #5
bne t0940f
rts
t0940f ldx vtrydev
jsr strechn
;jsr strbout
sec
t0970f rts
vtrydev .bss 1