#1308 Indexed and pointer addressing error

closed-fixed
nobody
5
2013-05-25
2007-03-19
labolida
No

Indexed and pointer addressing error
When a character of array indexed or addressed by pointer, there are a mistake apparently invading another RAM areas.
When a character of same array is indexed directly, it runs OK.
In the file voic.c, procedure vcin_read, when using a direct adressing (switch instruction, line 248) it runs fine, but when use indexing or pointer (lines 260 and 262 respectively) the program generate a bad output in port B as if apparently g_wave_buf was corrupted.

Discussion

  • labolida

    labolida - 2007-03-19

    full project

     
  • labolida

    labolida - 2007-03-19

    Logged In: YES
    user_id=1694633
    Originator: YES

    Note: compiler version is
    SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.6.3 #4
    543 (Dec 31 2006) (MINGW32)

     
  • Raphael Neider

    Raphael Neider - 2007-03-22

    Logged In: YES
    user_id=1115835
    Originator: NO

    This is a bug in the interrupt code generation: FSR is not saved, but used both in interrupt-code (_interrupts) and non-interrupt code (on every array[index] operation, e.g. in vcin_read).
    I need to look into this a bit further; for the time being, you should probably start your interrupt routines with
    char saved_fsr = FSR; // do not make this static!
    and add
    FSR = saved_fsr;
    just before leaving them.
    As I am leaving for holiday, fixing this will take at least about a week or so.

     
  • Raphael Neider

    Raphael Neider - 2007-03-22
    • assigned_to: nobody --> tecodev
     
  • Raphael Neider

    Raphael Neider - 2007-03-22
    • milestone: --> fixed
    • assigned_to: tecodev --> nobody
    • status: open --> closed-fixed
     
  • Raphael Neider

    Raphael Neider - 2007-03-22

    Logged In: YES
    user_id=1115835
    Originator: NO

    Fixed in SDCC 2.6.4, r4708.
    The interrupt handler entry code now saves W, STATUS, PCLATH and (new) FSR automatically before doing anything else and restores them before leaving the handler.

     

Log in to post a comment.