//---------------------------------------------------------------- // mynumio.s // // This program is just for testing the conversion routines. // // assemble using: as mynumio.s -o mynumio.o // link using: ld mynumio.o asc2int.o int2asc.o -o mynumio // // programmer: ALLAN CRUSE // written on: 14 OCT 2003 //---------------------------------------------------------------- .data prompt: .ascii "\nPlease type a number on the line below: \n\n" prmtsz: .int . - prompt outmsg: .ascii "\nok, twice that number equals " outbuf: .zero 12 .ascii "\n\n" outsz: .int . - outmsg number: .int 0 inbuf: .space 12 .text _start: movl $4, %eax # sys_write movl $1, %ebx # stdout movl $prompt, %ecx # string-address movl prmtsz, %edx # string-length int $0x80 # kernel-call movl $3, %eax # sys_read movl $0, %ebx # stdin movl $inbuf, %ecx # buffer-address movl $12, %edx # buffer-length int $0x80 # kernel-call movl $inbuf, %esi # string-address call ascii_to_int # convert to number movl %eax, number # store the number movl $2, %eax # setup muliplier mull number # times multiplicand movl $outbuf, %edi # buffer-address call int_to_ascii # convert to string movl $4, %eax # sys_write movl $1, %ebx # stdout movl $outmsg, %ecx # string-address movl outsz, %edx # string-length int $0x80 # kernel-call movl $1, %eax # sys_exit movl $0, %ebx # return-code int $0x80 # kernel-call .globl _start