flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > wrong addres of label

Author
Thread Post new topic Reply to topic
Kicer



Joined: 30 Apr 2005
Posts: 34
Location: Poland
Kicer 13 May 2005, 06:42
look just at this code:

Code:
console_begin:
    inc byte [ds:0b8000h+79*2+23*160]
    jmp console_begin
console_data:
console_stack: times 128 db 0                             ;segment stosu
console_end:

t_begin:
    nop
    jmp t_begin
t_stack: times 128 db 0
t_end:
    


when i jumped to t_begin the program crashed,
so i pushed nop between console_end and t_begin and everything is ok
here are listings of code with nop and without nop:

Code:
                                                console_begin:
00000BC5: FE 05 FE 8E 0B 00                         inc byte [ds:0b8000h+79*2+23*160]
00000BCB: EB F8                                     jmp console_begin
                                                console_data:
00000BCD: 00 00 00 00 00 00 00 00 00 00 00 00   console_stack: times 128 db 0                             ;segment stosu
          00 00 00 00 00 00 00 00 00 00 00 00   console_end:
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   t_begin:
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00               
00000C4D: 90                                        nop
00000C4E: EB FD                                     jmp t_begin
00000C50: 00 00 00 00 00 00 00 00 00 00 00 00   t_stack: times 128 db 0
          00 00 00 00 00 00 00 00 00 00 00 00   t_end:
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   begin:
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00               
    


and the 2nd:

Code:
                                                console_begin:
00000BC5: FE 05 FE 8E 0B 00                         inc byte [ds:0b8000h+79*2+23*160]
00000BCB: EB F8                                     jmp console_begin
                                                console_data:
00000BCD: 00 00 00 00 00 00 00 00 00 00 00 00   console_stack: times 128 db 0                             ;segment stosu
          00 00 00 00 00 00 00 00 00 00 00 00   console_end:
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00               
00000C4D: 90                                    nop
                                                t_begin:
00000C4E: 90                                        nop
00000C4F: EB FD                                     jmp t_begin
00000C51: 00 00 00 00 00 00 00 00 00 00 00 00   t_stack: times 128 db 0
          00 00 00 00 00 00 00 00 00 00 00 00   t_end:
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   begin:
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00 00 00 00 00   
          00 00 00 00 00 00 00 00               
            
    


as You see in the 1st example t_begin is in a wrong place...
Post 13 May 2005, 06:42
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8376
Location: Kraków, Poland
Tomasz Grysztar 13 May 2005, 08:10
The assembly is OK (look at it with disassembler), it's just the problem of listing extension (it is still likely to have a lots of them since it's a kind of "hack" over the fasm internals that were not initially designed to support such feature). I will try to fix it later.


Last edited by Tomasz Grysztar on 13 May 2005, 08:27; edited 2 times in total
Post 13 May 2005, 08:10
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: 20594
Location: In your JS exploiting you and your system
revolution 13 May 2005, 08:13
This is just an artifact of the listing output. The generated code is correct.

The line "t_begin:" has no code output directly associated with it. The listing will use lines like this for padding when it needs to print more outout data.

The binary "EB FD" is correct in both cases.
Post 13 May 2005, 08:13
View user's profile Send private message Visit poster's website Reply with quote
Kicer



Joined: 30 Apr 2005
Posts: 34
Location: Poland
Kicer 13 May 2005, 09:37
maybe but why my program without nop is crashing ?:/
Post 13 May 2005, 09:37
View user's profile Send private message Reply with quote
Kicer



Joined: 30 Apr 2005
Posts: 34
Location: Poland
Kicer 13 May 2005, 09:50
ok nevermind, my fault :/
Post 13 May 2005, 09:50
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.