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 > Useless coding riddle: Stable raster without I/O
2014-11-12 08:59
lft

Registered: Jul 2007
Posts: 369
Useless coding riddle: Stable raster without I/O

Hi!

I came up with a technique to synchronise code to the raster position without accessing any I/O registers. It is not very efficient, and hence not very useful, but it was a nice intellectual exercise.

This is the premise: Provide a small piece of code (less than a page) that may start executing at any time. When execution reaches the end of the code, the current rasterline and cycle will be known. You may assume that sprites and interrupts are off, and that d011 has its default value (9b).

See if you can figure out how it's done!
 
... 20 posts hidden. Click here to view all posts....
 
2014-11-15 14:03
Fresh

Registered: Jan 2005
Posts: 101
This is my last one, I don't want to flood the thread. :)
It uses brk and converges a bit faster: 262 frames, about 5.2s.
Too bad that I couldn't bring it down to 256 or less...
One more thought: adding other misaligned write cycles, even though it doesn't ruin the sync process, has the side effect of slowing it down because those writes get "randomly" absorbed by the badlines.


http://pastebin.com/rLNaayPz
(63 bytes)
2014-11-16 00:15
ruk

Registered: Jan 2012
Posts: 43
@lft: Brilliant as always :) I would never have thought of using JSR in favour of a plain old INC. 10/10
2021-12-11 13:19
Krill

Registered: Apr 2002
Posts: 2980
For the record, Quiss's method with Copyfault's refinements solves the problem in 8 bytes, so it does have useful properties for sizecoding. =)
2021-12-11 17:25
Copyfault

Registered: Dec 2001
Posts: 478
Quoting Krill
For the record, Quiss's method with Copyfault's refinements solves the problem in 8 bytes, so it does have useful properties for sizecoding. =)
Oh nice, thanks Krill for the mention. This brought the whole thread here to my notice for the first time, so I really *do* wonder how this could have slipped through my radar for coding riddles.

Nice approaches in here, so thanks also for the pointer!
Previous - 1 | 2 | 3 - 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
instant
csabanw
Derision/Longshot
psych
Linus/MSL
algorithm
Røly/Mayday!
Krill/Plush
zscs
Guests online: 81
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 No Listen  (9.6)
3 Party Elk 2  (9.6)
4 Cubic Dream  (9.6)
5 Copper Booze  (9.6)
6 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Musicians
1 Rob Hubbard  (9.7)
2 Mutetus  (9.7)
3 Jeroen Tel  (9.7)
4 Linus  (9.6)
5 Stinsen  (9.6)

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