home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / cbm / 4556 < prev    next >
Encoding:
Text File  |  1992-11-15  |  2.3 KB  |  69 lines

  1. Newsgroups: comp.sys.cbm
  2. Path: sparky!uunet!utcsri!skule.ecf!torn!watserv2.uwaterloo.ca!watmath!neumann.uwaterloo.ca!csbruce
  3. From: csbruce@neumann.uwaterloo.ca (Craig Bruce)
  4. Subject: Re: Strange bug/problem...
  5. Message-ID: <BxrxHM.EH0@math.uwaterloo.ca>
  6. Originator: csbruce@neumann.uwaterloo.ca
  7. Sender: news@math.uwaterloo.ca (News Owner)
  8. Organization: University of Waterloo, Canada (eh!)
  9. Date: Sun, 15 Nov 1992 20:12:58 GMT
  10. Lines: 57
  11.  
  12. Yo!
  13.  
  14. mcmillan_a@kosmos.wcc.govt.nz (Kirk) writes:
  15.  
  16. >Help! Does anyone know why the following program does NOT work properly on a
  17. >C-128, but is fine on a C-64 or Plus/4? (All using the same 1571 disk drive.)
  18. >
  19. >I have condensed it to a minimum as a demonstration... it should just copy
  20. >the file "source" to "newfile".
  21. >[...]
  22.  
  23. I have encountered this problem too.  Your code is a bit messy.  The way that
  24. CHKIN and CHKOUT work is that you call them ONCE to set up the input and
  25. output channels, then copy your data, and then tear down the connection with
  26. CLRCHN.  However, you will run into problems if you have a CHKIN and a CHKOUT
  27. to devices on the serial bus at the same time.  What should theoretically
  28. happen is that when you do the GETIN, the device that has been commanded
  29. to listen (CHKIN and CHKOUT are equivalent to TALK and LISTN for serial
  30. devices) should catch the byte as the talker puts the byte on the serial
  31. bus - without you doing a BSOUT.  However, it has been my experience that
  32. this situation causes the listening device to stop paying attention.  This
  33. may be a side-effect of using the fast serial protocol.
  34.  
  35. Anyway, to make a short story longer, you have to change your code to the
  36. following:
  37.  
  38. loop:    ldx #5
  39.     jsr CHKIN
  40.     jsr GETIN
  41.     pha
  42.     ldx $90
  43.     stx tempst
  44.     jsr CLRCHN
  45.     ldx #6
  46.     jsr CHKOUT
  47.     pla
  48.     jsr BSOUT
  49.     jsr CLRCHN
  50.     lda tempst
  51.     and #$40
  52.     beq loop
  53.     rts
  54.  
  55. This does a clear channel for every CHKIN and CHKOUT.  This will be fairly
  56. slow since instead of two serial bytes you end up sending six (LISTN, SECOND,
  57. TALK, TKSA) for each byte transferred.  You could modify the above code to
  58. transfer multiple bytes (say, up to 250) while a channel is established for
  59. reading or for writing.  This is what ACE-128/64, ZED-128, and Little Red
  60. Reader-128 do.
  61.  
  62. What kind of a program is this section of code going into?
  63.  
  64. Keep on Hackin'!
  65.  
  66. -Craig Bruce
  67. csbruce@neumann.uwaterloo.ca
  68. "Smarter than a speeding bullet!"
  69.