ok, your jumping to 0x7E00:0000 is actually correct... but many other things aren't, let me try to give a partial list:
for your bootsector:
1)
Code:
int 13h
you haven't set up your stack yet -- the stack the BIOS was using is not guaranteed to be valid (for practical reasons it probably will be, but you really are supposed to set up a stack before using it)
2)
Code:
int 13h
jmp 0x7e00:0000
this will likely work most of the time on most emulators, but will not work on real hardware -- in reality, any time you read from the disk you need to be prepared for read errors and retry the disk read -- this is especially true for the FDD
3)
Code:
cli
hlt
this isn't really an error but it is unnecessary (since the jmp transfers execution elsewhere)
this code could be rewritten better by adding a stack setting code, and then adding code to retry the disk read if the read function returns an error
for your 2nd stage:
4)
Code:
org 0x7e00
this is actually wrong: it should be org 0
the org value is added to addresses by the assembler, and thus should be set to the offset to be added -- the starting offset from DS (not CS, and not the segment)
5)
Code:
jmp main
main:
not really an error, but completely unnecessary
6)
Code:
mov si, msg
where is msg defined? I see it nowhere in the code you posted... most likely this is zero (as that would explain the symptoms you described)
7)
Code:
call print
print:
this works, but it does something unexpected... after calling print, it returns and continues executing here... making it execute print again, this time with SI pointing after the end of your previous string (this will print whatever garbage happened to be in memory after your string...)
to this point this code actually works however, but it causes this error here:
8 )
Code:
ret
this isn't an error itself, but because of problem #7, it becomes an errror...
the first time print is called this works correctly, however because you drop into the print function after returning from the print function this ret returns to whatever was on the stack before... which means you now loose control of the CPU
worse, the CPU will continue executing random instructions from random memory until it gets to an instruction that reads/writes a hardware device, and by doing so sets that device to a bad setting which destroys the computer
while this might not happen, it will certainly not do what you want it to do
9) -- this one is out of order because of the relation between the previous 2
Code:
lodsb
this instruction isn't doing what you think it is -- you haven't set DS, therefore you aren't taking the message from wherever you have it (its not anywhere in the code you posted) but rather taking it from the address 7e00 (your org statement) + offset-of-message-in-file + whatever_DS_base_happens_to_be_set_to...
this 2nd stage could be better rewritten by:
change org to 0
be sure to place the message in the same file with the 2nd stage
set DS as appropriate so it can reach your 2nd stage (where the data is)
move your
Code:
cli
hlt
up to be between the
Code:
call print
line and the
Code:
print:
line
if you make the changes and fixes I described here, your code should work
edit:
do note that some emulators halt execution when they find a HLT instruction with IF=0 (like your cli;hlt instruction pair you have been using) -- sometimes this will happen before the printed text is actually displayed to the screen, if this happens replacing the cli;hlt instruction block with:
Code:
end:
hlt
jmp end
will fix it and allow the text to be displayed properly