Subversion Repositories pentevo

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1186 savelij 1
        cpu     mico8_v3
2
 
3
; from user's manual
4
 
5
        b _start                ; 0x33001 110011000000000001
6
_start:
7
        nop             ; 0x10000 010000000000000000
8
add:
9
        movi R00,0x55   ; 0x12055 010010000001010101
10
        movi R01,0x05   ; 0x12105 010010000100000101
11
        movi R02,0x03   ; 0x12203 010010001000000011
12
        add R01,R02     ; 0x08110 001000000100010000
13
        addi R01,0x01   ; 0x0A101 001010000100000001
14
        mov R03,R01     ; 0x10308 010000001100001000
15
        mov R04,R02     ; 0x10410 010000010000010000
16
        movi R05,0x35   ; 0x12535 010010010100110101
17
        movi R06,0x43   ; 0x12643 010010011001000011
18
        add R06,R05     ; 0x08628 001000011000101000
19
        addi R06,0x13   ; 0x0A613 001010011000010011
20
        mov R07,R05     ; 0x10728 010000011100101000
21
 
22
; This program will allow user to run a fibonacci number
23
; generator and updown counter. This program responds to
24
; the interrupt from the user (through Orcastra).
25
; When there is an interrupt, the program will halt the current program,
26
; and execute the int_handler function. When the intr_handler function
27
; is done, the program will continue from its last position
28
 
29
        b       int_handler
30
        nop
31
        nop
32
        seti                    ; set the program to be able to receive interrupt
33
        nop
34
        nop
35
        b       start
36
start:
37
        import  r5, 5
38
        mov     r6, r5
39
        andi    r5, 0xf0        ; masking r5 to decide type of program
40
        mov     r7, r5
41
        mov     r5, r6
42
        andi    r5, 0x0f        ; masking r5 to get the speed
43
        mov     r25, r5
44
        cmpi    r7, 0x10
45
        bz      phase2
46
        cmpi    r7, 0x20
47
        bz      phase2
48
        b       start
49
phase2:
50
        cmpi    r25, 0x01
51
        bz      phase3
52
        cmpi    r25, 0x02
53
        bz      phase3
54
        cmpi    r25, 0x03
55
        bz      phase3
56
        cmpi    r25, 0x04
57
        bz      phase3
58
        b       start
59
phase3:
60
        cmpi    r7, 0x10
61
;       bz      fibo
62
        cmpi    r7, 0x20        ; 1 = fibonacci, 2 = counter
63
;       bz      counter
64
        b       start
65
int_handler:
66
        iret
67
 
68
; examples of instruction classes
69
 
70
        add     r15,r23
71
        addi    r2,0x12
72
 
73
        rolc    r10,r5
74
 
75
        clri
76
        setz
77
 
78
        b       $ + 10
79
 
80
        import  r10,21
81
        export  r10,21
82
 
83
; register aliases
84
 
85
myreg1e         equ     r15
86
myreg2e         equ     r14
87
myreg1r         reg     r15
88
myreg2r         reg     r14
89
myreg1re        reg     myreg1e
90
myreg2re        reg     myreg2e
91
 
92
                add     r14,r15
93
                add     myreg2e,myreg1e
94
                add     myreg2re,myreg1r
95
                add     myreg2re,myreg1re
96
 
97
;-----------------------------------------------------
98
; standard Intel/MASM-style pseudo instructions
99
 
100
        dn      8 dup(1,2,3)
101
        db      4 dup(1,2,3)
102
        dw      4 dup(1,2,3)
103
        include "../t_dx/t_dd.inc"
104
        include "../t_dx/t_dq.inc"
105
        include "../t_dx/t_dt.inc"
106
        include "../t_dx/t_do.inc"