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

The previous thread took a little long to load, so this is a new fresh one..
 
... 647 posts hidden. Click here to view all posts....
 
2025-06-12 23:28
Krill

Registered: Apr 2002
Posts: 3098
Quoting chatGPZ
I doubt it makes sense to even try using those IEEE macros for producing CBM style floats - they are too different in the details.
I guess it doesn't matter much. For all practical purposes, you'd parse strings to IEEE 64-bit floats (aka "doubles") and then convert those byte-wise to the much simpler BASIC floats with some arithmetics. Inf, NaN and friends... not important for defining constants.

Quoting Slammer
Why is macros cumbersome?
I guess you can't do ".float 62.23, 6.28, 1e6" analogous to .byte/.word (apart from having to define a macro/function for the purpose or including some magic library file every time you need this).

Quoting Oswald
frankly dont think that .float is justified because Gunnar have used it 2 times over a few decades. but it wont hurt either. I cant think of any case I'd use it.
Thank you for your 2 fillér. And I did mention 3 specific examples from my works plus implied at least 2 more in this thread, most of them recent, ongoing or to come.

But let's let this be this thread's last post about this topic, as i seem to be the only one to see practical value in a native 5-byte float feature for a 6502 assembler.
2025-06-13 07:23
TWW

Registered: Jul 2009
Posts: 557
Quoting Krill
Quoting Slammer
Why is macros cumbersome?
I guess you can't do ".float 62.23, 6.28, 1e6" analogous to .byte/.word (apart from having to define a macro/function for the purpose or including some magic library file every time you need this).


Regarding this; Why not add a command line option (Manual - Appendix A - Table A.1.) which allows importing source files?

This would allow you to import f.eks. a 'magic library' fP-function as requested here (can't be that hard to write a function to do this) and then add this command line option to the KickAss.cfg file in the KA folder (Ref. 2.3. in the manual). This way these functions are always included (almost like they were internal :D) and would not have to be referenced each time you need them.
2025-06-13 13:41
Oswald

Registered: Apr 2002
Posts: 5127
"Why not add a command line option (Manual - Appendix A - Table A.1.) which allows importing source files?"

how to make a simple task overcomplicated tm. and then it all gets forgotten and the source gets used by someone else, who wonders where the fuck is that macro referenced when nothing is in the source.
2025-06-13 13:48
Slammer

Registered: Feb 2004
Posts: 449
Quoting chatGPZ
I doubt it makes sense to even try using those IEEE macros for producing CBM style floats - they are too different in the details.


Could you elaborate on that? I have noted that the exponents are different, so giving the exponent directly, not as bits, will save a couple of lines, so exposing that too will make it easier. But could you explain how the fraction bits differ?

(btw, it is functions, not macros. The macro/pseudocommand is up to you to implement using the functions)

NB.You should update your 'Opcode naming in different Assemblers' table in the NoMoreSecrets docs as it got outdated in 2014. These updates are missing, perhaps more.

18/11-2014 : New beta release (v3.37):
Added illegal nop opcodes (nop #$01 - nop $02 - nop $03,x - nop $1000 - nop $1000,x)

2/5-2021 : New release (v5.20):
Added aliases for illegal opcodes: lax=lxa, dcp=dcm, isc=ins=isb, alr=asr, xaa=ane, axs=sbx, ahx=sha, tas=shs, las=lae=lds.


You can find the KickAss opcodes here.
https://theweb.dk/KickAssembler/webhelp/content/apas03s02.html
2025-06-13 14:17
Slammer

Registered: Feb 2004
Posts: 449
Quoting TWW
Regarding this; Why not add a command line option (Manual - Appendix A - Table A.1.) which allows importing source files?

This would allow you to import f.eks. a 'magic library' fP-function as requested here (can't be that hard to write a function to do this) and then add this command line option to the KickAss.cfg file in the KA folder (Ref. 2.3. in the manual). This way these functions are always included (almost like they were internal :D) and would not have to be referenced each time you need them.


Great idea. It is hereby noted. Until implemented, it is possible to create your own custom version of KickAss with the macros you wan't by opening the jar file (with a zip program), find the autoinclude.asm file and place it there.

[Oswald] If you are worried about the kickass.jar / KickAss.cfg is missing when someone else is going to compile simply put it in your repository. I would say the problem would be much larger if you have a large toolchain with dedicated tools, you should remember to install and configure. In the end I guess its all boils down to "It's easier for you to work with other peoples code if they use the tools you already know", but that is the same for everybody.
2025-06-13 14:33
Oswald

Registered: Apr 2002
Posts: 5127
I dont use repository, its just a source file and an assembler and a few data files generated in vb6 or python, I dont like to overcomplicate things. but whatever floats your boat, hide the source include in some .cfg file you will forget even exists, its much nicer to be able to see it in the main source right away. but that is just my opinion, you do it as you like.
2025-06-13 15:15
cobbpg

Registered: Jan 2022
Posts: 53
Quoting Krill
I guess you can't do ".float 62.23, 6.28, 1e6" analogous to .byte/.word (apart from having to define a macro/function for the purpose or including some magic library file every time you need this).

Also, now you have to write it as something like EmitFloats(List().add(1, 2, 3, 4, 5)) (short of defining all the N variants you'll ever use). If we had variadic macros, you could write EmitFloats(1, 2, 3, 4, 5) instead, which doesn't feel too bad to me. Variadic macros and functions could be generally useful to clean up some noise here and there, and their implementation could be straightforward: they would always be declared with a single List-typed argument, possibly with a dedicated keyword like .varmacro/.varfunction.
2025-06-14 09:38
Slammer

Registered: Feb 2004
Posts: 449
Quoting Oswald
I dont use repository, its just a source file and an assembler and a few data files generated in vb6 or python, I dont like to overcomplicate things. but whatever floats your boat, hide the source include in some .cfg file you will forget even exists, its much nicer to be able to see it in the main source right away. but that is just my opinion, you do it as you like.


But Oswald, I find it a bit funny that you use the exact same constructs in Python as the ones you critize. Eg. if you want to use 'datetime' you do 'from datetime import datetime' and your downloaded libraries you keep in 'requirements.txt' (equivalent to what you call 'some .cfg file you will forget even exists'). And even if you don't use a repository, you can still place the jar/cfg-file together with your project. I'm starting to understand why people call you 'grumpy old man' - It's like you are trying to construct problems there isn't there :-)
2025-06-14 10:35
Oswald

Registered: Apr 2002
Posts: 5127
Quote: Quoting Oswald
I dont use repository, its just a source file and an assembler and a few data files generated in vb6 or python, I dont like to overcomplicate things. but whatever floats your boat, hide the source include in some .cfg file you will forget even exists, its much nicer to be able to see it in the main source right away. but that is just my opinion, you do it as you like.


But Oswald, I find it a bit funny that you use the exact same constructs in Python as the ones you critize. Eg. if you want to use 'datetime' you do 'from datetime import datetime' and your downloaded libraries you keep in 'requirements.txt' (equivalent to what you call 'some .cfg file you will forget even exists'). And even if you don't use a repository, you can still place the jar/cfg-file together with your project. I'm starting to understand why people call you 'grumpy old man' - It's like you are trying to construct problems there isn't there :-)


yes you can do all that, but I am lazy and grumpy, I just start the python file then it complains, then I see on top of the source what libraries are missing, I install them, done. :)

tbh I only used python for one thing, and dont know very much about it, didnt knew about req.txt, but wouldnt use it just to "remember" I used numpy and that other library I clearly remember downloading from a specific site.
2025-06-14 11:00
Slammer

Registered: Feb 2004
Posts: 449
Quoting cobbpg
Quoting Krill
I guess you can't do ".float 62.23, 6.28, 1e6" analogous to .byte/.word (apart from having to define a macro/function for the purpose or including some magic library file every time you need this).

Also, now you have to write it as something like EmitFloats(List().add(1, 2, 3, 4, 5)) (short of defining all the N variants you'll ever use). If we had variadic macros, you could write EmitFloats(1, 2, 3, 4, 5) instead, which doesn't feel too bad to me. Variadic macros and functions could be generally useful to clean up some noise here and there, and their implementation could be straightforward: they would always be declared with a single List-typed argument, possibly with a dedicated keyword like .varmacro/.varfunction.

True, The List().add(..) is not nice in this situation.. I can tell you that I'm planing a to make it easier to make lists and hashtables which will do it a little better. [..] and {..} is taken, so I plan for:
    .var myList = [[ $10, $20, $30, "Hello", "World"]]     
    .var myHashTable = {{ "Name" : "Codebase64", Message: "Support Frantic and Moloch" }}  

and some python inspired stuff like:
    .var myList = [[ x foreach x in range(10)]]     

    // Fill 5 sprites in alternating colors 
    // (Spriterange returns structs with n= spriteNo, x=xpos, y=....)
    .var colors = [[ %10101010, %01010101, %11111111, %10011001, %01100110 ]]
    .fill [[ colors.get(s.n) foreach s in spriteRange(5) ]]     

However, the new namespacing and segment modifiers shall be completed first.

variadic macros would also be good!

Regarding the current sitiation. Using .pseudocommands gets the job done so if you really want a float 'directive' you can hack it with something like:

    .pseudocommand float f0 : f1 : f2 : f3 : f4 : f5 : f6 : f7 {

        .var varargs = List().add(f0,f1,f2,f3,f4,f5,f6,f7)
        .foreach (var f in varargs) {
            .if (f.getType()== AT_NONE) .return;
            .fill myToBasicFloatFunc(f.getValue())
        }
    }

    // Use:
    float 1.234 : 0.000123 : -123.123
Previous - 1 | ... | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 - 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
Guests online: 540
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Codeboys & Endians  (9.7)
4 Mojo  (9.6)
5 Coma Light 13  (9.6)
6 Edge of Disgrace  (9.6)
7 Signal Carnival  (9.6)
8 Wonderland XIV  (9.5)
9 Uncensored  (9.5)
10 Comaland 100%  (9.5)
Top onefile Demos
1 Nine  (9.7)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.5)
6 Scan and Spin  (9.5)
7 Onscreen 5k  (9.5)
8 Grey  (9.5)
9 Dawnfall V1.1  (9.5)
10 Rainbow Connection  (9.5)
Top Groups
1 Artline Designs  (9.3)
2 Booze Design  (9.3)
3 Performers  (9.3)
4 Oxyron  (9.3)
5 Censor Design  (9.3)
Top Fullscreen Graphicians
1 Joe  (9.7)
2 Sulevi  (9.6)
3 The Sarge  (9.6)
4 Veto  (9.5)
5 Facet  (9.5)

Home - Disclaimer
Copyright © No Name 2001-2025
Page generated in: 5.999 sec.