From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-04-12 22:28:56
Hi! On Sat, Apr 12, 2003 at 12:04:46PM -0500, Robert Steinmetz wrote: > > 1. Would it make sense to support more than one serial port? > > > Yes Apple //c and //gs have 2 ports. Ok, so to make this more concrete: Adding multiple ports would add about 25 + 20 + 2*6 + 2*x = 57 + 2*x cyles to the call of the most important rs232_get and rs232_put routines. x is the number of cycles needed to load the port number, this would be 2 for a constant and 7 for an auto variable. So the minumum additional overhead is 61 cycles per call. This assumes that the port number is passed as a parameter to the rs232_get and rs232_put functions. There are other solutions (like separate functions), but they are ugly. Add to this the overhead in the driver, which must evaluate the port number and switch to the respective buffer. Since even drivers without multiple ports will have this overhead, the question is, if the overhead is acceptable. Assuming a C64 with a 1MHz CPU, 38400 baud and no hardware buffer in the UART (popular case: 6551), interrupts are occuring all 260us. The interrupt handler needs about 135 cycles with no special cases. This leaves about 125 cycles for the CPU to handle the incoming byte. The call to rs232_get is currently 79 cycles plus the overhead for loading the pointer and checking the return code, so a C64 is currently capable of doing 38400 baud, provided that it just checks for a special byte or places incoming bytes into another buffer. With the additional overhead introduced by adding multiple ports, a C64 would no longer be able to handle 38400 baud, even if it does not more than just droping the received data. Of course some cycles could be gained by redoing the API. For example, I can introduce a new function that returns the number of characters in the receive buffer, and the rs232_get function could pass the character from the buffer back as return value. But I doubt that this will save more than 10 or 20 cycles. Since using a 6551 and a CPU with 1MHz is rather common in the 6502 world, the question is: Do we prefer support for more than one serial port over support for higher serial speeds? Regards Uz -- Ullrich von Bassewitz uz_at_musoftware.de ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2003-04-12 22:29:20 CEST