| |
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 |
|
| |
MagerValp
Registered: Dec 2001 Posts: 1078 |
My money would be on stack corruption. Are your IRQ handlers reentrant? |
| |
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 |
| |
Peiselulli
Registered: Oct 2006 Posts: 81 |
try
jmp $ea81
instead |
| |
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. |
| |
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. |
| |
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 |
| |
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. |
| |
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. |
| |
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. |