- Yes. You could (should?) have two stacks. One for interrupts and one for other. That s probably the safest way to do it. The interrupts stack can be prettyMessage 1 of 44 , Feb 7, 2013View SourceYes. You could (should?) have two stacks.
One for interrupts and one for other.
That's probably the safest way to do it.
The interrupts stack can be pretty small.
On 2/7/2013 10:24 AM, bill rowe wrote:
right. I'm going to switch to another register for my sp if i'm running with interrupts.
- Ted: I ve ended up using the technique of adjusting the high byte of the stack register before the low byte when subtracting and the reverse on adding. IMessage 44 of 44 , Feb 19, 2013View SourceTed: I've ended up using the technique of adjusting the high byte of the stack register before the low byte when subtracting and the reverse on adding. I think it's bullet-proof.By the way, I note from yoour examples that you were actually able to run interrupt service routines written in C. Nice work. I continue to be impressed with how well tailored to the 1802 environment your compler is.bill
Date: Tue, 19 Feb 2013 19:25:40 +0000
Subject: [cosmacelf] Re: disabling/enabling interruptsI ran into the same problem with my C compiler. I used a separate stack pointer register. This is a must if using the 1861 as you can't disable interrupts or you might miss a display update and delay it and cause screen tearing. When I tried to have my main code deal with this it caused code bloat (not that I didn't already have major problems here).
--- In email@example.com, "bill_rowe@..." wrote:
> The C compiler currently uses the live 1802 stack for variable storage. At the beginning of each C function it subtracts a good-sized number from sp to reserve space and adds it back at the end to free it. If this got interrupted it would end badly.
> I was going to bracket the sp manipulations with enable/disable interrupts but dis/ret seems pretty disruptive. Is there another solution? I need something like:
> glo sp
> smi 17
> plo sp
> ghi sp
> smc 0
> phi sp
> the subtracted number could be pretty big so a decrement loop probably wouldn't work.
> My alternative is to use another register as a frame pointer but i don't want to do that right now.