Author Topic: jump short  (Read 43 times)

kaisermtv

  • Newbie
  • *
  • Posts: 1
    • View Profile
jump short
« on: June 08, 2018, 09:21:23 PM »
Hello sir Bogdan.
I'm having trouble with my bootloader code.
The code size after the build exceeds 512 bytes.
You can optimize jump functions in 16bit mode
Code: [Select]
je label ; 4byte "0F 84 XX XX"
je short label ; 2byte "74 XX"

Code: [Select]
jmp label ; 3byte "E9 XX XX"
jmp short label  ; 2 byte "EB XX"

If you can provide or add the following functions in 16bit mode
Code: [Select]
ljmp segment:offset ; jmp segment:offset

mov {reg},[es:{reg}] ; mov ax,[es:di]
mov {reg},[ss:{reg}] ; mov ax,[ss:di]

cmpsb



bogdanontanu

  • Administrator
  • Newbie
  • *****
  • Posts: 18
    • View Profile
    • oby.ro
Re: jump short
« Reply #1 on: June 18, 2018, 02:08:57 PM »
Hello sir Bogdan.
I'm having trouble with my bootloader code.
The code size after the build exceeds 512 bytes.
You can optimize jump functions in 16bit mode
Code: [Select]
je label ; 4byte "0F 84 XX XX"
je short label ; 2byte "74 XX"

Code: [Select]
jmp label ; 3byte "E9 XX XX"
jmp short label  ; 2 byte "EB XX"

If you can provide or add the following functions in 16bit mode
Code: [Select]
ljmp segment:offset ; jmp segment:offset

mov {reg},[es:{reg}] ; mov ax,[es:di]
mov {reg},[ss:{reg}] ; mov ax,[ss:di]

cmpsb



Hi kaiser,

Thanks for checking this,
I will check it out and see if I can improve the size of the 16 bits encodings.
I will also add the missing long jump and cmpsb instructions.

Meanwhile
I also have bootloader code in Solar_OS (same 512 bytes) and I have managed to fit the code in there.

However I did not try to add all the code in there.

The general advice here is to simply load a 2nd stage boot loader code with a bigger size.

For example in my boot loader I load 24 sectors for 12Kilo bytes right after the boot loader.
And then I jump to that code ;)

This way I avoid trying to stuff all the boot loader code in the first 512 bytes



« Last Edit: June 18, 2018, 02:10:57 PM by bogdanontanu »