home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.cbm
- Path: sparky!uunet!utcsri!skule.ecf!torn!watserv2.uwaterloo.ca!watmath!neumann.uwaterloo.ca!csbruce
- From: csbruce@neumann.uwaterloo.ca (Craig Bruce)
- Subject: Re: Strange bug/problem...
- Message-ID: <BxrxHM.EH0@math.uwaterloo.ca>
- Originator: csbruce@neumann.uwaterloo.ca
- Sender: news@math.uwaterloo.ca (News Owner)
- Organization: University of Waterloo, Canada (eh!)
- Date: Sun, 15 Nov 1992 20:12:58 GMT
- Lines: 57
-
- Yo!
-
- mcmillan_a@kosmos.wcc.govt.nz (Kirk) writes:
-
- >Help! Does anyone know why the following program does NOT work properly on a
- >C-128, but is fine on a C-64 or Plus/4? (All using the same 1571 disk drive.)
- >
- >I have condensed it to a minimum as a demonstration... it should just copy
- >the file "source" to "newfile".
- >[...]
-
- I have encountered this problem too. Your code is a bit messy. The way that
- CHKIN and CHKOUT work is that you call them ONCE to set up the input and
- output channels, then copy your data, and then tear down the connection with
- CLRCHN. However, you will run into problems if you have a CHKIN and a CHKOUT
- to devices on the serial bus at the same time. What should theoretically
- happen is that when you do the GETIN, the device that has been commanded
- to listen (CHKIN and CHKOUT are equivalent to TALK and LISTN for serial
- devices) should catch the byte as the talker puts the byte on the serial
- bus - without you doing a BSOUT. However, it has been my experience that
- this situation causes the listening device to stop paying attention. This
- may be a side-effect of using the fast serial protocol.
-
- Anyway, to make a short story longer, you have to change your code to the
- following:
-
- loop: ldx #5
- jsr CHKIN
- jsr GETIN
- pha
- ldx $90
- stx tempst
- jsr CLRCHN
- ldx #6
- jsr CHKOUT
- pla
- jsr BSOUT
- jsr CLRCHN
- lda tempst
- and #$40
- beq loop
- rts
-
- This does a clear channel for every CHKIN and CHKOUT. This will be fairly
- slow since instead of two serial bytes you end up sending six (LISTN, SECOND,
- TALK, TKSA) for each byte transferred. You could modify the above code to
- transfer multiple bytes (say, up to 250) while a channel is established for
- reading or for writing. This is what ACE-128/64, ZED-128, and Little Red
- Reader-128 do.
-
- What kind of a program is this section of code going into?
-
- Keep on Hackin'!
-
- -Craig Bruce
- csbruce@neumann.uwaterloo.ca
- "Smarter than a speeding bullet!"
-