home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transactor
/
Transactor_27_1988_Transactor_Publishing.d64
/
shellram.sda
/
C$GETCHAR.A
< prev
next >
Wrap
Text File
|
2023-02-26
|
2KB
|
127 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
;
;
; c$getchar.a
;
; This implements the C library routines
; c$2102, C$1102, c$funct{CBM-@}init and
; c$getchar
;
; They must be in the shell to save
; space. It would be nice to be able to
; link in the versions from the distribution
; library disk, but several problems
; prevent this, so these versions are
; provided here.
;
.ref fstatbl
.ref cgetcnt
.ref cgetlim
;
.ref readst
.ref chrin
.ref chrout
;
.def c$2102
.def c$1102
.def c$funct{CBM-@}init
.def c$getchar
;
.ref cgetcbf ; must be forced above the $1600 to $16ff address page
;
;
; c$2102 - push 0 onto C stack
;
c$2102 lda #0
;
; c$1102 - push a onto C stack
;
c$1102 ldy #0
sta ($1a),y
inc $1a
bne t0090f
inc $1b
t0090f rts
;
; c$funct{CBM-@}init - do c function init
;
c$funct{CBM-@}init lda $1a
bne t0150f
dec $1b
t0150f dec $1a
ldy #$00
lda ($1a),y
tax
rts
;
; c$getchar - do getc for c
;
c$getchar tay
dey
lda fstatbl,y
beq t0100f
sec
rts
t0100f lda $99
beq t0110f
jsr chrin
pha
jsr readst
sta fstatbl,y
pla
clc
rts
t0110f ldx cgetcnt
cpx cgetlim
bne t0140f
sty vcgetfn
tay
t0120b jsr chrin
sta cgetcbf,y
iny
cmp #$0d
bne t0120b
jsr chrout
sty cgetlim
sty cgetcnt
lda cgetcbf
cmp #'.
bne t0130f
lda cgetcbf+1
cmp #$0d
bne t0130f
ldy vcgetfn
lda #$01
sta fstatbl,y
sec
rts
t0130f ldx #0
stx cgetcnt
t0140f lda cgetcbf,x
inc cgetcnt
clc
rts
vcgetfn .bss 1