;this little program is an example of how to use the "init" type
;of startup program to initialize the baud rate and the other
;related memory locations, so that PAULMON2 will *not* attempt
;to do automatic baud rate detection, even if it configured to
;do automatic baud rate detection by default.  For boards with
;flash rom, this allows the board to used for a dedicated purpose
;without having to do automatic baud rate detection every time
;the power is cycled.  Startup programs other than hardware
;initialization should usually used type 253 instead of 249.

.equ	baud_const, 255		;57600 baud w/ 11.0592 MHz
;.equ   baud_const, 253         ;19200 baud w/ 11.0592 MHz
;.equ   baud_const, 252         ;19200 baud w/ 14.7456 MHz
;.equ   baud_const, 243         ;4808 baud w/ 12 MHz

.equ    locat, 0xFF00     ;Location for this program

.org	locat
.db	0xA5,0xE5,0xE0,0xA5	;signiture bytes
.db	249,255,0,0		;id (35=prog, 249=init, 253=startup, 254=cmd)
.db	0,0,0,0			;prompt code vector
.db	0,0,0,0			;reserved
.db	0,0,0,0			;reserved
.db	0,0,0,0			;reserved
.db	0,0,0,0			;user defined
.db	255,255,255,255		;length and checksum (255=unused)
.db	"Fixed Baud Rate",0
.org	locat+64                ;executable code begins here

	mov	a, #baud_const
	mov     0x7B, a
        mov     0x7A, a         ;store the baud rate for next warm boot.
        mov     0x79, a
        mov     0x78, a
        xrl     0x7A, #01010101b
        xrl     0x79, #11001100b
        xrl     0x78, #00011101b
	ret

