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: 29
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: 1078
My money would be on stack corruption. Are your IRQ handlers reentrant?
2016-10-18 02:45
wbochar

Registered: May 2002
Posts: 29
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: 275
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: 677
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: 2244
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: 5094
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: 490
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: 545
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
Knut Clausen/SHAPE/F..
Alakran_64
Flashback
Broti/DT/KRN
Devia/Ancients
Paulko64
Guests online: 94
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 Cubic Dream  (9.6)
4 Party Elk 2  (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 Coders
1 Axis  (9.8)
2 Graham  (9.8)
3 Lft  (9.8)
4 Crossbow  (9.8)
5 HCL  (9.8)

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