Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user hoist ! (Registered 2024-10-04) 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....
 
2009-09-04 11:42
Conjuror

Registered: Aug 2004
Posts: 168
Done http://codebase64.org/doku.php?id=base:emulation

I added some 6502 instructions that I noticed were missing as I was working with it. Probably a lot more missing. See asm_instruction_set.xml

Enjoy!
2009-09-04 11:53
MagerValp

Registered: Dec 2001
Posts: 1066
TextMate bundle added to codebase.
2009-09-04 17:24
LOGAN
Account closed

Registered: Aug 2003
Posts: 71
I hope The assembler list will include more than just the modded Acme. And hopefully more symtax highlighting for other editors (preferably free and open source editors like, erm, notepad++ :D
2009-09-08 12:58
TWW

Registered: Jul 2009
Posts: 543
Small question regarding syntax;

I do this:

:irqEnd #$32 ; #<irq1 ; #>irq1

.pseudocommand irqEnd d12 ; irqlo ; irqhi {
lda d12
sta $d012
lda irqlo
sta $fffe
lda irqhi
sta $ffff
}

This works fine.

Question is, how would i do a:

:irqEnd #$32 ; irq1

.pseudocommand irqEnd d12 ; irq {
lda d12
sta $d012
lda #<irq
sta $fffe
lda #>irq
sta $ffff
}

So I don't need to pass both the lo- & the hi-byte to the Pseudo?

In other words, How can I splitt up the 'irq' parameter (16 bits adress pointer) into hi & lo-byte pointers wich I can pass to $ffff:$fffe inside a Pseudo?
2009-09-08 13:30
Slammer

Registered: Feb 2004
Posts: 416
Look in the manual under pseudo commands. Here is showed how to define 16 bit pseudo commands. There is a move command which is defined like this:
.function _16bit_nextArgument(arg) { 
	.if (arg.getType()==AT_IMMEDIATE) .return CmdArgument(arg.getType(),>arg.getValue()) 
	.return CmdArgument(arg.getType(),arg.getValue()+1)
}

.pseudocommand mov16 src;tar { 
	lda src
	sta tar 
	lda _16bit_nextArgument(src) 
	sta _16bit_nextArgument(tar)
} 

With this you can do stuff like:
:mov16 #irq ; $fffe
:mov16 irqTable,x ; $fffe
etc.

You can now define you pseudocommand like this:
pseudocommand irqEnd d12 ; irq {
      lda d12
      sta $d012
      :mov16 irq ; $fffe
}

and use it like this:
:irqEnd #$10 ; #irq1  
or 
:irqEnd d012Table,y ; irqTable,x  
2009-09-08 13:54
Slammer

Registered: Feb 2004
Posts: 416
Btw. forgot to tell that if you don't like to code that much then use a normal macro:

.macro endIrq(d012Value, irq) {
lda #d012Value
sta $d012
lda #<irq
sta $fffe
lda #>irq
sta $ffff
}

Pseudo commands gives more flexibility (you can use different addressing modes on the same pseudo command), while macros might be easier. However, once you get the idea, pseudocommands are really effective.
2009-09-08 19:33
Angel of Death

Registered: Apr 2008
Posts: 210
How much I love using macros and however timesaving it is I am always a bit concerned with not knowing how long my code will turn out. In other words: I'm always worried about ,when finally finished and working, having to take apart the macros to optimize the code to make it shorter...
Probably an OCD symptom on my part but I just happen to like compact code. :)
Anyways. Is there some methode of keeping track of the length besides compiling it and hoping for the best?
2009-09-08 23:53
Conjuror

Registered: Aug 2004
Posts: 168
As compiling takes seconds at most, I'll suffer that time.

Work takes 6-10 minutes for build and redeploy. Now that hurts, especially when you leave a space out of a dynamically generated SQL statement.

2009-09-09 05:00
TWW

Registered: Jul 2009
Posts: 543
Quote: Look in the manual under pseudo commands. Here is showed how to define 16 bit pseudo commands. There is a move command which is defined like this:
.function _16bit_nextArgument(arg) { 
	.if (arg.getType()==AT_IMMEDIATE) .return CmdArgument(arg.getType(),>arg.getValue()) 
	.return CmdArgument(arg.getType(),arg.getValue()+1)
}

.pseudocommand mov16 src;tar { 
	lda src
	sta tar 
	lda _16bit_nextArgument(src) 
	sta _16bit_nextArgument(tar)
} 

With this you can do stuff like:
:mov16 #irq ; $fffe
:mov16 irqTable,x ; $fffe
etc.

You can now define you pseudocommand like this:
pseudocommand irqEnd d12 ; irq {
      lda d12
      sta $d012
      :mov16 irq ; $fffe
}

and use it like this:
:irqEnd #$10 ; #irq1  
or 
:irqEnd d012Table,y ; irqTable,x  


Yeah I saw that section but I thought there might be a more easy approach then define your own special functions to deal with a triviel task such as hi/lo pointers.

I had already used macros for this task but wanted to check out this posibility aswell :)

I guess in the long run pseudo-ops are more convenient even though a little more extensive in the beginning.

*cheers*
2009-09-09 06:25
Slammer

Registered: Feb 2004
Posts: 416
The _16bit_nextArgument(arg) function is the easy way to deal with 16 bit values. Just write the 4 lines once and newer think about it again. This is good when you have to define many 16bit pseudo commands. If you don't like structural things like the _16bit_nextArgument function and the mov command, simply define the pseudocommand directly as shown below. (I guess I should have given you this example in the first place since it easer to look at).

.pseudocommand irqEnd d12 ; irq {

       .var hiArg 
       .if (irq.getType()==AT_IMMEDIATE) .eval hiArg= CmdArgument(arg.getType(),>arg.getValue()) 
       else .eval hiArg= CmdArgument(arg.getType(),arg.getValue()+1)

      lda d12
      sta $d012
      lda irq
      sta $fffe	
      lda hiArg
      sta $ffff	
}
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | ... | 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
REBEL 1/HF
MAT64
theK/ATL
tlr
encore
Jazzcat/Onslaught
Laurikka
Steveboy
X-Raffi/X-Rated
Guests online: 59
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.5)
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 Performers  (9.3)
4 Nostalgia  (9.3)
5 Censor Design  (9.3)
Top Logo Graphicians
1 Sander  (9.8)
2 Mermaid  (9.5)
3 Facet  (9.4)
4 Shine  (9.4)
5 Pal  (9.4)

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