| |
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.... |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
Try version 3.21 where you can force all the arguments types. Zeropage and zeropage,x are considered two different types so: ldy.a $c000,x // Abolute mode - No indexing
ldy.ax $c000,x // Absolute,x
sta.z $fb,x // Zeropage mode - No indexing
sta.zx $fb,x // Zeropage mode,x
I skimmed the Dasm manual and had the impression that they have a similar approach? However i like the simplicity of only having to memorize two extensions so I will take a look at the implication once i get some sparetime.
Nice stx lab,y observaton.
|
| |
tlr
Registered: Sep 2003 Posts: 1737 |
Quoting SlammerTry version 3.21 where you can force all the arguments types. Zeropage and zeropage,x are considered two different types so: ldy.a $c000,x // Abolute mode - No indexing
ldy.ax $c000,x // Absolute,x
sta.z $fb,x // Zeropage mode - No indexing
sta.zx $fb,x // Zeropage mode,x
I skimmed the Dasm manual and had the impression that they have a similar approach? However i like the simplicity of only having to memorize two extensions so I will take a look at the implication once i get some sparetime.
Dasm does have that approach but I consider it very confusing.
I've even changed that in my own version of dasm. |
| |
TWW
Registered: Jul 2009 Posts: 542 |
Hey!
Is there a clever way to count the amount of bytes used in a routine within KickAss?
something like (creating an index table):
.pc = begin
CODE
.pc = end
.for (var i = 0 ; i < 128 ; i++) {
.byte <STUFF+[i*[end-begin]]
}
cheers! |
| |
Cruzer
Registered: Dec 2001 Posts: 1048 |
Something like this?...
.var length = end - start
start:
nop
end:
.print "length:" + length
|
| |
TWW
Registered: Jul 2009 Posts: 542 |
Quote: Something like this?...
.var length = end - start
start:
nop
end:
.print "length:" + length
Yepp, Exactly like that 8-D
Easier then I thought^^
Thanx! |
| |
tlr
Registered: Sep 2003 Posts: 1737 |
Am I missing something here?
This works:
.pc = $1000
.const TEST_ENABLE = true
.macro test(v) {
.byte v
}
.if (TEST_ENABLE) {
:test(2)
}
This doesn't:
.pc = $1000
.const TEST_ENABLE = true
.if (TEST_ENABLE) {
.macro test(v) {
.byte v
}
:test(2)
}
(fails with "Error: Macro command 'test' not defined")
Seems pretty unintuitive to me, especially as the if is enabled by a constant.
|
| |
Slammer
Registered: Feb 2004 Posts: 416 |
No, it's just a bad error message. Macros can't be defined inside if statements. They are collected in a preparse which makes it possible to define macros after you use them (eg. macro definitions in the bottom of your sourcefile).
Why do you want to place it inside an if? I'm guessing you have made a libraryfile and only want to define the macro once in the case the library is imported sevaral times? If thats the case, place an .importonce directive in the top of your library-file. It works as the if you had placed an #ifndef, #define XYZ, #endif in C++:
--------- KickAss Library File: ---------
.importonce
... your code
--------- C++ Library File: ---------
#ifndef __MYLIB__
#define __MYLIB__
... your code
#endif |
| |
tlr
Registered: Sep 2003 Posts: 1737 |
Quoting SlammerNo, it's just a bad error message. Macros can't be defined inside if statements. They are collected in a preparse which makes it possible to define macros after you use them (eg. macro definitions in the bottom of your sourcefile).
Why do you want to place it inside an if? ...
The .if in this case is for conditional compile. In this case the macro only relates to the code within that code block. Then it makes sense to be able to define the macro close to the code that actually uses it.
As a side note, not being able to set constants in the global scope from within an .if (in the conditional compile use) is rather inconvenient.
Should I be using some other construct for conditional compile? |
| |
Pantaloon
Registered: Aug 2003 Posts: 124 |
ohh, i didnt know of the importonce, lovely!!! |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
Tlr: Like in java, you can't reach a variable declared inside an if (or for). If you want to access it outside the scope of the if, then declare it outside of the scope and set it inside.
Panta: Thanks :-)
|
Previous - 1 | ... | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | ... | 61 - Next |