BB Inline assembler: Just give it a go!

Miscellaneous Forums/General Discussion/BB Inline assembler: Just give it a go!

hey Mark Sibbly!
I think it would be pretty easily done to implement some inline Assembly to BB, wouldn't it?

Just imagine:
Asm
    mov eax, ebx
End Asm


I wonder, if you would give it a go and just try it. On the other hand: What exactly is keeping you from doing it?

..and how about support for multiple CPUs?

sure that'll be great. but it would be very hard as well. its not easy to code using multiple threads and it wouldnt be easy to implement to a programming language i guess...

but for this moment i would be satisfyed with inline asm:)
i sure could use it for my software renderer polygon drawing routine!

Cobra allows inline ASM.

http://www.squeakyduck.co.uk

but i want it for blitz

Wouldn't this be the same as including an asm file as a normal include?

well then try this ;D
...no it will be a syntax error because you may only include bb files

I think he means Import, in the case of BMax, seeing as you can import assembly code and have it built into whatever you're building.

I'm guessing you're probably asking for this for Blitz3D or something, since you seem to loathe BlitzMax. If that is the case, bad idea. If you want to be able to optimize to that degree, use C.

Devils Child, it can be done using asm bytecode if you want more info contact me.

i did.

While we're at it how about being able to assign Camera's to monitors.

monitorlist[] = QueryMonitors()

cam1 = createcamera()
AssignCamera cam1,monitor[0]

cam2 = createcamera()
AssignCamera cam2,monitor[1]

This way you could have 2 totally different things going on in each monitor. That would rock.

Hey I remember discussing this, wasn't it 5 years ago? While it would be nice I think it has very little chance of happening...

Darkheart

loop:	inc	eax
	invoke	print, eax
	cmp	eax, 10
	jz	exit
	jmp	loop
exit:


just for fun, i'm now coding on my own virtual assembler. it is an interpreting asm langauge that is more on the level of a script language. it is interpreted and just feels good in the heard of an asm lover :)
i'll show some demo in the blitz showcase within this week.

I can see it all now "No longer do you have to choose between the long-windedness of assembly programming and the slow speeds of an interpreted language... now you can get all the disadvantages in a single package!"

Only joking... it's not a bad learning exercise, and if you can be bothered to implement all the opcodes I will be impressed.

hm. thats just a script engine in asm look :)
anyway, here is an example of how to flood the screen with pixelst
lop1:	invoke	lockbuffer
	invoke	rand, &h000000, &hffffff
	mov	eax, 0
lop2:	cmp	eax, 630
	jz	lop2e
	add	eax, 10
	mov	ebx, 0
lop3:	cmp	ebx, 470
	jz	lop3e
	add	ebx, 10
	invoke	plot, eax, ebx, ecx
	jmp	lop3
lop3e:	jmp	lop2
lop2e:	invoke	unlockbuffer
	invoke	flip
	jmp	lop1


but enough of my virtual asm engine. i'm releasing it tomorrow.

anything real would be nice. i mean Kev mailed me and showed me how to add hex machine code to the program. but how to add asm is still an open chapter yet... mark you can close this chapter ;)!

here i posted it: http://www.blitzbasic.com/Community/posts.php?topic=75431