printing - Print Register in Assembly x86 -
followed couple of online documents , yet when try print number have stored in register %ecx nothing happens. because i'm performing calculations , trying print while in loop?
mov $48, %ecx #convert ascii mov $1, %edx #print byte add %eax, %ecx mov $4, %eax #output console mov $1, %ebx #file descriptor - standardout int $0x80 #call kernel
the write system call expects pointer data printed. far can tell, have single digit. can temporarily store on stack printing follows:
mov $48, %ecx #convert ascii mov $1, %edx #print byte add %eax, %ecx push %ecx # store on stack mov %esp, %ecx # load address mov $4, %eax # output console mov $1, %ebx # file descriptor - standardout int $0x80 # call kernel pop %ecx # clean stack remember need better conversion routine multi-digit numbers.
Comments
Post a Comment