flat assembler
Message board for the users of flat assembler.
Index
> DOS > boot and bios? problem with JMP instruction size, boot code. |
Author |
|
decard 02 Jan 2004, 10:36
You forgot about two things:
1) jump instruction in the beginning of the boot loader is assumed to be 3-bytes long, but FASM will generate optimised code so your JMP will occupy only 2 bytes; That's why you need extra NOP instruction; 2) boot loader should have 0x55aa signature in the end. try: Code: org 7c00h jmp start nop ; <---- times 100 db 0x41 start: mov ax,0000 int 10h mov bx,0x0007 mov di,0 mov cx,6 mov ah,0xe loopek: mov al,byte [szText+di] add di,1 int 10h loop loopek go: jmp go szText db "Atomic", 0 rb 0x7C00+512-2-$ ; <------- db 0x55 db 0xaa I tested this code under Bochs only, but it should work with real floppy too . BTW: on FASM homepage you can find very interesting bootsector expamle - PHBOOT. regards, Decard |
|||
02 Jan 2004, 10:36 |
|
Bitdog 15 Feb 2004, 06:31
I think BIOS post boots to video mode 3
so you can do direct screen writes ? Code: PUSH WORD 0xB800 POP ES XOR DI,DI ; ES:DI = screen seg row0,col0,page0 PUSH CS POP DS ; DS = CS CALL PSTR0 DB 4,"Howdy wurld !",0 ;color 4 ;more code here, & exit ? ;put endless loop here, CLI & JMP $ PSTR0: ;Vmem print proc POP SI ;pop return address = message adr LODSB MOV AH,AL ;color Ptop: LODSB ;get AL from DS:SI OR AL,AL ;check for nul=0 end JZ BYEBYE ;exit print proc STOSW ;write AL=char & AH=attribute color to ES:DI screen seg & INC DI JMP Ptop ;loop, Fasm optimizes to short/byte jump BYEBYE: ;Xit JMP SI ; CS:SI = end of string = return address, so jump SI ;Bitdog |
|||
15 Feb 2004, 06:31 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.