Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user maak ! (Registered 2024-04-18) 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-09-03 18:32
Digger

Registered: Mar 2005
Posts: 421
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.
2016-10-19 04:32
TWW

Registered: Jul 2009
Posts: 541
Math Question:

Say I have a number: -161230 and do the following:

    .var number = -161230
    .var HighOrder   = floor(abs(number/10000))                                 // Gives 16
    .var MediumOrder = floor([abs(number/10000)-floor(abs(number/10000))]*100)  // Gives 12
    .var LowOrder    = (abs(number/100))                                        // Gives 1612,3
    .eval LowOrder   = floor(abs(number/100))                                   // Gives 1612
    .eval LowOrder   = [(abs(number/100)) - floor(abs(number/100))]*100         // Gives 29,99999999999545



In my head this should give 30,0

Or shouldn't it?

EDIT: I can use round as a workaround(^^).
2016-10-19 07:44
soci

Registered: Sep 2003
Posts: 473
That's how binary floating point works. This special case would have worked with decimal floating point.

In short floating point numbers need to be handled carefully and yes, that round() will be needed.

Btw. this sort of calculation should have been done with modulo and division using integer arithmetic only. And preferably unsigned to not get "surprising" results for negative numbers (implementation specific).
2016-10-21 19:37
xIII

Registered: Nov 2008
Posts: 210
just a fast question:

if I use -> .word 100,100
the result in Vice is -> 64,80,64,00
I was expecting -> 64,00,64,00 ?

if I use .word $012c
I get -> 2c 80
expecting: 2c 01 ?
2016-10-22 16:46
xIII

Registered: Nov 2008
Posts: 210
Quote: just a fast question:

if I use -> .word 100,100
the result in Vice is -> 64,80,64,00
I was expecting -> 64,00,64,00 ?

if I use .word $012c
I get -> 2c 80
expecting: 2c 01 ?


anyone ?
2016-10-22 18:18
lA-sTYLe

Registered: Sep 2003
Posts: 63
no idea why, nor used to Kickass,

but how about .byte $2c,$01 ?
2016-10-22 18:44
xIII

Registered: Nov 2008
Posts: 210
Quote: no idea why, nor used to Kickass,

but how about .byte $2c,$01 ?


yes thx, ofcourse it works with .byte but it should work with .word ;)
2016-10-22 18:59
soci

Registered: Sep 2003
Posts: 473
No one wants to say but you're likely doing something wrong. The examples given work with the last version.
2016-10-22 19:50
xIII

Registered: Nov 2008
Posts: 210
@soci: indeed I was doing something wrong, I found a ROR in my routine that caused the 1 to become 80 :(
2016-10-30 15:11
Mace

Registered: May 2002
Posts: 1799
This:
Relaunch64 3.3.7 (Build 20161031)
Mac OS X 10.11.6 (x86_64)
Java-Version 1.8.0_111 (Oracle Corporation)
KickAssembler v4.3

Produces this error:
Exception in thread "main" java.lang.UnsupportedClassVersionError: kickass/KickAssembler : Unsupported major.minor version 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
	at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)


Please help :(
Previous - 1 | ... | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 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
kbs/Pht/Lxt
Bansai/BSILabs
megasoftargentina
hedning/G★P
CA$H/TRiAD
Mr SQL
Airwolf/F4CG
wil
Acidchild/Padua
acrouzet/G★P
Paladin/G★P
A3/AFL
Flex/Artline Designs
aegis/ascraeus/r3turn
psych
Guests online: 114
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 The Ghost  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.8)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 Wafer Demo  (9.5)
7 TRSAC, Gabber & Pebe..  (9.5)
8 Onscreen 5k  (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 Organizers
1 Burglar  (9.9)
2 Sixx  (9.8)
3 hedning  (9.7)
4 Irata  (9.7)
5 MWS  (9.6)

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