| |
Slammer
Registered: Feb 2004 Posts: 416 |
Kick Assembler Thread 2
The previous thread took a little long to load, so this is a new fresh one.. |
|
... 592 posts hidden. Click here to view all posts.... |
| |
Lobogris Account closed
Registered: Oct 2010 Posts: 22 |
It was more a curiosity for future projects, so I looked quickly the manual (I have my head full of algorithms right now!) I need to print the manual because in pdf I miss some parts sometimes! sorry for that, and thanks bepp! |
| |
TWW
Registered: Jul 2009 Posts: 542 |
Cheers
Is the a way to reliable determine the size of a immediate value (8/16/32 bit)?
I'm guessing that you can fetch the arg.getvalue+1 / +2 etc and check if they are zero but maybee there is a even more slick method?
-TWW |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
Im not sure exactly what you want, but you can write a bytesize function like this:
//Examples of use
.print "$12->"+byteSize($12)
.print "$123->"+byteSize($123)
.print "$123456->"+byteSize($123456)
// The function
.function byteSize(x) {
.if (x==0) .return 0
.return 1+byteSize(x>>8)
} |
| |
TWW
Registered: Jul 2009 Posts: 542 |
I was thinking (yeah I do that sometimes too) that I could construct "universal" pseudocommands for example:
:ADD x ; y ; z
and then get the pseudo to determine if it needs to utilize 8, 16, 24 or 'n' bits addition.
That is instead of making multiple pseudos like :ADD8 / :ADD16 f.ex.
Making a function like the one you made here returning the number of bytes in a passed argument looks to be a step in the right direction 8-) |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
That would be nice to have. I think there is a problem though. The destination will be a memory adress and we have to know if the data on that adress is 8 bit or 16 bit. If you want to do:add #1 ; label Then the value 1 can be contained in one byte (byteSize=1) but if 'label' is pointing to a 16 bit number you still have to make and adc to both the low and the high-byte in order to handle the carryflag when the lowbyte makes an overflow.
|
| |
TWW
Registered: Jul 2009 Posts: 542 |
I see your point.
However I have another issue:
.pseudocommand MEMFILL destination_address ; number_of_bytes ; value {
.if (number_of_bytes.getValue()<=5) {
"DO THE FIRST THING"
}
.if (number_of_bytes.getValue()>5 && number_of_bytes.getValue()<=256) {
"DO THE SECOND THING"
}
.if (number_of_bytes.getValue()>256) {
"DO THE THIRD THING"
}
}
After i put in the doube boolean check on the second thing I get a message: "Made no progress and cant solve the program.. You should have gotten an error. Contact the author!"
If I change the 2nd entry to a single boolean check (i.e. more then 5 f.ex.) it works like a charm.
Any suggestions? |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
Update to Kick Assembler v3.15. If you are already running on v3.15 then you have found a bug. Send me a piece of failing code and I will se what I can do about it.
|
| |
TWW
Registered: Jul 2009 Posts: 542 |
There you go! Ask Slammer and it's good to go. Should have checked latest version myself before posting (smacks forehead). Somehow I imagined I 'had' the latest version... Time to cut down on the jack&cokes^^
Edit: I saw Pantaloon requested a ".ifdefined" function for determining if a variable have been defined earlier. I could not find anything regarding this in you updates page (or the manual(I admit though I only browsed it lightly^^)) so I guess what I'm asking is: Is it still on your to_do list? 8-D |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
It's not forgotten, but dont expect it soon. These days im a bit busy with other projects (like work).. |
| |
Digger
Registered: Mar 2005 Posts: 422 |
Guys, I am trying to split my source into logical parts using import source "file.asm"
How to define global variables in the main.asm (so that other imported files have access to them) other way than having a globals.asm file that gets imported into every linked .asm file?
Can I use namespaces for that?
Cheers big ears.
|
Previous - 1 | ... | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | ... | 61 - Next |