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 > Do you analyze page crossings / try to eliminate them?
2024-03-13 13:16
cadaver

Registered: Feb 2002
Posts: 1153
Do you analyze page crossings / try to eliminate them?

Particularly in a game context, where code isn't easily separated into hot paths + data can be spread out in a manner that is not conductive to page-aligning everything cleanly?

As for the methods, I personally do that by symbol table analysis + a customizable simple emulator for runtime detection & counting ( https://github.com/cadaver/oldschoolengine2 )
 
... 28 posts hidden. Click here to view all posts....
 
2024-03-18 17:01
Oswald

Registered: Apr 2002
Posts: 5018
Quote: If someone would happen to feel like it, don't hesitate to write a short article on this topic on codebase64.

https://codebase64.org/doku.php?id=start

By the way: I just realised that the Codebase64 wiki has existed for 17 years now. Quite a while. :)

//FTC


thank you for keeping it alive, I bet it helped countless coders throughout the years. I use it to steal some routines from time to time I know.
2024-03-18 17:03
Oswald

Registered: Apr 2002
Posts: 5018
Quote: I sometimes use macros like this:
!macro lobcs .target {
!if (* - .target) <= 126 {
	bcs .target
} else {
	bcc +
	jmp .target
+
}
}


.copy
... Code that might grow or shrink depending on zeropage usage etc ...
+lobcs .copy



with a switch 64tass does this automatically for you, every too far branch is replaced like that.

.page

...

.endp

if a page is crossed between .page and .endp you get a warning.
2024-03-19 01:07
Martin Piper

Registered: Nov 2007
Posts: 634
Quote: with a switch 64tass does this automatically for you, every too far branch is replaced like that.

.page

...

.endp

if a page is crossed between .page and .endp you get a warning.


Yeah I don't want a switch to have that for every branch, I want more control. I never really liked TASS, it never felt like a good assembler.
2024-03-19 09:16
Krill

Registered: Apr 2002
Posts: 2845
Quoting Martin Piper
I never really liked TASS, it never felt like a good assembler.
Care to elaborate? :)

I, for one, prefer my assembler's pseudo-ops not to scream at me (and the assembler itself to accept canonical syntax).
2024-03-19 13:25
chatGPZ

Registered: Dec 2001
Posts: 11118
--fullstop to the rescue :D

I prefer ACME too, only because the dev is on IRC so i can yell at him when something doesn't work as expected :)
2024-03-19 15:21
Martin Piper

Registered: Nov 2007
Posts: 634
Quote: Quoting Martin Piper
I never really liked TASS, it never felt like a good assembler.
Care to elaborate? :)

I, for one, prefer my assembler's pseudo-ops not to scream at me (and the assembler itself to accept canonical syntax).


It's mostly the syntax. For example, having "." used for directives feels very wrong. For me a "." is meant to be a local label, and a label without is a global label.

Then after .text and .byte etc we have functions, like binary(), suddenly appear with a different syntax and naming convention again.

I really just get a massive headache every time I look at TASS stuff.

I've tweaked ACME to include much better label resolving and code generation that can settle on stable addresses instead of aborting the assembly. I've also added python support for inline assembly and data generation. With these additions, I don't need TASS.
2024-03-19 16:16
Raistlin

Registered: Mar 2007
Posts: 562
We're veering off topic here but I prefer KickAss .. for reasons hinted at in its name. I wish it wasn't Java-based, of course, but that's not such a huge bugbear.
2024-03-19 17:49
Frantic

Registered: Mar 2003
Posts: 1627
Quote: thank you for keeping it alive, I bet it helped countless coders throughout the years. I use it to steal some routines from time to time I know.

👍 Credits should also go to CountZero for hosting, and Moloch for providing the domain name.
2024-03-19 18:49
soci

Registered: Sep 2003
Posts: 473
Quoting Martin Piper
I've tweaked ACME to include much better label resolving and code generation that can settle on stable addresses instead of aborting the assembly. I've also added python support for inline assembly and data generation. With these additions, I don't need TASS.

Hmm, interesting. I take it as a compliment.

Back on topic I do align stuff but only as needed. Did profiling once in a while like on cfsfsck where it was not obvious what takes the most time. But for effects it's usually easy to know which loop(s) need such branch/table optimizations.

Btw. while listing all page crossing branches can be insightful too that's not how it goes. As mentioned above page checks for branch or table page crosses are added where these matter. Sometime in the past I got a friendly reminder that these two crossings are not exactly the same so there's a way to distinguish which one is meant.

Assertions are good but they do trigger eventually and then comes the code reshuffling, sticking stuff to explicit addresses or adding of alignments. To avoid the first two I did some work last year on alignments ( https://tass64.sourceforge.net/#alignment ). Just so I don't need to worry about wasting more than what's necessary for interrupt routines with small timing loops in them. Or to only align a critical table if it's really necessary.

Such alignments were possible through creative use of fill directive already so there's nothing new under the sun.
2024-03-20 04:29
Martin Piper

Registered: Nov 2007
Posts: 634
Quote: We're veering off topic here but I prefer KickAss .. for reasons hinted at in its name. I wish it wasn't Java-based, of course, but that's not such a huge bugbear.

Hah. I've been thinking of converting ACME to Java so I can integrate assembly into testing and profile guided optimisation. It would allow branch optimisation and also choose which labels/data to put in zeropage.
Previous - 1 | 2 | 3 | 4 - 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
csabanw
E$G/hOKUtO fOrcE
El Jefe/sidDivers
Guests online: 130
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 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Wafer Demo  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Nostalgia  (9.3)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Original Suppliers
1 Black Beard  (9.7)
2 Derbyshire Ram  (9.5)
3 hedning  (9.2)
4 Baracuda  (9.1)
5 Irata  (8.5)

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