Cross-compiler of my dreams

Pagina 4/7
1 | 2 | 3 | | 5 | 6 | 7

Van LeandroCorreia

Paladin (955)

afbeelding van LeandroCorreia

09-11-2004, 20:03

Not, not to convert on the fly. I do not think of an optimizer, but instead of that, I think of a real compiler. To compile BEFORE running.

Van flyguille

Prophet (3028)

afbeelding van flyguille

09-11-2004, 20:03

the best way to program great quality games in assembler

is to code only the animation routine in assembler... and the rest in basic...

Van NYYRIKKI

Enlighted (5918)

afbeelding van NYYRIKKI

09-11-2004, 20:04

...or simply use a bit-shift-left or right operation in case of powers of 2.

You just ended up to define the problem of compiled BASIC... You just can't do this... There is no bit-shift in BASIC. I think, that it does not make big difference, do you write on BASIC:

10 PRINT "Hello there"

or in assembler:

	PRINT "Hello there"

in assembler. The difference is, that to get this working in assembler you have to include macro like this:

PRINT:	MACRO @PARAM
	CALL PRINT2
	DEFB @PARAM
	DEFB 10,13,0
	ENDM

PRINT2:
LOOP:
	POP HL
	LD A,(HL)
	INC HL
	AND A
	PUSH HL
	RET Z
	RST #30
	DEFB #80
	DEFW #A2
	JR LOOP

... it sounds stupid to include so much code to your ASM program, but when the moment comes, where this code is used very often to do something like print "Score: " to up left on the screen and you notice, that MSX speed is not enough anymore, you can't do anything on BASIC, but in ASM you can start optimizeing the code part for this special purpose.

Now I think, next you say: "But that is why I need this Dreamcompiler (TM) !"

It really does not make any difference. When you use BASIC compiler you have the same limitations, you can't tell, how computer should do this. Sure, it is possible to add bit-shift commands or possibility to use external librarys or add you possibility to define better what kind of variables you need etc. etc. but when you define more and more details, you soon notice, that upgrading your knowledge for assembler is much better and faster solution than upgrading compiler knowledge to understand what you want. Smile

Van NYYRIKKI

Enlighted (5918)

afbeelding van NYYRIKKI

09-11-2004, 20:12

Not, not to convert on the fly. I do not think of an optimizer, but instead of that, I think of a real compiler. To compile BEFORE running.

This has no effect on speed, is it JIT compiled (just in time) or compiled to executable / ROM file. The speed is 100% same.

X-BASIC aka KUN-BASIC aka MSX-BASIC KUN COMPILER is a JIT compiler. (and it actually can optimize *2 routine correctly :9 )

Van flyguille

Prophet (3028)

afbeelding van flyguille

09-11-2004, 20:13

and that is way nobody did a basic >> assembler translator....

because if you have enought knowledge for then to optimize the result a bit, surelly you have the knowledge to write it directly becuase there is only a fews of syntax rules a lot less than MSX-BASIC . the commands are too simples.... ofcourse it will make you code three or four times large (in text source), but always you can to comment on the right each group of lines

like

xxxxx ; It does "PUT SPRITE n,(x,y),d"
xxxxxx
xxxxxx
xxxxxx
xxxxxx
xxxxxx

xxxxxx ; it does "SOUND b,a"
xxxxxx

Van LeandroCorreia

Paladin (955)

afbeelding van LeandroCorreia

09-11-2004, 20:15

Come on, Nyyrikki...

Today, more and more compilers are being done. Many games are fast, but would be even faster if they were not created in C.

I do not care how my program will run (and most programmers don't too), as long as it works... A compiler would be great for most simpler tasks. Even if I could speed a BASIC program up to 10 times its original speed, I could create nice games and applications. The compiler should be opensource, so its speed and user-friendlyness could be improved gradually.

That would be great for a revival. And to be honest, if I had time to really learn Assembly (that would be learned after many things I must study now), the first thing I'd do would be such a compiler. Smile

Van flyguille

Prophet (3028)

afbeelding van flyguille

09-11-2004, 20:19

Come on, Nyyrikki...

Today, more and more compilers are being done. Many games are fast, but would be even faster if they were not created in C.

I do not care how my program will run (and most programmers don't too), as long as it works... A compiler would be great for most simpler tasks. Even if I could speed a BASIC program up to 10 times its original speed, I could create nice games and applications. The compiler should be opensource, so its speed and user-friendlyness could be improved gradually.

That would be great for a revival. And to be honest, if I had time to really learn Assembly (that would be learned after many things I must study now), the first thing I'd do would be such a compiler. Smile

Including in PC world there is no one basic to assembler translator

Including all the line of Visual Basic, Qbasic, the compiled versions is BASIC pre-compiled code inside of an EXE and that is why it needs the VB DLL

the pre-compiled codes is just a lot of CALL that ... CALL this .... CALL that..... doing CALLs for all the things that the progran needs to do.... and that is why the VB libraries are a lot and bigger.

Van LeandroCorreia

Paladin (955)

afbeelding van LeandroCorreia

09-11-2004, 20:24

To Flyguille...

Agreed. If someone knows Assembly enough to create such a compiler, he is good enough not to need a compiler.

But if someone is good enough to create such a compiler and releases this compiler freely on the web, thousands of MSX users will download it, hundreds will program it, and many new and nice programs will be available in increasing number.

That would really make this compiler a Dream. Smile

Van LeandroCorreia

Paladin (955)

afbeelding van LeandroCorreia

09-11-2004, 20:26

To Flyguille and Nyyrikki...

Where can I start learning Assembly language? Is there a compreensive tutorial on the web?

Van NYYRIKKI

Enlighted (5918)

afbeelding van NYYRIKKI

09-11-2004, 20:26

... and that is why X-BASIC on tR can usually beat up in speed Qbasic "compiled" EXE running on 100MHz 486 Smile

Pagina 4/7
1 | 2 | 3 | | 5 | 6 | 7