PokittoLib is the library needed for programming the Pokitto DIY game console (www.pokitto.com)

Committer:
spinal
Date:
Sun Nov 18 15:47:54 2018 +0000
Revision:
64:6e6c6c2b664e
Parent:
5:ea7377f3d1af
added fix for directrectangle()

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Pokitto 5:ea7377f3d1af 1 //*****************************************************************************
Pokitto 5:ea7377f3d1af 2 // aeabi_romdiv_patch.s
Pokitto 5:ea7377f3d1af 3 // - Provides "patch" versions of the aeabi integer divide functions to
Pokitto 5:ea7377f3d1af 4 // replace the standard ones pulled in from the C library, which vector
Pokitto 5:ea7377f3d1af 5 // integer divides onto the rom division functions contained in
Pokitto 5:ea7377f3d1af 6 // specific NXP MCUs such as LPC11Uxx and LPC12xx.
Pokitto 5:ea7377f3d1af 7 // - Note that this patching will only occur if "__USE_ROMDIVIDE" is
Pokitto 5:ea7377f3d1af 8 // defined for the project build for both the compiler and assembler.
Pokitto 5:ea7377f3d1af 9 //*****************************************************************************
Pokitto 5:ea7377f3d1af 10 //
Pokitto 5:ea7377f3d1af 11 // Copyright(C) NXP Semiconductors, 2013
Pokitto 5:ea7377f3d1af 12 // All rights reserved.
Pokitto 5:ea7377f3d1af 13 //
Pokitto 5:ea7377f3d1af 14 // Software that is described herein is for illustrative purposes only
Pokitto 5:ea7377f3d1af 15 // which provides customers with programming information regarding the
Pokitto 5:ea7377f3d1af 16 // LPC products. This software is supplied "AS IS" without any warranties of
Pokitto 5:ea7377f3d1af 17 // any kind, and NXP Semiconductors and its licensor disclaim any and
Pokitto 5:ea7377f3d1af 18 // all warranties, express or implied, including all implied warranties of
Pokitto 5:ea7377f3d1af 19 // merchantability, fitness for a particular purpose and non-infringement of
Pokitto 5:ea7377f3d1af 20 // intellectual property rights. NXP Semiconductors assumes no responsibility
Pokitto 5:ea7377f3d1af 21 // or liability for the use of the software, conveys no license or rights under any
Pokitto 5:ea7377f3d1af 22 // patent, copyright, mask work right, or any other intellectual property rights in
Pokitto 5:ea7377f3d1af 23 // or to any products. NXP Semiconductors reserves the right to make changes
Pokitto 5:ea7377f3d1af 24 // in the software without notification. NXP Semiconductors also makes no
Pokitto 5:ea7377f3d1af 25 // representation or warranty that such application will be suitable for the
Pokitto 5:ea7377f3d1af 26 // specified use without further testing or modification.
Pokitto 5:ea7377f3d1af 27 //
Pokitto 5:ea7377f3d1af 28 // Permission to use, copy, modify, and distribute this software and its
Pokitto 5:ea7377f3d1af 29 // documentation is hereby granted, under NXP Semiconductors' and its
Pokitto 5:ea7377f3d1af 30 // licensor's relevant copyrights in the software, without fee, provided that it
Pokitto 5:ea7377f3d1af 31 // is used in conjunction with NXP Semiconductors microcontrollers. This
Pokitto 5:ea7377f3d1af 32 // copyright, permission, and disclaimer notice must appear in all copies of
Pokitto 5:ea7377f3d1af 33 // this code.
Pokitto 5:ea7377f3d1af 34 //*****************************************************************************
Pokitto 5:ea7377f3d1af 35 #if defined(__USE_ROMDIVIDE)
Pokitto 5:ea7377f3d1af 36
Pokitto 5:ea7377f3d1af 37 // Note that the romdivide "divmod" functions are not actually called from
Pokitto 5:ea7377f3d1af 38 // the below code, as these functions are actually just wrappers to the
Pokitto 5:ea7377f3d1af 39 // main romdivide "div" functions which push the quotient and remainder onto
Pokitto 5:ea7377f3d1af 40 // the stack, so as to be compatible with the way that C returns structures.
Pokitto 5:ea7377f3d1af 41 //
Pokitto 5:ea7377f3d1af 42 // This is not needed for the aeabi "divmod" functions, as the compiler
Pokitto 5:ea7377f3d1af 43 // automatically generates code that handles the return values being passed
Pokitto 5:ea7377f3d1af 44 // back in registers when it generates inline calls to __aeabi_idivmod and
Pokitto 5:ea7377f3d1af 45 // __aeabi_uidivmod routines.
Pokitto 5:ea7377f3d1af 46
Pokitto 5:ea7377f3d1af 47 .syntax unified
Pokitto 5:ea7377f3d1af 48 .text
Pokitto 5:ea7377f3d1af 49
Pokitto 5:ea7377f3d1af 50 // ========= __aeabi_idiv & __aeabi_idivmod =========
Pokitto 5:ea7377f3d1af 51 .align 2
Pokitto 5:ea7377f3d1af 52 .section .text.__aeabi_idiv
Pokitto 5:ea7377f3d1af 53
Pokitto 5:ea7377f3d1af 54 .global __aeabi_idiv
Pokitto 5:ea7377f3d1af 55 .set __aeabi_idivmod, __aeabi_idiv // make __aeabi_uidivmod an alias
Pokitto 5:ea7377f3d1af 56 .global __aeabi_idivmod
Pokitto 5:ea7377f3d1af 57 .global pDivRom_idiv // pointer to the romdivide 'idiv' functione
Pokitto 5:ea7377f3d1af 58 .func
Pokitto 5:ea7377f3d1af 59 .thumb_func
Pokitto 5:ea7377f3d1af 60 .type __aeabi_idiv, %function
Pokitto 5:ea7377f3d1af 61
Pokitto 5:ea7377f3d1af 62 __aeabi_idiv:
Pokitto 5:ea7377f3d1af 63 push {r4, lr}
Pokitto 5:ea7377f3d1af 64 ldr r3, =pDivRom_idiv
Pokitto 5:ea7377f3d1af 65 ldr r3, [r3, #0] // Load address of function
Pokitto 5:ea7377f3d1af 66 blx r3 // Call divide function
Pokitto 5:ea7377f3d1af 67 pop {r4, pc}
Pokitto 5:ea7377f3d1af 68
Pokitto 5:ea7377f3d1af 69 .endfunc
Pokitto 5:ea7377f3d1af 70
Pokitto 5:ea7377f3d1af 71 // ======== __aeabi_uidiv & __aeabi_uidivmod ========
Pokitto 5:ea7377f3d1af 72 .align 2
Pokitto 5:ea7377f3d1af 73
Pokitto 5:ea7377f3d1af 74 .section .text.__aeabi_uidiv
Pokitto 5:ea7377f3d1af 75
Pokitto 5:ea7377f3d1af 76 .global __aeabi_uidiv
Pokitto 5:ea7377f3d1af 77 .set __aeabi_uidivmod, __aeabi_uidiv // make __aeabi_uidivmod an alias
Pokitto 5:ea7377f3d1af 78 .global __aeabi_uidivmod
Pokitto 5:ea7377f3d1af 79 .global pDivRom_uidiv // pointer to the romdivide 'uidiv' function
Pokitto 5:ea7377f3d1af 80 .func
Pokitto 5:ea7377f3d1af 81 .thumb_func
Pokitto 5:ea7377f3d1af 82 .type __aeabi_uidiv, %function
Pokitto 5:ea7377f3d1af 83
Pokitto 5:ea7377f3d1af 84 __aeabi_uidiv:
Pokitto 5:ea7377f3d1af 85 push {r4, lr}
Pokitto 5:ea7377f3d1af 86 ldr r3, =pDivRom_uidiv
Pokitto 5:ea7377f3d1af 87 ldr r3, [r3, #0] // Load address of function
Pokitto 5:ea7377f3d1af 88 blx r3 // Call divide function
Pokitto 5:ea7377f3d1af 89 pop {r4, pc}
Pokitto 5:ea7377f3d1af 90
Pokitto 5:ea7377f3d1af 91 .endfunc
Pokitto 5:ea7377f3d1af 92
Pokitto 5:ea7377f3d1af 93 #endif // (__USE_ROMDIVIDE)