;This device driver was written by: ; ;Marshall Strouse ; ;Digital Audio Applications Engineer ;Motorola Inc. ; ;Internet: r18081@email.sps.mot.com ; ;This source code is (C) MOTOROLA, INC., 1997 ; ;NOTE: This code maybe freely distributed and used as long as ;consideration is given to its author and Motorola. ; ;NOTE: Your comments, suggestions, and corrections are requested and ;greatly appreciated. ; ;DISCLAIMER: Motorola reserves the right to make changes without ;further notice to any products herein. Motorola makes no warranty, ;representation or guarantee regarding the suitability of its ;products for any particular purpose, nor does Motorola assume any ;liability arising out of the application or use of any product or ;circuit, and specifically disclaims any and all liability, including ;without limitation consequential or incidental damages. "Typical" ;parameters can and do vary in different applications. All operating ;parameters, including "Typicals" must be validated for each customer ;application by customer's technical experts. Motorola does not ;convey any license under its patent rights nor the rights of others. ;Motorola products are not designed, intended, or authorized for use ;as components in systems intended for surgical implant into the ;body, or other applications intended to support or sustain life, or ;for any other application in which the failure of the Motorola ;product could create a situation where personal injury or death may ;occur. Should Buyer purchase or use Motorola products for any such ;unintended or unauthorized application, Buyer shall indemnify and ;hold Motorola and its officers, employees, subsidiaries, affiliates, ;and distributors harmless against all claims, costs, damages, and ;expenses, and reasonable attorney fees arising out of, directly or ;indirectly, any claim of personal injury or death associated with ;such unintended or unauthorized use, even if such claim alleges ;that Motorola was negligent regarding the design or manufacture of ;the part. Motorola is a registered trademark of Motorola, Inc. ;Motorola, Inc. is an Equal Opportunity/Affirmative Action Employer. ; ;Whoa... ; ; ; On-Screen-Display Device Driver for the M68HC11 ; ; by Marshall Strouse Motorola SPS Applications 10/23/96 ; ; Written on a Macintosh using Crossbow M68HC11 cross compiler. ; ; Code was designed to run on an M68HC711E9. Should run on all others. ; ; Please note that this is not the "most excellent" piece of code, ; but it does get the basic idea across. ; ; >>> Basic functions: ; Main: Main entry point for this small demo program. ; Init: Sets up basic BU5963AS parameters. ; Clear: Clears the OSD display field in the OSD device. ; Set_Addr: Sets an address in the BU5963AS (for either control or ; characters). ; Send_Char: Sends a character to the OSD (default here is WHITE). ; Send_Char1: Sends a CLEAR character (will send a char that has no ; color) ; OSD_Comm: Communicates with the BU5963 (bit bangs 16 bits to the ; device) ; Delay: Simple delay routine. ; ; ; ; Port Usage: ; ; Port B Pin Function ; PB7 Serial Data Out ; PB6 Serial Clock Out ; PB5 OSD Chip Select ; PB4 - PB0 Not used ; ; ; regbas EQU $1000 ;default register base address porta EQU $00 pioc EQU $02 portc EQU $03 portb EQU $04 portcl EQU $05 ddrb EQU $06 ddrc EQU $07 portd EQU $08 ddrd EQU $09 porte EQU $0a cforc EQU $0b oc1m EQU $0c oc1d EQU $0d tcnt EQU $0e tic1 EQU $10 tic2 EQU $12 tic3 EQU $14 toc1 EQU $16 toc2 EQU $18 toc3 EQU $1a toc4 EQU $1c ti4o5 EQU $1e tctl1 EQU $20 tctl2 EQU $21 tmsk1 EQU $22 tflg1 EQU $23 tmsk2 EQU $24 tflg2 EQU $25 pactl EQU $26 pacnt EQU $27 spcr EQU $28 spsr EQU $29 spdr EQU $2a baud EQU $2b eprog EQU $2b sccr1 EQU $2c sccr2 EQU $2d scsr EQU $2e scdr EQU $2f adctl EQU $30 adr1 EQU $31 adr2 EQU $32 adr3 EQU $33 adr4 EQU $34 bprot EQU $35 option EQU $39 coprst EQU $3a pprog EQU $3b hprio EQU $3c init EQU $3d test1 EQU $3e config EQU $3f ;*********************************************** org $b600 Main jsr Init ;init the OSD device jsr Clear ;clear out the display field (on reset ;there are junk chars) ; Here we go.... x ldd #146 ;video screen address. jsr Set_Addr ;send the address. ldd #'1' ;get the ascii equiv. of letter "1". jsr Send_Char ;send the character to the OSD device ;(color is white). jsr Delay ;just wait a little. ldd #146 ;video screen address. (note same ;address as above...) jsr Set_Addr ;send the address. ldd #'A' ;get the ascii of letter "A". jsr Send_Char ;send the character to the OSD device ;(color is white). jsr Delay ;just wait a little. jmp x ;lets do it again....how boring. rts ;*************** ; For some of these equates, it would be best to consult with the data sheet! Init ldx #regbas bset portb,x,$20 ;make sure OSD device ~CS is hi ldd #240 ;register base address for OSD device jsr Set_Addr ;set an address ldd #41 ;horizontal offset [xxx00000][00101001] jsr OSD_Comm ;send it to the OSD device ldd #41 ;vertical offset [xxx00000][00101001] jsr OSD_Comm ;send it to the OSD device] ldd #00 ;[xxx00000][00000000] jsr OSD_Comm ldd #193 ;[xxx00000][11000001] jsr OSD_Comm rts ;*************** ; Clear ldd #$0000 jsr Set_Addr ldy #$ef Clear_1 ldd #' ' jsr Send_Char1 ;Hey, we're sending a CLEAR space.... dey ; can you figure an easier way? I can. bne Clear_1 rts ;*************** ; Set_Addr oraa #$20 ;set addressing mode jsr OSD_Comm ;send it to the OSD device rts ;*************** ; Send_Char oraa #$1E ;[00011110] RGB Color is white jsr OSD_Comm rts ;*************** ; Send_Char1 oraa #$10 ;[00010010] RGB color is off (clear) jsr OSD_Comm rts ;*************** ; Just send 16 bits to the device (bit banged for now) OSD_Comm pshy ; ldx #regbas ;get the register base for the HC11 ldy #$10 ;16 bits to send bclr portb,x,$20 data lsrd bcc zero ;taken if we need to send a zero bset portb,x,$80 ;not taken so send one bra toggle ;toggle the clock line zero bclr portb,x,$80 ;send a zero to the OSD device toggle bset portb,x,$40 ;data is latched when clock goes hi bclr portb,x,$40 ;send the clock back low again dey ;y is y-1 bne data ;taken if y is not zero. bset portb,x,$20 puly rts ;exit ;*************** ; Delay ldx #$0006 D_1 ldy #$ffff D_2 dey bne D_2 dex bne D_1 rts ;*************** ; ;End.