OSDev.org

The Place to Start for Operating System Developers
It is currently Sat Mar 23, 2019 7:06 am

All times are UTC - 6 hours




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 35 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: How to make a real stand-alone system?
PostPosted: Tue Feb 19, 2013 12:36 pm 
Offline
Member
Member

Joined: Thu Jul 05, 2012 5:12 am
Posts: 921
Location: Finland
I am sure that this topic must have been discussed somewhere in the past but I try to get a brief conclusion of this. I first try to define what I mean: An operating system / environment developed without any external tools for IBM PC compatibles. Only a boot sector is written beforehand.

The boot sector must contain a command line interpreter that is capable of receiving written machine code and executing it. When that is possible, there should be no limits of what can be done. Then you just start typing machine code. It is possible to do bigger "second stage" and write everything on disk (e.g. port I/O) and then reboot. Then things can go a little further again.

Of course there is no sense doing this but it would be a nice theoretical project.

_________________
Undefined behavior since 2012


Top
 Profile  
 
 Post subject: Re: How to make a real stand-alone system?
PostPosted: Tue Feb 19, 2013 1:43 pm 
Offline
Member
Member

Joined: Mon Dec 21, 2009 6:03 pm
Posts: 164
im not sure what your suggesting or asking?

If you consider a file just as a buffer holding the instuctions, all your doing is buffering them in your head.

So your just writing the wholw system in asm?


Top
 Profile  
 
 Post subject: Re: How to make a real stand-alone system?
PostPosted: Tue Feb 19, 2013 2:07 pm 
Offline
Member
Member
User avatar

Joined: Thu Jul 12, 2012 7:29 am
Posts: 721
Location: Tallinn, Estonia
Antti wrote:
The boot sector must contain a command line interpreter that is capable of receiving written machine code and executing it. When that is possible, there should be no limits of what can be done. Then you just start typing machine code. It is possible to do bigger "second stage" and write everything on disk (e.g. port I/O) and then reboot. Then things can go a little further again.

Of course there is no sense doing this but it would be a nice theoretical project.


This is exactly what this forum dweller DavidCooper did. Look up his posts, he has some nice information on how it was happening. He will probably be happy to reiterate it here with more details.

_________________
Learn to read.


Top
 Profile  
 
 Post subject: Re: How to make a real stand-alone system?
PostPosted: Tue Feb 19, 2013 2:13 pm 
Offline
Member
Member

Joined: Thu Jul 05, 2012 5:12 am
Posts: 921
Location: Finland
cxnuk wrote:
im not sure what your suggesting or asking?


I should have been more clear about it. I am not asking anything specific but I just try to think how that procedure would work.

First thing to do is to get rid of the machine code programming. The actual OS developing is not very high priority at first. Some kind of programming environment with a primitive assembler should be programmed in machine language.

dozniak wrote:
exactly what this forum dweller DavidCooper did


Thank you. I was almost sure that someone has tried this.

_________________
Undefined behavior since 2012


Last edited by Antti on Tue Feb 19, 2013 2:21 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: How to make a real stand-alone system?
PostPosted: Tue Feb 19, 2013 2:20 pm 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3344
Location: Chichester, UK
Surely all you need to start with is a command line that can accept two-digit hex numbers and store them in a file. That allows you to enter more complicated programs so you can work your way up to a proper editor and assembler. That's how I started assembler programming more years ago than I care to remember. Of course, it's a little more complicated with a modern processor than it was with a 6502; but the principle is the same.


Top
 Profile  
 
 Post subject: Re: How to make a real stand-alone system?
PostPosted: Tue Feb 19, 2013 2:40 pm 
Offline
Member
Member

Joined: Thu Jul 05, 2012 5:12 am
Posts: 921
Location: Finland
I did not remember DavidCooper until I checked his post just a minute ago and saw the MSB-OS in his signature. Yes of course, I visited his web-site a while ago but I did not pay attention to this issue then.

_________________
Undefined behavior since 2012


Top
 Profile  
 
 Post subject: Re: How to make a real stand-alone system?
PostPosted: Tue Feb 19, 2013 4:45 pm 
Offline
Member
Member

Joined: Wed Oct 01, 2008 1:55 pm
Posts: 2198
iansjack wrote:
Surely all you need to start with is a command line that can accept two-digit hex numbers and store them in a file. That allows you to enter more complicated programs so you can work your way up to a proper editor and assembler. That's how I started assembler programming more years ago than I care to remember. Of course, it's a little more complicated with a modern processor than it was with a 6502; but the principle is the same.


Me too, but with Z80. I still know a few of the hex-codes for Z80. :)


Top
 Profile  
 
 Post subject: Re: How to make a real stand-alone system?
PostPosted: Wed Feb 20, 2013 7:00 am 
Offline
Member
Member
User avatar

Joined: Thu Nov 03, 2011 9:30 am
Posts: 143
@OP: You may want to look into Forth systems. They're something more than you described, though still quite minimal.

_________________
http://sandras.systems


Top
 Profile  
 
 Post subject: Re: How to make a real stand-alone system?
PostPosted: Wed Feb 20, 2013 12:34 pm 
Offline
Member
Member
User avatar

Joined: Wed Oct 27, 2010 4:53 pm
Posts: 1005
Location: Scotland
dozniak wrote:
This is exactly what this forum dweller DavidCooper did. Look up his posts, he has some nice information on how it was happening. He will probably be happy to reiterate it here with more details.

I didn't do it exactly like that, though in difficulty terms it was equivalent. I built my OS in data statements within Qbasic, starting with code to communicate with the FDC chip and then adding more to handle an indexing system to make machine code programming manageable (so that addresses and jump distances are automatically corrected whenever code gets moved around). It took a good many weeks (or maybe even months - it's too long ago to remember now) to make the jump away from Qbasic to getting my OS to boot, load, modify and save itself. [I also did the same thing previously with a Z80 machine, but it always booted through Basic, and it certainly took months rather than weeks.]

What Antti is suggesting sounds fully possible though - it wouldn't take a lot of bootsector space to load in a huge number of sectors and then to save them back to disk when a particular key is pressed as the BIOS does most of the work, and the only other thing you'd need is code to display and edit a byte of memory, plus a little more code to change which byte is being viewed/edited. By leaving gaps between all the chunks of the code you then go on to write through this system, you'd have have plenty of room to be able to edit that code without having to move all the rest of the code beyond it at every step, so it would be easy enough then to build up all the functionality required to create a more advanced OS - that's practically what I did when building things in data statements, though it would be a lot more awkward if you're restricted to viewing one byte at a time. I'm sure there's enough room to display a lot more memory at a time though, so you probably could create something within a bootsector which would be more efficient than the way I worked through Qbasic. If I had used the BIOS for loading and saving instead of talking directly to the FDC chip, I might well have done it that way instead of using Qbasic.

It's a neat idea though to make a bootsector which is capable of building an OS without any outside assistance. If anyone wants to try it, I'd advise them to write it in such a way that it can load and save through both CHS and LBA if there's enough room to code for that as well - checking the value in DL should be enough to decide which it uses, though I'd avoid using it extensively on a flash drive as it would always save to the same location on the drive and could wear it out while using only a fraction of a percent of it, so it would be best to use it with real floppy disks or disk images in an emulator. [Edit: using floppy disks (or images of) also allows you to save multiple copies easily, so when things go wrong you can simply start again with the previous version - working on real hardware with a flash drive would leave you completely stuck unless you keep making backups through a hex editor.]

_________________
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming


Top
 Profile  
 
 Post subject: Re: How to make a real stand-alone system?
PostPosted: Thu Feb 28, 2013 7:05 pm 
Offline
Member
Member
User avatar

Joined: Wed Oct 27, 2010 4:53 pm
Posts: 1005
Location: Scotland
Introducing BwtSecOS, a stand-alone boot sector operating system which can modify and save extended versions of itself (though the boot sector itself does not change):-

Code:
EB 64 90 42 77 74 53 65 63 4F 53 76 62 72 29 7C 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7E 00 01 02 11 00 A0 01 01 01 12 00 C4 00 02 01 12 00 E8 01 02 01 0C FF E4 64 24 01 75 06 33 C9 E2 FE EB F4 B5 01 E2 FE E4 60 CB BF C2 7C FE 05 FB 57 9A 68 7C 00 00 5F FE 0D FA C3 EB 6A A1 0E 7C 96 AC 3C FF 72 01 CB 8A E0 B0 00 A3 16 7C 8E C0 8A 44 01 66 33 C9 3C 00 74 02 B1 12 33 C0 8A 44 03 03 C8 8A 44 02 8B D0 B2 24 F7 E2 03 C8 66 A1 20 7C 66 03 C8 66 49 66 89 0E 18 7C AC 8A E0 B0 00 A3 14 7C 93 AC 8A E0 A0 28 7C 92 AC 50 8A E0 AC 91 AC A2 12 7C B4 02 60 BE 10 7C CD 13 72 27 61 58 E8 04 00 EB 9A EB 2A 56 91 33 C0 8E D8 BF 00 8F B8 00 B0 8E C0 91 04 30 AA 5E C3 50 E4 60 3C 01 58 74 07 EB D1 3C 00 61 74 F1 58 B0 CE EB D1 00 7E 33 C0 8E D8 8E D0 BC 00 7C 92 A2 28 7C 3C 00 74 05 B0 42 A2 C2 7C BE 10 7C 1E 9A 68 7C 00 00 1F FA A1 00 7E 3C 90 75 03 E8 D7 00 B8 00 B0 8E C0 9A 42 7C 00 00 3C 41 74 EF 3C 3F 75 07 1E E8 16 FF 1F EB E7 BE FC 7C 8B DE 3C 4D 75 04 FF 04 EB 06 3C 4B 75 04 FF 0C EB 08 3C 2D 75 06 AD 96 FE 04 EB 08 3C 2C 75 06 AD 96 FE 0C EB 09 3C 23 75 05 BF 0A 7C FE 05 90 90 90 8B F3 AD 96 B8 FA 00 BF 00 80 2B F0 B9 F4 01 B4 0B A0 0A 7C 24 01 75 43 AC 8A D0 2C 64 72 0F 8A D0 2C 64 72 05 92 B0 32 EB 06 B0 31 EB 02 B0 20 AB 92 BB 00 0B 3C 0A 72 05 43 2C 0A EB F7 93 3C 00 75 07 92 3C 20 74 04 B0 00 04 30 AB 93 04 30 AB B0 20 AB E2 C2 EB 22 B0 20 AB AC 50 C0 E8 04 04 30 3C 3A 72 02 04 07 AB 58 24 0F 04 30 3C 3A 72 02 04 07 AB B0 20 AB E2 E0 BF D1 87 B0 0C AA 47 AA 47 AA E9 30 FF 55 AA


I'm hoping you can just copy and paste that into a hex editor to make a disk image (it may work better if you do the "reply with quote" thing first and copy from there). If that doesn't work, I'll make .bin files available somewhere. You probably want to start with an empty floppy disk image first, and it will be easier to work with when you run it if you've filled at least the first part of track 1 with zeros (4A00 onwards).

You can also paste this extension at 4A00 (the start of the second track, track 1):-

Code:
F5 EB 25 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 B8 D9 00 A3 75 7D B0 E8 A2 74 7D C3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3C 48 75 08 8B 04 2D 14 00 89 04 C3 3C 50 75 08 8B 04 05 14 00 89 04 C3 C3


This estension was written using BwtSecOS itself and enhances its capability, as you'll see if you run the OS in Bochs or Qemu. It also runs on real hardware off real floppy disks and off flash/hard drives. If you put it at the start of a partition, you'll need to write the LBA location at byte 20h.

What exactly does it do? It loads in lots of sectors from disk to fill the space from 7E00 to FFFF, and when you press F5 it saves them all back to disk. The sectors where it stores all that start at sector 1 on track 1 and continue up from there in order and without any gaps. The cursor initially indicates the byte at 7E00 to show that it's the one available for modification, but you can change that using the cursor keys, though only left and right are initially supported. If you put the extension code on the disk at 4A00 you'll find that the up and down keys start working after F7 is pressed and the OS instantly becomes a lot easier to use.

To change the value of a byte, use the z and x keys, but it's best not to do that to any of the bytes in the boot sector (or the parts of the extension that aren't empty space) as it'll probably cause a crash. These keys simply decrease or increase the value, so it isn't the fastest way to write code, but that doesn't matter for two reasons: firstly that it works; and secondly that you can easily write code to handle number and letter key input to write values directly to the byte under the cursor. The next improvement to add after that would be to display the address of the byte under the cursor so that you can easily see where you are.

F7 calls the code at 7E00, though it helps if there is any code there to run - don't do it without the extension in place or without putting code of your own there. If the byte at 7E00 is 144 (90h - a nop), the code there will run automatically on booting.

Pressing h will toggle between decimal and hex mode.

The code that does the loading and saving can be adapted to load and save from anywhere else on the disk by pointing the variable at 0E (containing a two-byte address) at a different list of data, the data consisting of groups of 6 bytes with an FF terminating the list. The format of these 6-byte groups is as follows: most sig. byte of dest./source segment; most sig. byte of dest./source address; head no.; track no.; start sector no.; number of sectors. The load routine can then be called using a far call to the address 7C68 and the save routine can be called using a near call to the address 7C55, or alternatively you can inc the read/write value at 7CC2 and do a far call to 7C68 instead, but you'll also have to dec it back afterwards.

The interrupts are disabled except during loading and saving (though you can enable them whenever you like), and that's because I've set it to get key input by polling port 64h and to read raw key data from port 60h. The routine which does that can be run with a far call to 7C42, returning the key input in AL (but it won't work with interrupts enabled).

_________________
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming


Top
 Profile  
 
 Post subject: Re: How to make a real stand-alone system?
PostPosted: Fri Mar 01, 2013 4:18 am 
Offline
Member
Member
User avatar

Joined: Thu Jul 12, 2012 7:29 am
Posts: 721
Location: Tallinn, Estonia
DavidCooper wrote:
Introducing BwtSecOS


You have instant win in the 512-byte OS contest. How do I upvote the post?

_________________
Learn to read.


Top
 Profile  
 
 Post subject: Re: How to make a real stand-alone system?
PostPosted: Fri Mar 01, 2013 7:28 am 
Offline
Member
Member
User avatar

Joined: Sat Oct 23, 2004 11:00 pm
Posts: 1220
Location: Sweden
Hehe, yeah that is pretty impressive. I think I saw something similar on the fasm board's 512b contest a few years back.

_________________
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub


Top
 Profile  
 
 Post subject: Re: How to make a real stand-alone system?
PostPosted: Fri Mar 01, 2013 12:20 pm 
Offline
Member
Member
User avatar

Joined: Wed Oct 27, 2010 4:53 pm
Posts: 1005
Location: Scotland
Thanks for that feedback.

One correction is needed: I said it saves the data to the start of the 2nd track (track 1), but it actually starts at sector 2, leaving room to store a replacement boot sector in front of it. That isn't deliberate - I just used my existing boot sector and replaced the second half of the sector with new code, as well as adding save and key-reading routines near the start in place of further load data (which loads the directory track and another OS code module between 0800h and 7800h).

If anyone wants to see a commented version, feel free to stick the boot sector through a disassembler and post the result here so that I can copy it and add comments - I don't know how to disassemble code for myself.

_________________
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming


Top
 Profile  
 
 Post subject: Re: How to make a real stand-alone system?
PostPosted: Mon Mar 04, 2013 12:45 pm 
Offline
Member
Member

Joined: Sat Oct 22, 2011 12:27 pm
Posts: 409
DavidCooper wrote:
I don't know how to disassemble code for myself.

ndisasm -b [16, 32, 64] file > out.lst

Code:
; bootsector
00000000  EB64              jmp short 0x66
00000002  90                nop
00000003  42                inc dx
00000004  7774              ja 0x7a
00000006  53                push bx
00000007  65634F53          arpl [gs:bx+0x53],cx
0000000B  7662              jna 0x6f
0000000D  7229              jc 0x38
0000000F  7C10              jl 0x21
00000011  0000              add [bx+si],al
00000013  0000              add [bx+si],al
00000015  0000              add [bx+si],al
00000017  0000              add [bx+si],al
00000019  0000              add [bx+si],al
0000001B  0000              add [bx+si],al
0000001D  0000              add [bx+si],al
0000001F  0000              add [bx+si],al
00000021  0000              add [bx+si],al
00000023  0000              add [bx+si],al
00000025  0000              add [bx+si],al
00000027  0000              add [bx+si],al
00000029  007E00            add [bp+0x0],bh
0000002C  0102              add [bp+si],ax
0000002E  1100              adc [bx+si],ax
00000030  A00101            mov al,[0x101]
00000033  0112              add [bp+si],dx
00000035  00C4              add ah,al
00000037  0002              add [bp+si],al
00000039  0112              add [bp+si],dx
0000003B  00E8              add al,ch
0000003D  0102              add [bp+si],ax
0000003F  010C              add [si],cx
00000041  FFE4              jmp sp
00000043  642401            fs and al,0x1
00000046  7506              jnz 0x4e
00000048  33C9              xor cx,cx
0000004A  E2FE              loop 0x4a
0000004C  EBF4              jmp short 0x42
0000004E  B501              mov ch,0x1
00000050  E2FE              loop 0x50
00000052  E460              in al,0x60
00000054  CB                retf
00000055  BFC27C            mov di,0x7cc2
00000058  FE05              inc byte [di]
0000005A  FB                sti
0000005B  57                push di
0000005C  9A687C0000        call word 0x0:0x7c68
00000061  5F                pop di
00000062  FE0D              dec byte [di]
00000064  FA                cli
00000065  C3                ret
00000066  EB6A              jmp short 0xd2
00000068  A10E7C            mov ax,[0x7c0e]
0000006B  96                xchg ax,si
0000006C  AC                lodsb
0000006D  3CFF              cmp al,0xff
0000006F  7201              jc 0x72
00000071  CB                retf
00000072  8AE0              mov ah,al
00000074  B000              mov al,0x0
00000076  A3167C            mov [0x7c16],ax
00000079  8EC0              mov es,ax
0000007B  8A4401            mov al,[si+0x1]
0000007E  6633C9            xor ecx,ecx
00000081  3C00              cmp al,0x0
00000083  7402              jz 0x87
00000085  B112              mov cl,0x12
00000087  33C0              xor ax,ax
00000089  8A4403            mov al,[si+0x3]
0000008C  03C8              add cx,ax
0000008E  8A4402            mov al,[si+0x2]
00000091  8BD0              mov dx,ax
00000093  B224              mov dl,0x24
00000095  F7E2              mul dx
00000097  03C8              add cx,ax
00000099  66A1207C          mov eax,[0x7c20]
0000009D  6603C8            add ecx,eax
000000A0  6649              dec ecx
000000A2  66890E187C        mov [0x7c18],ecx
000000A7  AC                lodsb
000000A8  8AE0              mov ah,al
000000AA  B000              mov al,0x0
000000AC  A3147C            mov [0x7c14],ax
000000AF  93                xchg ax,bx
000000B0  AC                lodsb
000000B1  8AE0              mov ah,al
000000B3  A0287C            mov al,[0x7c28]
000000B6  92                xchg ax,dx
000000B7  AC                lodsb
000000B8  50                push ax
000000B9  8AE0              mov ah,al
000000BB  AC                lodsb
000000BC  91                xchg ax,cx
000000BD  AC                lodsb
000000BE  A2127C            mov [0x7c12],al
000000C1  B402              mov ah,0x2
000000C3  60                pushaw
000000C4  BE107C            mov si,0x7c10
000000C7  CD13              int 0x13
000000C9  7227              jc 0xf2
000000CB  61                popaw
000000CC  58                pop ax
000000CD  E80400            call word 0xd4
000000D0  EB9A              jmp short 0x6c
000000D2  EB2A              jmp short 0xfe
000000D4  56                push si
000000D5  91                xchg ax,cx
000000D6  33C0              xor ax,ax
000000D8  8ED8              mov ds,ax
000000DA  BF008F            mov di,0x8f00
000000DD  B800B0            mov ax,0xb000
000000E0  8EC0              mov es,ax
000000E2  91                xchg ax,cx
000000E3  0430              add al,0x30
000000E5  AA                stosb
000000E6  5E                pop si
000000E7  C3                ret
000000E8  50                push ax
000000E9  E460              in al,0x60
000000EB  3C01              cmp al,0x1
000000ED  58                pop ax
000000EE  7407              jz 0xf7
000000F0  EBD1              jmp short 0xc3
000000F2  3C00              cmp al,0x0
000000F4  61                popaw
000000F5  74F1              jz 0xe8
000000F7  58                pop ax
000000F8  B0CE              mov al,0xce
000000FA  EBD1              jmp short 0xcd
000000FC  007E33            add [bp+0x33],bh
000000FF  C08ED88ED0        ror byte [bp-0x7128],0xd0
00000104  BC007C            mov sp,0x7c00
00000107  92                xchg ax,dx
00000108  A2287C            mov [0x7c28],al
0000010B  3C00              cmp al,0x0
0000010D  7405              jz 0x114
0000010F  B042              mov al,0x42
00000111  A2C27C            mov [0x7cc2],al
00000114  BE107C            mov si,0x7c10
00000117  1E                push ds
00000118  9A687C0000        call word 0x0:0x7c68
0000011D  1F                pop ds
0000011E  FA                cli
0000011F  A1007E            mov ax,[0x7e00]
00000122  3C90              cmp al,0x90
00000124  7503              jnz 0x129
00000126  E8D700            call word 0x200
00000129  B800B0            mov ax,0xb000
0000012C  8EC0              mov es,ax
0000012E  9A427C0000        call word 0x0:0x7c42
00000133  3C41              cmp al,0x41
00000135  74EF              jz 0x126
00000137  3C3F              cmp al,0x3f
00000139  7507              jnz 0x142
0000013B  1E                push ds
0000013C  E816FF            call word 0x55
0000013F  1F                pop ds
00000140  EBE7              jmp short 0x129
00000142  BEFC7C            mov si,0x7cfc
00000145  8BDE              mov bx,si
00000147  3C4D              cmp al,0x4d
00000149  7504              jnz 0x14f
0000014B  FF04              inc word [si]
0000014D  EB06              jmp short 0x155
0000014F  3C4B              cmp al,0x4b
00000151  7504              jnz 0x157
00000153  FF0C              dec word [si]
00000155  EB08              jmp short 0x15f
00000157  3C2D              cmp al,0x2d
00000159  7506              jnz 0x161
0000015B  AD                lodsw
0000015C  96                xchg ax,si
0000015D  FE04              inc byte [si]
0000015F  EB08              jmp short 0x169
00000161  3C2C              cmp al,0x2c
00000163  7506              jnz 0x16b
00000165  AD                lodsw
00000166  96                xchg ax,si
00000167  FE0C              dec byte [si]
00000169  EB09              jmp short 0x174
0000016B  3C23              cmp al,0x23
0000016D  7505              jnz 0x174
0000016F  BF0A7C            mov di,0x7c0a
00000172  FE05              inc byte [di]
00000174  90                nop
00000175  90                nop
00000176  90                nop
00000177  8BF3              mov si,bx
00000179  AD                lodsw
0000017A  96                xchg ax,si
0000017B  B8FA00            mov ax,0xfa
0000017E  BF0080            mov di,0x8000
00000181  2BF0              sub si,ax
00000183  B9F401            mov cx,0x1f4
00000186  B40B              mov ah,0xb
00000188  A00A7C            mov al,[0x7c0a]
0000018B  2401              and al,0x1
0000018D  7543              jnz 0x1d2
0000018F  AC                lodsb
00000190  8AD0              mov dl,al
00000192  2C64              sub al,0x64
00000194  720F              jc 0x1a5
00000196  8AD0              mov dl,al
00000198  2C64              sub al,0x64
0000019A  7205              jc 0x1a1
0000019C  92                xchg ax,dx
0000019D  B032              mov al,0x32
0000019F  EB06              jmp short 0x1a7
000001A1  B031              mov al,0x31
000001A3  EB02              jmp short 0x1a7
000001A5  B020              mov al,0x20
000001A7  AB                stosw
000001A8  92                xchg ax,dx
000001A9  BB000B            mov bx,0xb00
000001AC  3C0A              cmp al,0xa
000001AE  7205              jc 0x1b5
000001B0  43                inc bx
000001B1  2C0A              sub al,0xa
000001B3  EBF7              jmp short 0x1ac
000001B5  93                xchg ax,bx
000001B6  3C00              cmp al,0x0
000001B8  7507              jnz 0x1c1
000001BA  92                xchg ax,dx
000001BB  3C20              cmp al,0x20
000001BD  7404              jz 0x1c3
000001BF  B000              mov al,0x0
000001C1  0430              add al,0x30
000001C3  AB                stosw
000001C4  93                xchg ax,bx
000001C5  0430              add al,0x30
000001C7  AB                stosw
000001C8  B020              mov al,0x20
000001CA  AB                stosw
000001CB  E2C2              loop 0x18f
000001CD  EB22              jmp short 0x1f1
000001CF  B020              mov al,0x20
000001D1  AB                stosw
000001D2  AC                lodsb
000001D3  50                push ax
000001D4  C0E804            shr al,0x4
000001D7  0430              add al,0x30
000001D9  3C3A              cmp al,0x3a
000001DB  7202              jc 0x1df
000001DD  0407              add al,0x7
000001DF  AB                stosw
000001E0  58                pop ax
000001E1  240F              and al,0xf
000001E3  0430              add al,0x30
000001E5  3C3A              cmp al,0x3a
000001E7  7202              jc 0x1eb
000001E9  0407              add al,0x7
000001EB  AB                stosw
000001EC  B020              mov al,0x20
000001EE  AB                stosw
000001EF  E2E0              loop 0x1d1
000001F1  BFD187            mov di,0x87d1
000001F4  B00C              mov al,0xc
000001F6  AA                stosb
000001F7  47                inc di
000001F8  AA                stosb
000001F9  47                inc di
000001FA  AA                stosb
000001FB  E930FF            jmp word 0x12e
000001FE  55                push bp
000001FF  AA                stosb

Code:
; extension
00000000  F5                cmc
00000001  EB25              jmp short 0x28
00000003  0000              add [bx+si],al
00000005  0000              add [bx+si],al
00000007  0000              add [bx+si],al
00000009  0000              add [bx+si],al
0000000B  0000              add [bx+si],al
0000000D  0000              add [bx+si],al
0000000F  0000              add [bx+si],al
00000011  0000              add [bx+si],al
00000013  0000              add [bx+si],al
00000015  0000              add [bx+si],al
00000017  0000              add [bx+si],al
00000019  0000              add [bx+si],al
0000001B  0000              add [bx+si],al
0000001D  0000              add [bx+si],al
0000001F  0000              add [bx+si],al
00000021  0000              add [bx+si],al
00000023  0000              add [bx+si],al
00000025  0000              add [bx+si],al
00000027  00B8D900          add [bx+si+0xd9],bh
0000002B  A3757D            mov [0x7d75],ax
0000002E  B0E8              mov al,0xe8
00000030  A2747D            mov [0x7d74],al
00000033  C3                ret
00000034  0000              add [bx+si],al
00000036  0000              add [bx+si],al
00000038  0000              add [bx+si],al
0000003A  0000              add [bx+si],al
0000003C  0000              add [bx+si],al
0000003E  0000              add [bx+si],al
00000040  0000              add [bx+si],al
00000042  0000              add [bx+si],al
00000044  0000              add [bx+si],al
00000046  0000              add [bx+si],al
00000048  0000              add [bx+si],al
0000004A  0000              add [bx+si],al
0000004C  0000              add [bx+si],al
0000004E  0000              add [bx+si],al
00000050  3C48              cmp al,0x48
00000052  7508              jnz 0x5c
00000054  8B04              mov ax,[si]
00000056  2D1400            sub ax,0x14
00000059  8904              mov [si],ax
0000005B  C3                ret
0000005C  3C50              cmp al,0x50
0000005E  7508              jnz 0x68
00000060  8B04              mov ax,[si]
00000062  051400            add ax,0x14
00000065  8904              mov [si],ax
00000067  C3                ret
00000068  C3                ret

_________________
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.


Top
 Profile  
 
 Post subject: Re: How to make a real stand-alone system?
PostPosted: Mon Mar 04, 2013 5:32 pm 
Offline
Member
Member
User avatar

Joined: Thu Jul 12, 2012 7:29 am
Posts: 721
Location: Tallinn, Estonia
m12 wrote:
ndisasm -b [16, 32, 64] file > out.lst


You do realise that you've posted mostly wrong crap? Not everything in the bootsector is code, x86 assembly might look totally different if you accidentally start disassembling at the wrong offset.

iow: don't do this again.

_________________
Learn to read.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 35 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group