flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
antos
And i am not saying about C/C++ Macro like variables, i am saying about runtime declared variables.
|
|||
![]() |
|
JohnFound
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. |
|||
![]() |
|
antos
And i need use which flags when compile my code? You know, i will not compile my code for an OS.
|
|||
![]() |
|
revolution
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).
|
|||
![]() |
|
antos
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? |
|||
![]() |
|
Trinitek
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. |
|||
![]() |
|
antos
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? |
|||
![]() |
|
revolution
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. |
|||
![]() |
|
DOS386
|
|||
![]() |
|
antos
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.
|
|||
![]() |
|
antos
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". |
|||
![]() |
|
ManOfSteel
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)? |
|||
![]() |
|
antos
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 |
|||
![]() |
|
antos
UP UP UP
|
|||
![]() |
|
Trinitek
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 |
|||
![]() |
|
antos
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 |
|||
![]() |
|
Trinitek
antos wrote: Well, we can not access directly to higher end of these register, but maybe we can access it indirect. Like this: |
|||
![]() |
|
revolution
Trinitek wrote: ... or you could rotate the register with RTL or RTR, ... |
|||
![]() |
|
Trinitek
revolution wrote:
|
|||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.