| |
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.. |
|
... 590 posts hidden. Click here to view all posts.... |
| |
Murphy
Registered: Jul 2006 Posts: 10 |
I know this is a complex request...
but string concatenating for label names can be very usefull in macros. Of course, only when the label can be 'exported' out of the scope of the macro.
Example code: register saver macros for irq.
.macro SaveRegsImm(reg_cache) {
sta reg_cache#_a
stx reg_cache#_x
sty reg_cache#_y
}
.macro LoadRegsImm(reg_cache) {
.label reg_cache#_a = *+1
lda #0
.label reg_cache#_x = *+1
ldx #0
.label reg_cache#_y = *+1
ldy #0
.public reg_cache#_a
.public reg_cache#_x
.public reg_cache#_y
} |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
I just released v3.40, where you will get a normal errormessage instead of a class cast exception when you suply a non-list-value to the addAll method.
I don't see anything that could be tricky with the assert, and it asserts fine here. Are you sure the given parameter is in the table?
About concatenating label names. I think it will a bit too complex. Basically, I have to be able to scan for labels and know their names. |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
Murphy: Btw. are you aware that you can access variables of executed macros by adding a label on the line that executes the macro:
.macro SetColor() {
color: lda #00
sta $d020
}
...
lda #1
sta x.color+1 // Set color in first execution of macro
lda #2
sta y.color+1 // Set color in second execution of macro
x: :SetColor()
y: :SetColor()
Perhaps this will solve your concatenation problem. |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
Btw. One thing about the assert commands. They don't stop execution if they fails. Instead they remember the error and print them out at the end of execution (If no 'hard' errors occurs.) They are primary made so I could have a testsuite to run before each release (currently 615 asserts)
I guess this explains your original problem :-)
http://theweb.dk/KickAssembler/webhelp/content/cpt_Testing.html |
| |
Murphy
Registered: Jul 2006 Posts: 10 |
Thanks Slammer!
Your solution is much more elegant than mine!
It's a shame that I haven't noticed this in the documentation. :) |
| |
TWW
Registered: Jul 2009 Posts: 541 |
From my -PNGtoKOALA routine I get the following error:
.for (var Pixel = 0 ; Pixel < 4 ; Pixel++) {
.eval PixelColor = Graphics.getPixel([[8*BlockNumber]+[[Pixel<<1]&7]]-[320*[floor(BlockNumber/40)]] , [8*floor(BlockNumber/40)]+Byte)
.eval BMPPattern = ColorIndex.get(PixelColor)
.eval BMPByte = BMPByte|[BMPPattern << [6 - Pixel*2]]
^
Error: Unknown function : <<
I've used it before and it worked fine so what the heck am I missing?
EDIT: Found out. Had some "ghost pixels" with different RGB codes in the GFX I was converting... Funtion works as intended. SOLVED. |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
BMPPattern contains a value for which the << operator is not defined. Could it be null? |
| |
TWW
Registered: Jul 2009 Posts: 541 |
Yepp. That was precisely it. |
| |
Killsquad Account closed
Registered: Jun 2005 Posts: 17 |
Any update on .ifdef/.ifndef directives? Would be very handy. |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
The basic directives are implemented as know from C# (#define, #if, #else, #elif, #endif, #undef). Currently missing is setting definitions from the commmand line and boolean operatiors. But they will be there, don't worry.
Other nice things which are already implemented are:
- The * is back, *=$1000. (You can still use .pc)
- You can now use normal ( ) aswell as [ ]
- You can add an optional ; in the end of commands, eg: .eval x=27;
+ Some other goodies
The reason it takes time is that they are part of a bigger modification, where the entire parsing routine is reimplemented. Instead og using a parsergenerator, most of it is now done by handwritten code which gives more flexability. This will be in the next major version (4.0). I guess it will take at least a couple of months finish. |
Previous - 1 | ... | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | ... | 61 - Next |