You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

openchannel 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. .PAG 'OPEN CHANNEL'
  2. ;***************************************
  3. ;* CHKIN -- OPEN CHANNEL FOR INPUT *
  4. ;* *
  5. ;* THE NUMBER OF THE LOGICAL FILE TO BE*
  6. ;* OPENED FOR INPUT IS PASSED IN .X. *
  7. ;* CHKIN SEARCHES THE LOGICAL FILE *
  8. ;* TO LOOK UP DEVICE AND COMMAND INFO. *
  9. ;* ERRORS ARE REPORTED IF THE DEVICE *
  10. ;* WAS NOT OPENED FOR INPUT ,(E.G. *
  11. ;* CASSETTE WRITE FILE), OR THE LOGICAL*
  12. ;* FILE HAS NO REFERENCE IN THE TABLES.*
  13. ;* DEVICE 0, (KEYBOARD), AND DEVICE 3 *
  14. ;* (SCREEN), REQUIRE NO TABLE ENTRIES *
  15. ;* AND ARE HANDLED SEPARATE. *
  16. ;***************************************
  17. ;
  18. NCHKIN JSR LOOKUP ;SEE IF FILE KNOWN
  19. BEQ JX310 ;YUP...
  20. ;
  21. JMP ERROR3 ;NO...FILE NOT OPEN
  22. ;
  23. JX310 JSR JZ100 ;EXTRACT FILE INFO
  24. ;
  25. LDA FA
  26. BEQ JX320 ;IS KEYBOARD...DONE.
  27. ;
  28. ;COULD BE SCREEN, KEYBOARD, OR SERIAL
  29. ;
  30. CMP #3
  31. BEQ JX320 ;IS SCREEN...DONE.
  32. BCS JX330 ;IS SERIAL...ADDRESS IT
  33. CMP #2 ;RS232?
  34. BNE JX315 ;NO...
  35. ;
  36. JMP CKI232
  37. ;
  38. ;SOME EXTRA CHECKS FOR TAPE
  39. ;
  40. JX315 LDX SA
  41. CPX #$60 ;IS COMMAND A READ?
  42. BEQ JX320 ;YES...O.K....DONE
  43. ;
  44. JMP ERROR6 ;NOT INPUT FILE
  45. ;
  46. JX320 STA DFLTN ;ALL INPUT COME FROM HERE
  47. ;
  48. CLC ;GOOD EXIT
  49. RTS
  50. ;
  51. ;AN SERIAL DEVICE HAS TO BE A TALKER
  52. ;
  53. JX330 TAX ;DEVICE # FOR DFLTO
  54. JSR TALK ;TELL HIM TO TALK
  55. ;
  56. LDA SA ;A SECOND?
  57. BPL JX340 ;YES...SEND IT
  58. JSR TKATN ;NO...LET GO
  59. JMP JX350
  60. ;
  61. JX340 JSR TKSA ;SEND SECOND
  62. ;
  63. JX350 TXA
  64. BIT STATUS ;DID HE LISTEN?
  65. BPL JX320 ;YES
  66. ;
  67. JMP ERROR5 ;DEVICE NOT PRESENT
  68. .PAG 'OPEN CHANNEL OUT'
  69. ;***************************************
  70. ;* CHKOUT -- OPEN CHANNEL FOR OUTPUT *
  71. ;* *
  72. ;* THE NUMBER OF THE LOGICAL FILE TO BE*
  73. ;* OPENED FOR OUTPUT IS PASSED IN .X. *
  74. ;* CHKOUT SEARCHES THE LOGICAL FILE *
  75. ;* TO LOOK UP DEVICE AND COMMAND INFO. *
  76. ;* ERRORS ARE REPORTED IF THE DEVICE *
  77. ;* WAS NOT OPENED FOR INPUT ,(E.G. *
  78. ;* KEYBOARD), OR THE LOGICAL FILE HAS *
  79. ;* REFERENCE IN THE TABLES. *
  80. ;* DEVICE 0, (KEYBOARD), AND DEVICE 3 *
  81. ;* (SCREEN), REQUIRE NO TABLE ENTRIES *
  82. ;* AND ARE HANDLED SEPARATE. *
  83. ;***************************************
  84. ;
  85. NCKOUT JSR LOOKUP ;IS FILE IN TABLE?
  86. BEQ CK5 ;YES...
  87. ;
  88. JMP ERROR3 ;NO...FILE NOT OPEN
  89. ;
  90. CK5 JSR JZ100 ;EXTRACT TABLE INFO
  91. ;
  92. LDA FA ;IS IT KEYBOARD?
  93. BNE CK10 ;NO...SOMETHING ELSE.
  94. ;
  95. CK20 JMP ERROR7 ;YES...NOT OUTPUT FILE
  96. ;
  97. ;COULD BE SCREEN,SERIAL,OR TAPES
  98. ;
  99. CK10 CMP #3
  100. BEQ CK30 ;IS SCREEN...DONE
  101. BCS CK40 ;IS SERIAL...ADDRESS IT
  102. CMP #2 ;RS232?
  103. BNE CK15
  104. ;
  105. JMP CKO232
  106. ;
  107. ;
  108. ;SPECIAL TAPE CHANNEL HANDLING
  109. ;
  110. CK15 LDX SA
  111. CPX #$60 ;IS COMMAND READ?
  112. BEQ CK20 ;YES...ERROR
  113. ;
  114. CK30 STA DFLTO ;ALL OUTPUT GOES HERE
  115. ;
  116. CLC ;GOOD EXIT
  117. RTS
  118. ;
  119. CK40 TAX ;SAVE DEVICE FOR DFLTO
  120. JSR LISTN ;TELL HIM TO LISTEN
  121. ;
  122. LDA SA ;IS THERE A SECOND?
  123. BPL CK50 ;YES...
  124. ;
  125. JSR SCATN ;NO...RELEASE LINES
  126. BNE CK60 ;BRANCH ALWAYS
  127. ;
  128. CK50 JSR SECND ;SEND SECOND...
  129. ;
  130. CK60 TXA
  131. BIT STATUS ;DID HE LISTEN?
  132. BPL CK30 ;YES...FINISH UP
  133. ;
  134. JMP ERROR5 ;NO...DEVICE NOT PRESENT
  135. .END