Recent Posts

Pages: 1 [2] 3 4 ... 10
11
Example Code / Re: RE: 64-bit MBR
« Last post by fredericopissarra on April 08, 2019, 01:48:37 AM »
12
Example Code / Re: RE: 64-bit MBR
« Last post by wolverine79936 on April 06, 2019, 06:36:38 PM »
Thank you for the input, @fredericopissarra. :) I think for me, MBR aside, the idea of writing an OS in ASM is a challenge and I really enjoy challenges when I can make progress on them. As far as the MBR, I know of UEFI, I have a UEFI BIOS, but I haven't spent much time on the UEFI topic so wasn't aware that it could do all of that FOR me. That's really cool. I'll definitely check it out. Thanks again, @fredericopissarra.
13
Example Code / Re: RE: 64-bit MBR
« Last post by fredericopissarra on April 06, 2019, 04:24:00 PM »
Thank you very much for the information, fredericopissarra. My understanding of what you just wrote is that the MBR is a 16-bit environment.

You're welcome! But why use MBR? You could develop your bootloader using UEFI and avoid the restriction of space (MBR is 1 sector long, 512 bytes, always) and let UEFI setup the protected mode for you (including long mode)... This kind of bootloader can be as big as you want, using graphics, network, etc...

I also meant to ask if anyone knows of someone who has successfully written an all ASM OS or if they all just switched over to a higher language as soon as they were done with their MBR...?

Well... you can do it, but, in my experience, using C is better, since the compiler otimizes the code better than you and I could do manually... Let ASM for high performance functions only (or small inline functions)...
14
Example Code / Re: RE: 64-bit MBR
« Last post by wolverine79936 on April 06, 2019, 01:25:12 AM »
Thank you very much for the information, fredericopissarra. My understanding of what you just wrote is that the MBR is a 16-bit environment. And now that I know that, that is very useful. I'll just finish touching up my MBR and then go ahead and start working on my kernel from whence I should be able to start making output and input finally. :)

I also meant to ask if anyone knows of someone who has successfully written an all ASM OS or if they all just switched over to a higher language as soon as they were done with their MBR...?
15
Example Code / Re: RE: 64-bit MBR
« Last post by fredericopissarra on April 05, 2019, 09:34:24 PM »
First, MBR is executed in REAL mode, always. Not even protected mode...

There are no "syscalls" but bios calls, via INT instruction.

There is two ways to write a string to the screen on MBR: Directly or using INT 0x10/AH=0x0e (See Ralph Brownn's Interrupt List).

Direct way: If you initialize the mode 3, via:
Code: [Select]
mov ax,3
int 0x10
You can write directly to segment 0xb800, offset 0. Each word is char/attribute. See IBM VGA manual, "Video Memory Organization" chapter.

Using BIOS:
Code: [Select]
; void puts( char * );
; Entry: DS:SI = asciiz string ptr.
; Destroys: AX, BX, SI and BP.
puts:
  mov ah,0x0e
  mov bx,7 ; page 0, white color.
.loop:
  lodsb
  test al,al
  jz   .exit
  int  0x10
  jmp .loop
.exit:
  ret
16
Example Code / RE: 64-bit MBR
« Last post by wolverine79936 on April 04, 2019, 09:10:51 PM »
Good afternoon, everyone.  ;D I have decided to start doing tons of research and work in regards to a operating system. I know, major undertaking, but I am familiar with C/C++ and wanted to learn ASM finally.

My question is quite simple: How in the world do I print to the screen without the BIOS or syscall?!?!?! I've been to like a million different websites searching specifically for 64-bit ASM and 64-bit MBR source code and everything I have found and tried simply doesn't work.

Now, I know y'all are going to need to see my code, but I'm not entirely comfortable putting a whole lot of it up right now. So, I'm going to do my best to explain how I got to the snippet in question and what is meant to happen after the snippet...

So, I set ORG 0x7c00 and tell NASM I need this part of my MBR to run in 16-bit mode. Then I ensure that I am loading at 0x7c00 instead of 0x7c00:0x0000. Then I clear out all the registers in 16-bit mode.

Here is the snippet that I am having trouble with:
Code: [Select]
BITS 64                 ; We are now switching the processor over to long mode. YAY! Progress. Personal joke.
    mov rax, 1
    mov rdi, 1
    mov rsi, msg
    mov rdx, msglen
   
msg: db 'Blah blah blah.',10
msglen: equ $ - msg

Now, after that is just the standard first 512b of padding and the boot signature at the end of the sector.

I have tried writing the 64-bit snippet with BIOS calls and got nowhere. I tried writing it with syscall and obviously that got me nowhere. I tried dropping BIOS interrupts and syscalls from this snippet and snill no dice. I assemble my source code for my mbr and then I write it to the first 512b of a floppy disk image and boot it into Oracle VirtualBox. I have tried a 16-bit mbr and was able to print through BIOS calls. So please, if anyone knows how to fix my issue and is willing to help me, it would be greatly appreciated. :)
17
Example Code / Re: How to add NASM to `Path` environment variable in Windows 10
« Last post by Clay on April 04, 2019, 02:38:04 AM »
This is even a better site to see in detail how to set your path in Windows 10.

Add to the PATH on Windows 10
https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/

And if you are using Microsoft Visual Studio to get a  C compiler for the NASM .obj files, and want to use their fairly new Powershell command tool rather than the DOS Visual Studio command prompt, you may want to add the directory where their cl.exe is located. Actually there four directories, depending if it is x64 or x86 AND Hostx64 or Hostx86. Quite a maze to navigate the path but using Powershell with it's BASH style command in addition to DOS is a lot better for me. And if truth be known, I have had a lot better luck running NASM on Linux than with Windows.
18
Programming with NASM / sigaction on Mac OS x
« Last post by lea35 on March 31, 2019, 01:20:58 PM »
Hello

is there any source working with SYS_sigaction syscall on Mac OS  ?
I just want to catch SIGINT signal and jump to a NASM function.

Many thanks  :D
19
Example Code / Re: How to add NASM to `Path` environment variable in Windows 10
« Last post by debs3759 on March 31, 2019, 12:17:08 PM »
Cool, I hadn't realised (never tried) you could still do that. I don't like all those coloured stars when I move the mouse on that page though :)
20
Example Code / How to add NASM to `Path` environment variable in Windows 10
« Last post by Clay on March 31, 2019, 07:29:15 AM »
How to add a folder to `Path` environment variable in Windows 10 (with screenshots)

https://stackoverflow.com/questions/44272416/how-to-add-a-folder-to-path-environment-variable-in-windows-10-with-screensho

Good Info. Enables you to call NASM from command line a old DOS shell and the new Windows Power Shell.
Pages: 1 [2] 3 4 ... 10