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: 400
Kick Assembler Thread 2

The previous thread took a little long to load, so this is a new fresh one..
 
... 532 posts hidden. Click here to view all posts....
 
2016-03-13 18:31
Jammer

Registered: Nov 2002
Posts: 566
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 21:04
Hoogo

Registered: Jun 2002
Posts: 76
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 07:31
Slammer

Registered: Feb 2004
Posts: 400
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 23:29
TWW

Registered: Jul 2009
Posts: 361
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 23:38
TWW

Registered: Jul 2009
Posts: 361
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 14:20
Scan

Registered: Dec 2015
Posts: 10
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
2016-09-02 18:47
Digger

Registered: Mar 2005
Posts: 202
Tru dat. But you can do this and it works without eval, since it evaluates post expression.

.var zp                 = $c0
.const screen           = zp++
.const vOffset          = zp+=2
.const vScrollText      = zp+=2
2016-09-02 19:22
TWW

Registered: Jul 2009
Posts: 361
You guys are so clever 8-D

I seriously should drag my ass to a (c0py)party so I can start handing out those beers...

Now only question remains is the string issue above.
2016-09-03 17:46
Agemixer

Registered: Dec 2002
Posts: 34
TWW, please check my example (dated 2015-03-27 earlier in this thread) for string conversion.

The basic idea for conversing kickass strings to ascii/petscii/whatever, is some macro like this:


.function pet2asc(p) { .eval p = [ p>$40? p+=$80 : p ] .return [ p<$20? p^$40 : p ] } // character conversion from Kickass text to c64 ascii

.macro asctxt(str) { .fill str.size(), pet2asc(str.charAt(i)) }
.macro asctxtCR(str) { :asctxt(str) .byte $0d } // With carriage return


After having these, you can define your text like:

:asctxt("Hello World!")
:asctxtCR("") // just a carriage return (byte $0d)
:asctxt("The quick brown fox ")
:asctxtCR("jumps over the lazy dog")
2016-09-03 20:32
Digger

Registered: Mar 2005
Posts: 202
Another useful macro (hope @Slammer will add that natively soon) that converts hex string to bytes super useful for color tables.

.macro stringToBytes(string) {
  .for (var i = 0; i < string.size(); i++) {
    .var char = string.charAt(i).number()
    .var value = char >= $30 ? char - $30 : char + 9
    .byte value
  }
}


Example:
stringToBytes("f582900000000000")


Can be surely written even shorter, but I didn't care.
Previous - 1 | ... | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 - 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
Ziili
Jak T Rip/DMAgic
hedning/G★P
xIII/WOW/F4CG
psych858o/MSL/Elysiu..
Magic/Nah-Kolor
Seven/Hitmen
Guests online: 32
Top Demos
1 Uncensored  (9.7)
2 Edge of Disgrace  (9.7)
3 Coma Light 13  (9.6)
4 Comaland  (9.6)
5 Comaland 100%  (9.6)
6 Wonderland XII  (9.5)
7 Fantasmolytic  (9.5)
8 Rocketry  (9.4)
9 GoatLight  (9.4)
10 We Are All Connected  (9.4)
Top onefile Demos
1 Daah, Those Acid Pil..  (9.4)
2 Treu Love [reu]  (9.4)
3 Dawnfall  (9.3)
4 One-Der  (9.2)
5 Hardware Accelerated..  (9.2)
6 Safe VSP  (9.1)
7 Ächzzeit  (9.1)
8 Led Board  (9.1)
9 Goatbeard  (9.1)
10 Black Magic  (9.0)
Top Groups
1 Censor Design  (9.4)
2 Booze Design  (9.4)
3 Oxyron  (9.3)
4 Crest  (9.3)
5 Nostalgia  (9.2)
Top Logo Graphicians
1 Pal  (9.5)
2 Mermaid  (9.2)
3 Yazoo  (9.2)
4 Elko  (9.2)
5 Jailbird  (9.1)

Home - Disclaimer
Copyright © No Name 2001-2016
Page generated in: 0.255 sec.