* OPT l,c,cre,s * File: term.asm * Tom Dickens 7/23/1995 * Purpose: To demonstrate using the HC11 to write to an * RS-232 device, such as pcbug11 in 'term' mode, or * a VT100/CIT device. * 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. * ORG $B600 ldaa #%10000000 staa $1004 ldx #$1000 ; Always keep X pointing to #$1000!!! bsr Init_Term Top: bsr Delay_Long ldab #'H bsr Write_2_Term ldab #'e bsr Write_2_Term ldab #'l bsr Write_2_Term bsr Write_2_Term ldab #'o bsr Write_2_Term ldab #' bsr Write_2_Term ldab #'T bsr Write_2_Term ldab #'h bsr Write_2_Term ldab #'e bsr Write_2_Term ldab #'r bsr Write_2_Term ldab #'e bsr Write_2_Term ldab #'! bsr Write_2_Term bsr Write_2_Term bsr Write_2_Term ldab #$0A bsr Write_2_Term ldab #$0D bsr Write_2_Term bra Top *======================================================================= * Delay *======================================================================= Delay: pshx ldx #$0000 LoopX dex bne LoopX pulx rts *======================================================================= * Delay Long *======================================================================= Delay_Long: pshx pshy ldy #$0010 LLoopY ldx #$0000 LLoopX dex bne LLoopX dey bne LLoopY puly pulx rts * *======================================================================= * TERM device driver: *======================================================================= *======================================================================= * Init_Term: Configure Serial port for pcbug11 communications: *======================================================================= Init_Term: ldx #$1000 clr $2c,x ; Set 8-bits, wake on Idle ldd #$3008 ; boot-loader loads #$302c staa $2b,x ; 9600 BAUD stab $2d,x ; No interrupts, enable transmitter 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