* OPT l,c,cre,s * File: cit.asm * Tom Dickens 7/23/1995 * Purpose: To demonstrate using the HC11 to read from and * write to an RS-232 device, such as a VT100/CIT device. * * The CIT setup is: B: 0101 0111 0100 0011 0000 T=9600 R=9600 * C: 1000 0001 0000 1010 0001 0 * D: 0010 0010 0011 0 F=0 T=9600 R=9600 * * The terminal device drivers in this file are: * Init_Term: Initialize the UART for 9600 BAUD. * Write_2_Term: Write the byte in register B to the terminal. * Read_Term: Read a byte from the terminal into B. Wait for byte. * ORG $B600 ldx #$1000 ; Always keep X pointing to #$1000!!! bsr Init_Term Top: bsr Read_Term bsr Write_2_Term bsr Write_2_Term bsr Write_2_Term bra Top *======================================================================= * Init_Term: Configure Serial port for pcbug11 communications: *======================================================================= Init_Term: ldx #$1000 clr $04,x inc $04,x clr $2c,x ; Set 8-bits, wake on Idle ldd #$300C ; boot-loader loads #$302c staa $2b,x ; 9600 BAUD stab $2d,x ; No interrupts, enable transmitter and receiver rts *======================================================================= * Write to Term: * Input: ASCII data in the B register. * Action: Wait until transmit buffer is empty, then * transmit the data in the B register. *======================================================================= Write_2_Term: brclr $2e,x %10000000 Write_2_Term ; check Transmit-empty stab $2f,x rts *======================================================================= * Read Term: * Output: ASCII data in the B register. * Action: Wait until a character is available, then return * the data in the B register. *======================================================================= Read_Term: brclr $2e,x %00100000 Read_Term ; check Receive data-empty ldab $2f,x rts