Well, a couple things, looks like you've set the transmit IRQ active. Second, better to explain your output wiring of the RS-232 port, as RTS, CTS, DTR, RxD, etc., rather than T1, R2, etc.. And what are you using to determine that you are transmitting? Case in point, certain control lines for the chip hardware need to be at certain logic states. Usually a null modem connection to another machine's RS-232 port with a terminal program controlling it. This way you can see if you are transmitting. I use ExtraPutty as a terminal program with RTS/CTS handshaking and a 5-wire modem.
As for the code, there's basically 3 needed routines to run the 65C51; An init routine to set the chip up, a receive routine that can poll for a character available and a transmit routine to send a character. The send/receive routines for polled I/O are dirt simple and rely on reading the status register to determine if a character is available to receive or if the transmitter is able to send a character. For example, here's a polled I/O transmit routine:
Code:
CHOUT PHA ;Save ACCUMULATOR on STACK
CHOUTL LDA SIOSTAT ;Read ACIA status register
AND #$10 ;Isolate transmit data register status bit
BEQ CHOUTL ;LOOP back to CHOUTL IF transmit data register is full
PLA ; ELSE, restore ACCUMULATOR from STACK
STA SIODAT ;Write byte to ACIA transmit data register
RTS ;Done CHOUT subroutine, RETURN
To init the 65C51, this is also quite simple:
Code:
INIT_6551
;Init the 65C51
SEI ;Disable Interrupts
LDA #$00 ;Get a zero
STA SIOSTAT ;write to status register, reset 6551
LDA #$1F ;Get Control reg config, 8-bits, 1 stop-bit, 19.2K baud
STA SIOCTL ;Write to the Control Register for 6551
LDA #$0B ;Get Command Reg config, No parity, Rcv mode normal, no Tx/Rx IRQ
STA SIOCMD ;Write to Command Register for 6551
CLI ;Re-enable Interrupts
RTS ;Return to caller
Now, with the latest WDC chip, Xmit is broken, so here's a delay routine you can modify as required:
Code:
; Latest WDC 65C51 has a bug - Xmit bit in status register is stuck on
; IRQ driven transmit is not possible as a result - interrupts are endlessly triggered
; Polled I/O mode also doesn't work as the Xmit bit is polled - delay routine is the only option
; The following delay routine kills time to allow W65C51 to complete a character transmit
; 0.523 milliseconds required loop time for 19,200 baud rate
; Microsecond routine takes 524 clock cycles to complete - X Reg is used for the count loop
; Y Reg is loaded with the CPU clock rate in MHz (whole increments only) and used as a multiplier
;
DELAY_6551 PHY ;Save Y Reg (3 clk cycles)
PHX ;Save X Reg (3 clk cycles)
DELAY_LOOP LDY #10 ;Get delay value (clock rate in MHz 2 clock cycles)
;
MICROSECOND LDX #$68 ;Seed X reg for 1ms (2 clk cycles)
DELAY_1 DEX ;Decrement low index (2 clk cycles)
BNE DELAY_1 ;Loop back until done (3 clk cycles if yes, 2 clock)
;
DEY ;Decrease by one (2 clk cycles)
BNE MICROSECOND ;Loop until done (3 clk cycles if yes, 2 clock)
PLX ;Restore X Reg (4 clk cycles)
PLY ;Restore Y Reg (4 clk cycles)
DELAY_DONE RTS ;Delay done, return (6 clk cycles)
;
To use the delay routine, modify the CHOUT routine as:
Code:
CHOUT PHA ;Save ACCUMULATOR on STACK
;
; Modification below for WDC 6551 chips - Xmit bit stuck on, need delay routine rather than polling - sucks.
;
CHOUTL LDA SIOSTAT ;Read ACIA status register
; AND #$10 ;Isolate transmit data register status bit
; BEQ CHOUTL ;LOOP back to CHOUTL IF transmit data register is full
PLA ;ELSE, restore ACCUMULATOR from STACK
STA SIODAT ;Write byte to ACIA transmit data register
JSR DELAY_6551 ;Required delay - Comment out for working 6551/65C51!
RTS ;Done CHOUT subroutine, RETURN
;
The above code segments will work with a 5-wire null-modem running at 19.2K baud to an async terminal. The delay values are for a 10MHz 65C02 processor and the latest WDC 65C51.
Hope this helps. Also, perhaps a full schematic of you 6551/Max238 interface would be helpful if the above doesn't work for you. Also, here's a link to some basic info on RS-232 null modem configs:
http://www.ethernut.de/en/documents/rs232primer.html