//
// stupid copy util by madcr
//

.global _start
_start:
.text
        movb $5,%al      # openS
        movl $m1,%ebx    # filename
        movw $0xc02,%cx  # mode
        int  $128

        movl %eax,%ebx   # descriptor
        movb $19,%al     # lseekS
        movw $5,%cx      # size
        movb $1,%dl      # position , where 0 = from current position
                                          # 1 = from start
                                          # 2 = from end (in %ecx $-x)
        int  $128

        movb $3,%al      # readS
        movl $m2,%ecx    # buffer
        movl $13,%edx    # size
        int $0x80

# creat new file and write old data

        movb $8,%al      # creatS
        movl $m3,%ebx    # filename
        movb $0,%cl      # attribute
        int $128

        movl %eax,%ebx   # descriptor
        movb $4,%al      # write
        movl $m2,%ecx    # address text
        movb $13,%dl     # size
        int $128

        movb $1,%al      # exit
        int $128
.data
m1: .string "a"
m3: .string "b"
m2: .byte 0
