flat assembler
Message board for the users of flat assembler.
Index
> Windows > Apply ascii text numbers without converting to int. |
Author |
|
Roman 17 Oct 2023, 11:52
I want add three ascii numbers.
547+44+325 And I not want converting all this numbers to integer then converting result to ascii |
|||
17 Oct 2023, 11:52 |
|
revolution 17 Oct 2023, 12:23
x86 has two instructions for this. AAA and AAS
|
|||
17 Oct 2023, 12:23 |
|
Furs 17 Oct 2023, 12:54
You're gonna have to code them manually like you would do additions by hand (like in school if you still remember).
|
|||
17 Oct 2023, 12:54 |
|
Roman 17 Oct 2023, 13:26
mov ax,0005h
add ax,0006h ;AX=000Bh aaa ;AX=0101h Only 32 bit, not for 64 bit and apply short numbers only two symbols |
|||
17 Oct 2023, 13:26 |
|
Roman 17 Oct 2023, 15:12
How remove AAA on flag carry?
Code: T1 db "4733" T2 db "7477" Mov eax, dword [T1] And eax, 0x0f0f0f0f Mov ebx, dword [T2] And ebx, 0x0f0f0f0f Add eax, ebx ;shr eax to flag carry |
|||
17 Oct 2023, 15:12 |
|
Roman 17 Oct 2023, 15:37
Code: txt22 db '4322','7829' hah db 32 dup(48),0,0 mov ebx,txt22 mov esi,hah mov ecx,3 .2: mov al,[ebx+ecx] sub al,48 mov dl,[ebx+ecx+4] sub dl,48 add al,dl mov ah,[esi] sub ah,48 aaa add ax,0x3030 mov [esi],ah mov [esi+1],al inc esi ;cmp ah,48 ;jz .3 ;inc esi .3: dec ecx cmp ecx,-1 jnz .2 i get: 12511 must be 12151 |
|||
17 Oct 2023, 15:37 |
|
bitRAKE 17 Oct 2023, 22:10
Raymond Filiatreault has a number (pun intended) of resources - in this instance the BCD intro is quite useful. There is example code and explanations for each of the instructions.
_________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
17 Oct 2023, 22:10 |
|
edfed 18 Oct 2023, 00:00
in x86, decimal operations are made with very basic instructions all named with opcodes starting with A.
A cause it's ascii, but it is decimal. then, since the first 8086 you have what you want |
|||
18 Oct 2023, 00:00 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.