You are here: Home DOCUMENTATION information SBASIC Manual - Page 46

Technological Arts Inc.

Your Shopping Cart

Your Cart is currently empty.

SBASIC Manual - Page 46

Article Index
Page 2
Page 3
Page 4
Page 5
Page 6
Page 7
Page 8
Page 9
Page 10
Page 11
Page 12
Page 13
Page 14
Page 15
Page 16
Page 17
Page 18
Page 19
Page 20
Page 21
Page 22
Page 23
Page 24
Page 25
Page 26
Page 27
Page 28
Page 29
Page 30
Page 31
Page 32
Page 33
Page 34
Page 35
Page 36
Page 37
Page 38
Page 39
Page 40
Page 41
Page 42
Page 43
Page 44
Page 45
Page 46
Page 47
Page 48
Page 49
Page 50
Page 51
Page 52
Page 53
Page 54
Page 55
Page 56
Page 57
Page 58
Page 59
Page 60
Table of Contents
All Pages

     SBasic User's Manual     SBasic Version 2.7             Page 46
     Printed:  December 5, 1999

     In the above example, control leaves the ISR immediately if N contains
     the value $66.  If not, then N is changed to $10 and control leaves
     the ISR through the normal END statement.

     In rare cases, you may need to combine a line label with the INTERRUPT
     statement.  This can happen in some variations of the 68hc11 MCU.  The
     'a1 variation, for example, often contains a form of the BUFFALO
     monitor in on-chip ROM.  BUFFALO takes full control of the interrupt
     vectors, so SBasic cannot modify any of the vectors.

     Instead, BUFFALO expects your program to use specific addresses in on-
     chip RAM as jump vectors to reach your ISR code.

     To get around this obstacle, you must combine a line label with use of
     the ADDR function.


          interrupt                ' note that no address is used!
          if u 0                ' if u is not yet 0
               u = u - 1           ' decrement u
          pokeb tflg2, $40         ' rearm interrupt

          pokeb $eb, $7e           ' write a jump instruction
          poke $ec, addr(rtiisr)   ' write addr of ISR

     Here, the code in MAIN modifies the RAM addresses used by BUFFALO.  It
     stores a JMP instruction ($7e) followed by the address of the jump

     When the RTI interrupt occurs, BUFFALO will jump to address $eb.  The
     code left there by MAIN will in turn pass control to the ISR at
     RTIISR, where the actual interrupt processing occurs.

     Note that the above example does not require an argument to the
     INTERRUPT statement.  This means SBasic will not create an entry in
     the target's vector area.  The above code, following the label MAIN,
     must be used to provide the target processor with access to the ISR.

     If necessary, you can use the /i option on SB's command line to
     surpress generation of all interrupt vectors, including the reset
     vector.  You can use this option if the target MCU already contains
     firmware for activating your program following reset.  Examples of
     such a situation include a 68HC11A1 with BUFFALO already in ROM, and
     the 68HC912B32 with its on-chip bootloader.