Image Map Image Map
Results 1 to 4 of 4

Thread: SVC @KBD not working on 4/4P ?

  1. #1

    Default SVC @KBD not working on 4/4P ?

    tried LS-DOS 631 and TRSDOS 6.2.1, although thinking this isn't a DOS problem, it's something dumb I'm doing;

    So, like a fool, instead of using my own keyboard scanning code, i try my hand at calling the OS. I always used to `call 0x2b` (INKEY) but this doesn't work on 4/4P, probably because the KB area is different.

    Am wondering if there's a universal ROM address for INKEY.

    Anyhow, 4/4P stuff apparently, i have to use @SVC stuff, so i do this;

    Code:
    char scanKey()
    {
        // return key pressed or 0 if none
    
        if (TRSModel >= 4)
        {
        __asm
            ld    a,#8      // @KBD
            RST   0x28      // uses DE
            ld    l,a
        __endasm;
        }
        else
        {
          __asm
            call    0x2b
            ld      l,a
        __endasm;
        }
    }
    But on 4P it just sits there, never returning from RST. Can't understand why. Is there some setup i'm missing?

    Thanks for helping.

  2. #2
    Join Date
    Jan 2014
    Location
    Western North Carolina, USA
    Posts
    1,252

    Default

    Ok, so what is the value of TRSModel for 4P? (Edit: Looking at some of your github code, should be 4...)

    Which compiler are you using?( edit: sdcc, correct?)

    Ok, looking through some of your code on github, one thing you may want to remember is that the M4 DOS has type ahead that relies on the RTC interrupt. You're disabling interrupts in the code I just looked at.
    Last edited by lowen; September 1st, 2019 at 07:53 PM.
    --
    Thus spake Tandy Xenix System III version 3.2: "Bughlt: Sckmud Shut her down Scotty, she's sucking mud again!"

  3. #3

    Default

    TRSModel is 4 for both 4 and 4P currently. In theory TRSModel could be 5 for 4P if i needed it.

    Yes, All code is built with SDCC.

    You're right about the interrupts! I thought I'd re-enabled them, but sure enough theres a `di` in `crt0.s` !! This explains why my SVC calls aren't working on M4.

    But, annoyingly if i enable interrupts it doesn't run at all anymore! I changed the code to enable interrupts *after* I've initialised things (eg the ram test) and it still doesn't run on M4.

    This looks like another silly mistake of mine somewhere....

    Incidentally, i relocated the stack for my code, but this can be commented out and it doesn't change things. Leaving the stack alone is ok for `scott19` but some of my other projects need quite a bit of runtime C stack.

    Does anyone know how much runtime stack can be relied upon by default on different models?

    I'll keep digging to find why interrupts are breaking things...

  4. #4

    Default

    update;

    M4 seems to set the stack to 0x37a by default = 890 bytes.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •