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-05 08:29
Krill

Registered: Apr 2002
Posts: 3098
Slammer: One thing i miss in my two go-to assemblers 64tass and ca65, and which i haven't seen in any other 6502 assembler so far, is... *drumrolls*

a .float directive emitting BASIC 5-byte floats.

Like this
baseline:   .float .39 ; kBps KERNAL LOAD throughput (1x speed)
would be equivalent to
baseline:   .byte $7f,$47,$de,$23,$10
but a lot more convenient for the user. I reckon this would not be terribly hard to add? =) (Planning to pester Soci about this.)
2025-06-05 12:24
Slammer

Registered: Feb 2004
Posts: 449
Quoting Krill
Slammer: One thing i miss in my two go-to assemblers 64tass and ca65, and which i haven't seen in any other 6502 assembler so far, is... *drumrolls*

a .float directive emitting BASIC 5-byte floats.

Like this
baseline:   .float .39 ; kBps KERNAL LOAD throughput (1x speed)
would be equivalent to
baseline:   .byte $7f,$47,$de,$23,$10
but a lot more convenient for the user. I reckon this would not be terribly hard to add? =) (Planning to pester Soci about this.)


What do you need it for? (Usecases?)

My impression is that Soci is good at what he is doing. If you manage to convince him I'm sure you will have it in no time.
2025-06-05 14:29
Krill

Registered: Apr 2002
Posts: 3098
Quoting Slammer
What do you need it for? (Usecases?)
Working with the ROM float routines, ofc.

Came in handy with data throughput calculation with Transwarp, some precalc stuff in Artefacts, and lately, on 80-column PET, calculating FPS from cyclecount between VSYNC signals, e.g.
2025-06-05 17:05
Slammer

Registered: Feb 2004
Posts: 449
Quoting Krill
Quoting Slammer
What do you need it for? (Usecases?)
Working with the ROM float routines, ofc.

Came in handy with data throughput calculation with Transwarp, some precalc stuff in Artefacts, and lately, on 80-column PET, calculating FPS from cyclecount between VSYNC signals, e.g.


Ok, What I was trying to figure out is if it was a one time occurance. Giving it a .float directive feels wrong (Like mixes two worlds) but I guess thats a matter of taste. If someone needed it in Kick Assembler I think I would make a getExponentBits(d) and getMantissaBits(d) and then it would be possible to make a macro that produced any float format you like. A name like BasicFloat(f) would be in line with BasicUpstart() and people could handle cornercases if any (nan? Inf?) like they want.
2025-06-05 21:27
Slammer

Registered: Feb 2004
Posts: 449
Quoting TWW


#2: Did I hear version?? In that case would it be possible to allow one or two additional passes to resolve labels (if that indeed would fix the issue)?

No-sense Example:
    .if (TestLabel == $1000) {
        lda #$00
        sta $d020
    } else {
        lda #$00
        sta $d020
        sta $d021
    }

TestLabel:



This would for example allow pseudocommands automatically select long branches (forwards) for example or make "optimizations" where an immediate value passed to a mov16 command which has the same hi and lo byte be optimized (and there were other usecases as well but can't remeber of the top of my head).



This one is complicated. I don't think the general case gonna happend anytime soon. There is the classic problem of, what will you do here:
	*=$1000-8
    .if (TestLabel == $1000) {
        lda #$00
        sta $d020
    } else {
        lda #$00
        sta $d020
        sta $d021
    }

TestLabel:


You could try one of the possibilities and then adjust back and forth, and then let the progress detection catch it and make a 'no progress error', but these are rather confusing since 'Why wasn't there any progress?'. A second reason is that the switching back and forth works poorly together with the caching mechanism (Results from previous passes are reused in later passes so heavy calculation are only done once and not once pr pass)

However I have given some thoughts to supporting specialized cases (You mentioned the branch distance problem)
2025-06-07 11:23
Krill

Registered: Apr 2002
Posts: 3098
Quoting Slammer
Ok, What I was trying to figure out is if it was a one time occurance.
Certainly not one-time in my world (if so, it wouldn't have occured to me to bring this up here :D).
Float computations keep popping up in instrumentation and small demos (anything <= 4 KB).

Quoting Slammer
Giving it a .float directive feels wrong (Like mixes two worlds) but I guess thats a matter of taste.
There is the .dword directive, and 32-bit integers arguably aren't native to the architecture either.

40-bit float math comes readily available with the BASIC ROMs of all 6502-based Commodore computers (and quite a few other 8-bit machines running Microsoft BASIC, too).

Quoting Slammer
If someone needed it in Kick Assembler I think I would make a getExponentBits(d) and getMantissaBits(d) and then it would be possible to make a macro that produced any float format you like.
I assumed macros to be a possibility already, but they're rather cumbersome for something that is quite native to the platform (not its CPU architecture) and should, imho, be expressible with a first-class directive.

But yeah, with macros and functions doing the job, it remains a mere nice-to-have.
2025-06-12 00:56
Slammer

Registered: Feb 2004
Posts: 449
Quoting Krill
Quoting Slammer
If someone needed it in Kick Assembler I think I would make a getExponentBits(d) and getMantissaBits(d) and then it would be possible to make a macro that produced any float format you like.
I assumed macros to be a possibility already, but they're rather cumbersome for something that is quite native to the platform (not its CPU architecture) and should, imho, be expressible with a first-class directive.


I guess you can easily do it if you put a little restriction on the used values (Don't use very large values and don't use very small values) since you have to be a little careful not to loose bit when converting them. However, java has a doubleToLongBits() which gives the IEEE 754 double bits, so they could easily be exposed.

Why is macros cumbersome? Is it to make? (Don't know the commodore float format) or to use. You can do it as a pseudocommand, so you don't have todo the paranthesis to execute (but you will also have to skip the dot):
basicFloat 1.234
or 
float 1.234
2025-06-12 08:16
Slammer

Registered: Feb 2004
Posts: 449
After giving it some thoughts, I guess there is a couple of details you have to pay attention to in the implementation...
2025-06-12 16:38
chatGPZ

Registered: Dec 2001
Posts: 11523
I doubt it makes sense to even try using those IEEE macros for producing CBM style floats - they are too different in the details.
2025-06-12 17:44
Oswald

Registered: Apr 2002
Posts: 5127
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.
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
Colt45RPM
Guests online: 402
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 Cover Designers
1 Duce  (9.8)
2 Electric  (9.8)
3 Junkie  (9.6)
4 The Elegance  (9.5)
5 Mermaid  (9.3)

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