add files
[idlebox.git] / write-records.s
blobb8a75adb43ecf506d1bc2932ebef53a0608356d5
1 .include "linux.s"
2 .include "record-def.s"
4 .section .data
6 record1:
7 .ascii "Fredrick\0"
8 .rept 31
9 .byte 0
10 .endr
12 .ascii "Bartlett\0"
13 .rept 31
14 .byte 0
15 .endr
17 .ascii "4242 S Prairie\nTulsa, OK 55555\0"
18 .rept 209
19 .byte 0
20 .endr
22 .long 45
24 record2:
25 .ascii "Marilyn\0"
26 .rept 32
27 .byte 0
28 .endr
30 .ascii "Taylor\0"
31 .rept 33
32 .byte 0
33 .endr
35 .ascii "2224 S Johannan St\nChicago, IL 12345\0"
36 .rept 203
37 .byte 0
38 .endr
40 .long 29
42 record3:
43 .ascii "Derrick\0"
44 .rept 32
45 .byte 0
46 .endr
48 .ascii "McIntire\0"
49 .rept 31
50 .byte 0
51 .endr
53 .ascii "500 W Oakland\nSan Diego, CA 54321\0"
54 .rept 206
55 .byte 0
56 .endr
58 .long 36
60 file_name:
61 .ascii "test.dat\0"
63 .equ ST_FILE_DESCRIPTOR, -4
64 .globl _start
65 _start
66 movl %esp, %ebp
67 subl $4, %esp
68 movl $SYS_OPEN, %eax
69 movl $file_name, %ebx
70 movl $0101, %ecx
71 movl $0666, %edx
72 int $LINUX_SYSCALL
74 movl %eax, ST_FILE_DESCRIPTOR(%ebp)
76 pushl ST_FILE_DESCRIPTOR(%ebp)
77 pushl $record1
78 call write_record
79 addl $8, %esp
81 pushl ST_FILE_DESCRIPTOR(%ebp)
82 pushl $record2
83 call write_record
84 addl $8, %esp
86 pushl ST_FILE_DESCRIPTOR(%ebp)
87 pushl $record3
88 call write_record
89 addl $8, %esp
91 movl $SYS_CLOSE, %eax
92 movl ST_FILE_DESCRIPTOR(%ebp), %ebx
93 int $LINUX_SYSCALL
95 MOVL $SYS_EXIT, %eax
96 movl $0, %ebx
97 int $LINUX_SYSCALL