~manxi-david/pyeffect/pyeffect

« back to all changes in this revision

Viewing changes to src/Examples/sub.s

  • Committer: dvspeed
  • Date: 2011-12-26 13:18:36 UTC
  • Revision ID: manxi.david@gmail.com-20111226131836-mvoy9y32z0ujxvm1
-Change of folder

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.section .data
 
2
Bytestring00:
 
3
        .byte   0
 
4
Bytestring11:
 
5
        .byte   0
 
6
Bytestring22:
 
7
        .byte   0
 
8
Bytestring33:
 
9
        .byte   0
 
10
Bytestring44:
 
11
        .byte   0
 
12
Bytestring55:
 
13
        .byte   0
 
14
Bytestring66:
 
15
        .byte   0
 
16
Bytestring77:
 
17
        .byte   0
 
18
Bytestring88:
 
19
        .byte   0
 
20
Bytestring99:
 
21
        .byte   0
 
22
Bytestring1010:
 
23
        .byte   0
 
24
Byte0:
 
25
        .byte   15
 
26
Byte1:
 
27
        .byte   0
 
28
Byte2:
 
29
        .byte   0
 
30
Byte3:
 
31
        .byte   0
 
32
Byte4:
 
33
        .byte   0
 
34
Byte5:
 
35
        .byte   0
 
36
Byte6:
 
37
        .byte   0
 
38
Byte7:
 
39
        .byte   0
 
40
Byte8:
 
41
        .byte   0
 
42
Byte9:
 
43
        .byte   0
 
44
Byte10:
 
45
        .byte   0
 
46
Byte11:
 
47
        .byte   0
 
48
Byte12:
 
49
        .byte   0
 
50
Byte13:
 
51
        .byte   0
 
52
Byte14:
 
53
        .byte   0
 
54
Byte15:
 
55
        .byte   0
 
56
Byte16:
 
57
        .byte   20
 
58
Byte17:
 
59
        .byte   0
 
60
Byte18:
 
61
        .byte   0
 
62
Byte19:
 
63
        .byte   0
 
64
Byte20:
 
65
        .byte   0
 
66
Byte21:
 
67
        .byte   0
 
68
Byte22:
 
69
        .byte   0
 
70
Byte23:
 
71
        .byte   0
 
72
.section .text
 
73
.globl _start
 
74
_start:
 
75
#Begin of program:
 
76
        #       y=20
 
77
        #       z=15
 
78
        #       x=z-y
 
79
        #z - y
 
80
        movq    Byte0,  %rdi
 
81
        movq    %rdi,   Byte8
 
82
        movq    Byte8,  %rdi
 
83
        movq    %rdi,   Byte8
 
84
        movq    Byte16, %rdi
 
85
        subq    %rdi,   Byte8
 
86
        #       print(x)
 
87
        movq    Byte8,  %rax
 
88
        movb    $10,    Bytestring1010
 
89
        movq    $Bytestring99,  %rdi
 
90
        movq    $Bytestring1010,        %rsi
 
91
        loop_x_0:
 
92
        movq    $10,    Byte0
 
93
        xorq    %rdx,   %rdx
 
94
        divq    Byte0
 
95
        addq    $48,    %rdx
 
96
        movb    %dl,    (%rdi)
 
97
        decq    %rdi
 
98
        cmpq    $0,     %rax
 
99
        jne loop_x_0
 
100
        subq    %rdi,   %rsi
 
101
        movq    %rsi,   %rdx
 
102
        incq    %rdi
 
103
        movq    $1,     %rax
 
104
        movq    %rdi,   %rsi
 
105
        movq    $1,     %rdi
 
106
        syscall
 
107
        #       exit(x)
 
108
        movq    $60,    %rax
 
109
        movq    Byte8,  %rdi
 
110
        syscall
 
111
#End of program