Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user nurd ! (Registered 2024-06-16) 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-03-23 17:51
Slammer

Registered: Feb 2004
Posts: 416
It's not forgotten, but dont expect it soon. These days im a bit busy with other projects (like work)..
2011-05-06 07:56
Digger

Registered: Mar 2005
Posts: 422
Guys, I am trying to split my source into logical parts using
import source "file.asm"

How to define global variables in the main.asm (so that other imported files have access to them) other way than having a globals.asm file that gets imported into every linked .asm file?

Can I use namespaces for that?
Cheers big ears.
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.
Previous - 1 | ... | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | ... | 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
CA$H/TRiAD
Smasher/F4CG
Majikeyric
t0m3000/HF^BOOM!^IBX
MCM/ONSLAUGHT
Grezz/S-Xpress
Guests online: 85
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.7)
5 Edge of Disgrace  (9.7)
6 Comaland 100%  (9.6)
7 No Bounds  (9.6)
8 Uncensored  (9.6)
9 Wonderland XIV  (9.6)
10 Aliens in Wonderland  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 Cubic Dream  (9.6)
3 Party Elk 2  (9.6)
4 Copper Booze  (9.6)
5 Rainbow Connection  (9.5)
6 It's More Fun to Com..  (9.5)
7 Dawnfall V1.1  (9.5)
8 Daah, Those Acid Pil..  (9.5)
9 Birth of a Flower  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Nostalgia  (9.4)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 SHAPE  (9.3)
Top Original Suppliers
1 Black Beard  (9.7)
2 Derbyshire Ram  (9.5)
3 hedning  (9.2)
4 Baracuda  (9.1)
5 Jazzcat  (8.6)

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