AMOS Pro Source Code Is Now Available ... | page 1 2 3 4
|
---|
|
---|
| | Fernando Pereira
Posts 68 29 Sep 2017 09:01
| Thierry Atheist wrote:
|
Fernando Pereira wrote:
| For me, the Vampire project is NOT a mare hobby, it is an opportunity to revive the platform that granted me the best times I ever had in front of a computer screen. It really means a lot to me, hence my frustration. :) |
I am 100% there with you on that!!!!!!! IT'S NOT OVER YET!
|
Thumbs up!
| |
| | Thellier Alain
Posts 143 29 Sep 2017 09:01
| @Thierry ASM is not so complicated There is only 3 mysteries for beginners A) Why use registers ? B) How writing values in memory do something ? C) What do those weirds instructions ? A) You can see registers as variables built-in the CPU So as there are in the CPU you can do operations with the CPU on registers = logical There are 2 kinds of registers data & adresses in the 68000 1) data registers are called d0 to d7 : they could have been called a b c d or x y z but there are called like this :-) You do operations like addition/multiplication on data registers only 2) adress registers are called a0 to a7: they are very similar to arrays as they allow to read/write values in memory So use (say) do d1 for adding two values then you store it in memory with (say) a0 B) Because some special adresse are "custom chip hardware registers" that act as switchs or counters For example there is such a register for "screen background color" or "sprite position x" So when you write differents values in those registers then color or sprite change = simple A book like "the Amiga hardware reference manual" give names/usages of those registers C) There are lots of instrutions but most of them are almost never used The most used are MOVE store a value in memory or register (so do things like x=1; x=y; array[10]=y; ) LEA load an adress in a adress registers for accessing some data in memory or a "custom chip hardware registers" ADD add 2 registers SUB sustract 2 registers MUL multiply 2 registers DIV divide 2 registers CMP compare 2 registers for doing things like "if (x > value)" the previous intructions is often used with a conditionnal branch (same as if(condition) goto) for example BGT is "branch if greater", BEQ "branch if equal" So for doing an "if (x > value) goto label1;" will do a CMP then a BGT label1 Alain Thellier
| |
| | Fernando Pereira
Posts 68 29 Sep 2017 09:21
| thellier alain wrote:
| @Thierry ASM is not so complicated There is only 3 mysteries for beginners A) Why use registers ? B) How writing values in memory do something ? C) What do those weirds instructions ? A) You can see registers as variables built-in the CPU So as there are in the CPU you can do operations with the CPU on registers = logical There are 2 kinds of registers data & adresses in the 68000 1) data registers are called d0 to d7 : they could have been called a b c d or x y z but there are called like this :-) You do operations like addition/multiplication on data registers only 2) adress registers are called a0 to a7: they are very similar to arrays as they allow to read/write values in memory So use (say) do d1 for adding two values then you store it in memory with (say) a0 B) Because some special adresse are "custom chip hardware registers" that act as switchs or counters For example there is such a register for "screen background color" or "sprite position x" So when you write differents values in those registers then color or sprite change = simple A book like "the Amiga hardware reference manual" give names/usages of those registers C) There are lots of instrutions but most of them are almost never used The most used are MOVE store a value in memory or register (so do things like x=1; x=y; array[10]=y; ) LEA load an adress in a adress registers for accessing some data in memory or a "custom chip hardware registers" ADD add 2 registers SUB sustract 2 registers MUL multiply 2 registers DIV divide 2 registers CMP compare 2 registers for doing things like "if (x > value)" the previous intructions is often used with a conditionnal branch (same as if(condition) goto) for example BGT is "branch if greater", BEQ "branch if equal" So for doing an "if (x > value) goto label1;" will do a CMP then a BGT label1 Alain Thellier |
That's actually very informative. But it really pumps turmoil in my brain as how does everything else works. Functions, classes & structs, object types, how could one simulate that in ASM? I understand that my brain is simply formatted to work in mid to high level languages, hence seeing ASM as mandarin. It really begs the question that Thierry previously asked, why not simply having keywords that make far more sense, that could be translated to ASM when compiling? move.w #$3200,BPLCON0 ; three bitplanes move.w #$0000,BPLCON1 ; horizontal scroll 0 move.w #$0050,BPL1MOD ; odd modulo move.w #$0050,BPL2MOD ; even modulo move.w #$2c81,DIWSTRT ; DIWSTRT - topleft corner (2c81) move.w #$c8d1,DIWSTOP ; DIWSTOP - bottomright corner (c8d1) move.w #$0038,DDFSTRT ; DDFSTRT move.w #$00d0,DDFSTOP ; DDFSTOP move.w #%1000000110000000,DMACON ; DMA set ON move.w #%0000000001111111,DMACON ; DMA set OFF move.w #%1100000000000000,INTENA ; IRQ set ON move.w #%0011111111111111,INTENA ; IRQ set OFF Just look at the above. I mean, really?!
| |
| | Gunnar von Boehn (Apollo Team Member) Posts 6254 29 Sep 2017 09:28
| thellier alain wrote:
| ADD add 2 registers SUB sustract 2 registers MUL multiply 2 registers DIV divide 2 registers CMP compare 2 registers
|
Yes, the 68K can operate on registers, the 68k can also use #immediates (immediates are numbers directly) and the 68k can also operate on (memory) directly. This flexibility makes the 68k very powerful and very easy to use. The 68K does supports operations like this:
ADD Reg,Reg ADD #imm,Reg ADD (mem),Reg ADD Reg,(mem) ADD #imm,(mem)
That 68k can work directly on memory is a reason why 68K can do much more work with less instructions. Its a major advantage the 68K has over the PowerPC.
| |
| | Thellier Alain
Posts 143 29 Sep 2017 10:23
| >Functions, classes & structs, object types, how could one simulate that in ASM? Just keep in mind that when compiled your (say) C++ program become a compiled binary so IS ASM : I mean it is possible as it happen all the time when you compile something :-) Functions: can called the usual way with parameters on stack as there are ASM instructions to read write/stack But most often (internals) functions use registers as parameters as they are "variables" after all Structs: are only a block of memory with inside variables at various offsets Imagine a struct with 3 long int inside x & y & z then load the beginning adresse of struct to a0 then x is at a0(0) y at a0(4) z at a0(8) you can define ASM macros to access this "fields" with real names Classes: same as struct but contain also functions called methods Just add a pointer to the function in your struct : it is only a 32 bit value to where to goto with a BRA you can also define ASM macros to access this "field" with a real name object type: various kind of classes > Just look at the above. You see there are MOVE so first line is ChipRegisters->BPLCON0=0x3200; What serve this Chip Register is not ASM : it is explicated in "hardware reference manual" exactly like when you refer to a class documentation : I mean it has an effect but only the doc will say what @Gunnar Yes I know that but dont want to be complicated Alain
| |
| | Fernando Pereira
Posts 68 30 Sep 2017 09:09
| Ahh guys, I just wish I had such knowledge. :)
| |
| | Hbarra 2Pi
Posts 8 30 Sep 2017 09:18
| Saludos Fernando. Todo es ponerse a ello ;-)
| |
| | Manfred Bergmann
Posts 235 01 Oct 2017 08:00
| I think looking at ACE (AmigaBasic Compiler with Extras) would also be an option. It's GPL'ed, available on Aminet. It's C based but generates Assembler code.Manfred
| |
| | Samuel Crow
Posts 424 01 Oct 2017 11:35
| Manfred Bergmann wrote:
| I think looking at ACE (AmigaBasic Compiler with Extras) would also be an option. It's GPL'ed, available on Aminet. It's C based but generates Assembler code. Manfred
|
The code generator needs a lot of work and not much source code available for projects using it but it's available. Maybe putting the parser in a GCC front-end would be practical.
| |
| | Manfred Bergmann
Posts 235 01 Oct 2017 11:43
| Samuel Crow wrote:
| Manfred Bergmann wrote:
| I think looking at ACE (AmigaBasic Compiler with Extras) would also be an option. It's GPL'ed, available on Aminet. It's C based but generates Assembler code. Manfred |
The code generator needs a lot of work and not much source code available for projects using it but it's available. Maybe putting the parser in a GCC front-end would be practical. |
Found some sources in forums where people had hacked it to compile with vbcc, vasm and vlink for linking. If vbcc get some 080 optimizations ACE could benefit from it. But non of that code has surfaced. I think is quite a number of small to mid size utilities available as examples, including the fd2bmap, ConvertCtoACE utils, etc. Manfred
| |
| | Samuel Crow
Posts 424 01 Oct 2017 12:49
| Manfred Bergmann wrote:
| Found some sources in forums where people had hacked it to compile with vbcc, vasm and vlink for linking. If vbcc get some 080 optimizations ACE could benefit from it. But non of that code has surfaced. I think is quite a number of small to mid size utilities available as examples, including the fd2bmap, ConvertCtoACE utils, etc. Manfred
|
After looking through the source on the Aminet, the compiler needs a total rewrite to get any benefit from the 68080. Only the compiler itself has been hacked to run on VBCC. The output assembly source is unoptimized and almost unoptimizable. It has no intermediate representation of the code that allows macrooptimization.
| |
| | Manfred Bergmann
Posts 235 01 Oct 2017 13:34
| Samuel Crow wrote:
|
Manfred Bergmann wrote:
| Found some sources in forums where people had hacked it to compile with vbcc, vasm and vlink for linking. If vbcc get some 080 optimizations ACE could benefit from it. But non of that code has surfaced. I think is quite a number of small to mid size utilities available as examples, including the fd2bmap, ConvertCtoACE utils, etc. Manfred |
After looking through the source on the Aminet, the compiler needs a total rewrite to get any benefit from the 68080. Only the compiler itself has been hacked to run on VBCC. The output assembly source is unoptimized and almost unoptimizable. It has no intermediate representation of the code that allows macrooptimization.
|
OK, that doesn't sound too promising. Question is, does it need benefits from 080? Have you had a look at the 'SuperOptimizer'? Manfred
| |
| | Samuel Crow
Posts 424 01 Oct 2017 14:25
| Manfred Bergmann wrote:
| OK, that doesn't sound too promising. Question is, does it need benefits from 080? Have you had a look at the 'SuperOptimizer'? Manfred |
The so-called "super-optimizer" is a peephole optimizer not much different than the one built in to VAsm except that it picks out patterns that would not appear in regular code outside of the compiler such as: Scc D0 BEQ Label
is converted to Bcc Label
| |
| | Manfred Bergmann
Posts 235 01 Oct 2017 14:58
| Samuel Crow wrote:
|
Manfred Bergmann wrote:
| OK, that doesn't sound too promising. Question is, does it need benefits from 080? Have you had a look at the 'SuperOptimizer'? Manfred |
The so-called "super-optimizer" is a peephole optimizer not much different than the one built in to VAsm except that it picks out patterns that would not appear in regular code outside of the compiler such as: Scc D0 BEQ Label
is converted to Bcc Label
|
I think the peep-hole optimizer and the 'SuperOptimizer' are two different things at ACE. But anyway, wouldn't it be possible to optimize for 080 as a post-process? Instead of re-writing the whole generator? Manfred
| |
| | M Rickan
Posts 177 01 Oct 2017 18:32
| I just noticed that AmiBlitz is being actively maintained. Does it offer much potential for Vampire optimization?
| |
| | Manfred Bergmann
Posts 235 01 Oct 2017 18:53
| m rickan wrote:
| I just noticed that AmiBlitz is being actively maintained. Does it offer much potential for Vampire optimization? |
Unfortunately it is not maintained actively. The maintainers are not responding at EXTERNAL LINK for quite a while. There are also a couple of stability issues with AmiBlitz2 and 3, including the need for FPU. Manfred
| |
|