03 October 2008, 15:09 | #1 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
6502 Asm
Totally the wrong forum really for a place where we should be talking about Amiga related coding but does anyone on here do any 6502 asm on C64? I've been trying to learn some over the last couple of days.
I've only done one routine so far - I knocked together a very quick and dirty scroll text routine which works (just about...) but the text scrolls too fast and I wanted to know if anyone knew of an elegant way to slow it down so it's readable...? If I really shouldn't be posting about non-Amiga related coding stuff here then I'll apologise in advance to the moderators now and wait for the post to be deleted! |
03 October 2008, 15:37 | #2 |
Moderator
Join Date: Jan 2003
Location: ...
Age: 52
Posts: 1,838
|
Generally speaking - regardless of platform - you need to synchronize your screen update with the screen refresh and match a muliple of the screen refresh rate.
The normal way of achieving this is using the vertical blanking interrupts to control screen updates, switching screens etc and you may use the raster line position as well. |
03 October 2008, 15:44 | #3 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Thanks IFW.
I set up an interrupt that gets triggered at raster position $00 and calls the code that writes the next character to the screen, x-scrolls the characters left (using lower 3 bits of $d016) and then copies all character codes from their current location to the one next left each time $d016 x-scroll reaches zero. The scrolling seems to be fairly smooth doing it like this it's just that it zips past too fast - is there something neater I can do than just waiting say for every second or third time raster position zero gets reached? |
03 October 2008, 15:45 | #4 |
Dazed and Confused
Join Date: Dec 2001
Location: portsmouth/uk
Posts: 242
|
Here is some C64 assembly and programming stuff. Maybe it's useful.
Last edited by Jherek Carnelia; 09 April 2011 at 22:22. |
03 October 2008, 20:00 | #5 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Thanks Jherek, that's useful general information.
I tried the method I mentioned in my previous post by changing the routine so that it now waits for the raster beam to reach position zero five times before doing any scrolling. That slows the scroller down enough so it's readable but it's still a bit jerky. Never mind... I'll keep trying to get it nice and shmoove. |
03 October 2008, 20:16 | #6 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
Try syncing on another line than 0. I can't recall the hardware details but I think that unless you write the MSB of the raster position in $D011 the VIC will trigger the interrupt every time the lower 8 bits match, and they will match line 0 twice per frame.
It could also be that you have some logical error in your code. Here's a very simplified example to compare with: Code:
ldy #0 ldx #8 main: lda #$80 cmp $d012 bne *-3 lda #$81 cmp $d012 bne *-3 dex bpl done ldx #0 move: lda $0401, x sta $0400, x inx cpx #39 bne move lda scrolltext, y sta $0427 iny ldx #7 done: stx $d016 jmp main Last edited by Leffmann; 03 October 2008 at 20:42. |
05 October 2008, 13:46 | #7 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Thanks for that Leffman.
I slept on it and then looked at my code again and found a problem with the loop logic that I've now fixed and things are looking a lot better with the scroller now. |
14 October 2008, 23:36 | #8 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,746
|
The C64 actually uses a 6510 CPU!
|
15 October 2008, 00:39 | #9 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,865
|
And the 1541 which you can also program uses a 6502 so all is fine again. lda/sta is all you need anyway =)
|
15 October 2008, 20:46 | #10 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,746
|
DualCore power! "Woohoo!" (c) Homer
|
16 October 2008, 15:05 | #11 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
@ Photon - you're absolutely right but you're also pedantic too! I stand corrected.
@ StingRay - you always make everything to do with asm sound so easy - if only I found it all that simple - I'd have more hair for a start... @ Leffman - I was reading some info on the VIC-II. This document states that for timing of a raster line: "Raster line 0 is an exception: In this line, IRQ and incrementing of RASTER are performed one cycle later than in the other lines." Looks like you were right about raster line 0 being a special case. |
17 October 2008, 22:20 | #12 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
PMC
I didn't know that actually. I was talking about a different situation, but that's good to know. Anything cool to show yet? If you're looking for help with C64 programming then you will find the true experts in #C-64 on the ircnet network. |
18 October 2008, 12:56 | #13 |
move.w #$4489,$dff07e
Join Date: Sep 2005
Location: Norfolk, UK
Age: 43
Posts: 2,351
|
Is there no end to your talents pmc? As if Amiga wasn't enough for you you've now become a hardware basher on the 64 as well. Good work
|
18 October 2008, 18:00 | #14 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Leffman - errr, no nothing very cool to show you yet I'm afraid - unless you would count a rather lame built in character set scroller text as cool...
At the moment I'm just playing really and trying to learn about the hardware. I've read some stuff on codebase64.org and floated around as a guest on CSDb a bit. Those guys on there seem to be the cream of the C64 scene though. The stuff they put out is way, way ahead of anything I think I could ever do but it's fun to try new things anyway. Ideally for me the next stop will be to try to understand all the VIC timing stuff and make a stable raster routine and take it from there. Maybe then I could do some raster splits or open the sideborders, that'd be cool. @ musashi5150 - one tries, one tries but as you well know, when it comes to me and asm, 'talent' is a very relative term! I tell you though man, I'm loving C64 demos - some of the stuff those elite scene guys do on that machine are enough to make you fall off your chair - even doing things that the makers of the hardware would have thought were impossible, all the VIC tricks and things - superb. |
18 October 2008, 18:09 | #15 | |
move.w #$4489,$dff07e
Join Date: Sep 2005
Location: Norfolk, UK
Age: 43
Posts: 2,351
|
Quote:
http://www.pouet.net/prod.php?which=30213 |
|
18 October 2008, 18:19 | #16 | |
HOL/FTP busy bee
Join Date: Sep 2006
Location: Germany
Age: 46
Posts: 32,308
|
Quote:
|
|
18 October 2008, 18:51 | #17 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Yeah I saw the Desert Dream remake, fantastic stuff on a C64 - top notch coding, graphics and music.
You should check out one of my personal favourites Tsunami from Booze Design, if you haven't already: http://noname.c64.org/csdb/getinternalfile.php/6135/Tsunami.zip I love that demo cos it flows so beautifully - it's so laid back and looks so effortless that while you're watching you forget how difficult that stuff is to do on a C64... |
02 November 2008, 21:04 | #18 | ||
Registered User
Join Date: Sep 2008
Location: Trondheim, Norway
Posts: 12
|
Quote:
Quote:
For 6502 training, you can use the http://6502asm.com/ environment, it's a 6502 based virtual machine with development environment running in Javascript. I've heard the author of the site is super sexy and awsome in every thinkable way. hehe.. |
||
04 November 2008, 09:55 | #19 | ||||
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Quote:
Quote:
Quote:
Quote:
I checked out 6502asm.com - nice site. You're right, whoever runs that site must be a bit of a hero... |
||||
05 November 2008, 14:56 | #20 | ||
Registered User
Join Date: Sep 2008
Location: Trondheim, Norway
Posts: 12
|
Well, it's nothing worth mentioning actually. The last one was "Ledge and Deary" from the Solskogen party: http://noname.c64.org/csdb/release/?id=69056. I'm working on another multipart demo, but I'm not sure when/where it will be released yet.
Quote:
Quote:
|
||
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Visual 6502 in JavaScript | Charlie | Retrogaming General Discussion | 1 | 03 October 2010 13:35 |
for ASM programmers | meynaf | Coders. General | 29 | 05 August 2010 10:00 |
Using ReadArgs() from asm | oRBIT | Coders. General | 4 | 11 May 2010 16:11 |
The 6502 assembler code in "The Terminator" (1984) | Shoonay | Nostalgia & memories | 2 | 15 May 2009 13:52 |
ASM Uni Course | BippyM | Coders. Tutorials | 27 | 18 September 2008 10:37 |
|
|