flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution
edfed wrote: ... atomic operations, commons to every cpus. |
|||
![]() |
|
edfed
revolution wrote:
the compiler converts every universal instruction in the target specific instruction(s). and any instrcution from any platform can be integrated to th Uasm instruction set, with the translation in all other platforms |
|||
![]() |
|
revolution
Can you give an example?
On first reading it looks like you describe an HLL. |
|||
![]() |
|
edfed
it looks lika hll, but with asm syntax and then, cpu mechanism is not hiden.
mov eax,1 for example is movlw 1 if translated from X86 to pic. and movlw 1 becomes mov eax,1 if pic to x86, or any other register set to be the W register. eax is by default the accumulator in x86. mov regA,regB becomes movf regB,W / movf regA,W with X86 to pic, but of course, the conditionnal assembly can be used to ignore the second instruction if the default accumulator is regA. and so on with every instructions . the work is very huge to make a UASM instruction set, and UASM translations macros, but nothing seems to be impossible. |
|||
![]() |
|
DimonSoft
edfed wrote:
Well, my 2 cents… In fact, if you think about it, it’s a matter of choosing between limited instruction set and low performance. If we start with, say, a set of atomic operations, we lose lots of useful instructions that don’t fall into this category, especially for CISC architectures. If we start adding some equivalents for those, we’ll have to implement them with code pieces on RISC architectures. Which means a tiny instruction that looks like something lightweight (and might be for some CISC architecture) will eventually become slow on some other hardware. Which basically is what we know as HLL, except that they use a set of higher-level primitives which at least gives their compilers the opportunity to optimize not only separate constructs but their combinations as well. Might not be the case if we treat the hypothetic UASM as… um… assembler. Well, obviously, we could balance the set of “universal instructions” to optimize trade-offs for particular tasks. But would it really be universal then? |
|||
![]() |
|
bitshifter
modern hardware has deep pipeline and cache
we need HLL to convert our branches into bitwise ops to batch process pre sorted chunks either we relearn how to program or use HLL even modern gcc can optimize switch cases out if used with constant value i often do think of the perfect language, c is best i have found so far, but it has its quirks too _________________ Coding a 3D game engine with fasm is like trying to eat an elephant, you just have to keep focused and take it one 'byte' at a time. |
|||
![]() |
|
revolution
edfed wrote: it looks lika hll, but with asm syntax and then, cpu mechanism is not hiden. Code: mov reg, 0x1234567890abcdef In ARM32 we can do this: Code: add r0, r1, r2, lsr r3 |
|||
![]() |
|
DimonSoft
bitshifter wrote: c is best i have found so far Until one day you find out type sizes are implementation-defined and may not even be multiples of 8 bits, and radix for floating-point values might some day become 3 or 4 (since it’s defined by the implementation as a symbolic constant in one of the standard h-files), so writing cross-platform code in fair manner becomes a nightmare? As you might guess, I definitely double this: bitshifter wrote: but it has its quirks too |
|||
![]() |
|
edfed
i don't see any limitation to a conditional macro system, else than the huge amount of work for every usecase.
but yes, C is for the moment one of the best ways to make universal code. here, it's asm related topic, meaning universal assembly would be a lot of asm like instructions set. the only part where it would be fine to don't write asm mnemonics is for math expressions. with any operand to be compatible with asm operands. then, eax = eax*[table+ebx*4]/ratio would be possible and be translatable to instructions. maybe the problem here is not really universal asm, but only expression translation to let the programmer write expressions and don't deal with the uber complex job of asm formulaes composition.... |
|||
![]() |
|
revolution
I think assembly language/syntax isn't suited to be universal. That isn't really it's purpose.
Use assembly to exploit the CPU and make good code. Use HLL to make average code that might run on different architectures. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.