| |
Lux
Registered: Apr 2011 Posts: 17 |
ML Load routine makes program crashes
Hi guys,
I'm doing a simple noter. In program, I use simple load routine from codebase64 (Richard Bayliss routine, http://codebase64.org/doku.php?id=base:disk_loader_with_flashin..). I'm loading font files on address $0800. Noter starting at $4000 in memory so there is no overlaping with ML code of noter. Every font file I'am using for loading are saved from $0800 to $1000. Noter working ok (editing, using menus etc.), but after loading font file, main program start to behaves strangely and in some cases crashes (yes!). There is no way that font file overlap ML code, I check it. So my question is .. is there something to do after using load routine (to do kernel cals, to reset something or ..?).
Perhaps some of you have had a similar problem so please help.
Lux :) |
|
| |
tlr
Registered: Sep 2003 Posts: 1790 |
Hard to tell without knowing exactly what you are doing. Could you post some code? Source or binary is ok. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
your program relies on pointers/zeropage locations which are used by the kernal? |
| |
Lux
Registered: Apr 2011 Posts: 17 |
This is memory locations:
$0800 - $1000 default font
$1000 - $1300 noter preview
$1300 - $4000 screen data
$4000 -> editor code
Editor started on $4000, and after starting editor, there is MENU with different task.. create page, edit page, del.pag etc.
I'am testing this editor in VICE + kickassembler, but I also have real hardware + 1541U2, for real testing.
I'll upload D64 image with prg+fonts on csdb.
Much appreciate your help. I will soon set up a link. |
| |
Lux
Registered: Apr 2011 Posts: 17 |
Zeropage locations I'am using for memory transfers, when I deleting or inserting page.
More using locations in editor memory area or in noter area. |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
you should try loading with this instead, its compatible with kernal friendly load speeders, and only does whats needed in the CORRECT way:
http://codebase64.org/doku.php?id=base:loading_a_file
Richard's routine does a lot of very risky things it shouldnt. (patching run/stop vector, calling shitloads of kernal/basic routines that are NOT needed for a simple load, etc etc) |
| |
Lux
Registered: Apr 2011 Posts: 17 |
Guys, this is link:
Simple Writer V0.8 |
| |
Lux
Registered: Apr 2011 Posts: 17 |
Oswald, thanks for reply. Yes, I also used that simple load routine, same problem happens, very strange. I tested yesterday with almsot 20 font files. Some file loaded ok, but some not. I saved files from same memory location. |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
try to enter monitor while your program is running and simply fill the font memory with various values and see if your code still survives. if doesnt then your code is accidentally relying on a value in font space. if it still works, then possibly you have a zeropage conflict with kernal.
edit: maybe some vice monitor gurus can tell you how to create a breakpoint to see if your code reads into font memory. |
| |
Lux
Registered: Apr 2011 Posts: 17 |
Oswald, thanks for the advice, it seems to me that I could use to find the cause. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
> break load 800 fff (or even "load exec") |
| |
Lux
Registered: Apr 2011 Posts: 17 |
Yes, monitor echoed ...
WATCH: 1 C:$0800-$0fff (Stop on load)
Thanx Groepaz! |
| |
tlr
Registered: Sep 2003 Posts: 1790 |
.C:4af3 78 SEI
.C:4af4 A9 37 LDA #$37
.C:4af6 85 01 STA $01
.C:4af8 20 81 FF JSR $FF81
.C:4afb 20 84 FF JSR $FF84
.C:4afe 20 8A FF JSR $FF8A
.C:4b01 A9 00 LDA #$00
.C:4b03 8D 20 D0 STA $D020
.C:4b06 8D 21 D0 STA $D021
.C:4b09 A9 BF LDA #$BF
.C:4b0b A2 4B LDX #$4B
.C:4b0d 8D 28 03 STA $0328
.C:4b10 8E 29 03 STX $0329
.C:4b13 58 CLI
.C:4b14 A9 08 LDA #$08
.C:4b16 A6 BA LDX $BA
.C:4b18 A0 00 LDY #$00
.C:4b1a 20 BA FF JSR $FFBA
.C:4b1d AD CE 50 LDA $50CE
.C:4b20 A2 AF LDX #$AF
.C:4b22 A0 4B LDY #$4B
.C:4b24 20 BD FF JSR $FFBD
.C:4b27 A2 00 LDX #$00
.C:4b29 A0 08 LDY #$08
.C:4b2b A9 00 LDA #$00
.C:4b2d 20 D5 FF JSR $FFD5
.C:4b30 B0 2A BCS $4B5C
.C:4b32 A2 08 LDX #$08
.C:4b34 20 C3 FF JSR $FFC3
.C:4b37 20 CC FF JSR $FFCC
.C:4b3a 20 81 FF JSR $FF81
.C:4b3d AD D8 11 LDA $11D8
.C:4b40 8D 86 02 STA $0286
.C:4b43 20 44 E5 JSR $E544
.C:4b46 AD D5 11 LDA $11D5
.C:4b49 8D 20 D0 STA $D020
.C:4b4c 8D 21 D0 STA $D021
The problem is that you leave the break vector in a crappy state after loading. If you run the program, load a font, then pop into the monitor you'll see that $0328 points to $4bed. Change that to the usual $f6ed and the program works normally.
Also in the routine there are some redundant stuff. The $ffc3 (CLOSE) and $ffcc (CLRCHN) calls are completely redundant and the $ff81 (CINT) is sort of redundant.
If you change the CINT call to $ff8a (RESTOR) it will probably work, although it will corrupt a small amount of memory at $fd30.
Q: why can't I enter an asterisk in the file load dialog? |
| |
Lux
Registered: Apr 2011 Posts: 17 |
tlr, thank you very much, I'll make changes and test the program as you suggested.
Routine input file name allows you to enter only these characters .. ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 -+.()#!, coz' when loading (or saving) the file (from the VICE emulator) then only these characters are properly interpreted on pc.
I will implement character (*) when this load routine begins work. Once again thank you for your generous help.
I'll remove very soon link on csdb coz' this program is still in the making (it is not release).
This is simple-writer download link from dropbox ( https://dl.dropboxusercontent.com/s/7u6m4ms9mke1mi4/simple-writ.. //
I hope that I can set the download link on this forum, if it is banned I will remove it.). |
| |
Hein
Registered: Apr 2004 Posts: 954 |
All your load crashes are belong to us! |
| |
Lux
Registered: Apr 2011 Posts: 17 |
Guys, I've found a bug in the program. Load routine was fine. But part of the code is doing a mistake. Based on your suggestions I found a mistake. When I finish writer (very soon) I will credited you. Thanks again for your support.
Regards, Lux :)) |