home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_27_1988_Transactor_Publishing.d64 / shellram.sda / C$GETCHAR.A < prev    next >
Text File  |  2023-02-26  |  2KB  |  127 lines

  1. ;
  2. ; shellram
  3. ;
  4. ;  By: Adrian Pepper
  5. ;      Toronto, Ontario
  6. ;
  7. ;  based on, but heavily modified from
  8. ;  the Pro-Line/Spinnaker
  9. ;    C POWER/POWER C shell for the
  10. ;  Commodore 64 home computer.
  11. ;
  12. ;  The shell was modified to reduce
  13. ;  the size of the code, and arrange
  14. ;  things so memory page 22 (hex $16)
  15. ;  will be free for use as a "RAMdisk
  16. ;  Interface Page", for use with the
  17. ;  Commodore 1764 256K RAM expander
  18. ;  for the Commodore 64
  19. ;
  20. ;  This (basically) allows all programs
  21. ;  designed to run under the shell to
  22. ;  operate with the RAM disk
  23. ;
  24. ;
  25. ; c$getchar.a
  26. ;
  27. ;  This implements the C library routines
  28. ; c$2102, C$1102, c$funct{CBM-@}init and
  29. ; c$getchar
  30. ;
  31. ;  They must be in the shell to save
  32. ; space.  It would be nice to be able to
  33. ; link in the versions from the distribution
  34. ; library disk, but several problems
  35. ; prevent this, so these versions are
  36. ; provided here.
  37. ;
  38.  .ref fstatbl
  39.  .ref cgetcnt
  40.  .ref cgetlim
  41. ;
  42.  .ref readst
  43.  .ref chrin
  44.  .ref chrout
  45.  .def c$2102
  46.  .def c$1102
  47.  .def c$funct{CBM-@}init
  48.  .def c$getchar
  49. ;
  50.  .ref cgetcbf  ; must be forced above the $1600 to $16ff address page
  51. ;
  52. ;
  53. ; c$2102 - push 0 onto C stack
  54. c$2102 lda #0
  55. ;
  56. ; c$1102 - push a onto C stack
  57. ;
  58. c$1102 ldy #0
  59.  sta ($1a),y
  60.  inc $1a
  61.  bne t0090f
  62.  inc $1b
  63. t0090f rts
  64. ;
  65.  
  66. ; c$funct{CBM-@}init - do c function init
  67. ;
  68. c$funct{CBM-@}init lda  $1a
  69.  bne t0150f
  70.  dec $1b
  71. t0150f dec $1a
  72.  ldy #$00
  73.  lda ($1a),y
  74.  tax
  75.  rts
  76. ;
  77. ; c$getchar - do getc for c
  78. ;
  79. c$getchar tay
  80.  dey
  81.  lda fstatbl,y
  82.  beq t0100f
  83.  sec
  84.  rts
  85. t0100f lda  $99
  86.  beq t0110f
  87.  jsr chrin
  88.  pha
  89.  jsr readst
  90.  sta fstatbl,y
  91.  pla
  92.  clc
  93.  rts
  94. t0110f ldx cgetcnt
  95.  cpx cgetlim
  96.  bne t0140f
  97.  sty vcgetfn
  98.  tay
  99. t0120b jsr chrin
  100.  sta cgetcbf,y
  101.  iny
  102.  cmp #$0d
  103.  bne t0120b
  104.  jsr chrout
  105.  sty cgetlim
  106.  sty cgetcnt
  107.  lda cgetcbf
  108.  cmp #'.
  109.  bne t0130f
  110.  lda cgetcbf+1
  111.  cmp #$0d
  112.  bne t0130f
  113.  ldy vcgetfn
  114.  lda #$01
  115.  sta fstatbl,y
  116.  sec
  117.  rts
  118. t0130f ldx #0
  119.  stx cgetcnt
  120. t0140f lda cgetcbf,x
  121.  inc cgetcnt
  122.  clc
  123.  rts
  124. vcgetfn .bss 1
  125.