flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
edfed 24 Jun 2008, 05:22
yes, you pad your code wrong.
see on some examples like mines to know how to do. |
|||
![]() |
|
DustWolf 24 Jun 2008, 17:33
Care to provide a handy link? I'm not sure what to look for when you put it like that.
|
|||
![]() |
|
TNick 24 Jun 2008, 17:51
Well... I really do not know what link should I post... maybe this one, but I guess you already know about this.
![]() The problem is that: - at the start of your file, you should place a Code: org 0x7c00 wich will inform the assembler that, even if, in file, you are at offset 0, it should treat the code as being placed at that address. At this point $ is equal with 0x7c00. As you write code, $ will increase. At the end of what you need to be placed in first sector, you may add something like this: Code: if ($ - 0x7c00) > 510 ; if we are above allowed size display 'Too much data in Sector 1!!!',13,10; this will alert you else if ($ - 0x7c00) < 510 ; if we are below that size db (510 - ($ - 0x7c00)) dup 1 ; fill the space with 1 ... or 0 After this, you may place data and code that you want in sector 2 ... and 3 ... and, if you want to know how manny sectors you need to read, place this at the very end: Code: if (512 - (($ - Sector2) and 0x1FF)) > 0 db (512 - (($ - Sector2) and 0x1FF)) ; fill up to make a full sector end if SctToRead = ($ - Sector2) / 0x200 ; or 512 = the size of one sector HTH Nick |
|||
![]() |
|
DustWolf 24 Jun 2008, 23:26
Using this code I get the exact same problem as with my code.
Must be something stupid... here is my code: Code: mov cx,2 ;sector=2 cylinder=0 mov dh,0 ;head=0 mov dl,0 ;drive=floppy A (80h=hdd) mov es,cx ;segment 0 All the code runs fine but in the lower half, si seems to point at offset 0x200 instead of 0x219 (I used a hex editor on binary and compared to the display on screen). If I put my lower half data (bootMsg) with the other data higher up, it works fine. EDIT: Nevermind! I can't believe I spent two days trying to figure that out! XP So optimizing code before you finnish it is bad... ps.: for the record this code works fine: Code: times (7DFEh-$) db ? db 55h,0AAh |
|||
![]() |
|
edfed 26 Jun 2008, 19:40
there are problems:
you don't write the right values. first: Code: mov cx,2 mov dx,0 mov bx,0 mov ax,segment mov es,ax mov al,sectorcount mov ah,diskoperation int 13h and second: Code: free = 510-(padding-$$) padding rb free dw 0aa55h this code uses a label to calculate the amount of byte to pad. this is very usefull in case of modularised boot sector. you can participate in one of my multiple threads on the subject if you want. my current researchs on OO disk operations bootloader created with the help of many coders this one is exactlly like the current thread this one is about how to boot, and switch to Protected mode and this one is about an hardcore project |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.