|
Tutorial: How to put inline assembly functions into ZX Basic
|
|
2012-02-16, 03:05 PM
Hey!!! Amazing!! Thanks! 8)
2012-02-16, 03:22 PM
I never got around to learning assembly,
2012-02-16, 06:03 PM
Well, I'm recommending ZX Basic as a way of learning - you can do it a little bit at a time, rather than having to do everything in assembly.
2012-02-17, 05:07 PM
Do you allow me to put a Copy of this cool Doc in Spectrum profi Club magazine?
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead Visit my http://members.inode.at/838331/index.html home page!
2012-02-18, 08:35 PM
Of course, LCD. If you can make it look better formatted!
2012-02-18, 10:33 PM
britlion Wrote:Of course, LCD. If you can make it look better formatted!Thanks! Sure I will reformat it, thats no problem! Edit: By the way, sorry for being off topic, but I did my mirroring function in Boriels BASIC a little bit different (without a table): Code: function mirror(dowedoit as ubyte, number as ubyte) as ubyte
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead Visit my http://members.inode.at/838331/index.html home page!
2012-02-19, 11:09 PM
Yes - that looks like it would work, but it's a LOT harder to understand. I deliberately kept it as easy to read for Sinclair Basic users as possible, such as keeping "REM" rather than ' and using LET everywhere...
Also stuck to using BAND rather than & - and the basic and the machine code use very very nearly the same algorithm, so it's easier to see what the assembly is using.
2012-02-20, 01:19 AM
britlion Wrote:Yes - that looks like it would work, but it's a LOT harder to understand. I deliberately kept it as easy to read for Sinclair Basic users as possible, such as keeping "REM" rather than ' and using LET everywhere... Thats why I wrote its off Topic. Thats my art of coding, hard to understand, not suitable for tutorials, but working and very fast. ![]() I do not use the LET command, but you are right, BAND is easier to understand for novices than &, I just used it because it is shorter and fits better in a line of code. You inspired me to learn a bit more assembly.
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead Visit my http://members.inode.at/838331/index.html home page!
You should see what I'm working on now. Probably way too ambitious to finish. But I did 12 pages this evening...
http://goo.gl/4jPd5
2012-02-20, 10:07 AM
LCD Wrote:Though if I was going to, I'd say why bother with a new variable? :mrgreen: Code: function mirror(dowedoit as ubyte, number as ubyte) as ubyteThat said, if you read the behemoth assembly that makes. Ouch. Hopping on and off the stack like crazy! Not to mention a lot of very expensive reads and writes to (IX+7) - which cost 19 T states each. I wonder if my original beginners algorithm is faster! Anyway, I think my suggested optimized version is pretty tight: Code: function fastcall mirror (dowedoit as uByte, number as uByte) as uByte
2012-02-20, 11:06 AM
I was in fact planning an ebook (PDF free & hard cover), for ZX Basic compiler.
But it's a huge task, and English is not my mother tongue!
2012-02-20, 11:19 AM
boriel Wrote:I was in fact planning an ebook (PDF free & hard cover), for ZX Basic compiler. Yes. yes it is. Working on it... At least some of it. No doubt I'll have time shortages again.
2012-02-20, 01:05 PM
britlion Wrote::oops:LCD Wrote:Though if I was going to, I'd say why bother with a new variable? :mrgreen: I overseen it... It was my mirroring function from my unfinished fractal picture decompressor which I adopted to match yours, mine had no dowedoit, so it was: Code: function MirrorByte(num as ubyte) as ubytebritlion Wrote:Anyway, I think my suggested optimized version is pretty tight:It is!!! Much faster than both compiled codes. The books looks very good by the way!!! My compliments!
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead Visit my http://members.inode.at/838331/index.html home page!
2012-02-20, 01:25 PM
Ah - then you'd need one that just looks like this, I think:
Code: function fastcall mirror (number as uByte) as uByteI haven't tested it, mind. Just typed it here. Feels right, though
|
|
« Next Oldest | Next Newest »
|
Users browsing this thread: 1 Guest(s)


