|
Post by stiggity on Oct 16, 2022 2:27:39 GMT
I really hope somebody can lend me a helping hand... Wendling!!!? are you around?? anyone?? Well, I'm trying to convert a c64 routine, into something for the 128! It doesn't seem that hard, and I'd like to know how to properly execute the code.. Here's what it looks like .. RS232ENB = $02A1 ;RS232 ENABLE=128, DISABLE=255 RESET JSR SETUP <== this routine is already working, and posting all of it will probably make things worse. LDA RS232ENB CMP #$80 BEQ RESET CMP #$92 BEQ RESET RTS I want to know how to LDA RS232ENB, which in 128 land is this ==> rs232enb = $0a0f
|
|
|
Post by c128old on Oct 16, 2022 11:19:37 GMT
Comparing the C64 reference guide and MappingC128 (I'm sure you went there before but just to put things in context and allow readers to think along): C64: $02A1 - ENABL - Holds current active interrupts in the CIA #2 ICR. Bit 4 on means waiting for Receiver Edge. Bit 1 turned on then system is receiving, bit 0 turned on then transmitting. MappingC128: Content of DD0D... Bit Interrupt source RS-232 activity 0 Timer A bits being transmitted 1 Timer B bits being received 4 FLAG line waiting for start bit to be received I assume the implementation is (also meant to be) behaving the same.
After your SETUP (I assume this is to set up device 2), you are checking for $80, bit 7 set as well as bit 0-6 clear. Bit7 on DD0D is listed as NMI Flag (1 = NMI Occurred), while bit 4 (pending) and 3 (interrupt) and Send/Recv (1 and 0) are asked zero. This (c64) code apparently loops SETUP-calls until an NMI occurred. Note 'mapping128' does not describe how bit7 shall behave (it does say that any of bit 0 1 or 4 being set means the soft-RS232 system is enabled) The next check for #$92 checks bit7 AND bit4 AND bit1 (7 = NMI happened, 4 = FLAG-input received, 1 = TimerB = being received) This suggests the loop is waiting for data to come in (is it?) but and expects NMI-occurred to be found high. My best guess is that 1 difference C64-C128 would be that 'NMI occurred' is not guaranteed to be high after data coming in because the IRQ system on C128 runs off the VIC and not the CIA. So the NMI could have been acknowledged before you get a chance to see it.
Perhaps one thing you might try here is to 'wait for bit4 to go high' as a sign that data was received.
Though I don't see why one would loop in this 'RESET' routine if NMI is reporting 'High' (the test for only-bit7), I would imagine the test for bit4-and-bit1 could be an 'AND' rather than a 'CMP', so as to make sure you do not rely on bit7 to be high.
I may be completely off with my thinking. Maybe the routine merely wants to wait for a RESET to return 'all done and no transmission anymore'
Note that the Basic Example listed in the C64 manual does not suggest to test bit7, nor does the description of RS232ENB, thus it would help to know the intent of the c64 program (or at least the desired post-condition of this piece of code)
|
|
|
Post by stiggity on Oct 16, 2022 16:26:41 GMT
Yeah, after reading most of that in mapping the 128, i didnt know if I could just LDA RS232ENB, or if i'd need to set that up for a read by $ff74, or can simply LDA RS232ENB work on the 128 like it does on the c64?
>> Maybe the routine merely wants to wait for a RESET to return 'all done and no transmission anymore'
I believe that's it's intention..
How could I duplicate the c64 call, to work with the c128?
-Thanks
|
|
|
Post by stiggity on Oct 20, 2022 3:21:53 GMT
srry!!!! d'Oh!!! i figured it out...
"c128old" - Thank you for the assistance with the routine, and the explanation of what it does... i got it working.. with my limited knowledge..
|
|