Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in 
CSDb User Forums


Forums > C64 Coding > Kick Assembler Thread 2
2009-07-21 19:20
Slammer

Registered: Feb 2004
Posts: 295
Kick Assembler Thread 2

The previous thread took a little long to load, so this is a new fresh one..
 
... 414 posts hidden. Click here to view all posts....
 
2011-08-25 18:37
Slammer

Registered: Feb 2004
Posts: 295
You have stumbled upon an interesting detail. To simplify a bit, look at the following:
.pc = $fd	
	lda label
label:
In the case the position of the label depends on the size of the command, and the size of the command depends on the position of the label so the only way to determine if the command can use its zeropage form is by trial and error, which might get quite complex and lead to more passes.

Instead Kick Assembler tries to reduce the command to its zeropage form when it first meets the command, and since it doesn't know the value of the label, it fails and marks the command as using the absolute addressing mode. This is the reason why the first command in your example is reduced to the zeropage form and the second isn't.

So what do you do then?. You can use this little magic trick to tell the assembler that you want a zeropage command:
.pc=$1000
.pseudopc $90
{
some_label:
	lda $1000
	inc some_label+1
	inc CmdArgument(2, some_other_label+1)
some_other_label:
	lda $1000
}
The magic is the argument type constant 2 which actually is 'AT_ZEROPAGE' which is not exposed in the current version but will be in the next release (Nobody I know of have had this problem before - placing code on the zeropage seems kind of special, but might be a smart optimization?)

Previously I have had plans for making it easier to force addressing modes like this:
inc.zp label
lda.abs $0000
and they can be reintroduced on the todo list if there is a demand for it.
2011-08-25 19:01
tlr

Registered: Sep 2003
Posts: 850
Quoting Slammer
Previously I have had plans for making it easier to force addressing modes like this:
inc.zp label
lda.abs $0000
and they can be reintroduced on the todo list if there is a demand for it.

It should be possible to resolve it in most cases using additional passes but I'd vote for your solution with extensions.

I've used .z and .a in dasm quite a lot.
2011-08-25 21:03
Cruzer

Registered: Dec 2001
Posts: 719
I second tlr. Sometimes i use abs-mode for zp addresses for VIC timing reasons, to make it take a cycle more. In this case I do it like this:

.by LDA_ABS
.wo zpAdr

This approach can be used the other way around too of course, but it's a bit clumsy in the long run.
2011-08-26 14:56
Shadow

Registered: Apr 2002
Posts: 264
Sorry Slammer, I write strange code for strange platforms, so I guess I end up hitting those cases noone thought of! :)

I'll try the workarounds posted here!
2011-08-31 21:15
tlr

Registered: Sep 2003
Posts: 850
Typo:
buf_zp:
 .fill 4                  do <ctrl>-t here
 ^                            |
                              v
Error: Invalid number of arguemnts
at line 122, column 2 in test.asm


2011-08-31 22:02
Slammer

Registered: Feb 2004
Posts: 295
Thanks. It's corrected in the next release.
2011-09-07 21:01
Slammer

Registered: Feb 2004
Posts: 295
I just release v3.20. One of the new features is that you can force addressing modes like this:
inc.zp label
lda.abs $0000
or
inc.z label
lda.a $0000
Btw. the 'chars inheriting from number' issue was implemented in v3.19
2011-09-07 21:29
tlr

Registered: Sep 2003
Posts: 850
Great!
2011-09-24 11:35
tlr

Registered: Sep 2003
Posts: 850
Quote: I just release v3.20. One of the new features is that you can force addressing modes like this:
inc.zp label
lda.abs $0000
or
inc.z label
lda.a $0000
Btw. the 'chars inheriting from number' issue was implemented in v3.19


Hmm, in 3.20 do:
	.pc = $0801
	ldy.a	$c000,x
	sta.z	$fb,x

This will silently ignore the indexed addressing mode (= bad).

Also this could be resolved in a nicer way as we know that it must be <zp>,y:
	.pc = $0801
	stx	lab,y
.label lab = $fb

2011-09-24 19:08
Slammer

Registered: Feb 2004
Posts: 295
Try version 3.21 where you can force all the arguments types. Zeropage and zeropage,x are considered two different types so:
	ldy.a	$c000,x		// Abolute mode - No indexing
	ldy.ax  $c000,x		// Absolute,x
	sta.z	$fb,x		// Zeropage mode - No indexing
	sta.zx	$fb,x		// Zeropage mode,x

I skimmed the Dasm manual and had the impression that they have a similar approach? However i like the simplicity of only having to memorize two extensions so I will take a look at the implication once i get some sparetime.

Nice stx lab,y observaton.
Previous - 1 | ... | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | ... | 43 - 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
metalux
Nuckhead/Backbone So..
The Human Co../Maste..
Knut Clausen
Guests online: 32
Top Demos
1 Edge of Disgrace  (9.7)
2 Coma Light 13  (9.7)
3 Daah, those acid pil..  (9.6)
4 Deus Ex Machina  (9.3)
5 Andropolis  (9.3)
6 Te-Te-Te-TechTech It..  (9.3)
7 +H2K  (9.2)
8 GOLC  (9.2)
9 Artphosis  (9.2)
10 2011 - A Press Space..  (9.2)
Top Groups
1 Booze Design  (9.4)
2 Crest  (9.4)
3 Oxyron  (9.4)
4 Maniacs of Noise  (9.2)
5 Eagle Soft Incorpora..  (9.2)
Top Cover Designers
1 Junkie  (9.9)
2 Electric  (9.9)
3 Duce  (9.8)
4 The Elegance  (9.4)
5 Cuc  (9.1)

Home - Disclaimer
Copyright © No Name 2001-2013
Page generated in: 1.002 sec.