| |
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.... |
| |
Carlos Account closed
Registered: Mar 2009 Posts: 15 |
Great! didn't notice that.. thks Cruzer. |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
Once you get more comfortable with the basic stuff, you can start using pseudocommands, which support both things at once.
.pseudocommand setBackground(color) {
lda color
sta $d021
}
:setBackground #color // Use predetermined value (immediate mode)
:setBackground color // Use value from memory (absolute mode)
Btw. The background color macro is just an example of how to create and use a macro. I guess you cant benefit much by using this particular macro.. |
| |
Carlos Account closed
Registered: Mar 2009 Posts: 15 |
Interesting Slammer, i will try it.
Another question: User defined structures. Can the fields of the structure be of any size or each field is always a byte?
.struct foo {x , y) (i want x be a word and y a byte) |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
The struct directive is just a collection of fields with no particular type. The fields can be anything: Numbers, lists, strings, etc. For example:
.stuct MyStruct {a, b}
.var myVar = MyStruct(27, "Hello World")
.byte myVar.a // is the same as .byte 27
.print myVar.b // is the same as .print "Hello world"
In the above example only the '.byte myVar.a' directive will produce output to the assembled .prg file. It will be a byte because a .byte directive is used, but if you had written .word myVar.a it would have been a word.
hope it helped..
|
| |
chatGPZ
Registered: Dec 2001 Posts: 11136 |
mmmmh. whats the difference between a struct and a namespace then? *shrug* |
| |
Pantaloon
Registered: Aug 2003 Posts: 124 |
groepaz, you dont know the difference between namespace & structs ? i hope you are trolling :) |
| |
Cruzer
Registered: Dec 2001 Posts: 1048 |
Groepaz doesn't even know the difference between .align and .fill :P |
| |
Oswald
Registered: Apr 2002 Posts: 5023 |
Probably I'm off with this here, but do we really need all this mumbo jumbo for some simple 8 bit demo effects? Namespaces, structs, macros and whatnots ? :) Anyway its just probably only me still stuck in '96 or so, it would be nice to see some examples on how are these *really* useful. when it comes cycle counting and it comes to that even with non timing critical code, you'll WANT to see the code. Speedcode generators have to be written eventually when linking the demo (so why write once a macro, once a real version?)
etc.. |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
Pantaloon: Yeah, Obviosly trolling :-)
Oswald: No you don't need it, but it can make life easier. Just take the things you find useful into your programming routine and ignore the things that doesn't appeal to you. |
| |
TWW
Registered: Jul 2009 Posts: 541 |
Hiho
Got a strange error:
.eval BMPByte = BMPByte|[BMPPattern << [6 - Pixel*2]]
^
Error: Unknown function : <<
The code itself comes from this loop:
.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]]
}
Which is inside a macro which I call 3 times and no problems but the 4th, this occurs.
If I reuse the macro a 4th time with earlier parameters, it works fine so it's something with the data processed the 4th time which makes it kneel.
Ideas?
EDIT: Found it. Wrong pallette in the gfx. Pro'lly caused some invalid data to be processed. |
Previous - 1 | ... | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | ... | 60 - Next |