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..
 
... 590 posts hidden. Click here to view all posts....
 
2016-03-13 14:16
Jammer

Registered: Nov 2002
Posts: 1289
Question about functions/macros. There's clear division which does what in manual. How about piece of code that is mix of assembler and script conditions/variables - should I define the one below as macro or function?

	.if(usefreqtable1)
	{
		.if(usefreqlo1)
		{
			ldx #$00
		checkch1freq:
			lda ch1freq, x
			cmp #$fe
			bne updatech1freq
			ldx #$00
			stx checkch1freq - 1
			jmp checkch1freq
		updatech1freq:
			sta $d401
			
			.if([usefreqhisweeptable1] || [constfreqhisweep1 != $00])
			{
				sta dofreqhisweep1 + 1
			}
			
			inx
			lda ch1freq, x
			sta $d400
			
			.if([usefreqlosweeptable1] || [constfreqlosweep1 != $00])
			{
				sta dofreqlosweep1 + 1
			}
			
			inx
			stx checkch1freq - 1
		}
		else
		{
			ldx #$00
		checkch1freq:
			lda ch1freq, x
			cmp #$fe
			bne updatech1freq
			ldx #$00
			stx checkch1freq - 1
			jmp checkch1freq
		updatech1freq:
			sta $d401
			
			.if([usefreqhisweeptable1] || [constfreqhisweep1 != $00])
			{
				sta dofreqhisweep1 + 1
			}
			
			inc checkch1freq - 1

			.if([usefreqlosweeptable1] || [constfreqlosweep1 != $00])
			{
				lda #$00
				sta dofreqlosweep1 + 1
			}
		}
	}
2016-03-13 15:49
Slammer

Registered: Feb 2004
Posts: 416
It would have to be a macro (or pseudo command). Commands that produces bytes to the resulting .prg file (like mnemonics and .byte/.word etc) can't be in functions.

Edit: Otherwise you could make some really tricky stuff like:
lda #myByteProducingFunc(27)
2016-03-13 15:58
Jammer

Registered: Nov 2002
Posts: 1289
I've tried to define that portion of code both as macro and function. Macro resulted in error due to non-assembly instructions. Function compiled without error but most probably as regular assembly that's not really a subroutine. Ok, I see that it has to be totally reorganized ;)
2016-03-13 16:36
Slammer

Registered: Feb 2004
Posts: 416
If you are reporting error please post complete examples. When you post cutout pieces of code I have no chance of verifying if its an error or not.

I dont think I understand what you are writing. Are you sure its not when you put it in a function you get an error for using asm directives? ( = directives that produce bytes to the output)
2016-03-13 17:31
Jammer

Registered: Nov 2002
Posts: 1289
Sorry about that :) Macro seems to work fine - it was just enclosed within .if directive that I didn't catch somehow. No error report whatsoever and thank you for the tip ;)
2016-03-13 20:04
Hoogo

Registered: Jun 2002
Posts: 102
I guess there are situations where automatic long branches are difficult:
---> Dest 1
|    ...
| -<Branch 2
| |  ...
--+<Branch 1
  |  ...
  -->Dest 2
Branch2 cannot be decided until Branch 1 was decided, and the other way around the same.
But such a situation can already be created with an .if (futureLabelFormual)FillSomeBytesFormula. How do you treat that? Forbid .if with unknown labels? Or some check if passes get out of sync?
2016-03-14 06:31
Slammer

Registered: Feb 2004
Posts: 416
You guessed it , using if's on yet unknown values gives an error since the memlocation of labels have to be resolved in first pass.
2016-09-01 21:29
TWW

Registered: Jul 2009
Posts: 541
I saw I asked this thing like 4 years ago and surely found some work-around back then but that is several HD crashes ago and perhaps there are updates I didn't catch.

Strings:

I am making a string for a cartridge header but it contains some RVRS ON characters and stuff. The question is how do I avoid doing this hack:

.const CartridgeName = "C64GS C" // Maximum 32 bytes.
.text CartridgeName
.byte $61,$72,$74,$72,$69,$64,$67,$65

Basically what I would like to do is to append the constant with the bytes as added data to the string. This again to allow me to fill in the surplus available characters without having to cheat:

.fill 32-CartridgeName.size()-8,0

So what I would like to do is:

.const CartridgeName = "C64GS C"+hexBytes($61,$72,$74,$72,$69,$64,$67,$65)
2016-09-01 21:38
TWW

Registered: Jul 2009
Posts: 541
Hmm another thing I saw now was that I get an error when compiling my code after updating Kickass (was using old version):

    .var ZP                    = $02
    .const FetchDataVector     = ZP .eval ZP+=2


Have to move the ".eval ZP+=2" to a new line but it used to assemble just fine. Will make my ZP variable declarations a lot more messy ^^
2016-09-02 12:20
Scan

Registered: Dec 2015
Posts: 110
You don't need to move it to a new line, you can also use ; to separate the statements:
    .var ZP                    = $02
    .const FetchDataVector     = ZP  ; .eval ZP+=2
Previous - 1 | ... | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | ... | 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
Thierry
Scorpion/Contex / Ar..
Genius/Xenon
csabanw
d0c
Titus/Rabenauge
dlee
neoman/titan
Guests online: 132
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Bromance  (9.6)
10 Memento Mori  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Coders
1 Axis  (9.8)
2 Graham  (9.8)
3 Lft  (9.8)
4 Crossbow  (9.8)
5 HCL  (9.8)

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