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 > ASM Code Sizes
2016-10-18 00:09
wbochar

Registered: May 2002
Posts: 26
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 02:19
MagerValp

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

Registered: May 2002
Posts: 26
UpperSection:

--- Do Something Here ---


lda #120
sta $d012

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


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

Registered: Oct 2006
Posts: 81
try
jmp $ea81
instead
2016-10-18 08:15
Peacemaker

Registered: Sep 2004
Posts: 243
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 09:09
enthusi

Registered: May 2004
Posts: 674
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 09:53
TheRyk

Registered: Mar 2009
Posts: 2035
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 14:06
Oswald

Registered: Apr 2002
Posts: 5007
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 15:02
oziphantom

Registered: Oct 2014
Posts: 478
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 21:50
TWW

Registered: Jul 2009
Posts: 541
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
Brataccas/HF
celticdesign/G★P/M..
Guests online: 353
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 No Bounds  (9.6)
6 Comaland 100%  (9.6)
7 Uncensored  (9.6)
8 The Ghost  (9.6)
9 Wonderland XIV  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 Party Elk 2  (9.7)
2 Cubic Dream  (9.6)
3 Copper Booze  (9.5)
4 Rainbow Connection  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Onscreen 5k  (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 Booze Design  (9.3)
2 Nostalgia  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Diskmag Editors
1 Jazzcat  (9.4)
2 Magic  (9.4)
3 hedning  (9.2)
4 Newscopy  (9.1)
5 Elwix  (9.1)

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