Page 1 of 1

MS VPC Issue

Posted: Sat Dec 14, 2013 6:18 pm
by xixpsychoxix
Ok all, I am using the following code to get the boot sector of my disk within my stage 2 loader:

Code: Select all

;****************************************************************
;	_fat12_Initialize: Initialize the FAT12 device
;	Parameters: DL - device number
;	Returns: AX = 0 on success, 1 on failure
;****************************************************************

_fat12_Initialize:

	; save all registers. Five error retries
	mov di,5
	
	; save the current disk number in _currentDisk
	mov byte [_currentDisk],dl
	
.try_loop:

	xor ax,ax			; BIOS function 0 (reset disk)
	int 0x13			; reset
	
	; since we have invalid data in the table, we need to raw-load sector 0
	
	mov ax,0x0
	mov es,ax
	
	mov bx,_fat12_BPB				; our buffer for the sector
	mov ah,0x02						; bios function 2
	mov al,1						; read one sector
	mov cl,0x01						; read sector 1
	mov ch,0x00						; the cylinder number is zero
	mov dh,0x00						; the head number is zero, and dl already contains the drive number
	mov dl,byte [_currentDisk]		; load the disk number (just in case?)
	
	int 0x13				; call the interrupt
	jnc .loaded				; if we were successful, finish
	
	; setup for retry
	
	dec di					; decrement error counter
	jnz .try_loop			; if we have tries left, try again
	stc						; otherwise, set carry flag and return
	
.loaded:

	; return
	ret
This code is working fine in VMWare and Bochs. A lack of working floppy disks has prevented my testing it on real hardware, but it seems to be working fine in everything but MS Virtual PC 2007. I get an error (AH = 0x01?) when calling this function. Anyone know what may be causing this? I have the system working well, but I can't seem to pinpoint what may be happening in VPC.

Re: MS VPC Issue

Posted: Sat Dec 21, 2013 9:15 pm
by xixpsychoxix
Update: So I got THIS function to work in VPC by moving the disk reset call below the sector load call, but now for some reason I cannot load the file. The function call to my file loader never returns. I am at work now but will try to post source code for the loader when I get home. BTW, is forum participation down? Seems like low response numbers lately :D

Re: MS VPC Issue

Posted: Sun Dec 22, 2013 6:36 pm
by halofreak1990
I guess everyone's kind of waiting for mike to put up the next chapter and doesn't want to 'pollute' the forums with random discussions.

Re: MS VPC Issue

Posted: Fri Dec 27, 2013 2:16 pm
by pathos
xixpsychoxix wrote:BTW, is forum participation down? Seems like low response numbers lately :D
I check in every day, but I'm terrible at this stuff so I didn't try to help you =/

This forum was never really hopping, but has certainly been extra quiet for a few months now. Not sure why Mike is either. It's too bad. This is the best OS Dev tutorial out there.

Re: MS VPC Issue

Posted: Wed Jan 08, 2014 10:57 pm
by Mike
Hello,

Apologies for the late response.

Be careful with preserving the registers as the BIOS makes no guarantees. Make sure to push/pop DI in order to preserve the counter. Additionally, add additional error checking: make sure that the disk gets reset without error. Note that the disk reset BIOS service takes AH=0, DL=Drive number. The value of DL in the provided function is never set during reset.

We recommend staying with the original posted code (with the above modifications of course.) The disk reset should be done prior to reading from the disk not after.

Re: MS VPC Issue

Posted: Thu Jan 30, 2014 4:38 pm
by albus
Mike you'll continue the tutorial on the OS development?

Re: MS VPC Issue

Posted: Sun Mar 02, 2014 11:08 pm
by Mike
Hello,

Yes, the series is still continuing. A couple of chapters are being worked on; particularly Graphics 3 and Process Management 2. Unfortunately due to a lack of time, we have not been able to push out these articles yet. In the worst case, they will be out a little later this year.

If interested, topics for Process Management 2 include but may not be limited to scheduling, multi-threading, introduction to MP systems, init and idle process, shared resources, mutual exclusion, concurrent programming, security, and kernel shared data.

We will try to push it out some time in the next two weeks if possible. Apologies for the long delay -- they are almost complete though. :)

Re: MS VPC Issue

Posted: Tue Mar 04, 2014 9:49 pm
by halofreak1990
include but may not be limited to scheduling, multi-threading, introduction to MP systems, init and idle process, shared resources, mutual exclusion, concurrent programming, security, and kernel shared data.
Sounds good, mike. Nice to hear you're still working on this great series.

Re: MS VPC Issue

Posted: Fri Apr 11, 2014 3:10 pm
by astrocrep
Mike wrote:Hello,

Yes, the series is still continuing. A couple of chapters are being worked on; particularly Graphics 3 and Process Management 2. Unfortunately due to a lack of time, we have not been able to push out these articles yet. In the worst case, they will be out a little later this year.

If interested, topics for Process Management 2 include but may not be limited to scheduling, multi-threading, introduction to MP systems, init and idle process, shared resources, mutual exclusion, concurrent programming, security, and kernel shared data.

We will try to push it out some time in the next two weeks if possible. Apologies for the long delay -- they are almost complete though. :)
Your tutorials rock, thanks for them! Any chances for a sneak peak at the upcoming materials?? Need any testing?

Thanks,
Rich