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 > Coding on a PC for the 64?
2016-01-11 05:53
Stablizer

Registered: Jan 2016
Posts: 19
Coding on a PC for the 64?

I've seen various editors out there, currently starting to use the C64Studio for this, but it seems like getting charsets, graphics, music, etc, is a bit problematic when going at it this way, isn't it?

Would love to get some pointers to reading material on the subject (have done some searches already, but haven't come up with anything notable really).

Thanks!
-Stab
 
... 179 posts hidden. Click here to view all posts....
 
2016-01-20 18:33
soci

Registered: Sep 2003
Posts: 474
Yes, it looks similar but it's very different.

On the other hand your version is easier to understand for those unfamiliar with the concepts. And at the end that's what matters.
2016-01-20 18:38
Slammer

Registered: Feb 2004
Posts: 416
I imagine that you find the range directive and then duplicate the line and insert 0,1,2,3,4... as replacement for the range? (Seems clear to me)
2016-01-20 19:05
Oswald

Registered: Apr 2002
Posts: 5022
nice inline sinus stuff guys. any way to use different numbers than 0-256 ? :)

the subtle difference in syntax doesnt matter, its not why some1 would choose one assembler over the other imho.
2016-01-20 19:22
soci

Registered: Sep 2003
Posts: 474
The macro replacement model gives the correct answer for that example. But I didn't stop there.

Oswald:
A slightly modified version for 100 items in 0-999 range, nicely separated into two tables (low/high bytes).
tmp = 500.5 + 499 * sin(range(100) * rad(360.0/100))
low  .byte <tmp
high .byte >tmp
2016-01-20 20:14
ChristopherJam

Registered: Aug 2004
Posts: 1380
Loving soci's solution for the sine table.

As for me,
from cjplib3 import dumpNumarrayToa65, np

with open("sinus.inc","w") as fo:
    dumpNumarrayToa65(fo, "sinus", (128.5+127*np.sin(np.arange(256)*np.pi/128)).astype(np.int))

All but the last line I'd probably already have in place if there were already other tables or data to include. Fair chance 'i' would already equal range(256), too.
2016-01-20 21:11
Oswald

Registered: Apr 2002
Posts: 5022
soci, you make me excited, now can you generate code aswell with that? an example? :)
2016-01-20 21:20
Oswald

Registered: Apr 2002
Posts: 5022
tmp = range (999)

sta tmp+screen


would work ?
2016-01-20 21:32
Slammer

Registered: Feb 2004
Posts: 416
I think i would just do it twice. Something like:
low: .fill 100, <500.5+499*sin(toRadians(i*360/100))
high: .fill 100, >500.5+499*sin(toRadians(i*360/100))
But you could also define a list or function first if you only want to write you expression once:
.function mySinus(i) { .return 500.5+499*sin(toRadians(i*360/100)) }
low: .fill 100, <mySinus(i)
high: .fill 100, >mySinus(i)

Oswald: My current guess is that soci defines a list with his range command and that all his operations/ functions work on lists. So the range list times the rad(360.0/100) gives another list where all the elements are multiplied by the result of the rad calculation. Etc.
2016-01-20 21:32
soci

Registered: Sep 2003
Posts: 474
Oswald:
Yes it does work, but I go for an example where you don't need to scroll the forum too much after I paste it in ;)
.1000 a2 00          ldx #$00           ldx #0
.1002 9d 00 04       sta $0400,x     lp sta $400+range(4)*256,x
.1005 9d 00 05       sta $0500,x
.1008 9d 00 06       sta $0600,x
.100b 9d 00 07       sta $0700,x
.100e e8             inx                inx
.100f d0 f1          bne $1002          bne lp

A bit less pretty example:
.1000 a5 fb          lda $fb            lda $fb
.1002 0a             asl a              asl [a,] x 4
.1003 0a             asl a
.1004 0a             asl a
.1005 0a             asl a
.1006 85 fb          sta $fb            sta $fb
2016-01-20 21:43
soci

Registered: Sep 2003
Posts: 474
Slammer: Right. That's what happens.

Range generates a range of integers that's the data source.

Universal functions (like the built-in sin() here) can operate on (nested) arrays. And operators too.

Broadcasting happens when the sizes don't match, then things get repeated as necessary (a simple number is an "array" too).

And at the end the ".byte" directive flattens the arrays (if necessary) for storing.

Using this I can throw out most of my verbose for loops.

There are still some corner cases I need to work on, but all my practical use cases are covered.

Better don't think about how much effort it took to implement this using plain C ;)
Previous - 1 | ... | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | ... | 19 - 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
Alakran_64
Core/VPN
sln.pixelrat
hedning/G★P
jmin
Oxbow/Xenon
tlr
Didi/Laxity
Hein
Apollyon/ALD
Mibri/ATL^MSL^PRX
Guests online: 103
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 Dawnfall V1.1  (9.5)
8 Quadrants  (9.5)
9 Daah, Those Acid Pil..  (9.5)
10 Birth of a Flower  (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 Fullscreen Graphicians
1 Carrion  (9.8)
2 Joe  (9.8)
3 Duce  (9.8)
4 Mirage  (9.7)
5 Facet  (9.7)

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