|
Subject: Re: [stella] kernal klunk From: "B. Watson" <atari@xxxxxxxxxxxxxx> Date: Mon, 9 Feb 2004 10:16:45 -0500 (EST) |
On Mon, 9 Feb 2004 KirkIsrael@xxxxxxxxxxxxx wrote:
> it's funny, I used to be really paranoid about page boundaries...
> I made up a perl script to analyze and find cross-page jumps,
As much as I love perl scripts (and I really do!), dasm can already do
this for you.
> Guess I should do some .ORGing to put my kernal at the begining of
> page, and then JMP to that location as the last instruction at the very
> end of the VBLANK? Is that a good method for dealing with this,
> easier than rejiggering a kernal?
Instead of ORG, use ALIGN...
org $f000
; init and vblank code here
; ...
sta VBLANK ; end of vertical blank
waste jmp kernel
; there may be room here for a small table or something
align 256
kernel
; kernel code here
; ...
; ...
end_kernel
; overscan code here
; then, anywhere you want in the .asm file:
echo "Kernel alignment wastes",kernel-waste,"bytes"
; who needs a perl script?
if (>kernel != >end_kernel)
echo "WARNING: Kernel crosses a page boundary!"
endif
...then, you'll see the messages during assembly:
$ dasm testasm.asm -otmp.bin -f3
DASM V2.20.09, Macro Assembler (C)1988-2003
Kernel alignment wastes $0 bytes
WARNING: Kernel crosses a page boundary!
Complete.
One minor annoyance is that you'll see them multiple times (once per pass
the assembler makes), but it's not a big deal.
If you really wanted to be ambitious, you could write macros that replace
the BNE, BPL, etc. instructions, that calculate whether or not the branch
crosses a page boundary and prints out a warning if so. I've never done
this, but it might look like:
mac pbne
bne {1}
if (>* != >{1})
echo "WARNING: BNE at",*-2,"crosses page boundary!"
endif
endm
This would be more useful if dasm had a way to reference the current
source file and line number (like __LINE__ and __FILE__ in C). Maybe it
does have something like that, but I couldn't find it in my admittedly
quick look at dasm.doc just now.
Hope this helps...
--
B.
----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [stella] kernal klunk, KirkIsrael | Thread | Re: Re: [stella] kernal klunk, Dennis Debro |
| Re: Re: [stella] kernal klunk, Dennis Debro | Date | Re: [stella] Has anyone tried this , Glenn Saunders |
| Month |