Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1069813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:28:36+00:00 2026-05-16T20:28:36+00:00

just did my first test with MASM and FASM with the same code (almos)

  • 0

just did my first test with MASM and FASM with the same code (almos) and I falled in trouble. The only difference is that to produce just the 104 bytes I need to write to MBR in FASM I put org 7c00h and in MASM 0h.

The problem is on the

mov si, offset msg

that in the first case transletes it to 44 7C (7c44h) and with masm translates to 44 00 (0044h)! but just when I change org 7c00h to org 0h in MASM. Otherwise it will produce the entire segment from 0 to 7dff.

how do I solve it?

or in short, how to make MASM produce a binary that begins at 7c00h as it first byte and subsequent jumps remain relative to 7c00h?

.model TINY 
.code  
org             7c00h             ; Boot entry point. Address 07c0:0000 on the computer memory
 xor  ax, ax          ; Zero out ax
 mov  ds, ax       ; Set data segment to base of RAM
 jmp start       ; Jump to the first byte after DOS boot record data    

; ----------------------------------------------------------------------
; DOS boot record data
; ----------------------------------------------------------------------
brINT13Flag     db      90h             ; 0002h - 0EH for INT13 AH=42 READ
brOEM           db      'MSDOS5.0'      ; 0003h - OEM name & DOS version (8 chars)
brBPS           dw      512             ; 000Bh - Bytes/sector
brSPC           db      1               ; 000Dh - Sectors/cluster
brResCount      dw      1               ; 000Eh - Reserved (boot) sectors
brFATs          db      2               ; 0010h - FAT copies
brRootEntries   dw      0E0h            ; 0011h - Root directory entries
brSectorCount   dw      2880            ; 0013h - Sectors in volume, < 32MB
brMedia         db      240             ; 0015h - Media descriptor
brSPF           dw      9               ; 0016h - Sectors per FAT
brSPH           dw      18              ; 0018h - Sectors per track
brHPC           dw      2               ; 001Ah - Number of Heads
brHidden        dd      0               ; 001Ch - Hidden sectors
brSectors       dd      0               ; 0020h - Total number of sectors
                db      0               ; 0024h - Physical drive no.
                db      0               ; 0025h - Reserved (FAT32)
                db      29h             ; 0026h - Extended boot record sig
brSerialNum     dd      404418EAh       ; 0027h - Volume serial number (random)
brLabel         db      'OSAdventure'   ; 002Bh - Volume label  (11 chars)
brFSID          db      'FAT12   '      ; 0036h - File System ID (8 chars)

;------------------------------------------------------------------------
; Boot code
; ----------------------------------------------------------------------

start:
 mov si, offset msg
 call showmsg
hang: 
 jmp hang

msg    db  'Loading...',0

showmsg:
 lodsb
 cmp al, 0
 jz showmsgd
 push si
 mov bx, 0007
 mov ah, 0eh
 int 10h
 pop si
 jmp showmsg
showmsgd:
 retn

; ----------------------------------------------------------------------
; Boot record signature
; ----------------------------------------------------------------------
       dw   0AA55h                      ; Boot record signature
END 
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T20:28:36+00:00Added an answer on May 16, 2026 at 8:28 pm

    I altered your code a little bit to work with FASM. Hope this helps. According to the MS Terms of service your not allowed to make an OS with MASM. So its not recommended to do that and then advertise it in open chat. But FASM works great. Here is your code “fixed” so that you can compile it in FASM.

    use16
    format binary
    
    org 7c00h             ; Boot entry point. Address 07c0:0000 on the computer memory
    
    somelabel:
     xor  ax, ax          ; Zero out ax
     mov  ds, ax       ; Set data segment to base of RAM
     jmp start       ; Jump to the first byte after DOS boot record data    
    
    ; --------------------------------------
    ; DOS boot record data
    ; --------------------------------------
    
    brINT13Flag     db      90h             ; 0002h - 0EH for INT13 AH=42 READ
    brOEM           db      'FASMv1.6'      ; 0003h - OEM name & LOS version (8 chars)
    brBPS           dw      512             ; 000Bh - Bytes/sector
    brSPC           db      1               ; 000Dh - Sectors/cluster
    brResCount      dw      1               ; 000Eh - Reserved (boot) sectors
    brFATs          db      2               ; 0010h - FAT copies
    brRootEntries   dw      0E0h            ; 0011h - Root directory entries
    brSectorCount   dw      2880            ; 0013h - Sectors in volume, < 32MB
    brMedia         db      240             ; 0015h - Media descriptor
    brSPF           dw      9               ; 0016h - Sectors per FAT
    brSPH           dw      18              ; 0018h - Sectors per track
    brHPC           dw      2               ; 001Ah - Number of Heads
    brHidden        dd      0               ; 001Ch - Hidden sectors
    brSectors       dd      0               ; 0020h - Total number of sectors
                    db      0               ; 0024h - Physical drive no.
                    db      0               ; 0025h - Reserved (FAT32)
                    db      29h             ; 0026h - Extended boot record sig
    brSerialNum     dd      404F18EAh       ; 0027h - Volume serial number (random)
    brLabel         db      'FASM_DISK_1'   ; 002Bh - Volume label  (11 chars)
    brFSID          db      'FAT12   '      ; 0036h - File System ID (8 chars)
    
    
    ;-------------------------------------------
    ; Boot code
    ; ------------------------------------------
    
    msg1 db '  This is a test of FASM 1.6',0
    
    start:
            mov     ax,msg1
            MOV     si,ax
    
    display11:
     lodsb
     test al, al
     jnz disp0
            jmp finish
    disp0:
     mov ah, 0xE
     mov bx, 7
     int 10h
            jmp display11
    
    finish:
            jmp $ ;This tells times to compare the end here with the
                  ;beginning up there called somelabel ( NOTE : entry by
                  ;itself is not allowed because FASM uses it. )
    
    ; ------------------------------------
    ; Boot record signature
    ; ------------------------------------
    
    size equ $ + somelabel
    
    times (512 - size - 2) db 0  ;needed to padd the first 512 sector with 0's
    
                                   ;AFTER the jmp $ command. ( size equ $+entry )
    
                                   ;then is takes size away from 512 as well as
    
                                   ;takes 2 bytes away for the boot sig and your done.
    
    
           dw   0AA55h             ; Boot record signature
    

    Compile that with FASM 1.6+ and it will make itself the name of the file you name it as well as make it into a BIN file. I use PowerISO to make CD images and it allows you to pull in a BIN file so you can make the CD bootable. ( HINT : It will show that only BIF files are your choice, just choose . and choose the BIN file anyways and there you go. ) Then use the free program VM VirtualBox to mount and test the CD. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I've just released my first module for nodejs . Things that I did:
I just started my first Mercurial project. I did a 'cd' into my source
I just publicated yesterday my first android application. I did not tested on android
I have a unit tests that test if the first name of a baby
This is just a test application, There is only a AppDelegate class to create
I just did a syntax like this mysql_real_escape_string($var = 'Hello'); print_r($var); and I got
I just did something dumb with my SVN repository, I accidentally imported a load
I just did an svn merge from a branch to a trunk in my
I just did File -> New Project last night on a new project. Ah,
I just did a fresh installation of Visual Studio 2010 Ultimate and ReSharper 5.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.