flat assembler
Message board for the users of flat assembler.
Index
> Main > Is possible to write an OS with Flat assembler? (_64BIT) Goto page 1, 2 Next |
Author |
|
antos 13 Jul 2016, 20:10
And i am not saying about C/C++ Macro like variables, i am saying about runtime declared variables.
|
|||
13 Jul 2016, 20:10 |
|
JohnFound 13 Jul 2016, 20:33
Yes it is possible. Actually FASM is the best assembler for writing new OS, because it is very easy portable and this way the new OS will become self hosting very early.
More, there are already several OSes written with FASM - MenuetOS, KolibriOS(fork of Menuet), MikeOS and probably other I can't remember right now. But, still writing OS is very serious and hard task. You probably will need to learn assembly language programming and computer architecture first. Learning assembly language you can start with reading FASM manual (in every FASM package downloaded) and trying to compile, run and modify some of the included examples. |
|||
13 Jul 2016, 20:33 |
|
antos 13 Jul 2016, 21:30
And i need use which flags when compile my code? You know, i will not compile my code for an OS.
|
|||
13 Jul 2016, 21:30 |
|
revolution 14 Jul 2016, 02:08
antos: fasm doesn't use command line flags to control the assembly output. You use the "format" directive within the source code to define the output. This is also the same for 16-bit, 32-bit and 64-bit encodings, you use directives within the source code to select the encoding (code16, code32 and code64 respectively).
|
|||
14 Jul 2016, 02:08 |
|
antos 14 Jul 2016, 10:09
Thanks, i have a last question: i was reading x86-64 Machine-Level Programming book. And i see this line:
Much of (?) the program state is held in registers rather than on the stack. Integer and pointer procedure arguments (up to 6) are passed via registers. Some procedures do not need to access the stack at all. I know function arguments stored in register else of stack frame in x86-64 Assembly. What is stack frame exactly and what "Much of the program state" and "Some procedures do not need to access the stack at all" means? And how long double variable type can store much than 64 bits? |
|||
14 Jul 2016, 10:09 |
|
Trinitek 14 Jul 2016, 12:53
A stack frame contains the arguments that are passed to a function and the function's local variables. Depending on the function, it may not have enough local variables to require the use of any of the local variable space provided by the stack frame, and it can use the registers to store them instead.
There are special FPU registers that are able to work with values wider than 64-bits. |
|||
14 Jul 2016, 12:53 |
|
antos 14 Jul 2016, 16:07
I know this is an unneedful question but: Is Floating Point Unit in ALU?
And can i write a Graphics API like OpenGL or Vulkan? |
|||
14 Jul 2016, 16:07 |
|
revolution 14 Jul 2016, 16:14
The FPU is usually a separate unit from the ALU. Such internal details will be different for each CPU model and CPU make, and could change radically in future designs, and have changed radically from past designs. But such internal details shouldn't really be too much of a concern unless you are deep into optimisation.
You can write any API you wish to in assembly. But for GPUs and the like, obtaining the necessary internal details to write the code against will be a difficult task. |
|||
14 Jul 2016, 16:14 |
|
DOS386 16 Jul 2016, 08:47
|
|||
16 Jul 2016, 08:47 |
|
antos 16 Jul 2016, 12:29
I know this hard as hell. OS development needs organization, one person can't do anything interesting. But Linux 0.01 wrote by only one person. Invent the wheel again, but do it better from the first wheel.
|
|||
16 Jul 2016, 12:29 |
|
antos 16 Jul 2016, 13:16
And:
the second byte (?) of registers %rax,%rcx , %rdx, and %rbx can be directly accessed by instructions having single-byte operands. What second byte means? I know single-byte operands: "MOVB 5, %AX". |
|||
16 Jul 2016, 13:16 |
|
ManOfSteel 17 Jul 2016, 08:34
antos wrote: What second byte means? I know single-byte operands: "MOVB 5, %AX". Perhaps you're referring to the low and high bytes (al and ah)? |
|||
17 Jul 2016, 08:34 |
|
antos 17 Jul 2016, 10:49
ManOfSteel wrote:
Okey. I got, but 64 bit and 32 bit registers does not have low and high bytes like 16 bit registers, or is it? Can you give a example prograrm? _________________ V0.01 |
|||
17 Jul 2016, 10:49 |
|
antos 17 Jul 2016, 15:28
UP UP UP
|
|||
17 Jul 2016, 15:28 |
|
Trinitek 17 Jul 2016, 19:09
EAX access the lower end of RAX. There is no register that accesses the higher end of RAX.
AX access the lower end of EAX. There is no register that accesses the higher end of EAX. AL accesses the lower end of AX. AH accesses the higher end of AX. This applies to all of the other general purpose registers. See: https://en.wikipedia.org/wiki/X86#/media/File:Table_of_x86_Registers_svg.svg |
|||
17 Jul 2016, 19:09 |
|
antos 17 Jul 2016, 22:01
Trinitek wrote: EAX access the lower end of RAX. There is no register that accesses the higher end of RAX. Well, we can not access directly to higher end of these register, but maybe we can access it indirect. Like this: SUB AX, AX ;AX equal to 1 BSWAP EAX ;And we change the value of higher end of EAX, and lower end too Is it possible? _________________ V0.01 |
|||
17 Jul 2016, 22:01 |
|
Trinitek 17 Jul 2016, 22:21
antos wrote: Well, we can not access directly to higher end of these register, but maybe we can access it indirect. Like this: |
|||
17 Jul 2016, 22:21 |
|
revolution 17 Jul 2016, 23:41
Trinitek wrote: ... or you could rotate the register with RTL or RTR, ... |
|||
17 Jul 2016, 23:41 |
|
Trinitek 18 Jul 2016, 02:33
revolution wrote:
|
|||
18 Jul 2016, 02:33 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.