Hello.
Does anyone see a problem with the following code:
I get hte error at mov bp,msg
thx
Does anyone see a problem with the following code:
.386
.model flat, stdcall
.data
db msg "Cleared.",0
db times 510-($-$$), 0
dw 0AA55h
.code
start:
mov ah, 00h
mov al, 03h
int 10h
xor ax, ax
mov al, 2eh
out 70h, al
xor al, al
out 71h, al
xor ax, ax
mov ah, 13h
mov al, 01h
mov bh, 00h
mov cx, 23h
mov bl, 07h
mov bp, msg
add bp, 07c00h
int 10h
end start
I get hte error at mov bp,msg
thx
msg has type BYTE, so MASM complains to load it into a 16bit register
Most likely you wanted to do
Most likely you wanted to do
mov bp, offset msg
the error is that you're trying to do 16bit code on win32 flat model. i see you're trying to do a bootloader of some sort, do .model tiny. and the signature+padding's got to be at the END of the bootloader
hey, any ideas what the next erro means:
error LNK2001: unresolved external symbol _WinMainCRTStartup
I used the offset for the msg, that was right but now i get this.....
waht is it?
error LNK2001: unresolved external symbol _WinMainCRTStartup
I used the offset for the msg, that was right but now i get this.....
waht is it?
Are you using a 16bit linker?
make shore the WinMain proc is declared with a proto,
or the WinMain proto exists and the proc it self doesnt exists....
or the WinMain proto exists and the proc it self doesnt exists....
linker.....i am using a linker that comes with masm 32 so....it is a 32 bit linker....do i have to use a 16 bit linker...i don';t think there is any 16 bit code there...since i chaned mov bp, offset msg. And why do i need to have a win main...can't i jsut run my program without a winmain?
here is the updated code:
here is the updated code:
format PE GUI 4.0
entry start
include 'C:\IDE\FASM\INCLUDE\win32a.inc'
section '.data' data readable writeable
msg db "Cleared",0
;times 510-($-$$) db 0
times db 510-($-$$), 0
dw 0AA55h
section '.code' code readable executable
start:
mov ah, 00h
mov al, 03h
int 10h
xor ax, ax
mov al, 2eh
out 70h, al
xor al, al
out 71h, al
xor ax, ax
mov ah, 13h
mov al, 01h
mov bh, 00h
mov cx, 23h
mov bl, 07h
mov bp, msg
add bp, 07c00h
int 10h
i don';t think there is any 16 bit code there
The use of interrupts and port I/O is *very* much 16bit DOS code - this won't work at all in a win32 program. Yes, you will need a 16-bit linker if you want to write this kind of code.
Or, you could get FASM - http://www.flatassembler.net
Do check the EULA that comes with masm32. Or if you are not using masm32, whatever EULA that comes with your ml.exe.
PS: I think FASM is better for this kind of thing. Personally I do not like Nasm.
PS: I think FASM is better for this kind of thing. Personally I do not like Nasm.
i got fasm now...
but syntaxies is so diffrent here and all...
anyways i get error on the first line...any ideas on what it should be, i looked at the other source code but it is the same......
sThx in advnace
but syntaxies is so diffrent here and all...
anyways i get error on the first line...any ideas on what it should be, i looked at the other source code but it is the same......
format PE GUI 4.0
entry start
include 'C:\IDE\FASM\INCLUDE\win32a.inc'
section '.data' data readable writeable
msg db "Cleared",0
;times 510-($-$$) db 0
times db 510-($-$$), 0
dw 0AA55h
section '.code' code readable executable
start:
mov ah, 00h
mov al, 03h
int 10h
xor ax, ax
mov al, 2eh
out 70h, al
xor al, al
out 71h, al
xor ax, ax
mov ah, 13h
mov al, 01h
mov bh, 00h
mov cx, 23h
mov bl, 07h
mov bp, msg
add bp, 07c00h
int 10h
sThx in advnace
That is wrong
PS: I have not tested it out yet, but I think it should work
format binary
use16
org 7c00h
jmp start
nop
start:
mov ah, 00h
mov al, 03h
int 10h
xor ax, ax
mov al, 2eh
out 70h, al
xor al, al
out 71h, al
xor ax, ax
mov ah, 13h
mov al, 01h
mov bh, 00h
mov cx, 23h
mov bl, 07h
mov bp, msg
int 10h
hlt
msg db "Cleared",0
times 510+7c00h-$ db 0
db 55h,0aah ; boot signature
PS: I have not tested it out yet, but I think it should work
okey, i compiled the program and the compilation is fine, i don't get any errors, nothing like htat, but i get a .bin file....am i not suppoused to get a .exe, .com or even .bat file?
how do i finish the linking of this file to get an executable?
how do i finish the linking of this file to get an executable?
hey, nm my previous post, i got it.
My question is, ar ther any tutorials articles, etc on the bootleader and 16 bit programming of the above kind?
thx
My question is, ar ther any tutorials articles, etc on the bootleader and 16 bit programming of the above kind?
thx
What kind are you searching for? Most tutorials are for nasm, but I guess it would not be too difficult to convert them into fasm.
There are some useful links here:
http://www.asmcommunity.net/board/viewtopic.php?t=13474
There are some useful links here:
http://www.asmcommunity.net/board/viewtopic.php?t=13474