long __fastcall__ atol (const char* s);
 int __fastcall__ atexit (void (*exitfunc) (void));
 void* __fastcall__ bsearch (const void* key, const void* base, size_t n,
-                            size_t size, int (*cmp) (const void*, const void*));
+                            size_t size, int __fastcall__ (* cmp) (const void*, const void*));
 div_t __fastcall__ div (int numer, int denom);
 void __fastcall__ exit (int ret) __attribute__ ((noreturn));
 char* __fastcall__ getenv (const char* name);
 void __fastcall__ qsort (void* base, size_t count, size_t size,
-                         int (*compare) (const void*, const void*));
+                         int __fastcall__ (* compare) (const void*, const void*));
 long __fastcall__ strtol (const char* nptr, char** endptr, int base);
 unsigned long __fastcall__ strtoul (const char* nptr, char** endptr, int base);
 int __fastcall__ system (const char* s);
 
 struct outdesc;
 
 /* Type of the function that is called to output data */
-typedef void (*outfunc) (struct outdesc* desc, const char* buf, unsigned count);
+typedef void __cdecl__ (* outfunc) (struct outdesc* desc, const char* buf, unsigned count);
 
 
 
 
 /*
 ** bsearch.c
 **
-** Ullrich von Bassewitz, 17.06.1998
+** 1998-06-17, Ullrich von Bassewitz
+** 2015-06-21, Greg King
 */
 
 
 
 
 void* __fastcall__ bsearch (const void* key, const void* base, size_t n,
-                            size_t size, int (*cmp) (const void*, const void*))
+                            size_t size, int __fastcall__ (* cmp) (const void*, const void*))
 {
     int current;
     int result;
 
 /*
 ** qsort.c
 **
-** Ullrich von Bassewitz, 09.12.1998
+** 1998.12.09, Ullrich von Bassewitz
+** 2015-06-21, Greg King
 */
 
 
 
 static void QuickSort (register unsigned char* Base, int Lo, int Hi,
                        register size_t Size,
-                       int (*Compare)(const void*, const void*))
+                       int __fastcall__ (* Compare) (const void*, const void*))
 /* Internal recursive function. Works with ints, but this shouldn't be
 ** a problem.
 */
 
 
 void __fastcall__ qsort (void* base, size_t nmemb, size_t size,
-                         int (*compare)(const void*, const void*))
+                         int __fastcall__ (* compare) (const void*, const void*))
 /* Quicksort implementation */
 {
     if (nmemb > 1) {
 
 ; can ignore the passed pointer d, and access the data directly. While this
 ; is not very clean, it gives better and shorter code.
 ;
-; static void out (struct outdesc* d, const char* buf, unsigned count)
+; static void cdecl out (struct outdesc* d, const char* buf, unsigned count)
 ; /* Routine used for writing */
 ; {
 ;     register size_t cnt;
         ldy     #7
         jsr     pushwysp        ; Push count
         lda     ptr
-        ldx     ptr+1   
+        ldx     ptr+1
         jsr     _fwrite
         sta     ptr1            ; Save function result
         stx     ptr1+1
 
 ;
-; int vsnprintf (char* Buf, size_t size, const char* Format, va_list ap);
+; int __fastcall__ vsnprintf (char* Buf, size_t size, const char* Format, va_list ap);
 ;
 ; Ullrich von Bassewitz, 2009-09-26
 ;
 ; ----------------------------------------------------------------------------
 ; Callback routine used for the actual output.
 ;
-; static void out (struct outdesc* d, const char* buf, unsigned count)
+; static void __cdecl__ out (struct outdesc* d, const char* buf, unsigned count)
 ; /* Routine used for writing */
 ;
 ; Since we know, we're called with a pointer to our static outdesc structure,