flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
windwakr 22 Aug 2009, 01:15
EDIT: Does it do ANYTHING after the boot loader is done?
You don't need to hard-code hex stuff like the 1FEh in "db (1FEh - ($ - $$)) dup (0)", Just put 510, to make it easier to read for everyone. BTW: WELCOME TO THE FORUM! It's nice to see new members here. ![]() EDIT: Ignore below, I wrote it without even looking at your code. I didn't look through it, but are ES and DS set to you're second stage segment? EDIT: Ya, doesn't look like you set DS up. EDIT: WAIT A SECOND, ds isn't used for that interrupt, WHAT AM I THINKING?? Well, you should set it up anyways. |
|||
![]() |
|
RHaden 22 Aug 2009, 03:19
Thanks for the welcome!
windwakr wrote: EDIT: Does it do ANYTHING after the boot loader is done? Yes... the boot loader transfers control to the "second-stage loader", which is currently meant to find out how much free memory there is and write it out on the screen. Then it just enters an infinite loop where it echoes on the screen each key the user (i.e. me) presses. Quote: You don't need to hard-code hex stuff like the 1FEh in "db (1FEh - ($ - $$)) dup (0)", Just put 510, to make it easier to read for everyone. Fair enough, I guess. ![]() Last edited by RHaden on 22 Aug 2009, 03:26; edited 1 time in total |
|||
![]() |
|
revolution 22 Aug 2009, 03:24
windwakr wrote: You don't need to hard-code hex stuff like the 1FEh in "db (1FEh - ($ - $$)) dup (0)", Just put 510, to make it easier to read for everyone. |
|||
![]() |
|
windwakr 22 Aug 2009, 03:43
Hmmm, I don't know. Try adding
Code: mov ax,cs mov es,ax To the top of the entry point of the second stage. Also, your ReadSector is flawed. di gets reset to 5 every loop, so if it can't read the floppy it would enter an endless loop and never bail out. Even if it did detect an error, it would still continue on to try to jump to a not loaded area. I would write it as: Code: mov di,5 ReadSector: mov ax, 0201h ; Read one sector from drive. int 13h jnc StartLoader ; Start the loader if there's no error. xor ax, ax ; Clear AX register to be able to reset drive. int 13h dec di jnz ReadSector ; If counter > 0, try again. jmp loaderror StartLoader: Have a label called loaderror that displays an error message and halts or something. |
|||
![]() |
|
sinsi 22 Aug 2009, 03:53
Code: mov ax, [fatSectors] div [sectorsPerTrack] - fatSectors isn't initialised and could be anything - you should set up a stack too |
|||
![]() |
|
revolution 22 Aug 2009, 03:56
sinsi wrote:
|
|||
![]() |
|
sinsi 22 Aug 2009, 04:22
revolution: sectorsPerTrack is a byte.
|
|||
![]() |
|
revolution 22 Aug 2009, 04:37
Oh, never mind.
|
|||
![]() |
|
sinsi 22 Aug 2009, 04:40
'div bx' divides DX:AX by BX
but 'div bl' divides AX (AH:AL) by BL |
|||
![]() |
|
RHaden 22 Aug 2009, 19:18
windwakr wrote: Hmmm, I don't know. Try adding I tried that and the same thing happens. The string I want to display does not appear on the screen. What does appear is a string of 18 empty characters. Quote: Also, your ReadSector is flawed. di gets reset to 5 every loop, so if it can't read the floppy it would enter an endless loop and never bail out. Even if it did detect an error, it would still continue on to try to jump to a not loaded area. Ah yes, you're right! Thanks for pointing that out to me. I've fixed the code accordingly. |
|||
![]() |
|
RHaden 22 Aug 2009, 19:21
sinsi wrote:
Based on looking at the code, you're right. I should've pointed out that I write the number of FAT sectors in that space when I run my disk-format program. Quote: - you should set up a stack too Okay, why is that? |
|||
![]() |
|
RHaden 25 Aug 2009, 01:24
Okay, I did some more investigating tonight using Bochs' wonderful system-snapshot functionality and HEdit by Yuri Software. It turns out that my "second-stage loader" program was not being read into memory at 1000h:0000h (like I thought it was). How could this be? Well, it turns out that it wasn't be written on a disk-drive sector boundary, because I was not properly calculating the sector-size of the FAT in my disk-formatter program. I've since corrected that program and the "second-stage loader" now works like a charm!
So in a nutshell, this was yet another example of PEBKAC. ![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.