Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user Nicron ! (Registered 2024-05-21) You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Kick Assembler Thread 2
2009-07-21 17:20
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....
 
2013-03-18 09:45
Carlos
Account closed

Registered: Mar 2009
Posts: 15
Yeah.. this was my second approach but, as far as i know, i can't use a memory location as the parameter of a KickAss macro. I have tested it and the assembler gives no error but nothing happens:

read_joy:
lda $dc00
lsr
bcc joy_up
jmp read_joy

joy_up:
inc color
:setBackground(color)
jmp read_joy

color: .byte 0



2013-03-18 10:11
Cruzer

Registered: Dec 2001
Posts: 1048
Change the macro to this, to avoid immediate addressing mode:
.macro setBackground(color) {
	lda color
	sta $d021
}
2013-03-18 10:34
Carlos
Account closed

Registered: Mar 2009
Posts: 15
Great! didn't notice that.. thks Cruzer.
2013-03-18 18:19
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..
2013-03-22 12:00
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)
2013-03-22 17:02
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..
2013-03-22 17:04
chatGPZ

Registered: Dec 2001
Posts: 11147
mmmmh. whats the difference between a struct and a namespace then? *shrug*
2013-03-22 20:32
Pantaloon

Registered: Aug 2003
Posts: 124
groepaz, you dont know the difference between namespace & structs ? i hope you are trolling :)
2013-03-22 21:10
Cruzer

Registered: Dec 2001
Posts: 1048
Groepaz doesn't even know the difference between .align and .fill :P
2013-03-22 21:45
Oswald

Registered: Apr 2002
Posts: 5028
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..
Previous - 1 | ... | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | ... | 61 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Mibri/ATL^MSL^PRX
REBEL 1
Walt/Bonzai
Nicron
E$G/hOKUtO fOrcE
Didi/Laxity
tlr
Mr. SID
manganoid/Hokuto Force
iceout/Avatar/HF
Mythus/Delysid
St0rmfr0nt/Quantum
Guests online: 85
Top Demos
1 Next Level  (9.8)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.7)
5 Edge of Disgrace  (9.6)
6 Comaland 100%  (9.6)
7 Uncensored  (9.6)
8 No Bounds  (9.6)
9 Bromance  (9.5)
10 Wonderland XII  (9.5)
Top onefile Demos
1 Layers  (9.6)
2 It's More Fun to Com..  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Rainbow Connection  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Booze Design  (9.3)
3 Censor Design  (9.3)
4 Crest  (9.3)
5 Performers  (9.3)
Top Musicians
1 Rob Hubbard  (9.7)
2 Stinsen  (9.7)
3 Jeroen Tel  (9.6)
4 Linus  (9.6)
5 MacMagix  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.08 sec.