flat assembler
Message board for the users of flat assembler.
Index
> Main > times vs dup? And ' symbol? |
Author |
|
Roman 20 Jan 2021, 12:02
What is times and dup differents ?
Code: times 16 db 0x0f db 16 dup (0x0f) What is this mean ? Code:
dq 0F0F0F0F'0F0F0F0Fh I am about symbol ' in hex value |
|||
20 Jan 2021, 12:02 |
|
Roman 20 Jan 2021, 15:12
O !
times 2000 nop Do repeat 2000 asm command nop ! As rept 2000 { nop } Some times its usefull. |
|||
20 Jan 2021, 15:12 |
|
Calanor 20 Jan 2021, 15:33
Well, yes, "times" can be useful. I don't know exactly what goes on behind the scenes when it comes to "times" vs "dup", although I presume that using the former to create data would result in longer compilation times than when using the latter.
|
|||
20 Jan 2021, 15:33 |
|
revolution 20 Jan 2021, 22:32
Calanor wrote: ... I presume that using the former to create data would result in longer compilation times than when using the latter. |
|||
20 Jan 2021, 22:32 |
|
Tomasz Grysztar 21 Jan 2021, 09:13
Roman wrote: What is times and dup differents ? Code: buffer db 16 dup 0x0f label buffer:byte times 16 db 0x0f Roman wrote: What is this mean ? |
|||
21 Jan 2021, 09:13 |
|
Roman 21 Jan 2021, 10:09
Thanks Tomasz.
What is this and what is mean ? label buffer:byte I compile this in code. Code: .code: Start: mov eax, buffer label buffer:byte IDA Pro show eax = address buffer Like simple label. Code: .code: Start: mov eax, lb1 lb1: But what magicaly in buffer:byte ? |
|||
21 Jan 2021, 10:09 |
|
Tomasz Grysztar 21 Jan 2021, 10:28
Compare this:
Code: buffer: db 0 mov [buffer],1 ; Error: operand size not specified add [buffer],ax ; add word [buffer],ax Code: buffer db 0 mov [buffer],1 ; mov byte [buffer],1 add [buffer],ax ; Error: operand sizes do not match Code: label buffer mov [buffer],1 ; Error: operand size not specified add [buffer],ax ; add word [buffer],ax Code: label buffer:byte mov [buffer],1 ; mov byte [buffer],1 add [buffer],ax ; Error: operand sizes do not match |
|||
21 Jan 2021, 10:28 |
|
Calanor 21 Jan 2021, 12:49
revolution wrote: Test it. As a side-note, one noteworthy difference between using "times" and "rept" is that "times" won't generate a truckload of lines, while "rept" does. |
|||
21 Jan 2021, 12:49 |
|
revolution 21 Jan 2021, 12:55
Calanor: Good.
BTW: There is also repeat. |
|||
21 Jan 2021, 12:55 |
|
Roman 21 Jan 2021, 14:18
Tomasz.
I try this. Code: mov [.buffer],1 ;this put byte jmp lp1 label .buffer:byte lp1: mov [.buffer],1 ;this put dword label .buffer:dword Its cool ! How change dynamicly from label buffer:dword to label buffer:word ? Code: .data buffer rb 4000 .code mov [buffer],1 mov [buffer+1],2 ;now i want write dword in buffer buffer:dword mov [buffer],1 mov [buffer+4],2 Its be nice and usefull. For fill structs or buffers. |
|||
21 Jan 2021, 14:18 |
|
Roman 25 Jan 2021, 12:13
' and _ not work in float values.
Code: mov dword [val],48_828_125.0 ;error reserved word used as symbol mov dword [val],48_828_125f ;error reserved word used as symbol mov dword [val],48'828'125.0 ;error reserved word used as symbol mov dword [val],48'828'125f ;error reserved word used as symbol |
|||
25 Jan 2021, 12:13 |
|
Tomasz Grysztar 25 Jan 2021, 12:54
They do with fasmg.
|
|||
25 Jan 2021, 12:54 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.