OpenCores
URL https://opencores.org/ocsvn/ssbcc/ssbcc/trunk

Subversion Repositories ssbcc

[/] [ssbcc/] [trunk/] [example/] [interrupt/] [dual_interrupt.s] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 sinclairrf
; Copyright 2015, Sinclair R.F., Inc.
2
; demonstrate dual interrupt peripheral
3
 
4
.memory ROM myrom
5
.variable msg N"INT\n"
6
 
7
.memory RAM myram
8
.variable ixMsg 0
9
 
10
.main
11
  ; Mask all but the external interrupt and then enable interrupts.
12
  C_INTERRUPT .outport(O_INTERRUPT_MASK)
13
  .ena
14
 
15
  ; Sit in an infinite loop while the interrupt handler does everything else.
16
  :infinite .jump(infinite)
17
 
18
.interrupt
19
  ; Get the interrupt event(s).
20
  ; ( - u_int )
21
  .inport(I_INTERRUPT)
22
 
23
  ; Test for the external interrupt.
24
  ; ( u_int - u_int )
25
  dup C_INTERRUPT & 0= .jumpc(not_external)
26
    ; Set the index into the output message.
27
    msg .storevalue(ixMsg)
28
    ; Enable the UART_Tx interrupt.
29
    .inport(I_INTERRUPT_MASK) C_UART_TX_INTERRUPT or .outport(O_INTERRUPT_MASK)
30
  :not_external
31
 
32
  ; Test for the UART_Tx not_busy interrupt.
33
  ; ( u_int - u_int )
34
  dup C_UART_TX_INTERRUPT & 0= .jumpc(not_uart)
35
    ; Get the next character to transmit and move the pointer to the next
36
    ; character.
37
    ; ( - u_char )
38
    .fetchvalue(ixMsg) .fetch+(myrom) .storevalue(ixMsg)
39
    ; If the character is a terminating null character then discard it and
40
    ; disable this part of the interrupt, otherwise output it.
41
    .jumpc(not_null,nop)
42
      ; ( u_char - )
43
      drop
44
      .inport(I_INTERRUPT_MASK) ${~C_UART_TX_INTERRUPT} & .outport(O_INTERRUPT_MASK)
45
      .jump(not_uart)
46
    :not_null
47
      ; ( u_char - )
48
      .outport(O_UART_TX)
49
  :not_uart
50
 
51
  ; Drop the interrupt event from the data stack and return from the interrupt.
52
  ; ( u_int - )
53
  drop .returni

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.