Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
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....
 
2011-05-06 09:17
Slammer

Registered: Feb 2004
Posts: 416
My guess is that you do like this:
-----------main.asm---------------
.import source "file1.asm"
.import source "file2.asm"

.var myNumber=42

-----------file1.asm---------------
lda #myNumber

This will not work since the variable is declared after file1.asm is included, so the variable is used before it is declared.

There are two solutions:
1. Define your vars before the import statements
2. Define your vars as labels (this will cost you an extra pass when assembling since the value first will be ready in pass two, but you probably don't care about this)

The following should work:
-----------main.asm---------------
.import source "file1.asm"
.import source "file2.asm"

.label myNumber=42

-----------file1.asm---------------
lda #myNumber
2011-05-06 09:26
Cruzer

Registered: Dec 2001
Posts: 1048
Or import globals.asm as the first file in main.asm, that way it doesn't need to be imported into all the other files.
2011-05-09 19:01
Mace

Registered: May 2002
Posts: 1799
There is no way to incorporate binary data as ASCII in the source with KickAss, is there?
Something like BASE64?
2011-05-09 19:40
Slammer

Registered: Feb 2004
Posts: 416
You can write a decode macro that does it. Something like:
.var base64Str = "sfkjfsjdfisjhfijsifjsdkjfskdjf";
:Base64Decode(base64Str)

.marcro Base64Decode(str) {
	// for all chars in str look up value in decode table and make a .byte directive to output the data
}
I'm curious, how is this useful?
2011-05-09 19:50
Mace

Registered: May 2002
Posts: 1799
So I could post on forums a source that includes binary data, without having to type all bytes with .byte. :-)
It's not that I really NEED it, but I was just wondering.
2011-05-10 00:23
Conjuror

Registered: Aug 2004
Posts: 168
I have a question about scoping. Is there anyway to access variables within a scope block, such as:

lda #$03
sta scroller.rowCount + 1

scroller: {
rowCount:
ldx #$03
...
rts
}

note: example only

Otherwise I'd have to expose the entire 'function' and its labels/variables to the rest of the program. Yes I am a JAVA programmer :D

Steve
2011-05-10 09:43
Mace

Registered: May 2002
Posts: 1799
@ Conjuror: yes, check pages 18 and 34 of the manual.

Also, you could place your label inside the scope better, so that it points to the address itself instead of having to do calculations outside the scope.
2011-05-10 10:47
Conjuror

Registered: Aug 2004
Posts: 168
Thanks Mace, thats just embarrassing. I was very tired today.
2011-05-10 18:24
Slammer

Registered: Feb 2004
Posts: 416
As Mace said, it is supported. Another example of 'auto namespacing' is when you put a label before a macro execution. This will enable you to access the labels inside the macro which is quite useful.
2011-05-10 18:37
Mace

Registered: May 2002
Posts: 1799
Quote:
Another example of 'auto namespacing' is when you put a label before a macro execution.
Blimey, I needed that! Thanks :-)
Previous - 1 | ... | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | ... | 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
Sande/Hokuto Force
Exploding Fi../Techn..
Ghost/Quantum
iAN CooG/HVSC
Guests online: 96
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Mojo  (9.6)
6 Uncensored  (9.6)
7 Wonderland XIV  (9.6)
8 Comaland 100%  (9.6)
9 No Bounds  (9.6)
10 Unboxed  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 Party Elk 2  (9.6)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.6)
5 Rainbow Connection  (9.5)
6 It's More Fun to Com..  (9.5)
7 Morph  (9.5)
8 Dawnfall V1.1  (9.5)
9 Onscreen 5k  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Booze Design  (9.3)
2 Oxyron  (9.3)
3 Nostalgia  (9.3)
4 Censor Design  (9.3)
5 Performers  (9.3)
Top Graphicians
1 Mirage  (9.7)
2 Archmage  (9.7)
3 Facet  (9.6)
4 Carrion  (9.6)
5 Pal  (9.6)

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