From what it looks like, you need to store the stack before you switch out the lower pages. You need to store the current stack pointer at the start of your program, setup a new stack in the higher pages (the default will be in the lower), just before you exit restore the stack. Ive attached a new disk image with chk3 in it that works. Remmeber as the stack is in the lower page, when you switch out its fine, when you do your call it sticks the return address where it thinks the stack is (somewhere on the screen probably), you clear the screen to white, so when it goes to return if pulls the value back (which you have overwritten when clearing the screen). Setting a new stack into higher memory pages sorts this. Adrian
________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andrew Park Sent: 19 January 2007 12:01 To: [email protected] Subject: Some Help Hi, I was messing about with comet assembler recently and tried a simple routine to display some data on the screen one worked a treat the other killed my routine but they should have both done exactly the same. The difference was on the first routine i done all the paging etc, then displayed my data then paged out, worked fine ! however when i moved a routine out of the main loop to be called by a CALL statement to display the data this killed it. The file is a disk image for COMET, the 2 files in question are Chk1 which clears the screen to white, this works, chk2 however clears the screen to white then corrupts the output and crashes. I've always got around the problem by paging the HMPR instead of the LMPR but this has limited me. Could be a simple solution such as an incorrect stack but it's confusing me as when I save the SP do the above then restore the SP it works then resets. Any help would be highly appreciated. Andy
test.rar
Description: test.rar
