@database "cia"
@master "ADCD_v1.2:IncludesD/Inc&AD1.3/doc/cia.doc"

@Node Main "cia.doc"
@TOC 1.3Includes_Autodocs/Autodocs

@{" AbleICR() " Link "AbleICR()"}         @{" RemICRVector() " Link "RemICRVector()"}
@{" AddICRVector() " Link "AddICRVector()"}    @{" SetICR() " Link "SetICR()"}

@EndNode

@Node "AbleICR()" "cia.resource/AbleICR"

NAME
    AbleICR -- enable/disable ICR interrupts

SYNOPSIS
    oldMask = AbleICR(mask),  Resource
    D0                D0      A6

FUNCTION
    This function provides a means of enabling and disabling
    6526 @{"CIA" Link "ADCD_v1.2:Inc&AD1.3/Includes/hardware/cia.h/Main" 21} interrupt control registers.
    In addition it returns the previous enable mask.

INPUTS
    mask - a bit mask indicating which interrupts to be
        modified.  If bit 7 is clear the mask indicates
        interrupts to be disabled.  If bit 7 is set, the
        mask indicates interrupts to be enabled.
        Bit positions are identical to those in 6526 ICR.

RESULTS
    oldMask - the previous enable mask before the requested
        changes.  To get the current mask without making
        changes, call the function with a null parameter.

EXAMPLES
    Get the current mask:
        mask = AbleICR(0)
    Enable both timer interrupts:
        AbleICR(0x83)
    Disable serial port interrupt:
        AbleICR(0x08)

EXCEPTIONS
    Enabling the mask for a pending interrupt will cause
    an immediate processor interrupt (that is if everything
    else is enabled).  You may want to clear the pending
    interrupts with SetICRx prior to enabling them.

SEE ALSO
    @{"SetICR" Link "ADCD_v1.2:Inc&AD1.3/Autodocs/cia/SetICR()"}

@EndNode

@Node "AddICRVector()" "cia.resource/AddICRVector"

NAME
     AddICRVector -- attach an interrupt handler to a @{"CIA" Link "ADCD_v1.2:Inc&AD1.3/Includes/hardware/cia.h/Main" 21} bit

SYNOPSYS
     interrupt = AddICRVector(iCRBit, interrupt), resource
     D0                       D0      A1          A6

FUNCTION
     Assign interrupt processing code to a particular interrupt
     bit of the @{"CIA" Link "ADCD_v1.2:Inc&AD1.3/Includes/hardware/cia.h/Main" 21} ICR.  If the interrupt bit has already been
     assigned, this function will fail, and return a pointer
     to the owner interrupt.  If it succeeds, a null is returned.

     This function will also enable the @{"CIA" Link "ADCD_v1.2:Inc&AD1.3/Includes/hardware/cia.h/Main" 21} interrupt for the given
     ICR bit.

INPUTS
     iCRBit - bit number to set (0..4)
     interrupt - pointer to interrupt structure

RESULT
     interrupt - zero if successful, otherwise returns a pointer
             to the current owner interrupt structure.

SEE ALSO
     @{"RemICRVector" Link "ADCD_v1.2:Inc&AD1.3/Autodocs/cia/RemICRVector()"}

@EndNode

@Node "RemICRVector()" "cia.resource/RemICRVector"

NAME
     RemICRVector -- detach an interrupt handler from a @{"CIA" Link "ADCD_v1.2:Inc&AD1.3/Includes/hardware/cia.h/Main" 21} bit

SYNOPSYS
     RemICRVector(iCRBit, interrupt), resource
                  D0      A1          A6

FUNCTION
     Disconnect interrupt processing code for a particular interrupt
     bit of the @{"CIA" Link "ADCD_v1.2:Inc&AD1.3/Includes/hardware/cia.h/Main" 21} ICR.

     This function will also disable the @{"CIA" Link "ADCD_v1.2:Inc&AD1.3/Includes/hardware/cia.h/Main" 21} interrupt for the given
     ICR bit.

INPUTS
     iCRBit - bit number to set (0..4)
     interrupt - pointer to interrupt structure

RESULT

SEE ALSO
     @{"AddICRVector" Link "ADCD_v1.2:Inc&AD1.3/Autodocs/cia/AddICRVector()"}

@EndNode

@Node "SetICR()" "cia.resource/SetICR"

NAME
    SetICR -- cause, clear, and sample ICR interrupts

SYNOPSIS
    oldMask = SetICR(mask), Resource
    D0               D0     A6

FUNCTION
    This function provides a means of reseting, causing, and
    sampling 6526 @{"CIA" Link "ADCD_v1.2:Inc&AD1.3/Includes/hardware/cia.h/Main" 21} interrupt control registers.

INPUTS
    mask - a bit mask indicating which interrupts to be
        effected.  If bit 7 is clear the mask indicates
        interrupts to be reset.  If bit 7 is set, the
        mask indicates interrupts to be caused.
        Bit positions are identical to those in 6526 ICR.

RESULTS
    oldMask - the previous interrupt register status before
        making the requested changes.  To sample current
        status without making changes,  call the function
        with a null parameter.

EXAMPLES
    Get the interrupt mask:
        mask = SetICR(0)
    Clear serial port interrupt:
        SetICR(0x08)

EXCEPTIONS
    Setting an interrupt bit for an enabled interrupt will cause
     an immediate interrupt.

SEE ALSO

@EndNode

