//////////////////////////////////////////////////////////////////////////////
//                                                                           /
// IAR ARM ANSI C/C++ Compiler V4.11A/W32              20/Jul/2004  18:58:50 /
// Copyright 1999-2004 IAR Systems. All rights reserved.                     /
//                                                                           /
//    Cpu mode        =  arm                                                 /
//    Endian          =  little                                              /
//    Stack alignment =  4                                                   /
//    Source file     =  C:\medusa\zl_bus.c                                  /
//    Command line    =  -I "C:\Program Files\IAR Systems\Embedded           /
//                       Workbench 4.0\ARM\INC\" -lc C:\medusa\Debug\List\   /
//                       -la C:\medusa\Debug\List\ -o C:\medusa\Debug\Obj\   /
//                       -s2 --no_cse --no_unroll --no_inline                /
//                       --no_code_motion --no_tbaa --no_clustering          /
//                       --no_scheduling --debug --cpu_mode arm --endian     /
//                       little --cpu ARM7TDMI-S --stack_align 4 -e --fpu    /
//                       None "-D_DLIB_CONFIG_FILE=C:\Program Files\IAR      /
//                       Systems\Embedded Workbench                          /
//                       4.0\ARM\LIB\dl4tpannl8n.h" C:\medusa\zl_bus.c       /
//    List file       =  C:\medusa\Debug\List\zl_bus.s79                     /
//                                                                           /
//                                                                           /
//////////////////////////////////////////////////////////////////////////////

        NAME zl_bus

        RTMODEL "ARMv4M", "USED"
        RTMODEL "StackAlign4", "USED"
        RTMODEL "__cpu_mode", "__pcs__arm"
        RTMODEL "__data_model", "absolute"
        RTMODEL "__endian", "little"
        RTMODEL "__rt_version", "6"

        RSEG CSTACK:DATA:NOROOT(2)

        FUNCTION busCsAssert,0203H
        FUNCTION busCsNegate,0203H
        FUNCTION busRead,0203H
        LOCFRAME CSTACK, 20, STACK
        FUNCTION busReadAssert,0203H
        FUNCTION busReadNegate,0203H
        FUNCTION busWrite,0203H
        LOCFRAME CSTACK, 20, STACK
        FUNCTION busWriteAssert,0203H
        FUNCTION busWriteNegate,0203H
        FUNCTION ssiDelay,0203H
        LOCFRAME CSTACK, 8, STACK
        PUBLIC zarlinkCommandWrite
        FUNCTION zarlinkCommandWrite,0203H
        LOCFRAME CSTACK, 8, STACK
        PUBLIC zarlinkCtrlBuffer1Read
        FUNCTION zarlinkCtrlBuffer1Read,0203H
        LOCFRAME CSTACK, 8, STACK
        PUBLIC zarlinkCtrlBuffer1Write
        FUNCTION zarlinkCtrlBuffer1Write,0203H
        LOCFRAME CSTACK, 8, STACK
        PUBLIC zarlinkCtrlBuffer2Read
        FUNCTION zarlinkCtrlBuffer2Read,0203H
        LOCFRAME CSTACK, 8, STACK
        PUBLIC zarlinkFrameRead
        FUNCTION zarlinkFrameRead,0203H
        LOCFRAME CSTACK, 8, STACK
        PUBLIC zarlinkFrameWrite
        FUNCTION zarlinkFrameWrite,0203H
        LOCFRAME CSTACK, 8, STACK
        PUBLIC zarlinkIndexedRead
        FUNCTION zarlinkIndexedRead,0203H
        LOCFRAME CSTACK, 8, STACK
        PUBLIC zarlinkIndexedWrite
        FUNCTION zarlinkIndexedWrite,0203H
        LOCFRAME CSTACK, 12, STACK
        PUBLIC zarlinkInterruptRead
        FUNCTION zarlinkInterruptRead,0203H
        LOCFRAME CSTACK, 4, STACK
        PUBLIC zarlinkInterruptWrite
        FUNCTION zarlinkInterruptWrite,0203H
        LOCFRAME CSTACK, 8, STACK
        PUBLIC zarlinkStatusRead
        FUNCTION zarlinkStatusRead,0203H
        LOCFRAME CSTACK, 4, STACK
        
        CFI Names cfiNames0
        CFI StackFrame CFA R13 HUGEDATA
        CFI Resource R0:32, R1:32, R2:32, R3:32, R4:32, R5:32, R6:32, R7:32
        CFI Resource R8:32, R9:32, R10:32, R11:32, R12:32, CPSR:32, R13:32
        CFI Resource R14:32, SPSR:32
        CFI VirtualResource ?RET:32
        CFI EndNames cfiNames0
        
        CFI Common cfiCommon0 Using cfiNames0
        CFI CodeAlign 4
        CFI DataAlign 4
        CFI ReturnAddress ?RET CODE
        CFI CFA R13+0
        CFI R0 Undefined
        CFI R1 Undefined
        CFI R2 Undefined
        CFI R3 Undefined
        CFI R4 SameValue
        CFI R5 SameValue
        CFI R6 SameValue
        CFI R7 SameValue
        CFI R8 SameValue
        CFI R9 SameValue
        CFI R10 SameValue
        CFI R11 SameValue
        CFI R12 Undefined
        CFI CPSR SameValue
        CFI R14 Undefined
        CFI SPSR SameValue
        CFI ?RET R14
        CFI EndCommon cfiCommon0
        

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock0 Using cfiCommon0
        CFI Function ssiDelay
   CODE32      
ssiDelay:
   SUB         SP,SP,#+0x8
        CFI CFA R13+8
   MOV         R1,#+0x0
   STR         R1,[SP, #+0]
??ssiDelay_0:
   LDR         R3,[SP, #+0]
   CMP         R3,#+0x80
   BGE         ??ssiDelay_1
   LDR         R0,??ssiDelay_2    ;; 0xe0024014
   LDR         R1,[R0, #+0]
   STR         R1,[SP, #+4]
   LDR         R3,[SP, #+0]
   ADD         R3,R3,#+0x1
   STR         R3,[SP, #+0]
   B           ??ssiDelay_0
??ssiDelay_1:
   ADD         SP,SP,#+0x8        ;; stack cleaning
        CFI CFA R13+0
   MOV         PC,LR              ;; return
   DATA        
??ssiDelay_2:
   DC32        0xe0024014
        CFI EndBlock cfiBlock0

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock1 Using cfiCommon0
        CFI Function busWriteNegate
   CODE32      
busWriteNegate:
   MOV         R0,#+0xE0000004
   ORR         R0,R0,#+0x28000
   MOV         R1,#+0x200
   STR         R1,[R0, #+0]
   MOV         PC,LR              ;; return
        CFI EndBlock cfiBlock1

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock2 Using cfiCommon0
        CFI Function busWriteAssert
   CODE32      
busWriteAssert:
   MOV         R0,#+0xE000000C
   ORR         R0,R0,#+0x28000
   MOV         R1,#+0x200
   STR         R1,[R0, #+0]
   MOV         PC,LR              ;; return
        CFI EndBlock cfiBlock2

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock3 Using cfiCommon0
        CFI Function busReadNegate
   CODE32      
busReadNegate:
   MOV         R0,#+0xE0000004
   ORR         R0,R0,#+0x28000
   MOV         R1,#+0x400
   STR         R1,[R0, #+0]
   MOV         PC,LR              ;; return
        CFI EndBlock cfiBlock3

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock4 Using cfiCommon0
        CFI Function busReadAssert
   CODE32      
busReadAssert:
   MOV         R0,#+0xE000000C
   ORR         R0,R0,#+0x28000
   MOV         R1,#+0x400
   STR         R1,[R0, #+0]
   MOV         PC,LR              ;; return
        CFI EndBlock cfiBlock4

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock5 Using cfiCommon0
        CFI Function busCsNegate
   CODE32      
busCsNegate:
   MOV         R0,#+0xE0000004
   ORR         R0,R0,#+0x28000
   MOV         R1,#+0x800
   STR         R1,[R0, #+0]
   MOV         PC,LR              ;; return
        CFI EndBlock cfiBlock5

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock6 Using cfiCommon0
        CFI Function busCsAssert
   CODE32      
busCsAssert:
   MOV         R0,#+0xE000000C
   ORR         R0,R0,#+0x28000
   MOV         R1,#+0x800
   STR         R1,[R0, #+0]
   MOV         PC,LR              ;; return
        CFI EndBlock cfiBlock6

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock7 Using cfiCommon0
        CFI Function busWrite
   CODE32      
busWrite:
   STMDB       SP!,{R4,R5,LR}     ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI R5 Frame(CFA, -8)
        CFI R4 Frame(CFA, -12)
        CFI CFA R13+12
   SUB         SP,SP,#+0x8
        CFI CFA R13+20
   MOV         R4,R0
   MOV         R5,R1
   MOV         R1,R5
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R2,R1, LSL #+16
   STR         R2,[SP, #+0]
   MOV         R12,R4
   ANDS        R12,R12,#+0xFF     ;; Zero extend
   MOV         LR,#+0x7000000
   ANDS        R0,LR,R12, LSL #+24
   LDR         R1,[SP, #+0]
   ORR         R1,R1,R0
   STR         R1,[SP, #+0]
   MOV         R3,#+0xE0000008
   ORR         R3,R3,#+0x28000
   LDR         R12,[R3, #+0]
   STR         R12,[SP, #+4]
   MOV         LR,#+0xE0000008
   ORR         LR,LR,#+0x28000
   LDR         R1,[SP, #+4]
   MOV         R2,#+0x7000000
   ORR         R2,R2,#+0xFF0000
   ORRS        R3,R2,R1
   STR         R3,[LR, #+0]
   MOV         R12,#+0xE0000004
   ORR         R12,R12,#+0x28000
   LDR         R0,[SP, #+0]
   STR         R0,[R12, #+0]
   MOV         R1,#+0xE000000C
   ORR         R1,R1,#+0x28000
   LDR         R3,[SP, #+0]
   MVN         R12,R3
   MOV         LR,#+0x7000000
   ORR         LR,LR,#+0xFF0000
   ANDS        R0,LR,R12
   STR         R0,[R1, #+0]
   BL          ssiDelay
   BL          ssiDelay
   BL          busCsAssert
   BL          ssiDelay
   BL          busWriteAssert
   BL          ssiDelay
   BL          ssiDelay
   BL          busWriteNegate
   BL          ssiDelay
   BL          busCsNegate
   BL          ssiDelay
   MOV         R1,#+0xE0000008
   ORR         R1,R1,#+0x28000
   LDR         R3,[SP, #+4]
   STR         R3,[R1, #+0]
   ADD         SP,SP,#+0x8        ;; stack cleaning
        CFI CFA R13+12
   LDMIA       SP!,{R4,R5,PC}     ;; return
        CFI EndBlock cfiBlock7

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock8 Using cfiCommon0
        CFI Function busRead
   CODE32      
busRead:
   STMDB       SP!,{R4,LR}        ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI R4 Frame(CFA, -8)
        CFI CFA R13+8
   SUB         SP,SP,#+0xC
        CFI CFA R13+20
   MOV         R4,R0
   MOV         R1,#+0xE0000008
   ORR         R1,R1,#+0x28000
   LDR         R2,[R1, #+0]
   STR         R2,[SP, #+4]
   MOV         R3,#+0xE0000008
   ORR         R3,R3,#+0x28000
   LDR         LR,[SP, #+4]
   BICS        R0,LR,#+0xFF0000
   ORRS        R1,R0,#+0x7000000
   STR         R1,[R3, #+0]
   MOV         R3,R4
   ANDS        R3,R3,#+0xFF       ;; Zero extend
   MOV         R12,#+0x7000000
   ANDS        LR,R12,R3, LSL #+24
   STR         LR,[SP, #+0]
   MOV         R0,#+0xE0000004
   ORR         R0,R0,#+0x28000
   LDR         R2,[SP, #+0]
   STR         R2,[R0, #+0]
   MOV         R3,#+0xE000000C
   ORR         R3,R3,#+0x28000
   LDR         LR,[SP, #+0]
   MVN         R0,LR
   ANDS        R1,R0,#+0x7000000
   STR         R1,[R3, #+0]
   BL          ssiDelay
   BL          ssiDelay
   BL          busCsAssert
   BL          ssiDelay
   BL          busReadAssert
   BL          ssiDelay
   BL          ssiDelay
   MOV         R3,#+0xE0000000
   ORR         R3,R3,#+0x28000
   LDR         R12,[R3, #+0]
   STR         R12,[SP, #+8]
   BL          busReadNegate
   BL          ssiDelay
   BL          busCsNegate
   BL          ssiDelay
   MOV         LR,#+0xE0000008
   ORR         LR,LR,#+0x28000
   LDR         R1,[SP, #+4]
   STR         R1,[LR, #+0]
   LDR         R3,[SP, #+8]
   MOV         R0,R3, LSR #+16
   ANDS        R0,R0,#+0xFF       ;; Zero extend
   ADD         SP,SP,#+0xC        ;; stack cleaning
        CFI CFA R13+8
   LDMIA       SP!,{R4,PC}        ;; return
        CFI EndBlock cfiBlock8

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock9 Using cfiCommon0
        CFI Function zarlinkIndexedWrite
   CODE32      
zarlinkIndexedWrite:
   STMDB       SP!,{R4,R5,LR}     ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI R5 Frame(CFA, -8)
        CFI R4 Frame(CFA, -12)
        CFI CFA R13+12
   MOV         R4,R0
   MOV         R5,R1
   MOV         R1,R4
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R0,#+0x0
   BL          busWrite
   MOV         R4,R4, LSL #+16
   MOVS        R4,R4, LSR #+16
   MOV         R1,R4, LSR #+8
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R0,#+0x1
   BL          busWrite
   MOV         R1,R5
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R0,#+0x2
   BL          busWrite
   LDMIA       SP!,{R4,R5,PC}     ;; return
        CFI EndBlock cfiBlock9

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock10 Using cfiCommon0
        CFI Function zarlinkIndexedRead
   CODE32      
zarlinkIndexedRead:
   STMDB       SP!,{R4,LR}        ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI R4 Frame(CFA, -8)
        CFI CFA R13+8
   MOV         R4,R0
   MOV         R1,R4
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R0,#+0x0
   BL          busWrite
   MOV         R4,R4, LSL #+16
   MOVS        R4,R4, LSR #+16
   MOV         R1,R4, LSR #+8
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R0,#+0x1
   BL          busWrite
   MOV         R0,#+0x2
   BL          busRead
   LDMIA       SP!,{R4,PC}        ;; return
        CFI EndBlock cfiBlock10

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock11 Using cfiCommon0
        CFI Function zarlinkCommandWrite
   CODE32      
zarlinkCommandWrite:
   STMDB       SP!,{R4,LR}        ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI R4 Frame(CFA, -8)
        CFI CFA R13+8
   MOV         R4,R0
   MOV         R1,R4
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R0,#+0x4
   BL          busWrite
   LDMIA       SP!,{R4,PC}        ;; return
        CFI EndBlock cfiBlock11

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock12 Using cfiCommon0
        CFI Function zarlinkStatusRead
   CODE32      
zarlinkStatusRead:
   STMDB       SP!,{LR}           ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI CFA R13+4
   MOV         R0,#+0x4
   BL          busRead
   LDMIA       SP!,{PC}           ;; return
        CFI EndBlock cfiBlock12

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock13 Using cfiCommon0
        CFI Function zarlinkFrameWrite
   CODE32      
zarlinkFrameWrite:
   STMDB       SP!,{R4,LR}        ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI R4 Frame(CFA, -8)
        CFI CFA R13+8
   MOV         R4,R0
   MOV         R1,R4
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R0,#+0x3
   BL          busWrite
   MOV         R4,R4, LSL #+16
   MOVS        R4,R4, LSR #+16
   MOV         R1,R4, LSR #+8
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R0,#+0x3
   BL          busWrite
   LDMIA       SP!,{R4,PC}        ;; return
        CFI EndBlock cfiBlock13

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock14 Using cfiCommon0
        CFI Function zarlinkFrameRead
   CODE32      
zarlinkFrameRead:
   STMDB       SP!,{LR}           ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI CFA R13+4
   SUB         SP,SP,#+0x4
        CFI CFA R13+8
   MOV         R0,#+0x3
   BL          busRead
   STRB        R0,[SP, #+0]
   MOV         R0,#+0x3
   BL          busRead
   STRB        R0,[SP, #+1]
   LDRH        R0,[SP, #+0]
   ADD         SP,SP,#+0x4        ;; stack cleaning
        CFI CFA R13+4
   LDMIA       SP!,{PC}           ;; return
        CFI EndBlock cfiBlock14

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock15 Using cfiCommon0
        CFI Function zarlinkCtrlBuffer1Write
   CODE32      
zarlinkCtrlBuffer1Write:
   STMDB       SP!,{R4,LR}        ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI R4 Frame(CFA, -8)
        CFI CFA R13+8
   MOV         R4,R0
   MOV         R1,R4
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R0,#+0x6
   BL          busWrite
   MOV         R4,R4, LSL #+16
   MOVS        R4,R4, LSR #+16
   MOV         R1,R4, LSR #+8
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R0,#+0x6
   BL          busWrite
   LDMIA       SP!,{R4,PC}        ;; return
        CFI EndBlock cfiBlock15

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock16 Using cfiCommon0
        CFI Function zarlinkCtrlBuffer1Read
   CODE32      
zarlinkCtrlBuffer1Read:
   STMDB       SP!,{LR}           ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI CFA R13+4
   SUB         SP,SP,#+0x4
        CFI CFA R13+8
   MOV         R0,#+0x6
   BL          busRead
   STRB        R0,[SP, #+0]
   MOV         R0,#+0x6
   BL          busRead
   STRB        R0,[SP, #+1]
   LDRH        R0,[SP, #+0]
   ADD         SP,SP,#+0x4        ;; stack cleaning
        CFI CFA R13+4
   LDMIA       SP!,{PC}           ;; return
        CFI EndBlock cfiBlock16

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock17 Using cfiCommon0
        CFI Function zarlinkCtrlBuffer2Read
   CODE32      
zarlinkCtrlBuffer2Read:
   STMDB       SP!,{LR}           ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI CFA R13+4
   SUB         SP,SP,#+0x4
        CFI CFA R13+8
   MOV         R0,#+0x7
   BL          busRead
   STRB        R0,[SP, #+0]
   MOV         R0,#+0x7
   BL          busRead
   STRB        R0,[SP, #+1]
   LDRH        R0,[SP, #+0]
   ADD         SP,SP,#+0x4        ;; stack cleaning
        CFI CFA R13+4
   LDMIA       SP!,{PC}           ;; return
        CFI EndBlock cfiBlock17

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock18 Using cfiCommon0
        CFI Function zarlinkInterruptWrite
   CODE32      
zarlinkInterruptWrite:
   STMDB       SP!,{R4,LR}        ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI R4 Frame(CFA, -8)
        CFI CFA R13+8
   MOV         R4,R0
   MOV         R0,R4
   ANDS        R0,R0,#+0xFF       ;; Zero extend
   ANDS        R1,R0,#+0x7
   ANDS        R1,R1,#+0xFF       ;; Zero extend
   MOV         R0,#+0x5
   BL          busWrite
   LDMIA       SP!,{R4,PC}        ;; return
        CFI EndBlock cfiBlock18

        RSEG CODE:CODE:NOROOT(2)
        CFI Block cfiBlock19 Using cfiCommon0
        CFI Function zarlinkInterruptRead
   CODE32      
zarlinkInterruptRead:
   STMDB       SP!,{LR}           ;; Push
        CFI ?RET Frame(CFA, -4)
        CFI CFA R13+4
   MOV         R0,#+0x5
   BL          busRead
   LDMIA       SP!,{PC}           ;; return
        CFI EndBlock cfiBlock19

        END
// 
// 1 076 bytes in segment CODE
// 
// 1 076 bytes of CODE memory
//
//Errors: none
//Warnings: 1
