Assembler problem
Name:
Anonymous
2007-12-17 11:24
I started trying to learn assembly yesterday and I've hit a problem. How do you convert integers to string and print them? I've done this.
jmp start;
;/////////////////////////////////
numcounter dw 0;
;/////////////////////////////////
start:
inc numcounter;
mov ah, 09;
mov dx, offset numcounter;
int 21h;
mov dx, 10;
int 21h;
cmp numcounter, 10;
jnz start;
mov ah, 4Ch;
mov al, 00;
int 21h;
and i've also done this to test it out
jmp start;
;/////////////////////////////
printnumber dw 10;
;/////////////////////////////
start:
mov ah, 09;
mov dx, offset printnumber;
int 21h;
mov ah, 4Ch;
mov al, 00;
int 21h;
Name:
Anonymous
2007-12-17 11:37
Ah, "assembly", I see.
Name:
Anonymous
2007-12-17 11:40
>>2
Ah, "Haskell", I see.
Name:
Anonymous
2007-12-17 11:49
Hint: you should be dividing by multiples of 10, to get each digit.
Name:
Anonymous
2007-12-17 11:53
>>3
Ah, ``faggot quotes'', I see.
Name:
Anonymous
2007-12-17 11:54
>>4
Hint: you shouldn't be replying even half-seriously to a moronic post like
>>1.
Name:
Anonymous
2007-12-17 12:05
>>6
Hint: this thread is now about putting things into the template made by combining ``Hint"'' and ``Ah, I see''.
Name:
Anonymous
2007-12-17 15:25
>>7
Ah, ``a hint", I see.
Name:
Anonymous
2007-12-17 15:48
Name:
Anonymous
2007-12-17 15:55
>>9
PROHINT:
jmp >
[code]call/cc[code/]
Name:
Anonymous
2007-12-17 16:00
>>10
Nuh-huh -- Scheme > hax0r code.
Name:
Anonymous
2007-12-17 17:13
>>9
I agree.
jmp <label> should be renamed to
gtfo <label>.
Name:
Anonymous
2007-12-17 17:17
>>12
No, jmp = gb2.
>>10
TIPHINT: jmp = call/cc when appropriate.
Name:
Anonymous
2007-12-17 23:21
>>1
PROTIP: you can call
printf from assembly.
Name:
Anonymous
2007-12-17 23:47
DON'T HELP HIM!
Name:
Anonymous
2007-12-18 0:14
.Wout0 | mov bx 10
.ivloop
div bx | push dx | xor dx dx | inc cx
or ax | jnz .ivloop
.dloop
pop ax | add al 48 | int h29
loop .dloop
learn2stdr
Name:
Anonymous
2007-12-18 0:17
STAX
Name:
Anonymous
2007-12-18 1:34
>>14
Warning: if you do, don't forget to fix up the stack afterwards (add 4*number_of_args to esp)
Name:
Anonymous
2007-12-18 1:40
steps:
remainder 10
add '0'
put register with index of array, insert number
put register with end index of array
reverse
print
Name:
Anonymous
2007-12-18 7:55
lrn2subroutines faggot
itoa:
enter yourvariableshere;
//your code here
leave;
Name:
Anonymous
2007-12-18 8:22
gcc > you
.file "test.c"
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "%u\n"
.text
.globl main
.type main, @function
main:
pushl %ebp
movl %esp, %ebp
pushl %eax
leal -4(%ebp), %eax
pushl %eax
pushl $.LC0
call scanf
pushl -4(%ebp)
pushl $.LC0
call printf
leave
ret
.size main, .-main
.ident "GCC: (GNU) 3.4.6 [FreeBSD] 20060305"
Name:
Anonymous
2007-12-18 18:59
Fatal error! Message could not be posted.
Please post threads less often!
Name:
Anonymous
2009-03-18 2:45
I wants lots and lots of some delectable pot!
Marijuana MUST be legalized.