0

I came across the following code :

.macro STAGE2
    /* Defined in the linker script. */
    mov $__stage2_nsectors, %al
    mov $0x02, %ah
    mov $1f, %bx   <----------------------
    mov $0x0002, %cx
    mov $0x00, %dh
    mov initial_dl, %dl
    int $0x13
    jmp 1f        <----------------------
    .section .stage2
    1:     <----------------------
.endm

Where the label 1 could have been a simple name like my_label as well, and then I could have done jmp my_label. But in the above code, why an f was appended in jmp 1f?

I tried fiddling the code to induce some errors to get to know what its called. I could get one of the following error :

main.S: Assembler messages:
main.S: Error: local label `"1" (instance number 2 of a fb label)' is not defined

Is this called as fb label? Initially I confused 1f as a constant, but then I saw that 0x prefix was missing in mov $1f, %bx, so it has to be label. Can someone please help me what its called and what are the rules around it?

Naveen
  • 7,944
  • 12
  • 78
  • 165
  • 1
    Per [this](https://stackoverflow.com/a/27353169/2189500), `It branches to the first found label "x" searching "forward" for "f" or "backward" for "b".` – David Wohlferd Feb 16 '20 at 08:16
  • @usr2564301 : yes it does. Thanks. I could not find it because I did not know what to search for. – Naveen Feb 16 '20 at 10:29

0 Answers0