#include "mc32p7212.inc"
TIMEOUT1  equ     0x10
TIMEOUT2  equ     0x11

        org     0x00
        goto    start
        org     0x08
inte:   
        NOP 
        goto    inte   
       
start:  
        ;fill    0x00,0xe8 
        ;call   option
        call    io_int
        comr    IOP1
        movai   0x01
        movra   OSCM     
        call    LCD_set
        comr    IOP1
        
lcd_loop:   
        movai   0x0b;0
        movra   LCDDS4
        movai   0x0f;0
        movra   LCDDS5  
        comr    IOP1       
        call    delay           
        call    delay
        call    delay           
        call    delay 
        movai   0x00;1
        movra   LCDDS4
        movai   0x06;1
        movra   LCDDS5 
        comr    IOP1        
        call    delay           
        call    delay
        call    delay           
        call    delay 
        movai   0x07;2
        movra   LCDDS4
        movai   0x0c;2
        movra   LCDDS5  
        comr    IOP1       
        call    delay           
        call    delay
        call    delay           
        call    delay 
        movai   0x05;3
        movra   LCDDS4
        movai   0x0e;3
        movra   LCDDS5  
        comr    IOP1       
        call    delay           
        call    delay
        call    delay           
        call    delay       
        movai   0x0c;4
        movra   LCDDS4
        movai   0x06;4
        movra   LCDDS5   
        comr    IOP1      
        call    delay           
        call    delay
        call    delay           
        call    delay  
        movai   0x0d;5
        movra   LCDDS4
        movai   0x0a;5
        movra   LCDDS5  
        comr    IOP1       
        call    delay           
        call    delay
        call    delay           
        call    delay 
        movai   0x0f;6
        movra   LCDDS4
        movai   0x0a;6
        movra   LCDDS5  
        comr    IOP1       
        call    delay           
        call    delay
        call    delay           
        call    delay 
        movai   0x00;7
        movra   LCDDS4
        movai   0x0e;7
        movra   LCDDS5   
        comr    IOP1      
        call    delay           
        call    delay
        call    delay           
        call    delay 
        movai   0x0f;8
        movra   LCDDS4
        movai   0x0f;8
        movra   LCDDS5   
        comr    IOP1      
        call    delay           
        call    delay
        call    delay           
        call    delay 
        movai   0x0d;9
        movra   LCDDS4
        movai   0x0f;9
        movra   LCDDS5   
        comr    IOP1      
        call    delay           
        call    delay
        call    delay           
        call    delay 
     
        ;STOP
        goto    lcd_loop
        
lab_loop:
        movai   0xff ;as output 
        movra   OEP1
        comr    IOP1
        goto    lab_loop

io_int:  
        movai   0x00 ;as input 
        movra   OEP0
        movai   0xff ;as output 
        movra   OEP1
        movai   0xff ;as pull up 
        movra   PUP0
        movra   PUP1
        return     
LCD_set:    
        movai   0xff   
        movai   0xfd   
        movai       0xe1
        movra   LCDCR0    
        movai   0xff   
        movai   0x02
        movra   LCDCR1
        
       
        bset   LCDCR0,7 ;LCDEN
        
        return
       
delay:   
        movai   0xff
        movra   TIMEOUT1
        movai   0xff
        movra   TIMEOUT2
         djzr    TIMEOUT2
        goto    $-1
        djzr    TIMEOUT1
        goto    $-4
        return

        org 0x0ff6
inte1:          
        NOP 
        goto    inte1         
        END
