Forum
"Register" command - Printable Version

+- Forum (https://www.boriel.com/forum)
+-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12)
+--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11)
+---- Forum: Wishlist (https://www.boriel.com/forum/forumdisplay.php?fid=14)
+---- Thread: "Register" command (/showthread.php?tid=168)



"Register" command - britlion - 02-27-2010

I was thinking that it might be incredibly useful, for inline assembly to be able to set what's on the registers as you hit z80 asm.

And a command to do that, that works in a similar way to a function call, might be a good way to do it and avoid a lot of the overhead of a function call for very small jobs.

How about a register and an unregister command?

Register - takes a variable and puts it in the current registers
unregister - takes registers and puts them into a variable.

So you could do something like:

DIM a as long
register a
asm
LD D,0
end asm
unregister a

To kill off the top byte of a long, if that was your whimsy.

Not sure if other people would find this useful, but I could imagine ways it could be useful.

How about:
dim a as fixed
dim b as uinteger
(do things)
register a
unregister b

to put the decimal part of a into b if you wanted to deal with the integer part and the decimal part separately. You could even shunt it back later...

Anyway, just a crazy thought from me, as per usual :-)