Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in 
CSDb User Forums


Forums > C64 Coding > ASM Code Sizes
2016-10-18 02:09
wbochar

Registered: May 2002
Posts: 12
ASM Code Sizes

I'm working on a project, that has 8 raster IRQ interrupts driving sprites and character animations.

So far everything works great, but as the code gets larger I get my program dumping to basic.

its not an error in the code, but just too much code it seems. Each IRQHandler has about 30-40 lines of code in it, with a batch of handler subroutines defined after the irqs.

I am at the point if in my last IRQ I add:

inc $d020

The program dumps to basic.

if I remove the line or any line before the code, the program runs as it should.



I am using Kick Assembler the following is the memory map before it blows. The code is in the Main Section.

Memory Map
----------
$0801-$080c basic bootstrap
$0810-$0c24 Main
$2000-$21ff Font Data
$2218-$27ff Custom Font Area
$2800-$31ff SpriteBlockersData
$4000-$49ff BitmapSource

I've only made small ASM programs in the past, so maybe its how I am structuring my source or something?

Is this a Page Boundry issue or something like that? I have been trying to find some reading on this but I don't know how to phrase the question..

--Wolf
2016-10-18 04:19
MagerValp

Registered: Dec 2001
Posts: 872
My money would be on stack corruption. Are your IRQ handlers reentrant?
2016-10-18 04:45
wbochar

Registered: May 2002
Posts: 12
UpperSection:

--- Do Something Here ---


lda #120
sta $d012

lda #<MidSection
sta $0314
lda #>MidSection
sta $0315


asl $d019
jmp $ea31
2016-10-18 07:32
Peiselulli

Registered: Oct 2006
Posts: 65
try
jmp $ea81
instead
2016-10-18 10:15
קєคςє๓คкєг

Registered: Sep 2004
Posts: 163
Memory Map
----------
$0801-$080c basic bootstrap
$0810-$0c24 Main
$2000-$21ff Font Data
$2218-$27ff Custom Font Area
$2800-$31ff SpriteBlockersData
$4000-$49ff BitmapSource

looks good. shouldnt make any problem. as long as you dont overwrite the "main" memory with data within your code somewhere.
2016-10-18 11:09
enthusi

Registered: May 2004
Posts: 635
Sometimes people tend to clear screen ram with 1024 bytes instead of 1000 which causes problems. Just something I saw several times when debugging stuff.
2016-10-18 11:53
TheRyk

Registered: Mar 2009
Posts: 371
Quote: Sometimes people tend to clear screen ram with 1024 bytes instead of 1000 which causes problems. Just something I saw several times when debugging stuff.

Yeah, fucking up sprite pointers for instance :) Not relevant if you set them afterwards, but also easy to prevent
2016-10-18 16:06
Oswald

Registered: Apr 2002
Posts: 4010
you should stop rooting your irqs through kernal rom. do it like this

http://codebase64.org/doku.php?id=base:introduction_to_raster_i..

my guess is that the problem is caused that your irqs overlap.
2016-10-18 17:02
oziphantom

Registered: Oct 2014
Posts: 102
The Kernal ISR is re-entrant thought right, its pushes not ZP stores.

If you are using the Kernal you HAVE disabled the CIA interrupts that BASIC uses right? If not my guess is that the INC is just putting you into a race condition where the CIA fires the IRQ and you have changed 314 and not 315 or something like that.

Get a build of vice with the memmap enabled, put a break point on the BRK handler code in the Kernal ( my best guess at what is causing you to hit BASIC ) then use chis and backrace where the cpu went.
2016-10-18 23:50
TWW

Registered: Jul 2009
Posts: 373
My money is on a subroutine which moves in memory when your code size on the IRQ routine moves. Remove the dec $d020 so it works fine, then try to .align $100 and other values to ensure your code don't fail depending on it's memory position.
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
ptoing
Thierry
Guests online: 31
Top Demos
1 Uncensored  (9.7)
2 The Shores of Reflec..  (9.7)
3 Edge of Disgrace  (9.7)
4 Coma Light 13  (9.6)
5 Lunatico  (9.6)
6 Comaland 100%  (9.6)
7 Incoherent Nightmare  (9.5)
8 Wonderland XII  (9.5)
9 Comaland  (9.5)
10 Neon  (9.5)
Top onefile Demos
1 Dawnfall V1.1  (9.5)
2 Daah, Those Acid Pil..  (9.4)
3 Treu Love [reu]  (9.4)
4 Dawnfall  (9.3)
5 Tunnel Vision  (9.3)
6 One-Der  (9.2)
7 Goatbeard  (9.2)
8 Globe 2016 [reu]  (9.2)
9 Hardware Accelerated..  (9.2)
10 Safe VSP  (9.1)
Top Groups
1 Booze Design  (9.4)
2 Oxyron  (9.4)
3 Censor Design  (9.4)
4 Crest  (9.3)
5 SHAPE  (9.2)
Top Crackers
1 Mr. Z  (9.9)
2 Mitch  (9.8)
3 Mr Zero Page  (9.8)
4 Snacky  (9.8)
5 Janitor  (9.7)

Home - Disclaimer
Copyright © No Name 2001-2017
Page generated in: 0.239 sec.