flat assembler
Message board for the users of flat assembler.

Index > Main > Anonymous labels not enough, need anonymous OPCODES

Goto page Previous  1, 2, 3, 4
Author
Thread Post new topic Reply to topic
xRagDiscretePulsar



Joined: 12 Nov 2022
Posts: 3
xRagDiscretePulsar 12 Nov 2022, 22:30
r22 wrote:
Anonymous labels don't add anything to the syntax.

They don't have to add anything to the syntax. They are needed in order to simply jump through the string line, or other reserved bytes:
Code:
jmp @f
someStr db "Hello World!",0h
@@:    

r22 wrote:
They promote spaghetti code

This is what assembler started with. And that's where he should stay. I am in favor of not even using labels, local labels and anonymous labels, but simply measuring relative to addresses.

I approve only:
    - Assign byte(s) to symbol (the number of bytes in a symbol must be revealed);
    - Assign symbols to symbol (the number of bytes in a symbol must be revealed);
    - The symbol can have variables;
    - The symbol in any time can be redefined (but it should not correct the previous assignations, unless a special flag is set for that);
    - The possibility to comments.

If you don't like thinking like a processor, go for a high-level language. Don't corrupt the cybernetic paradigms.

r22 wrote:
ASM like everything else that's useful needs a STANDARD way of doing things.

"Standard way of doing things" are the business of network transmissions. Assembler is the right to assemble the bytes however you like.

r22 wrote:
but one old fool in the 1960's thought 'well I don't like typing label names lets use @ signs'

The only fool here is your kind, who do not know with what approach computers were conceptualized.
Post 12 Nov 2022, 22:30
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 676
Location: Russia
macomics 13 Nov 2022, 03:03
You're 15 years late with the answer!
Post 13 Nov 2022, 03:03
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18963
Location: In your JS exploiting you and your system
revolution 13 Nov 2022, 05:43
xRagDiscretePulsar wrote:
r22 wrote:
Anonymous labels don't add anything to the syntax.

They don't have to add anything to the syntax. They are needed in order to simply jump through the string line, or other reserved bytes:
Code:
jmp @f
someStr db "Hello World!",0h
@@:    
Just to be clear, they aren't needed, there are alternative methods with named labels. You can choose to use them if you want to, but you don't need to use them if you don't want to.
Post 13 Nov 2022, 05:43
View user's profile Send private message Visit poster's website Reply with quote
xRagDiscretePulsar



Joined: 12 Nov 2022
Posts: 3
xRagDiscretePulsar 14 Nov 2022, 13:38
revolution wrote:
Just to be clear, they aren't needed, there are alternative methods with named labels. You can choose to use them if you want to, but you don't need to use them if you don't want to.

I wanted to say, but didn't say the most important thing in all of this, that anonymous labels allow you to reserve the names for more significant labels.
Post 14 Nov 2022, 13:38
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18963
Location: In your JS exploiting you and your system
revolution 14 Nov 2022, 13:45
xRagDiscretePulsar wrote:
I wanted to say, but didn't say the most important thing in all of this, that anonymous labels allow you to reserve the names for more significant labels.
Label names are not limited. There really isn't any need to be frugal with them. You can use any random name without restriction.
Code:
jmp .string_skip_1
someStr db "Hello World!",0h
.string_skip_1:     
Post 14 Nov 2022, 13:45
View user's profile Send private message Visit poster's website Reply with quote
xRagDiscretePulsar



Joined: 12 Nov 2022
Posts: 3
xRagDiscretePulsar 14 Nov 2022, 17:44
revolution wrote:
Label names are not limited. There really isn't any need to be frugal with them. You can use any random name without restriction.
Code:
jmp .string_skip_1
someStr db "Hello World!",0h
.string_skip_1:     

The problem with labels is that I would like to always call them by the same name: lpostr, lpistr, lpon, lpin, lphandle, lpostruct, lpistruct. It's just a magazine for a call.
If you name them that by increment, then after removing the previous label, it will no longer be: label1, label2, label3, but: label1, label3. And I'm lazy after that to reorder their numbers.

Here is what i use:
Code:
;...
c0 equ db 0E8h, 0, 0, 0, 0
j equ db 0EBh, 
;...
        c0                                   ; push the address of the instruction jmp
        j 36-5                               ; the columns indexed by notepad.exe
db "C:\Windows\sysWOW64\ws2_32.dll",0h
        pop edx                              
        add edx,2                            ; skip the instruction jmp
        p edx                                ; address of the string
        m ebx, LoadLibraryA
        c ebx     

Optimization is the second thing Very Happy


Last edited by xRagDiscretePulsar on 14 Nov 2022, 21:06; edited 3 times in total
Post 14 Nov 2022, 17:44
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 587
Location: Ukraine
Overclick 14 Nov 2022, 19:11
No problem to do all that things by macros.
Numerated shifting for example
Code:
macro @@@ t& {
        local anonymous
        @F1=$
        @B5 equ @B4
    @B4 equ @B3
    @B3 equ @B2
    @B2 equ @B1
    @B1 equ @F1
    @F1 equ @F2
    @F2 equ @F3
    @F3 equ @F4
    @F4 equ @F5
    @F5 equ anonymous
    match =: arg,t \{ arg \} }
    
Post 14 Nov 2022, 19:11
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18963
Location: In your JS exploiting you and your system
revolution 14 Nov 2022, 22:28
xRagDiscretePulsar wrote:
And I'm lazy after that to reorder their numbers.
You don't need to have the labels in any particular order. The assembler has no requirement for that.

The point was you can choose to do labelling in any way you please. But there is no need or requirement to use anonymous labels. It is purely your choice.

It also works the other way. There is no need or requirement to use named labels. You could probably write an entire program using anonymous labels. I've never tried, but I would guess it is possible. That might be a good challenge to see just how much can be done. Idea
Post 14 Nov 2022, 22:28
View user's profile Send private message Visit poster's website Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 1122
Location: Belarus
DimonSoft 21 Nov 2022, 14:32
Since anonymous labels are only first-before and first-after, the first if-then-else with both branches non-empty will be a headache and will probably require changing the instructions to accomodate.
Post 21 Nov 2022, 14:32
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3, 4

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.