Running Mikeos on a *real* 8086

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Burik
Posts: 7
Joined: Thu Apr 19, 2012 12:22 pm

Running Mikeos on a *real* 8086

Post by Burik »

Hey there, this is my first post here. I am the proud owner of an Olivetti M24 [8086 CPU, 640k RAM, 20Mb HDD] and I'd like to run Mikeos on it. Too bad its 3.5" drive can't read anything above 720K floppies, hence I have to modify the bootloader according to 720K specs. Original bootloader as follows:

Code: Select all

*snip*
; Values are those used by IBM for 1.44 MB, 3.5" diskette
 23 
 24 OEMLabel                db "MIKEBOOT"   ; Disk label
 25 BytesPerSector          dw 512          ; Bytes per sector
 26 SectorsPerCluster       db 1            ; Sectors per cluster
 27 ReservedForBoot         dw 1            ; Reserved sectors for boot record
 28 NumberOfFats            db 2            ; Number of copies of the FAT
 29 RootDirEntries          dw 224          ; Number of entries in root dir
 30                                         ; (224 * 32 = 7168 = 14 sectors to read)
 31 LogicalSectors          dw 2880         ; Number of logical sectors
 32 MediumByte              db 0F0h         ; Medium descriptor byte
 33 SectorsPerFat           dw 9            ; Sectors per FAT
 34 SectorsPerTrack         dw 18           ; Sectors per track (36/cylinder)
 35 Sides                   dw 2            ; Number of sides/heads
 36 HiddenSectors           dd 0            ; Number of hidden sectors
 37 LargeSectors            dd 0            ; Number of LBA sectors
 38 DriveNo                 dw 0            ; Drive No: 0
 39 Signature               db 41           ; Drive signature: 41 for floppy
 40 VolumeID                dd 00000000h    ; Volume ID: any number
 41 VolumeLabel             db "MIKEOS     "; Volume Label: any 11 chars
 42 FileSystem              db "FAT12   "   ; File system type: don't change!
 43 
*snip*
Too bad I'um unable to find the correct values for a 720K floppy.. I tried 1440 for LogicalSectors, 9 for SectorsPerTrack and F9 for MediumByte and I've basically destroyed the FAT :|

Any help?
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re: Running Mikeos on a *real* 8086

Post by bubach »

Those values you mention is right, but a 720kb floppy with FAT12 also uses 1kb cluster values, while 1.44mb floppies use 512byte. This might break MikeOS FAT-driver if it's not done right to account for different cluster sizes. Try setting "SectorsPerCluster db 2". It will however take some serious FAT hacking in a hex editor to convert the values inside the actual FAT for the files needed at boot. Maybe you could find software to deal with 720kb floppies, or is the 1.44mb drives incompatible with older floppy sizes?
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
Burik
Posts: 7
Joined: Thu Apr 19, 2012 12:22 pm

Re: Running Mikeos on a *real* 8086

Post by Burik »

Thanks for your reply, I gave "SectorsPerCluster db 2" a try with no luck, the bootdisk can't boot neither the M24 or my main PC. On my Linux box equipped with a 1.44mb drive I'm able to mount the 720K disk and list its contents, the disk itself looks fine. On the M24 running MSDOS5.0 I can't even read the disk. I'm going to take a look at the FAT driver and see if I can accomodate it to the new cluster size.
Rudster816
Member
Member
Posts: 141
Joined: Thu Jun 17, 2010 2:36 am

Re: Running Mikeos on a *real* 8086

Post by Rudster816 »

I cant find any part of the OS that uses 32 bit registers, but according to the download page, Mikeos requires a 386 with 1MB of RAM.

http://mikeos.berlios.de/#downloads
Senqo
Posts: 1
Joined: Thu Apr 19, 2012 6:56 pm

Re: Running Mikeos on a *real* 8086

Post by Senqo »

It requires at least a 386 because the FS and GS segment registers are used.
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re: Running Mikeos on a *real* 8086

Post by bubach »

wow, thats stupid. i mean it's a real mode OS ffs :P how hard could it be to live without fs and gs? make do.
Last edited by bubach on Fri Apr 20, 2012 12:01 pm, edited 1 time in total.
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
Burik
Posts: 7
Joined: Thu Apr 19, 2012 12:22 pm

Re: Running Mikeos on a *real* 8086

Post by Burik »

haha, I guess this settle things once and for all, I admit I didn't even read the kernel source, thanks guys.

Code: Select all

*snip*
123         mov fs, ax                      ; live entirely in 64K
124         mov gs, ax
*snip*
M-Saunders
Member
Member
Posts: 155
Joined: Fri Oct 27, 2006 5:11 am
Location: Oberbayern
Contact:

Re: Running Mikeos on a *real* 8086

Post by M-Saunders »

Delete those two lines and try it. I've never had access to anything pre-386 to try it on, hence why I said that was a minimum, just to be sure. But take out those two lines referring to GS and FS and see how it works.

M
MikeOS -- simple, well-documented x86 real-mode OS written in assembly language
http://mikeos.sourceforge.net
User avatar
amd64pager
Member
Member
Posts: 73
Joined: Fri Nov 25, 2011 8:27 am
Location: In the 266 squadron of the RFC,near Maranique in the Southern Front in the WW1

Re: Running Mikeos on a *real* 8086

Post by amd64pager »

What about access to this?
It's surprising what the semiconductor industry's definition of macro is and what the CS description is.
User avatar
Kazinsal
Member
Member
Posts: 559
Joined: Wed Jul 13, 2011 7:38 pm
Libera.chat IRC: Kazinsal
Location: Vancouver
Contact:

Re: Running Mikeos on a *real* 8086

Post by Kazinsal »

There are also lines of code in areas such as the FAT12 driver that (if I remember correctly) reference 32-bit registers, usually to clear EAX.

What you could do is use the "CPU 8086" NASM directive to instruct the parser to error out on any post-8086 instructions. Then you'll know where everything potentially-offending is.
Burik
Posts: 7
Joined: Thu Apr 19, 2012 12:22 pm

Re: Running Mikeos on a *real* 8086

Post by Burik »

M-Saunders wrote:Delete those two lines and try it. I've never had access to anything pre-386 to try it on, hence why I said that was a minimum, just to be sure. But take out those two lines referring to GS and FS and see how it works.

M
Will do. I've little spare time atm but I'll surely keep you updated.

And Blacklight, thanks for the tip.
Burik
Posts: 7
Joined: Thu Apr 19, 2012 12:22 pm

Re: Running Mikeos on a *real* 8086

Post by Burik »

I am as stuck as a fly on flypaper :|

According to the always trustworthy PC Hardware Book, the disk description table for a 720Kb, 3.5" disk should be as follows:

Code: Select all

OEMLabel                db "MIKEBOOT"
BytesPerSector          dw 512
SectorsPerCluster       db 2            ; 1 for 1.44Mb disk
ReservedForBoot         dw 1
NumberOfFats            db 2
RootDirEntries          dw 112          ; 224 for 1.44Mb disk
LogicalSectors          dw 1440         ; 2880 for 1.44Mb disk
MediumByte              db 0F9h         ; 0F0h for 1.44Mb disk
SectorsPerFat           dw 9
SectorsPerTrack         dw 9            ; 18 for 1.44Mb disk
Sides                   dw 2
HiddenSectors           dd 0
LargeSectors            dd 0
DriveNo                 dw 0
Signature               db 41
VolumeID                dd 00000000h
VolumeLabel             db "MIKEOS     "
FileSystem              db "FAT12   "
I also changed the floppy_ok routine according to the new values:

Code: Select all

floppy_ok:
       mov ax, 19
       call l2hts

       mov si, buffer
       mov bx, ds
       mov es, bx
       mov bx, si

       mov ah, 2
       mov al, 7                      ; Read 7 sectors [14 for 1.44Mb disk]
       pusha
And I'm building the 720K image this way:

mkdosfs -C -F 12 -r 112 -s 2 -S 512 -v disk_images/mikeos720.flp 720

Too bad the kernel.bin check in the next_root_entry routine fails miserably with the "kernel.bin not found" message, way before the FAT is read into RAM. I can't for the life of me figure out what I'm doing wrong.
JuEeHa
Member
Member
Posts: 30
Joined: Thu Mar 10, 2011 4:24 am

Re: Running Mikeos on a *real* 8086

Post by JuEeHa »

If I remember correctly 8086 didn't have pusha/popa opcodes. Try manualy pushing all registers.
Using 700MHz Pentium III machine with 64MB of RAM because I feel like it.
ed implementation in C: main(a){for(;;;){read(0,&a,1);if(a=='\n')write(1,"?\n",2);}}
Burik
Posts: 7
Joined: Thu Apr 19, 2012 12:22 pm

Re: Running Mikeos on a *real* 8086

Post by Burik »

OMG you're damn right, I didn't even think about that. Too bad manually pushing and popping the registers increases the boot sector size to over 600 bytes, I'll try to cut out the non-essential stuff and see how it goes.
ACcurrent
Member
Member
Posts: 125
Joined: Thu Aug 11, 2011 12:04 am
Location: Watching You

Re: Running Mikeos on a *real* 8086

Post by ACcurrent »

Intel manual states that they were added in 286. (Volume 3A 17-5)
Get back to work!
Github
Post Reply