This commit is contained in:
Vincent Barrilliot 2023-10-31 23:58:56 +01:00
commit da08d70111
59 changed files with 5852 additions and 2056 deletions

View file

@ -121,6 +121,172 @@ extern unsigned long __memory_start;
// See doc for more options, need to set $80 to get it started and use other bits to change the PWN...
*FAN_CTRL_REG = 0x01;
}
void init_SuperIO_config_zones(void) {
// First step is to get into the Configuration Mode
*CONFIG_0x2E_REG = 0x55; // We need to Get into the Config Mode with 0x55
// Setting Up Device 0 - Floppy
// {8'h06,16'h03F0,8'h00};
// LD
*CONFIG_0x2E_REG = 0x07;
*CONFIG_0x2F_REG = 0x00;
// BA_H (Base address)
*CONFIG_0x2E_REG = 0x60;
*CONFIG_0x2F_REG = 0x03;
// BA_L
*CONFIG_0x2E_REG = 0x61;
*CONFIG_0x2F_REG = 0xF0;
// INT
*CONFIG_0x2E_REG = 0x70;
*CONFIG_0x2F_REG = 0x06;
// Enable the Zone
*CONFIG_0x2E_REG = 0x30;
*CONFIG_0x2F_REG = 0x01;
// Setting Up Device 3 - Parallel Port
// {8'h07,16'h0378,8'h03};
// LD
*CONFIG_0x2E_REG = 0x07;
*CONFIG_0x2F_REG = 0x03;
// BA_H (Base address)
*CONFIG_0x2E_REG = 0x60;
*CONFIG_0x2F_REG = 0x03;
// BA_L
*CONFIG_0x2E_REG = 0x61;
*CONFIG_0x2F_REG = 0x78;
// INT0
*CONFIG_0x2E_REG = 0x70;
*CONFIG_0x2F_REG = 0x07;
// Parallel Mode
*CONFIG_0x2E_REG = 0xF0;
*CONFIG_0x2F_REG = 0x3A;
// Enable the Zone
*CONFIG_0x2E_REG = 0x30;
*CONFIG_0x2F_REG = 0x01;
// Setting Up Device 4 - Serial Port 1
// {8'h04,16'h03F8,8'h04};
// LD
*CONFIG_0x2E_REG = 0x07;
*CONFIG_0x2F_REG = 0x04;
// BA_H (Base address)
*CONFIG_0x2E_REG = 0x60;
*CONFIG_0x2F_REG = 0x03;
// BA_L
*CONFIG_0x2E_REG = 0x61;
*CONFIG_0x2F_REG = 0xF8;
// INT0
*CONFIG_0x2E_REG = 0x70;
*CONFIG_0x2F_REG = 0x04;
// Enable the Zone
*CONFIG_0x2E_REG = 0x30;
*CONFIG_0x2F_REG = 0x01;
// Setting Up Device 5 - Serial Port 2
// {8'h03,16'h02F8,8'h05};
// LD
*CONFIG_0x2E_REG = 0x07;
*CONFIG_0x2F_REG = 0x05;
// BA_H (Base address)
*CONFIG_0x2E_REG = 0x60;
*CONFIG_0x2F_REG = 0x02;
// BA_L
*CONFIG_0x2E_REG = 0x61;
*CONFIG_0x2F_REG = 0xF8;
// INT0
*CONFIG_0x2E_REG = 0x70;
*CONFIG_0x2F_REG = 0x03;
// Enable the Zone
*CONFIG_0x2E_REG = 0x30;
*CONFIG_0x2F_REG = 0x01;
// Setting Up Device 7 - Keyboard
// {8'h01, 16'h0060,8'h07};
// LD
*CONFIG_0x2E_REG = 0x07;
*CONFIG_0x2F_REG = 0x07;
// BA_H (Base address)
*CONFIG_0x2E_REG = 0x60;
*CONFIG_0x2F_REG = 0x00;
// BA_L
*CONFIG_0x2E_REG = 0x61;
*CONFIG_0x2F_REG = 0x60;
// INT0 (Keyboard)
*CONFIG_0x2E_REG = 0x70;
*CONFIG_0x2F_REG = 0x01;
// INT1 (mouse)
*CONFIG_0x2E_REG = 0x72;
*CONFIG_0x2F_REG = 0x02;
// Enable the Zone
*CONFIG_0x2E_REG = 0x30;
*CONFIG_0x2F_REG = 0x01;
// Setting Up Device 9 - Game Port
// {8'h00, 16'h0200,8'h09};
// LD
*CONFIG_0x2E_REG = 0x07;
*CONFIG_0x2F_REG = 0x09;
// BA_H (Base address)
*CONFIG_0x2E_REG = 0x60;
*CONFIG_0x2F_REG = 0x02;
// BA_L
*CONFIG_0x2E_REG = 0x61;
*CONFIG_0x2F_REG = 0x00;
// INT0
*CONFIG_0x2E_REG = 0x70;
*CONFIG_0x2F_REG = 0x00;
// Enable the Zone
*CONFIG_0x2E_REG = 0x30;
*CONFIG_0x2F_REG = 0x01;
// Setting Up Device 10 - PME (Power Management)
// {8'h00, 16'h0100,8'h0A};
// LD
*CONFIG_0x2E_REG = 0x07;
*CONFIG_0x2F_REG = 0x0A;
// BA_H (Base address)
*CONFIG_0x2E_REG = 0x60;
*CONFIG_0x2F_REG = 0x01;
// BA_L
*CONFIG_0x2E_REG = 0x61;
*CONFIG_0x2F_REG = 0x00;
// INT0
*CONFIG_0x2E_REG = 0x70;
*CONFIG_0x2F_REG = 0x00;
// Enable the Zone
*CONFIG_0x2E_REG = 0x30;
*CONFIG_0x2F_REG = 0x01;
// Setting Up Device 11 - PME (Power Management)
// {8'h05,16'h0330,8'h0B};
// LD
*CONFIG_0x2E_REG = 0x07;
*CONFIG_0x2F_REG = 0x0B;
// BA_H (Base address)
*CONFIG_0x2E_REG = 0x60;
*CONFIG_0x2F_REG = 0x03;
// BA_L
*CONFIG_0x2E_REG = 0x61;
*CONFIG_0x2F_REG = 0x30;
// INT0
*CONFIG_0x2E_REG = 0x70;
*CONFIG_0x2F_REG = 0x05;
// Enable the Zone
*CONFIG_0x2E_REG = 0x30;
*CONFIG_0x2F_REG = 0x01;
// Supplemental Settings
// Power On Device
*CONFIG_0x2E_REG = 0x22;
*CONFIG_0x2F_REG = 0xFF;
// We are done with config.
*CONFIG_0x2E_REG = 0xAA; // We need to Get into the Config Mode with 0x55
*GP60_REG = 0x84; // THis is to replicate the FPGA behavior when it did the config.
*LED1_REG = 0x01; // THis is to replace the FPGA behavior when it did the config in hardware.
}
#endif
void print_error(short channel, char * message, short code) {
@ -188,6 +354,7 @@ void initialize() {
#if HAS_SUPERIO
/* Initialize the SuperIO chip */
init_SuperIO_config_zones(); // This Init used to be done by the FPGA.
init_superio();
#endif

View file

@ -1,59 +1,63 @@
/**
* @file gabe_a2560k.h
*
* Define miscellaneous GABE registers
*/
#ifndef __GABE_A2560K_H
#define __GABE_A2560K_H
// These are 32bits Wide Registers since they are internal to the VICKY III
#define GABE_CTRL_REG ((volatile unsigned int *)0xFEC00000)
#define POWER_ON_LED 0x00000001
#define SDCARD_LED 0x00000002
#define BUZZER_CONTROL 0x00000010
#define MANUAL_RESET 0x00008000 // Make sure the word "DEAD" is written in GABE_RESET_ID
#define GABE_LFSR_REG0 ((volatile unsigned int *)0xFEC00004)
#define RGB_LED ((volatile unsigned int *)0xFEC00008) // Writing Only - A2560K Only - 0x__RRGGBB
#define GABE_LFSR_STATDATA ((volatile unsigned int *)0xFEC00008) // Read Only
#define GABE_SUBVER_ID ((volatile unsigned int *)0xFEC0000C) // Subversion[31:16], Machine ID[3:2] - Read Only
#define GABE_CPU_ID_MASK 0x0000FF00
#define GABE_CPU_SPD_MASK 0x000000E0
#define GABE_ID_MASK 0x0000000C
#define GABE_CHIP_SV_MASK 0xFFFF0000
#define GABE_CHIP_VERSION ((volatile unsigned int *)0xFEC00010) // Number[31:16], Version[15:0]
#define GABE_CHIP_V_MASK 0x0000FFFF
#define GABE_CHIP_N_MASK 0xFFFF0000
#define GABE_FIRMWARE_DATE ((volatile unsigned int *)0xFEC00014) // xxDDMMYY
#define GABE_FIRMWARE_DATE_YEAR_MASK 0x000000FF
#define GABE_FIRMWARE_DATE_MONTH_MASK 0x0000FF00
#define GABE_FIRMWARE_DATE_DAY_MASK 0x00FF0000
// Those registers in the GenX/A2560X are 16bits Wide.
#define GABE_DIP_REG ((volatile unsigned short *)0xFEC00518)
#define GABE_DIP_BOOT_MASK 0x0003 /* Mask for the boot mode: */
#define GABE_DIP_USER_MASK 0x0300 /* Mask for the user switches: */
// This applies to GenX and A2560X ONLY
#define GABE_SUB_MODEL_ID ((volatile unsigned short *)0xFEC00514)
#define GABE_SUB_MOD_MASK 0x0003 /* Mask for the sub-model: PB, LB, CU*/
#define GABE_GENX_STAT_LEDS ((volatile unsigned long *)0xFEC0000C)
#define GABE_GENX_STAT_LED_0_B 0x00000001 /* LED 0 (Close to DEL key) -- Blue ON */
#define GABE_GENX_STAT_LED_0_G 0x00000002 /* LED 0 (Close to DEL key) -- Green ON */
#define GABE_GENX_STAT_LED_0_R 0x00000004 /* LED 0 (Close to DEL key) -- Red ON */
#define GABE_GENX_STAT_LED_1_B 0x00000008 /* LED 1 (Below #0) -- Blue ON */
#define GABE_GENX_STAT_LED_1_G 0x00000010 /* LED 1 (Below #0) -- Green ON */
#define GABE_GENX_STAT_LED_1_R 0x00000020 /* LED 1 (Below #0) -- Red ON */
#define GABE_GENX_STAT_LED_2_B 0x00000040 /* LED 2 (above arrow) -- Blue ON */
#define GABE_GENX_STAT_LED_2_G 0x00000080 /* LED 2 (above arrow) -- Green ON */
#define GABE_GENX_STAT_LED_2_R 0x00000100 /* LED 2 (above arrow) -- Red ON */
#endif
/**
* @file gabe_a2560x.h
*
* Define miscellaneous GABE registers
*/
#ifndef __GABE_A2560X_H
#define __GABE_A2560X_H
// These are 32bits Wide Registers since they are internal to the VICKY III
#define GABE_CTRL_REG ((volatile unsigned int *)0xFEC00000)
#define POWER_ON_LED 0x00000001
#define SDCARD_LED 0x00000002
#define BUZZER_CONTROL 0x00000010
#define MANUAL_RESET 0x00008000 // Make sure the word "DEAD" is written in GABE_RESET_ID
#define GABE_LFSR_REG0 ((volatile unsigned int *)0xFEC00004)
#define RGB_LED ((volatile unsigned int *)0xFEC00008) // Writing Only - A2560K Only - 0x__RRGGBB
#define GABE_LFSR_STATDATA ((volatile unsigned int *)0xFEC00008) // Read Only
#define GABE_SUBVER_ID ((volatile unsigned int *)0xFEC0000C) // Subversion[31:16], Machine ID[3:2] - Read Only
#define GABE_CPU_ID_MASK 0x0000FF00
#define GABE_CPU_SPD_MASK 0x000000E0
#define GABE_ID_MASK 0x0000000C
#define GABE_CHIP_SV_MASK 0xFFFF0000
#define GABE_CHIP_VERSION ((volatile unsigned int *)0xFEC00010) // Number[31:16], Version[15:0]
#define GABE_CHIP_V_MASK 0x0000FFFF
#define GABE_CHIP_N_MASK 0xFFFF0000
#define GABE_FIRMWARE_DATE ((volatile unsigned int *)0xFEC00014) // xxDDMMYY
#define GABE_FIRMWARE_DATE_YEAR_MASK 0x000000FF
#define GABE_FIRMWARE_DATE_MONTH_MASK 0x0000FF00
#define GABE_FIRMWARE_DATE_DAY_MASK 0x00FF0000
// This applies to GenX and A2560X ONLY
#define GABE_SUB_MODEL_FF_ID ((volatile unsigned short *)0xFEC00514)
#define GABE_SUB_FF_MASK 0x0003 /* Mask for the sub-model: PB, LB, CU*/
#define GABE_SUB_MODEL_ID ((volatile unsigned short *)0xFEC00516)
#define GABE_SUB_MOD_MODEL 0x000F /* This indicate What is the Model of the Unit*/
// Those registers in the GenX/A2560X are 16bits Wide.
#define GABE_DIP_REG ((volatile unsigned short *)0xFEC00518)
#define GABE_DIP_BOOT_MASK 0x0003 /* Mask for the boot mode: */
#define GABE_DIP_USER_MASK 0x0300 /* Mask for the user switches: */
#define GABE_GENX_STAT_LEDS ((volatile unsigned long *)0xFEC0000C)
#define GABE_GENX_STAT_LED_0_B 0x00000001 /* LED 0 (Close to DEL key) -- Blue ON */
#define GABE_GENX_STAT_LED_0_G 0x00000002 /* LED 0 (Close to DEL key) -- Green ON */
#define GABE_GENX_STAT_LED_0_R 0x00000004 /* LED 0 (Close to DEL key) -- Red ON */
#define GABE_GENX_STAT_LED_1_B 0x00000008 /* LED 1 (Below #0) -- Blue ON */
#define GABE_GENX_STAT_LED_1_G 0x00000010 /* LED 1 (Below #0) -- Green ON */
#define GABE_GENX_STAT_LED_1_R 0x00000020 /* LED 1 (Below #0) -- Red ON */
#define GABE_GENX_STAT_LED_2_B 0x00000040 /* LED 2 (above arrow) -- Blue ON */
#define GABE_GENX_STAT_LED_2_G 0x00000080 /* LED 2 (above arrow) -- Green ON */
#define GABE_GENX_STAT_LED_2_R 0x00000100 /* LED 2 (above arrow) -- Red ON */
#endif

View file

@ -9,6 +9,9 @@
#ifndef __SUPERIO_H
#define __SUPERIO_H
#define CONFIG_0x2E_REG ((volatile unsigned char *)0xFEC0202E)
#define CONFIG_0x2F_REG ((volatile unsigned char *)0xFEC0202F)
#define PME_STS_REG ((volatile unsigned char *)0xFEC02100)
#define PME_EN_REG ((volatile unsigned char *)0xFEC02102)

View file

@ -46,9 +46,9 @@ void ind_set_power(short state) {
#if MODEL == MODEL_FOENIX_A2560K
*RGB_LED = 0x00004000;
#elif MODEL == MODEL_FOENIX_GENX
*RGB_LED = 0x00200020;
*RGB_LED = 0x0000DD00;
#elif MODEL == MODEL_FOENIX_A2560X
*RGB_LED = 0x00202000;
*RGB_LED = 0x00D42E00;
#else
*RGB_LED = 0x00004020;
#endif

View file

@ -11,9 +11,8 @@
xdef _restart_cli
;
; Interrupt registers for A2560U and U+
; Interrupt registers for A2560X/K and GenX
;
PENDING_GRP0 = $FEC00100
PENDING_GRP1 = $FEC00102
PENDING_GRP2 = $FEC00104
@ -85,11 +84,7 @@ PENDING_GRP2 = $FEC00104
dc.l not_impl ; 62 - Reserved
dc.l not_impl ; 63 - Reserved
dc.l interrupt_x10 ; 64 - Interrupt 0x10 - SuperIO - PS/2 Keyboard
if MODEL==11 ; A2560K
dc.l interrupt_x11 ; 65 - Interrupt 0x11 - A2560K Built-in Keyboard (Mo)
else
dc.l not_impl ; 65 - Reserved
endif
dc.l interrupt_x12 ; 66 - Interrupt 0x12 - SuperIO - PS/2 Mouse
dc.l interrupt_x13 ; 67 - Interrupt 0x13 - SuperIO - COM1
dc.l interrupt_x14 ; 68 - Interrupt 0x14 - SuperIO - COM2
@ -125,7 +120,7 @@ PENDING_GRP2 = $FEC00104
code
coldboot: move.w #$2700,SR ; Supervisor mode, Interrupt mode (68040), disable all interrupts
moveq #0,d0 ; Disable 040's MMU
movec d0,TC
@ -136,15 +131,10 @@ coldboot: move.w #$2700,SR ; Supervisor mode, Interrupt mode (68040), d
lea ___BSSSTART,a0
move.l #___BSSSIZE,d0
beq callmain
moveq #0,d1
; Be save in case BSS is not long word-aligned
clrloop: move.b d1,(a0)+
subq.l #1,d0
bpl.s clrloop
;clrloop: move.l d1,(a0)+ ; faster but requires BSS to be 4bytes aligned
; subq.l #4,d0
; bpl.s clrloop
clrloop: move.l #0,(a0)+
subq.l #4,d0
bne clrloop
move.l #$ffffff00,$fec80008 ; change border color
callmain: jsr ___main ; call __main to transfer to the C code

View file

@ -13,34 +13,9 @@
;
; Interrupt registers for A2560U and U+
;
; Don't try to use semething like "if MODEL=6 || MODEL=9", that doesn't work work in vasm 1.8 :/
if MODEL==6 ; A2560U
PENDING_GRP0 equ $00B00100
PENDING_GRP1 equ $00B00102
PENDING_GRP2 equ $00B00104
else if MODEL==9 ; A2560U+
PENDING_GRP0 equ $00B00100
PENDING_GRP1 equ $00B00102
PENDING_GRP2 equ $00B00104
else if MODEL==11 ; A2560K
PENDING_GRP0 equ $00C00100
PENDING_GRP1 equ $00C00102
PENDING_GRP2 equ $00C00104
else fail MODEL not recognized !
endif
;
; Interrupt Vector 0x1F -- Real Time Clock
;
if MODEL==6
RTC_FLAGS equ $00B0009A ; A2560U
else if MODEL==9
RTC_FLAGS equ $00B0009A ; A2560U+
else if MODEL==11
RTC_FLAGS equ $FEC0008D ; A2560K
else fail Cannot set RTC_FLAGs: Unknown model
endif
PENDING_GRP0 = $00B00100
PENDING_GRP1 = $00B00102
PENDING_GRP2 = $00B00104
section "VECTORS",code
@ -144,25 +119,28 @@ RTC_FLAGS equ $FEC0008D ; A2560K
code
coldboot: move.w #$2700,SR ; Supervisor mode, disable all interrupts
lea ___STACK,sp
coldboot: lea ___STACK,sp
bsr _int_disable_all
lea ___BSSSTART,a0
; Clear BSS segment
lea ___BSSSTART,a0
move.l #___BSSSIZE,d0
beq callmain
moveq.l #0,d1
beq.s callmain
move.l #0,d1
clrloop: ; We don't use clr.l because it's a read-modify-write operation
; that is not yet supported by the FPGA's bus logic for now.
; So we use a move instead.
; clr.l (a0)+
move.l d1,(a0)+
subq.l #4,d0
bpl.s clrloop
bne.s clrloop
move.l #trap_save_area,trap_save_area
; Set TRAP #15 vector handler
lea h_trap_15,a0 ; Address of the handler
move.l #(13+32)<<2,a1 ; TRAP#15 vector address
move.l a0,(a1) ; Set the vector
callmain: jsr ___main ; call __main to transfer to the C code
@ -170,7 +148,6 @@ callmain: jsr ___main ; call __main to transfer to the C code
___exit:
bra ___exit
if MODEL==11 ; A2560K
;
; Autovector #1: Used by VICKY III Channel B interrupts
;
@ -178,7 +155,6 @@ autovec1: movem.l d0-d7/a0-a6,-(a7)
jsr _int_vicky_channel_b ; Call the dispatcher for Channel B interrupts
movem.l (a7)+,d0-d7/a0-a6
rte
endif
;
; Autovector #1: Used by VICKY III Channel A interrupts
@ -240,9 +216,7 @@ interrupt_x1B: inthandler $1B, $0800, PENDING_GRP1 ; Interrupt Vector 0x1B
interrupt_x1C: inthandler $1C, $1000, PENDING_GRP1 ; Interrupt Vector 0x1C -- Timer 4
interrupt_x1D: inthandler $1D, $2000, PENDING_GRP1 ; Interrupt Vector 0x1D -- Reserved
interrupt_x1E: inthandler $1E, $4000, PENDING_GRP1 ; Interrupt Vector 0x1E -- Reserved
interrupt_x1F:
tst.b RTC_FLAGS ; Acknowledge interrupt by reading the flags. Because of this we can't use the inthandler macro.
inthandler $1F, $8000, PENDING_GRP1 ; Interrupt Vector 0x1F -- Real Time Clock
interrupt_x1F: inthandler $1F, $8000, PENDING_GRP1 ; Interrupt Vector 0x1F -- Real Time Clock
;
; Group 2 Interrupt Handlers
@ -383,55 +357,39 @@ panic_lock: bra panic_lock
; int32_t syscall(int32_t number, int32_t p0, int32_t p1, int32_t p2, int32_t p3, int32_t p4, int32_t p5)
;
_syscall:
; Repush the parameters
move.l 28(sp),-(sp)
move.l 28(sp),-(sp)
move.l 28(sp),-(sp)
move.l 28(sp),-(sp)
move.l 28(sp),-(sp)
move.l 28(sp),-(sp)
move.l 28(sp),-(sp)
trap #15 ; Call into the kernel
lea 28(sp),sp
movem.l d1-d7,-(sp) ; Save caller's registers
move.l (56,sp),d6 ; Parameter 5 to D6
move.l (52,sp),d5 ; Parameter 4 to D5
move.l (48,sp),d4 ; Parameter 3 to D4
move.l (44,sp),d3 ; Parameter 2 to D3
move.l (40,sp),d2 ; Parameter 1 to D2
move.l (36,sp),d1 ; Parameter 0 to D1
move.l (32,sp),d0 ; Function number to D0
TRAP #15 ; Call into the kernel
movem.l (sp)+,d1-d7 ; Restore caller's registers
rts
;
; TRAP#15 handler... transfer control to the C dispatcher
;
KFN_ELEVATE equ $43
h_trap_15:
; Save sr, return address and non-scratch registers into our save area
; TODO we should guard this if we want to allow system calls from interrupts.
move.l trap_save_area,a0
move.w (sp)+,d0 ; Status register
move.w d0,-(a0)
move.l (sp)+,-(a0) ; Return address
movem.l d2-d7/a2-a7,-(a0)
move.l a0,trap_save_area ; TODO should we check if we're beyond the end of that area ? As we'd be corrupting data.
; Fix stack if necessary so it points to the arguments for the dispatcher
btst #13,d0 ; Check supervisor bit from caller's status register to see if were we called from user mode
bne.s syscall_stack_set ; If yes, sp already points to the arguments
move.l usp,sp ; If not, the argument are on the user stack, so use it
syscall_stack_set:
move.l d6,-(sp) ; Push the parameters to the stack for the C call
move.l d5,-(sp)
move.l d4,-(sp)
move.l d3,-(sp)
move.l d2,-(sp)
move.l d1,-(sp)
move.l d0,-(sp)
cmpi.w #KFN_ELEVATE,(sp) ; Is this a sys_proc_elevate call?
beq.s h_trap_elev ; Yes, just handle it here
jsr _syscall_dispatch ; Call the C routine to do the dispatch
; Note: the C routine depends upon the register push order
jsr _syscall_dispatch ; Call the C routine to do the dispatch
add.l #28,sp ; Remove parameters from the stack
; Restore context from our save area
move.l trap_save_area,a0
movem.l (a0)+,d2-d7/a2-a7
move.l (a0)+,-(sp) ; Return address
move.w (a0)+,-(sp) ; Status register
move.l a0,trap_save_area
rte ; Return to the caller
h_trap_elev ori #$2000,(a7) ; Change the caller's privilege to supervisor
rte ; And return to it
;
; Jump into a user mode code
;
@ -440,29 +398,18 @@ h_trap_elev ori #$2000,(a7) ; Change the caller's privilege to super
; a1 = location to set user stack pointer
;
_call_user:
; Set up the user stack
move.l #$00010000,a0 ; Get the pointer to the process's stack
move.l (12,a7),d1 ; Get the number of parameters passed
move.l (16,a7),a1 ; Get the pointer to the parameters
move.l a1,-(a0) ; Push the parameters list
move.w d1,-(a0) ; Push the parameter count
move.l a0,usp ; Set the User Stack Pointer
; Set up the system stack
move.l (4,a7),a0 ; Get the pointer to the code to start
move.w #0,-(a7) ; Push the fake vector offset
move.l a0,-(a7) ; Push it as the starting address
move.w #$0000,-(a7) ; Push the user's initial SR (to switch to user mode)
rte ; Start the user process
move.l (8,a7),a1 ; Get the pointer to the process's stack
move.l (12,a7),d0 ; Get the number of parameters passed
move.l (16,a7),a2 ; Get the pointer to the parameters
; andi #$dfff,sr ; Drop into user mode
movea.l a1,a7 ; Set the stack
move.l a2,-(a7) ; Push the parameters list
move.l d0,-(a7) ; Push the parameter count
jsr (a0)
_restart_cli:
lea ___STACK,sp
jsr _cli_rerepl
bra _restart_cli
section BSS
TRAP_MAX_REENTRANCY EQU 4 ; Max number of reentrant calls to the trap handler
ds.b (6+12*4)*TRAP_MAX_REENTRANCY ; Each time we save status register .w and return address .l, so 6 bytes, + the saved registers (non-scratch) d2-d7/a2-a7 according to VBCC doc
trap_save_area: ds.l 1

View file

@ -253,7 +253,7 @@ unsigned char splashscreen_lut[] = {
0xFA, 0xFD, 0xFB, 0x00,
0xFF, 0xFC, 0xFF, 0x00,
0xFB, 0xFD, 0xFF, 0x00,
0xFB, 0xFF, 0xFC, 0x00,
0xFB, 0xFF, 0xFC
};
unsigned char splashscreen_pix[] = {
@ -1103,139 +1103,68 @@ unsigned char splashscreen_pix[] = {
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x1A, 0x0C, 0x0B, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0xFF, 0x0C,
0xFF, 0x0C, 0x4E, 0x0C, 0x0D, 0xFE, 0x1A, 0x0C, 0x0D, 0xFE, 0xFF, 0x0C, 0xFF, 0x0C, 0x4E, 0x0C,
0x09, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x1A, 0x0C, 0x0B, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0xFF, 0x0C, 0xE2, 0x0C, 0x01, 0x35, 0x11, 0x3C, 0x01, 0x35, 0x01, 0x16, 0x04, 0x0C,
0x01, 0x35, 0x11, 0x3C, 0x01, 0x35, 0x01, 0x16, 0x3F, 0x0C, 0x0D, 0xFE, 0x1A, 0x0C, 0x0A, 0xFC,
0x03, 0xFE, 0xFF, 0x0C, 0xE2, 0x0C, 0x01, 0x35, 0x12, 0x3C, 0x01, 0x66, 0x01, 0x5B, 0x03, 0x0C,
0x01, 0x35, 0x13, 0x3C, 0x01, 0x67, 0x3E, 0x0C, 0x08, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE,
0x01, 0xFC, 0x01, 0xFE, 0x1A, 0x0C, 0x09, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE,
0xFF, 0x0C, 0xE2, 0x0C, 0x01, 0x35, 0x13, 0x3C, 0x01, 0xC5, 0x01, 0x45, 0x02, 0x0C, 0x01, 0x35,
0x13, 0x3C, 0x01, 0xBB, 0x01, 0x54, 0x3D, 0x0C, 0x0D, 0xFE, 0x1A, 0x0C, 0x0D, 0xFE, 0xFF, 0x0C,
0xE2, 0x0C, 0x01, 0x35, 0x13, 0x3C, 0x01, 0xBF, 0x01, 0x74, 0x02, 0x0C, 0x01, 0x35, 0x13, 0x3C,
0x01, 0xB0, 0x01, 0x8D, 0x3D, 0x0C, 0x07, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE,
0x01, 0xFC, 0x01, 0xFE, 0x1A, 0x0C, 0x09, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE,
0xFF, 0x0C, 0xE2, 0x0C, 0x01, 0x35, 0x13, 0x3C, 0x01, 0xBF, 0x01, 0x8D, 0x02, 0x0C, 0x01, 0x35,
0x13, 0x3C, 0x01, 0xAC, 0x01, 0xA5, 0x3D, 0x0C, 0x0D, 0xFE, 0x1A, 0x0C, 0x08, 0xFC, 0x05, 0xFE,
0xFF, 0x0C, 0xE2, 0x0C, 0x01, 0x35, 0x13, 0x3C, 0x01, 0xBF, 0x01, 0x90, 0x02, 0x0C, 0x01, 0x35,
0x13, 0x3C, 0x01, 0xAC, 0x01, 0xA5, 0x3D, 0x0C, 0x06, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE,
0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x1A, 0x0C, 0x07, 0xFE, 0x01, 0xFC, 0x01, 0xFE,
0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0xFF, 0x0C, 0xE2, 0x0C, 0x01, 0x35, 0x05, 0x3C,
0x01, 0x95, 0x07, 0xFC, 0x01, 0x79, 0x05, 0x3C, 0x01, 0xBF, 0x01, 0x90, 0x02, 0x0C, 0x01, 0x35,
0x05, 0x3C, 0x01, 0x95, 0x07, 0xFC, 0x01, 0x9B, 0x05, 0x3C, 0x01, 0xAC, 0x01, 0xA5, 0x3D, 0x0C,
0x0D, 0xFE, 0x1A, 0x0C, 0x0D, 0xFE, 0xFF, 0x0C, 0xE2, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95,
0x01, 0xBF, 0x06, 0x0C, 0x06, 0x3C, 0x01, 0xBF, 0x01, 0x90, 0x02, 0x0C, 0x01, 0x35, 0x05, 0x3C,
0x01, 0x95, 0x01, 0xBF, 0x06, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0xAC, 0x01, 0xA5, 0x3D, 0x0C,
0x01, 0xFE, 0xFF, 0x0C, 0xFF, 0x0C, 0x4E, 0x0C, 0x0D, 0xFE, 0x1A, 0x0C, 0x0A, 0xFC, 0x03, 0xFE,
0xFF, 0x0C, 0xFF, 0x0C, 0x4E, 0x0C, 0x08, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x1A, 0x0C, 0x09, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0xFF, 0x0C,
0xFF, 0x0C, 0x4E, 0x0C, 0x0D, 0xFE, 0x1A, 0x0C, 0x0D, 0xFE, 0xFF, 0x0C, 0xFF, 0x0C, 0x4E, 0x0C,
0x07, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x1A, 0x0C,
0x09, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0xFF, 0x0C, 0xFF, 0x0C, 0x4E, 0x0C,
0x0D, 0xFE, 0x1A, 0x0C, 0x08, 0xFC, 0x05, 0xFE, 0xFF, 0x0C, 0xFF, 0x0C, 0x4E, 0x0C, 0x06, 0xFC,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x1A, 0x0C,
0x07, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0xFF, 0x0C,
0xFF, 0x0C, 0x4E, 0x0C, 0x0D, 0xFE, 0x1A, 0x0C, 0x0D, 0xFE, 0xFF, 0x0C, 0xFF, 0x0C, 0x4E, 0x0C,
0x05, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x1A, 0x0C, 0x07, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0xFF, 0x0C, 0xE2, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x06, 0x0C,
0x06, 0x3C, 0x01, 0xBF, 0x01, 0x90, 0x02, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF,
0x06, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0xAC, 0x01, 0xA5, 0x3D, 0x0C, 0x0D, 0xFE, 0x1A, 0x0C,
0x06, 0xFC, 0x07, 0xFE, 0xFF, 0x0C, 0xE2, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF,
0x06, 0x0C, 0x06, 0x3C, 0x01, 0xBF, 0x01, 0x90, 0x02, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95,
0x01, 0xBF, 0x06, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0xAC, 0x01, 0xA5, 0x3D, 0x0C, 0x04, 0xFC,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x1A, 0x0C, 0x05, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0xFF, 0x0C, 0xE2, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95,
0x01, 0xBF, 0x06, 0x0C, 0x06, 0x3C, 0x01, 0xBF, 0x01, 0x90, 0x02, 0x0C, 0x01, 0x35, 0x05, 0x3C,
0x01, 0x95, 0x01, 0xBF, 0x06, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0xAC, 0x01, 0xA5, 0x3D, 0x0C,
0x0D, 0xFE, 0x1A, 0x0C, 0x0D, 0xFE, 0xFF, 0x0C, 0xE2, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95,
0x01, 0xBF, 0x06, 0x0C, 0x06, 0x3C, 0x01, 0xBF, 0x01, 0x90, 0x02, 0x0C, 0x01, 0x35, 0x05, 0x3C,
0x01, 0x95, 0x01, 0xBF, 0x06, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0xAC, 0x01, 0xA5, 0x3D, 0x0C,
0x01, 0xFE, 0xFF, 0x0C, 0xFF, 0x0C, 0x4E, 0x0C, 0x0D, 0xFE, 0x1A, 0x0C, 0x06, 0xFC, 0x07, 0xFE,
0xFF, 0x0C, 0xFF, 0x0C, 0x4E, 0x0C, 0x04, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x1A, 0x0C, 0x05, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0xFF, 0x0C,
0xFF, 0x0C, 0x4E, 0x0C, 0x0D, 0xFE, 0x1A, 0x0C, 0x0D, 0xFE, 0xFF, 0x0C, 0xFF, 0x0C, 0x4E, 0x0C,
0x03, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x1A, 0x0C, 0x05, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0xFF, 0x0C, 0xE2, 0x0C, 0x01, 0x35,
0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x06, 0x0C, 0x06, 0x3C, 0x01, 0xBF, 0x01, 0x90, 0x02, 0x0C,
0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x06, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0xAC,
0x01, 0xA5, 0x3D, 0x0C, 0x0D, 0xFE, 0x1A, 0x0C, 0x04, 0xFC, 0x09, 0xFE, 0xFF, 0x0C, 0xE2, 0x0C,
0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x06, 0x0C, 0x06, 0x3C, 0x01, 0xBF, 0x01, 0x90,
0x02, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x06, 0x0C, 0x01, 0x35, 0x05, 0x3C,
0x01, 0xB0, 0x01, 0xA5, 0x3D, 0x0C, 0x02, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x1A, 0x0C,
0x03, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0xFF, 0x0C, 0xE2, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95,
0x01, 0xBF, 0x06, 0x0C, 0x06, 0x3C, 0x01, 0xBF, 0x01, 0x90, 0x02, 0x0C, 0x01, 0x35, 0x05, 0x3C,
0x01, 0x95, 0x01, 0xBF, 0x06, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0xB9, 0x01, 0xA5, 0x3D, 0x0C,
0x0D, 0xFE, 0x1A, 0x0C, 0x0D, 0xFE, 0xFF, 0x0C, 0xE2, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95,
0x01, 0xBF, 0x06, 0x0C, 0x06, 0x3C, 0x01, 0xBF, 0x01, 0x90, 0x02, 0x0C, 0x01, 0x35, 0x05, 0x3C,
0x01, 0x95, 0x01, 0xBF, 0x05, 0x0C, 0x01, 0x24, 0x06, 0x3C, 0x01, 0xD3, 0x01, 0x97, 0x3D, 0x0C,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0xFF, 0x0C, 0xFF, 0x0C, 0x4E, 0x0C,
0x0D, 0xFE, 0x1A, 0x0C, 0x04, 0xFC, 0x09, 0xFE, 0xFF, 0x0C, 0xFF, 0x0C, 0x4E, 0x0C, 0x02, 0xFC,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x1A, 0x0C, 0x03, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0xFF, 0x0C,
0xFF, 0x0C, 0x4E, 0x0C, 0x0D, 0xFE, 0x1A, 0x0C, 0x0D, 0xFE, 0xFF, 0x0C, 0xFF, 0x0C, 0x4E, 0x0C,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x1E, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x29, 0xFE, 0xFF, 0x0C,
0xBA, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x06, 0x0C, 0x06, 0x3C, 0x01, 0xBF,
0x01, 0x90, 0x02, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x03, 0x0C, 0x01, 0x23,
0x01, 0x35, 0x06, 0x3C, 0x01, 0x6F, 0x01, 0xF7, 0x01, 0x74, 0x3D, 0x0C, 0x26, 0xFE, 0x03, 0xFC,
0x33, 0xFE, 0xFF, 0x0C, 0xBA, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x06, 0x0C,
0x06, 0x3C, 0x01, 0xBF, 0x01, 0x90, 0x02, 0x0C, 0x01, 0x35, 0x12, 0x3C, 0x01, 0xD8, 0x01, 0xE6,
0x01, 0x33, 0x3D, 0x0C, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x1A, 0xFC, 0x03, 0xFE, 0x01, 0xFC,
0xFF, 0x0C, 0x26, 0x0C, 0x26, 0xFE, 0x03, 0xFC, 0x33, 0xFE, 0xFF, 0x0C, 0xFF, 0x0C, 0x26, 0x0C,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x29, 0xFC, 0x01, 0xFE, 0xFF, 0x0C, 0xBA, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95,
0x01, 0xBF, 0x06, 0x0C, 0x06, 0x3C, 0x01, 0xBF, 0x01, 0x90, 0x02, 0x0C, 0x01, 0x35, 0x10, 0x3C,
0x01, 0x75, 0x01, 0xE6, 0x01, 0xF2, 0x01, 0x6F, 0x3E, 0x0C, 0x5C, 0xFE, 0xFF, 0x0C, 0xBA, 0x0C,
0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x06, 0x0C, 0x06, 0x3C, 0x01, 0xBF, 0x01, 0x90,
0x02, 0x0C, 0x01, 0x35, 0x0F, 0x3C, 0x01, 0x9C, 0x01, 0xF7, 0x01, 0xE0, 0x01, 0x5E, 0x3F, 0x0C,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x1A, 0xFC, 0x03, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x29, 0xFC,
0x01, 0xFE, 0xFF, 0x0C, 0xFF, 0x0C, 0x26, 0x0C, 0x5C, 0xFE, 0xFF, 0x0C, 0xFF, 0x0C, 0x26, 0x0C,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x01, 0xFC, 0x1E, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x29, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0xFF, 0x0C,
0xBA, 0x0C, 0x01, 0x35, 0x13, 0x3C, 0x01, 0xBF, 0x01, 0x90, 0x02, 0x0C, 0x01, 0x35, 0x0F, 0x3C,
0x01, 0x9C, 0x01, 0xB6, 0x01, 0x40, 0x40, 0x0C, 0x24, 0xFE, 0x03, 0xFC, 0x35, 0xFE, 0xFF, 0x0C,
0xBA, 0x0C, 0x01, 0x35, 0x13, 0x3C, 0x01, 0xBF, 0x01, 0x90, 0x02, 0x0C, 0x01, 0x35, 0x10, 0x3C,
0x01, 0x6B, 0x01, 0x43, 0x40, 0x0C, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE,
0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x1A, 0xFC, 0x03, 0xFE, 0x01, 0xFC, 0x01, 0xFE,
0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE,
0x29, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0xFF, 0x0C, 0xBA, 0x0C, 0x01, 0x35, 0x13, 0x3C,
0x01, 0xBF, 0x01, 0x90, 0x02, 0x0C, 0x01, 0x35, 0x12, 0x3C, 0x01, 0x5B, 0x3F, 0x0C, 0x5C, 0xFE,
0xFF, 0x0C, 0xBA, 0x0C, 0x01, 0x35, 0x13, 0x3C, 0x01, 0xD3, 0x01, 0x8D, 0x02, 0x0C, 0x01, 0x35,
0x05, 0x3C, 0x01, 0x95, 0x04, 0xFC, 0x01, 0xF2, 0x01, 0x9F, 0x06, 0x3C, 0x01, 0x69, 0x01, 0x6D,
0x3E, 0x0C, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE,
0x01, 0xFC, 0x1E, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE,
0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x29, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE,
0xFF, 0x0C, 0xBA, 0x0C, 0x01, 0x35, 0x12, 0x3C, 0x01, 0x6D, 0x01, 0xF2, 0x01, 0x74, 0x02, 0x0C,
0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x04, 0x0C, 0x01, 0x4C, 0x01, 0xA5, 0x01, 0x7D,
0x05, 0x3C, 0x01, 0xB9, 0x01, 0x40, 0x3D, 0x0C, 0x22, 0xFE, 0x03, 0xFC, 0x37, 0xFE, 0xFF, 0x0C,
0xBA, 0x0C, 0x01, 0x35, 0x10, 0x3C, 0x01, 0x6B, 0x01, 0x93, 0x02, 0xE6, 0x01, 0x45, 0x02, 0x0C,
0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x06, 0x0C, 0x01, 0x5B, 0x05, 0x3C, 0x01, 0x9C,
0x01, 0x89, 0x3D, 0x0C, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0xFF, 0x0C, 0x26, 0x0C, 0x24, 0xFE, 0x03, 0xFC, 0x35, 0xFE, 0xFF, 0x0C, 0xFF, 0x0C, 0x26, 0x0C,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x1A, 0xFC, 0x03, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x29, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0xFF, 0x0C, 0xBA, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95,
0x0B, 0xFC, 0x01, 0xEA, 0x01, 0xC5, 0x01, 0x5E, 0x03, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95,
0x01, 0xBF, 0x06, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x8C, 0x01, 0xB9, 0x3D, 0x0C, 0x5C, 0xFE,
0xFF, 0x0C, 0xBA, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x10, 0x0C, 0x01, 0x35,
0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x06, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x87, 0x01, 0xC9,
0x3D, 0x0C, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x1E, 0xFE,
0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE,
0x01, 0xFC, 0x29, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE,
0xFF, 0x0C, 0xBA, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x10, 0x0C, 0x01, 0x35,
0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x06, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x87, 0x01, 0xCF,
0x3D, 0x0C, 0x20, 0xFE, 0x03, 0xFC, 0x39, 0xFE, 0xFF, 0x0C, 0xBA, 0x0C, 0x01, 0x35, 0x05, 0x3C,
0x01, 0x95, 0x01, 0xBF, 0x10, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x06, 0x0C,
0x01, 0x35, 0x05, 0x3C, 0x01, 0x87, 0x01, 0xCF, 0xFF, 0x0C, 0xFF, 0x0C, 0x54, 0x0C, 0x01, 0x35,
0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x10, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF,
0x06, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x87, 0x01, 0xCF, 0xFF, 0x0C, 0xFF, 0x0C, 0x54, 0x0C,
0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x10, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95,
0x01, 0xBF, 0x06, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x87, 0x01, 0xCF, 0xFF, 0x0C, 0xFF, 0x0C,
0x54, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x10, 0x0C, 0x01, 0x35, 0x05, 0x3C,
0x01, 0x95, 0x01, 0xBF, 0x06, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x87, 0x01, 0xCF, 0xFF, 0x0C,
0xFF, 0x0C, 0x54, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x10, 0x0C, 0x01, 0x35,
0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x06, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x87, 0x01, 0xCF,
0xFF, 0x0C, 0xFF, 0x0C, 0x54, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x10, 0x0C,
0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x06, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x87,
0x01, 0xCF, 0xFF, 0x0C, 0xFF, 0x0C, 0x54, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF,
0x10, 0x0C, 0x01, 0x35, 0x13, 0x3C, 0x01, 0x87, 0x01, 0xCF, 0xFF, 0x0C, 0xFF, 0x0C, 0x54, 0x0C,
0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x10, 0x0C, 0x01, 0x35, 0x13, 0x3C, 0x01, 0x87,
0x01, 0xCF, 0xFF, 0x0C, 0xFF, 0x0C, 0x54, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF,
0x10, 0x0C, 0x01, 0x35, 0x13, 0x3C, 0x01, 0x87, 0x01, 0xCF, 0xFF, 0x0C, 0xFF, 0x0C, 0x54, 0x0C,
0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x10, 0x0C, 0x01, 0x35, 0x13, 0x3C, 0x01, 0x9C,
0x01, 0xCC, 0xFF, 0x0C, 0xFF, 0x0C, 0x54, 0x0C, 0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF,
0x10, 0x0C, 0x01, 0x35, 0x13, 0x3C, 0x01, 0xD3, 0x01, 0xB9, 0xFF, 0x0C, 0xFF, 0x0C, 0x54, 0x0C,
0x01, 0x35, 0x05, 0x3C, 0x01, 0x95, 0x01, 0xBF, 0x10, 0x0C, 0x01, 0x35, 0x10, 0x3C, 0x01, 0x48,
0x01, 0x7E, 0x01, 0xCC, 0x01, 0xFC, 0x01, 0x72, 0xFF, 0x0C, 0xFF, 0x0C, 0x55, 0x0C, 0x01, 0xA5,
0x05, 0xFC, 0x01, 0xBF, 0x11, 0x0C, 0x01, 0xA5, 0x10, 0xFC, 0x01, 0xEF, 0x01, 0xD8, 0x01, 0x7D,
0x01, 0xFE, 0xFF, 0x0C, 0xFF, 0x0C, 0x26, 0x0C, 0x5C, 0xFE, 0xFF, 0x0C, 0xFF, 0x0C, 0x26, 0x0C,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x1E, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x01, 0xFC, 0x29, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0xFF, 0x0C,
0xFF, 0x0C, 0x26, 0x0C, 0x22, 0xFE, 0x03, 0xFC, 0x37, 0xFE, 0xFF, 0x0C, 0xFF, 0x0C, 0x26, 0x0C,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x1A, 0xFC,
0x03, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x29, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0xFF, 0x0C, 0xFF, 0x0C, 0x26, 0x0C, 0x5C, 0xFE, 0xFF, 0x0C, 0xFF, 0x0C, 0x26, 0x0C,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x1E, 0xFE, 0x01, 0xFC,
0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC,
0x29, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0xFC, 0x01, 0xFE, 0xFF, 0x0C,
0xFF, 0x0C, 0x26, 0x0C, 0x20, 0xFE, 0x03, 0xFC, 0x39, 0xFE, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C,
0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C,
0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C,
0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C,
0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C,
0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C,
0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C,
0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0x5F, 0x0C, 0x00, 0x00
};
0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C,
0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C,
0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C,
0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C,
0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0xFF, 0x0C, 0x65, 0x0C, 0x00, 0x00
}

View file

@ -9,6 +9,7 @@
*/
void sys_get_information(p_sys_info info) {
unsigned long gabe_id = 0;
unsigned short gabe_id_Genx = 0; // Needs to be a 16bits for access to the CPLD registers. (0xFEC005xx Region)
unsigned short genx_model_id = 0;
unsigned short clock_speed = 0;
unsigned short cpu = 0;
@ -26,7 +27,13 @@ void sys_get_information(p_sys_info info) {
gabe_id = *GABE_SUBVER_ID;
clock_speed = (gabe_id & 0xE0) >> 5;
cpu = (gabe_id & 0xF000) >> 12;
#if ( MODEL == MODEL_FOENIX_GENX || MODEL == MODEL_FOENIX_A2560X )
gabe_id_Genx = *GABE_SUB_MODEL_ID; // diffent register inside the CPLD - not the FPGA - The FPGA will report a reserved code 0101
machine_id = (gabe_id_Genx & 0x000F);
#else
machine_id = (gabe_id & 0x0F);
#endif
info->has_floppy = 1;
info->has_expansion_card = 0;
@ -34,12 +41,13 @@ void sys_get_information(p_sys_info info) {
info->has_ethernet = 1;
info->screens = 2;
#if MODEL == MODEL_FOENIX_GENX || MODEL == MODEL_FOENIX_A2560X
genx_model_id = *GABE_SUB_MODEL_ID; // This gets the MID on the board that tells us if it is a PB/LB/CU
genx_model_id = *GABE_SUB_MODEL_FF_ID; // This gets the MID on the board that tells us if it is a PB/LB/CU
// Now, that doesn't tell us if it is stuffed with audio chip or not
// However, those will tell us about if there is a Floppy or not
// This of course is good also for the A2560X
genx_model_id = genx_model_id & GABE_SUB_MOD_MASK; // This isolate 2 bits,
genx_model_id = genx_model_id & GABE_SUB_FF_MASK; // This isolate 2 bits,
// 00 = PB
// 01 = LB
// 10 = CU
@ -184,6 +192,10 @@ void sys_get_information(p_sys_info info) {
info->cpu_name = "i486DX4";
break;
case CPU_MC68060:
info->cpu_name = "MC68xx060"
break;
default:
info->cpu_name = "UNKNOWN";
break;

View file

@ -5,7 +5,6 @@
#ifndef __SYS_GENERAL_H
#define __SYS_GENERAL_H
#include "features.h"
#include "version.h"
#include "types.h"
@ -35,7 +34,7 @@
#define CPU_486DX2_50 0x08 /* Intel 486 chips... */
#define CPU_486DX2_60 0x09
#define CPU_486DX4 0x0A
#define CPU_MC68EC060 0x0B /* New things Coming... */
#define CPU_MC68060 0x0B /* New things Coming... */
/* Clock speeds */
@ -61,7 +60,7 @@ typedef struct s_sys_info {
unsigned short cpu; /* Code to say which CPU is running */
const char * cpu_name; /* Human readable name for the CPU */
unsigned int cpu_clock_khz; /* Speed of the CPU clock in KHz */
unsigned long fpga_date; /* YYYYMMDD */
unsigned long fpga_date; /* YYYYMMDD */
unsigned long fpga_model; /* FPGA model number */
unsigned short fpga_version; /* FPGA version */
unsigned short fpga_subver; /* FPGA sub-version */

13
vbcc/config/a2560-elf Normal file
View file

@ -0,0 +1,13 @@
-cc=vbccm68k -quiet %s -o= %s %s -O=%ld -I$VBCC/targets/a2560-elf/include
-ccv=vbccm68k %s -o= %s %s -O=%ld -I$VBCC/targets/a2560-elf/include
-as=vasmm68k_mot -quiet -Fvobj -nowarn=62 %s -o %s
-asv=vasmm68k_mot -Fvobj -nowarn=62 %s -o %s
-rm=rm -f %s
-rmv=rm %s
-ld=vlink -belf32m68k -x -Cvbcc $VBCC/targets/a2560-elf/lib/startup.o $VBCC/targets/a2560-elf/lib/syscalls.o $VBCC/targets/a2560-elf/lib/io.o %s %s -L$VBCC/targets/a2560-elf/lib -T$VBCC/targets/a2560-elf/vlink.cmd -lvc -o %s -Mmapfile
-l2=vlink -belf32m68k -x -Cvbcc %s %s -L$VBCC/targets/a2560-elf/lib -T$VBCC/targets/a2560-elf/vlink.cmd -o %s -Mmapfile
-ldv=vlink -belf32m68k -t -x -Cvbcc $VBCC/targets/a2560-elf/lib/startup.o $VBCC/targets/a2560-elf/lib/syscalls.o $VBCC/targets/a2560-elf/lib/io.o %s %s -L$VBCC/targets/a2560-elf/lib -T$VBCC/targets/a2560-elf/vlink.cmd -lvc -o %s -Mmapfile
-l2v=vlink -belf32m68k -t -x -Cvbcc %s %s -L$VBCC/targets/a2560-elf/lib -T$VBCC/targets/a2560-elf/vlink.cmd -o %s -Mmapfile
-ul=-l%s
-cf=-F%s
-ml=1000

13
vbcc/config/a2560-elf-win32 Executable file
View file

@ -0,0 +1,13 @@
-cc=vbccm68k -quiet %s -o= %s %s -O=%ld -I%%VBCC%%/targets/a2560-elf/include
-ccv=vbccm68k %s -o= %s %s -O=%ld -I%%VBCC%%/targets/a2560-elf/include
-as=vasmm68k_mot -quiet -Fvobj -nowarn=62 %s -o %s
-asv=vasmm68k_mot -Fvobj -nowarn=62 %s -o %s
-rm=del %s
-rmv=del %s
-ld=vlink -belf32m68k -x -Cvbcc %%VBCC%%/targets/a2560-elf/lib/startup.o %%VBCC%%/targets/a2560-elf/lib/syscalls.o %%VBCC%%/targets/a2560-elf/lib/io.o %s %s -L%%VBCC%%/targets/a2560-elf/lib -T%%VBCC%%/targets/a2560-elf/vlink.cmd -lvc -o %s -Mmapfile
-l2=vlink -belf32m68k -x -Cvbcc %s %s -L%%VBCC%%/targets/a2560-elf/lib -T%%VBCC%%/targets/a2560-elf/vlink.cmd -o %s -Mmapfile
-ldv=vlink -belf32m68k -t -x -Cvbcc %%VBCC%%/targets/a2560-elf/lib/startup.o %%VBCC%%/targets/a2560-elf/lib/syscalls.o %%VBCC%%/targets/a2560-elf/lib/io.o %s %s -L%%VBCC%%/targets/a2560-elf/lib -T%%VBCC%%/targets/a2560-elf/vlink.cmd -lvc -o %s -Mmapfile
-l2v=vlink -belf32m68k -t -x -Cvbcc %s %s -L%%VBCC%%/targets/a2560-elf/lib -T%%VBCC%%/targets/a2560-elf/vlink.cmd -o %s -Mmapfile
-ul=-l%s
-cf=-F%s
-ml=1000

13
vbcc/config/a2560-s28 Normal file
View file

@ -0,0 +1,13 @@
-cc=vbccm68k -quiet %s -o= %s %s -O=%ld -I$VBCC/targets/a2560-elf/include
-ccv=vbccm68k %s -o= %s %s -O=%ld -I$VBCC/targets/a2560-elf/include
-as=vasmm68k_mot -quiet -Fvobj -nowarn=62 %s -o %s
-asv=vasmm68k_mot -Fvobj -nowarn=62 %s -o %s
-rm=rm -f %s
-rmv=rm %s
-ld=vlink -bsrec28 -x -Cvbcc $VBCC/targets/a2560-elf/lib/startup.o $VBCC/targets/a2560-elf/lib/syscalls.o $VBCC/targets/a2560-elf/lib/io.o %s %s -L$VBCC/targets/a2560-elf/lib -T$VBCC/targets/a2560-elf/vlink.cmd -lvc -o %s -Mmapfile
-l2=vlink -bsrec28 -x -Cvbcc %s %s -L$VBCC/targets/a2560-elf/lib -T$VBCC/targets/a2560-elf/vlink.cmd -o %s -Mmapfile
-ldv=vlink -bsrec28 -t -x -Cvbcc $VBCC/targets/a2560-elf/lib/startup.o $VBCC/targets/a2560-elf/lib/syscalls.o $VBCC/targets/a2560-elf/lib/io.o %s %s -L$VBCC/targets/a2560-elf/lib -T$VBCC/targets/a2560-elf/vlink.cmd -lvc -o %s -Mmapfile
-l2v=vlink -bsrec28 -t -x -Cvbcc %s %s -L$VBCC/targets/a2560-elf/lib -T$VBCC/targets/a2560-elf/vlink.cmd -o %s -Mmapfile
-ul=-l%s
-cf=-F%s
-ml=1000

13
vbcc/config/a2560-s28-win32 Executable file
View file

@ -0,0 +1,13 @@
-cc=vbccm68k -quiet %s -o= %s %s -O=%ld -I%%VBCC%%/targets/a2560-elf/include
-ccv=vbccm68k %s -o= %s %s -O=%ld -I%%VBCC%%/targets/a2560-elf/include
-as=vasmm68k_mot -quiet -Fvobj -nowarn=62 %s -o %s
-asv=vasmm68k_mot -Fvobj -nowarn=62 %s -o %s
-rm=del %s
-rmv=del %s
-ld=vlink -bsrec28 -x -Cvbcc %%VBCC%%/targets/a2560-elf/lib/startup.o %%VBCC%%/targets/a2560-elf/lib/syscalls.o %%VBCC%%/targets/a2560-elf/lib/io.o %s %s -L%%VBCC%%/targets/a2560-elf/lib -T%%VBCC%%/targets/a2560-elf/vlink.cmd -lvc -o %s -Mmapfile
-l2=vlink -bsrec28 -x -Cvbcc %s %s -L%%VBCC%%/targets/a2560-elf/lib -T%%VBCC%%/targets/a2560-elf/vlink.cmd -o %s -Mmapfile
-ldv=vlink -bsrec28 -t -x -Cvbcc %%VBCC%%/targets/a2560-elf/lib/startup.o %%VBCC%%/targets/a2560-elf/lib/syscalls.o %%VBCC%%/targets/a2560-elf/lib/io.o %s %s -L%%VBCC%%/targets/a2560-elf/lib -T%%VBCC%%/targets/a2560-elf/vlink.cmd -lvc -o %s -Mmapfile
-l2v=vlink -bsrec28 -t -x -Cvbcc %s %s -L%%VBCC%%/targets/a2560-elf/lib -T%%VBCC%%/targets/a2560-elf/vlink.cmd -o %s -Mmapfile
-ul=-l%s
-cf=-F%s
-ml=1000

13
vbcc/config/raw-linux Normal file
View file

@ -0,0 +1,13 @@
-cc=vbccm68k -quiet %s -o= %s %s -O=%ld -I$VBCC/targets/m68k-foenix/include
-ccv=vbccm68k %s -o= %s %s -O=%ld -I$VBCC/targets/m68k-foenix/include
-as=vasmm68k_mot -quiet -Fvobj -nowarn=62 %s -o %s
-asv=vasmm68k_mot -Fvobj -nowarn=62 %s -o %s
-rm=rm %s
-rmv=rm %s
-ld=vlink -bsrec28 -x -Cvbcc %s %s -L$VBCC/targets/m68k-foenix/lib -T$VBCC/targets/m68k-foenix/vlink.cmd -lvc -o %s -Mmapfile
-l2=vlink -bsrec28 -x -Cvbcc %s %s -L$VBCC/targets/m68k-foenix/lib -T$VBCC/targets/m68k-foenix/vlink.cmd -o %s -Mmapfile
-ldv=vlink -bsrec28 -t -x -Cvbcc %s %s -L$VBCC/targets/m68k-foenix/lib -T$VBCC/targets/m68k-foenix/vlink.cmd -lvc -o %s -Mmapfile
-l2v=vlink -bsrec28 -t -x -Cvbcc %s %s -L$VBCC/targets/m68k-foenix/lib -T$VBCC/targets/m68k-foenix/vlink.cmd -o %s -Mmapfile
-ul=-l%s
-cf=-F%s
-ml=1000

13
vbcc/config/vc.config Normal file
View file

@ -0,0 +1,13 @@
-cc=vbccm68k -quiet %s -o= %s %s -O=%ld -I$VBCC/targets/m68k-foenix/include
-ccv=vbccm68k %s -o= %s %s -O=%ld -I$VBCC/targets/m68k-foenix/include
-as=vasmm68k_mot -quiet -Fvobj -nowarn=62 %s -o %s
-asv=vasmm68k_mot -Fvobj -nowarn=62 %s -o %s
-rm=rm %s
-rmv=rm %s
-ld=vlink -bsrec28 -x -Cvbcc %s %s -L$VBCC/targets/m68k-foenix/lib -T$VBCC/targets/m68k-foenix/vlink.cmd -lvc -o %s -Mmapfile
-l2=vlink -bsrec28 -x -Cvbcc %s %s -L$VBCC/targets/m68k-foenix/lib -T$VBCC/targets/m68k-foenix/vlink.cmd -o %s -Mmapfile
-ldv=vlink -bsrec28 -t -x -Cvbcc %s %s -L$VBCC/targets/m68k-foenix/lib -T$VBCC/targets/m68k-foenix/vlink.cmd -lvc -o %s -Mmapfile
-l2v=vlink -bsrec28 -t -x -Cvbcc %s %s -L$VBCC/targets/m68k-foenix/lib -T$VBCC/targets/m68k-foenix/vlink.cmd -o %s -Mmapfile
-ul=-l%s
-cf=-F%s
-ml=1000

View file

@ -0,0 +1,14 @@
#ifndef __ASSERT_H
#define __ASSERT_H 1
extern int __aprintf(const char *,...);
extern void abort(void);
#endif
#undef assert
#ifndef NDEBUG
#define assert(exp) ((void)((exp)?0:(__aprintf("Assertion failed: file %s, line %d\n",__FILE__,__LINE__),abort(),0)))
#else
#define assert(exp)
#endif

View file

@ -0,0 +1,56 @@
#ifndef __CTYPE_H
#define __CTYPE_H 1
extern const unsigned char __ctype[];
int isalnum(int);
int isalpha(int);
int isblank(int);
int iscntrl(int);
int isdigit(int);
int isgraph(int);
int islower(int);
int isprint(int);
int ispunct(int);
int isspace(int);
int isupper(int);
int isxdigit(int);
#define isalpha(x) (__ctype[(x)+1] & 3)
#define isblank(x) ((x)==9 || (x)==32)
#define isupper(x) (__ctype[(x)+1] & 1)
#define islower(x) (__ctype[(x)+1] & 2)
#define isdigit(x) (__ctype[(x)+1] & 4)
#define isxdigit(x) (__ctype[(x)+1] & 68)
#define isalnum(x) (__ctype[(x)+1] & 7)
#define isspace(x) (__ctype[(x)+1] & 8)
#define ispunct(x) (__ctype[(x)+1] & 16)
#define iscntrl(x) (__ctype[(x)+1] & 32)
#define isprint(x) (__ctype[(x)+1] & 151)
#define isgraph(x) (__ctype[(x)+1] & 23)
int toupper(int);
int tolower(int);
#ifndef __NOINLINE__
int toupper(__reg("d0") int) =
"\tinline\n"
"\txref\t___ctype\n"
"\tlea\t___ctype,a0\n"
"\tbtst\t#1,(1,a0,d0.w)\n"
"\tbeq\t.skip\n"
"\tand.b\t#$df,d0\n"
".skip\n"
"\teinline";
int tolower(__reg("d0") int) =
"\tinline\n"
"\txref\t___ctype\n"
"\tlea\t___ctype,a0\n"
"\tbtst\t#0,(1,a0,d0.w)\n"
"\tbeq\t.skip\n"
"\tor.b\t#$20,d0\n"
".skip\n"
"\teinline";
#endif /* __NOINLINE__ */
#endif /* __CTYPE_H */

View file

@ -0,0 +1,118 @@
#ifndef __ERRNO_H
#define __ERRNO_H 1
extern int errno;
#define E_OK 0 /* no error */
#define EPERM 1 /* Operation not permitted */
#define ENOENT 2 /* No such file or directory */
#define ESRCH 3 /* No such process */
#define EINTR 4 /* Interrrupted system call */
#define EIO 5 /* I/O error */
#define ENXIO 6 /* No such device or address */
#define E2BIG 7 /* Arg list is too long */
#define ENOEXEC 8 /* Exec format error */
#define EBADF 9 /* Bad file number */
#define ECHILD 10 /* No child process */
#define EDEADLK 11 /* Resource deadlock avoided */
/* 11 was EAGAIN */
#define ENOMEM 12 /* No memory available */
#define EACCES 13 /* Access denied */
#define EFAULT 14 /* Badd address */
#define ENOTBLK 15 /* Bulk device required */
#define EBUSY 16 /* Resource is busy */
#define EEXIST 17 /* File already exists */
#define EXDEV 18 /* Cross-device link */
#define ENODEV 19 /* No such device */
#define ENOTDIR 20 /* Is not a directory */
#define EISDIR 21 /* Is a directory */
#define EINVAL 22 /* Invalid argument */
#define ENFILE 23 /* No more files (system */
#define EMFILE 24 /* No more files (process */
#define ENOTTY 25 /* Not a terminal */
#define ETXTBSY 26 /* Text file is busy */
#define EFBIG 27 /* File is too large */
#define ENOSPC 28 /* No space left */
#define ESPIPE 29 /* Seek issued to pipe */
#define EROFS 30 /* Read-only file system */
#define EMLINK 31 /* Too many links */
#define EPIPE 32 /* Broken pipe */
#define EDOM 33 /* Math function argument error */
#define ERANGE 34 /* Math function result is out of
range */
/* from gcc ... */
/* non-blocking and interrupt i/o */
#define EAGAIN 35 /* Resource temporarily unavailable */
#ifndef _POSIX_SOURCE
#define EWOULDBLOCK EAGAIN /* Operation would block */
#define EINPROGRESS 36 /* Operation now in progress */
#define EALREADY 37 /* Operation already in progress */
/* ipc/network software -- argument errors */
#define ENOTSOCK 38 /* Socket operation on non-socket */
#define EDESTADDRREQ 39 /* Destination address required */
#define EMSGSIZE 40 /* Message too long */
#define EPROTOTYPE 41 /* Protocol wrong type for socket */
#define ENOPROTOOPT 42 /* Protocol not available */
#define EPROTONOSUPPORT 43 /* Protocol not supported */
#define ESOCKTNOSUPPORT 44 /* Socket type not supported */
#define EOPNOTSUPP 45 /* Operation not supported on socket */
#define EPFNOSUPPORT 46 /* Protocol family not supported */
#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */
#define EADDRINUSE 48 /* Address already in use */
#define EADDRNOTAVAIL 49 /* Can't assign requested address */
/* ipc/network software -- operational errors */
#define ENETDOWN 50 /* Network is down */
#define ENETUNREACH 51 /* Network is unreachable */
#define ENETRESET 52 /* Network dropped connection on reset */
#define ECONNABORTED 53 /* Software caused connection abort */
#define ECONNRESET 54 /* Connection reset by peer */
#define ENOBUFS 55 /* No buffer space available */
#define EISCONN 56 /* Socket is already connected */
#define ENOTCONN 57 /* Socket is not connected */
#define ESHUTDOWN 58 /* Can't send after socket shutdown */
#define ETOOMANYREFS 59 /* Too many references: can't splice */
#define ETIMEDOUT 60 /* Connection timed out */
#define ECONNREFUSED 61 /* Connection refused */
#define ELOOP 62 /* Too many levels of symbolic links */
#endif /* _POSIX_SOURCE */
#define ENAMETOOLONG 63 /* File name too long */
/* should be rearranged */
#ifndef _POSIX_SOURCE
#define EHOSTDOWN 64 /* Host is down */
#define EHOSTUNREACH 65 /* No route to host */
#endif /* _POSIX_SOURCE */
#define ENOTEMPTY 66 /* Directory not empty */
/* quotas & mush */
#ifndef _POSIX_SOURCE
#define EPROCLIM 67 /* Too many processes */
#define EUSERS 68 /* Too many users */
#define EDQUOT 69 /* Disc quota exceeded */
/* Network File System */
#define ESTALE 70 /* Stale NFS file handle */
#define EREMOTE 71 /* Too many levels of remote in path */
#define EBADRPC 72 /* RPC struct is bad */
#define ERPCMISMATCH 73 /* RPC version wrong */
#define EPROGUNAVAIL 74 /* RPC prog. not avail */
#define EPROGMISMATCH 75 /* Program version wrong */
#define EPROCUNAVAIL 76 /* Bad procedure for program */
#endif /* _POSIX_SOURCE */
#define ENOLCK 77 /* No locks available */
#define ENOSYS 78 /* Function not implemented */
#define EFTYPE 79 /* Inappropriate file type or format */
#ifdef KERNEL
/* pseudo-errors returned inside kernel to modify return to process */
#define ERESTART -1 /* restart syscall */
#define EJUSTRETURN -2 /* don't modify regs, just return */
#endif
#endif

View file

@ -0,0 +1,147 @@
#ifndef __FENV_H
#define __FENV_H 1
typedef unsigned long fenv_t;
typedef unsigned long fexcept_t;
/* rounding mode used by fegetround() and fesetround() */
#define FE_TONEAREST 0x00 /* round toward nearest (round) */
#define FE_TOWARDZERO 0x10 /* round toward zero (trunc) */
#define FE_DOWNWARD 0x20 /* round toward -inf (floor) */
#define FE_UPWARD 0x30 /* round toward +inf (ceil) */
/* rounding precision used by fegetprec() and fesetprec() */
#define FE_LDBLPREC 0x00 /* long double precision */
#define FE_FLTPREC 0x40 /* float precision */
#define FE_DBLPREC 0x80 /* double precision */
extern const char __Zero_l[];
#define FE_DFL_ENV (*(const fenv_t *)(const void *)__Zero_l)
/* begin function declarations */
int feclearexcept(int);
int fegetenv(fenv_t *);
int fegetexceptflag(fexcept_t *, int);
int fegetprec(void);
int fegetround(void);
int feholdexcept(fenv_t *);
int feraiseexcept(int);
int fesetenv(const fenv_t *);
int fesetexceptflag(const fexcept_t *, int);
int fesetprec(int);
int fesetround(int);
int fetestexcept(int);
int feupdateenv(const fenv_t *);
/* end function declarations */
#ifndef __NOINLINE__
/* faster inline functions */
#if defined(__M68881) || defined(__M68882)
/* direct FPU support */
int fegetenv(__reg("a0")fenv_t *) =
"\tinline\n"
"\tfmove.l\tfpcr,(a0)\n"
"\tmoveq\t#0,d0\n"
"\teinline";
int fegetround(void) =
"\tinline\n"
"\tfmove.l\tfpcr,d1\n"
"\tmoveq\t#$30,d0\n"
"\tand.l\td1,d0\n"
"\teinline";
int fegetprec(void) =
"\tinline\n"
"\tfmove.l\tfpcr,d0\n"
"\tand.l\t#$c0,d0\n"
"\teinline";
int feholdexcept(__reg("a0")fenv_t *) =
"\tinline\n"
"\tfmove.l\tfpcr,(a0)\n"
"\tmoveq\t#0,d0\n"
"\teinline";
int fesetenv(__reg("a0")const fenv_t *) =
"\tinline\n"
"\tfmove.l\t(a0),fpcr\n"
"\tmoveq\t#0,d0\n"
"\teinline";
int fesetround(__reg("d0")int) =
"\tinline\n"
"\tfmove.l\tfpcr,d1\n"
"\tand.w\t#$ffcf,d1\n"
"\tor.l\td0,d1\n"
"\tfmove.l\td1,fpcr\n"
"\tmoveq\t#0,d0\n"
"\teinline";
int fesetprec(__reg("d0")int) =
"\tinline\n"
"\tfmove.l\tfpcr,d1\n"
"\tand.w\t#$ff3f,d1\n"
"\tor.l\td0,d1\n"
"\tfmove.l\td1,fpcr\n"
"\tmoveq\t#0,d0\n"
"\teinline";
#else
/* IEEE or software floating-point */
int fegetenv(__reg("a0")fenv_t *) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
int fegetround(void) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
int fegetprec(void) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
int feholdexcept(__reg("a0")fenv_t *) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
int fesetenv(__reg("a0")const fenv_t *) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
int fesetround(__reg("d0")int) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
int fesetprec(__reg("d0")int) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
#endif
int feclearexcept(__reg("d0")int) =
"\tinline\n"
"\tmoveq\t#0,d0\n"
"\teinline";
int fegetexceptflag(__reg("a0")fexcept_t *, __reg("d0")int) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
int feraiseexcept(__reg("d0")int) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
int fesetexceptflag(__reg("a0")const fexcept_t *, __reg("d0")int) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
int fetestexcept(__reg("d0")int) =
"\tinline\n"
"\tmoveq\t#0,d0\n"
"\teinline";
int feupdateenv(__reg("a0")const fenv_t *) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
#endif /* __NOINLINE__ */
#endif /* __FENV_H */

View file

@ -0,0 +1,38 @@
#ifndef __FLOAT_H
#define __FLOAT_H 1
#define FLT_RADIX 2
#define FLT_ROUNDS 1
#define FLT_MANT_DIG 24
#define FLT_EPSILON 1.19209290E-07F
#define FLT_DIG 6
#define FLT_MIN_EXP (-125)
#define FLT_MIN 1.17549435E-38F
#define FLT_MIN_10_EXP (-37)
#define FLT_MAX_EXP 128
#define FLT_MAX 3.40282347E+38F
#define FLT_MAX_10_EXP 38
#define DBL_MANT_DIG 53
#define DBL_EPSILON 2.2204460492503131E-16
#define DBL_DIG 15
#define DBL_MIN_EXP (-1021)
#define DBL_MIN 2.2250738585072014E-308
#define DBL_MIN_10_EXP (-307)
#define DBL_MAX_EXP 1024
#define DBL_MAX 1.7976931348623157E+308
#define DBL_MAX_10_EXP 308
#define LDBL_MANT_DIG DBL_MANT_DIG
#define LDBL_EPSILON DBL_EPSILON
#define LDBL_DIG DBL_DIG
#define LDBL_MIN_EXP DBL_MIN_EXP
#define LDBL_MIN DBL_MIN
#define LDBL_MIN_10_EXP DBL_MIN_10_EXP
#define LDBL_MAX_EXP DBL_MAX_EXP
#define LDBL_MAX DBL_MAX
#define LDBL_MAX_10_EXP DBL_MAX_10_EXP
#endif

View file

@ -0,0 +1,211 @@
#ifndef __INTTYPES_H
#define __INTTYPES_H 1
#include <stdint.h>
typedef struct
{
intmax_t quot; /* Quotient */
intmax_t rem; /* Remainder */
} imaxdiv_t;
intmax_t imaxabs(intmax_t);
imaxdiv_t imaxdiv(intmax_t, intmax_t);
intmax_t strtoimax(const char *restrict, char **restrict, int);
uintmax_t strtoumax(const char *restrict, char **restrict, int);
/* fprintf() macros for new C99 data types */
#define __PRI8_PREFIX ""
#define __PRI16_PREFIX ""
#define __PRI32_PREFIX ""
#define __PRI64_PREFIX "ll"
#define PRId8 __PRI8_PREFIX "d"
#define PRIi8 __PRI8_PREFIX "i"
#define PRIo8 __PRI8_PREFIX "o"
#define PRIu8 __PRI8_PREFIX "u"
#define PRIx8 __PRI8_PREFIX "x"
#define PRIX8 __PRI8_PREFIX "X"
#define PRId16 __PRI16_PREFIX "d"
#define PRIi16 __PRI16_PREFIX "i"
#define PRIo16 __PRI16_PREFIX "o"
#define PRIu16 __PRI16_PREFIX "u"
#define PRIx16 __PRI16_PREFIX "x"
#define PRIX16 __PRI16_PREFIX "X"
#define PRId32 __PRI32_PREFIX "d"
#define PRIi32 __PRI32_PREFIX "i"
#define PRIo32 __PRI32_PREFIX "o"
#define PRIu32 __PRI32_PREFIX "u"
#define PRIx32 __PRI32_PREFIX "x"
#define PRIX32 __PRI32_PREFIX "X"
#define PRId64 __PRI64_PREFIX "d"
#define PRIi64 __PRI64_PREFIX "i"
#define PRIo64 __PRI64_PREFIX "o"
#define PRIu64 __PRI64_PREFIX "u"
#define PRIx64 __PRI64_PREFIX "x"
#define PRIX64 __PRI64_PREFIX "X"
#define PRIdLEAST8 PRId8
#define PRIiLEAST8 PRIi8
#define PRIoLEAST8 PRIo8
#define PRIuLEAST8 PRIu8
#define PRIxLEAST8 PRIx8
#define PRIXLEAST8 PRIX8
#define PRIdLEAST16 PRId16
#define PRIiLEAST16 PRIi16
#define PRIoLEAST16 PRIo16
#define PRIuLEAST16 PRIu16
#define PRIxLEAST16 PRIx16
#define PRIXLEAST16 PRIX16
#define PRIdLEAST32 PRId32
#define PRIiLEAST32 PRIi32
#define PRIoLEAST32 PRIo32
#define PRIuLEAST32 PRIu32
#define PRIxLEAST32 PRIx32
#define PRIXLEAST32 PRIX32
#define PRIdLEAST64 PRId64
#define PRIiLEAST64 PRIi64
#define PRIoLEAST64 PRIo64
#define PRIuLEAST64 PRIu64
#define PRIxLEAST64 PRIx64
#define PRIXLEAST64 PRIX64
#define PRIdFAST8 PRId32
#define PRIiFAST8 PRIi32
#define PRIoFAST8 PRIo32
#define PRIuFAST8 PRIu32
#define PRIxFAST8 PRIx32
#define PRIXFAST8 PRIX32
#define PRIdFAST16 PRId32
#define PRIiFAST16 PRIi32
#define PRIoFAST16 PRIo32
#define PRIuFAST16 PRIu32
#define PRIxFAST16 PRIx32
#define PRIXFAST16 PRIX32
#define PRIdFAST32 PRId32
#define PRIiFAST32 PRIi32
#define PRIoFAST32 PRIo32
#define PRIuFAST32 PRIu32
#define PRIxFAST32 PRIx32
#define PRIXFAST32 PRIX32
#define PRIdFAST64 PRId64
#define PRIiFAST64 PRIi64
#define PRIoFAST64 PRIo64
#define PRIuFAST64 PRIu64
#define PRIxFAST64 PRIx64
#define PRIXFAST64 PRIX64
#define PRIdPTR PRId32
#define PRIiPTR PRIi32
#define PRIoPTR PRIo32
#define PRIuPTR PRIu32
#define PRIxPTR PRIx32
#define PRIXPTR PRIX32
#define PRIdMAX PRId64
#define PRIiMAX PRIi64
#define PRIoMAX PRIo64
#define PRIuMAX PRIu64
#define PRIxMAX PRIx64
#define PRIXMAX PRIX64
/* fscanf() macros for new C99 data types */
#define __SCN8_PREFIX "hh"
#define __SCN16_PREFIX "h"
#define __SCN32_PREFIX ""
#define __SCN64_PREFIX "ll"
#define SCNd8 __SCN8_PREFIX "d"
#define SCNi8 __SCN8_PREFIX "i"
#define SCNo8 __SCN8_PREFIX "o"
#define SCNu8 __SCN8_PREFIX "u"
#define SCNx8 __SCN8_PREFIX "x"
#define SCNd16 __SCN16_PREFIX "d"
#define SCNi16 __SCN16_PREFIX "i"
#define SCNo16 __SCN16_PREFIX "o"
#define SCNu16 __SCN16_PREFIX "u"
#define SCNx16 __SCN16_PREFIX "x"
#define SCNd32 __SCN32_PREFIX "d"
#define SCNi32 __SCN32_PREFIX "i"
#define SCNo32 __SCN32_PREFIX "o"
#define SCNu32 __SCN32_PREFIX "u"
#define SCNx32 __SCN32_PREFIX "x"
#define SCNd64 __SCN64_PREFIX "d"
#define SCNi64 __SCN64_PREFIX "i"
#define SCNo64 __SCN64_PREFIX "o"
#define SCNu64 __SCN64_PREFIX "u"
#define SCNx64 __SCN64_PREFIX "x"
#define SCNdLEAST8 SCNd8
#define SCNiLEAST8 SCNi8
#define SCNoLEAST8 SCNo8
#define SCNuLEAST8 SCNu8
#define SCNxLEAST8 SCNx8
#define SCNdLEAST16 SCNd16
#define SCNiLEAST16 SCNi16
#define SCNoLEAST16 SCNo16
#define SCNuLEAST16 SCNu16
#define SCNxLEAST16 SCNx16
#define SCNdLEAST32 SCNd32
#define SCNiLEAST32 SCNi32
#define SCNoLEAST32 SCNo32
#define SCNuLEAST32 SCNu32
#define SCNxLEAST32 SCNx32
#define SCNdLEAST64 SCNd64
#define SCNiLEAST64 SCNi64
#define SCNoLEAST64 SCNo64
#define SCNuLEAST64 SCNu64
#define SCNxLEAST64 SCNx64
#define SCNdFAST8 SCNd32
#define SCNiFAST8 SCNi32
#define SCNoFAST8 SCNo32
#define SCNuFAST8 SCNu32
#define SCNxFAST8 SCNx32
#define SCNdFAST16 SCNd32
#define SCNiFAST16 SCNi32
#define SCNoFAST16 SCNo32
#define SCNuFAST16 SCNu32
#define SCNxFAST16 SCNx32
#define SCNdFAST32 SCNd32
#define SCNiFAST32 SCNi32
#define SCNoFAST32 SCNo32
#define SCNuFAST32 SCNu32
#define SCNxFAST32 SCNx32
#define SCNdFAST64 SCNd64
#define SCNiFAST64 SCNi64
#define SCNoFAST64 SCNo64
#define SCNuFAST64 SCNu64
#define SCNxFAST64 SCNx64
#define SCNdPTR SCNd32
#define SCNiPTR SCNi32
#define SCNoPTR SCNo32
#define SCNuPTR SCNu32
#define SCNxPTR SCNx32
#define SCNdMAX SCNd64
#define SCNiMAX SCNi64
#define SCNoMAX SCNo64
#define SCNuMAX SCNu64
#define SCNxMAX SCNx64
#endif /* __INTTYPES_H */

View file

@ -0,0 +1,37 @@
#ifndef __LIMITS_H
#define __LIMITS_H 1
#define MB_LEN_MAX 1
#define CHAR_BIT 8
#if __INTSIZE == 16
#define INT_MAX 32767
#define INT_MIN (-32768)
#else
#define INT_MAX 2147483647
#define INT_MIN (-2147483647-1)
#endif
#define LONG_MAX 2147483647L
#define LONG_MIN (-2147483647L-1)
#define SCHAR_MAX +127
#define SCHAR_MIN (-128)
#define CHAR_MAX SCHAR_MAX
#define CHAR_MIN SCHAR_MIN
#define SHRT_MAX 32767
#define SHRT_MIN (-32768)
#define UCHAR_MAX 255U
#if __INTSIZE == 16
#define UINT_MAX 65535U
#else
#define UINT_MAX 4294967295U
#endif
#define ULONG_MAX 4294967295UL
#define USHRT_MAX 65535U
#if __STDC_VERSION__ >= 199901L
#define LLONG_MIN (-9223372036854775807LL-1)
#define LLONG_MAX 9223372036854775807LL
#define ULLONG_MAX 18446744073709551615ULL
#endif
#endif

View file

@ -0,0 +1,40 @@
#ifndef __LOCALE_H
#define __LOCALE_H 1
#undef NULL
#define NULL ((void *)0)
struct lconv {
char *decimal_point;
char *thousands_sep;
char *grouping;
char *int_curr_symbol;
char *currency_symbol;
char *mon_decimal_point;
char *mon_thousands_sep;
char *mon_grouping;
char *positive_sign;
char *negative_sign;
char int_frac_digits;
char frac_digits;
char p_cs_precedes;
char p_sep_by_space;
char n_cs_precedes;
char n_sep_by_space;
char p_sign_posn;
char n_sign_posn;
};
#define LC_ALL 0
#define LC_COLLATE 1
#define LC_CTYPE 2
#define LC_MONETARY 3
#define LC_NUMERIC 4
#define LC_TIME 5
#define _LC_LAST 6
struct lconv *localeconv(void);
char *setlocale(int,const char *);
#endif

View file

@ -0,0 +1,330 @@
#ifndef __MATH_H
#define __MATH_H 1
#include <float.h>
#include <limits.h>
typedef float float_t;
typedef double double_t;
#define FLT_EVAL_METHOD 2
/* constants */
#define M_E 2.7182818284590452354 /* e */
#define M_LOG2E 1.4426950408889634074 /* log 2e */
#define M_LOG10E 0.43429448190325182765 /* log 10e */
#define M_LN2 0.69314718055994530942 /* log e2 */
#define M_LN10 2.30258509299404568402 /* log e10 */
#define M_PI 3.14159265358979323846 /* pi */
#define M_PI_2 1.57079632679489661923 /* pi/2 */
#define M_PI_4 0.78539816339744830962 /* pi/4 */
#define M_1_PI 0.31830988618379067154 /* 1/pi */
#define M_2_PI 0.63661977236758134308 /* 2/pi */
#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
#define MAXFLOAT FLT_MAX
extern const char __pInf_d[];
extern const char __pInf_s[];
extern const char __qNaN_s[];
#define INFINITY (*(const float *)(const void *)__pInf_s)
#define NAN (*(const float *)(const void *)__qNaN_s)
#define HUGE_VAL (*(const double *)(const void *)__pInf_d)
#define HUGE_VALF INFINITY
#define HUGE_VALL (long double)HUGE_VAL
/* return values for fpclassify() */
#define FP_NORMAL 0
#define FP_NAN 1
#define FP_INFINITE 2
#define FP_ZERO 4
#define FP_SUBNORMAL 8
/* errors for ilogb(), ilogbf() and ilogbl() */
#define FP_ILOGB0 LONG_MIN
#define FP_ILOGBNAN LONG_MIN
/* general error handling method */
#define MATH_ERRNO 1
#define MATH_ERREXCEPT 2
#define math_errhandling 0 /* C99 requires but currently unsupported */
/* begin function declarations */
double acos(double);
double acosh(double);
double asin(double);
double asinh(double);
double atan(double);
double atanh(double);
double atan2(double, double);
double ceil(double);
double copysign(double, double);
double cos(double);
double cosh(double);
double exp(double);
double exp2(double);
double exp10(double);
double expm1(double);
double fabs(double);
double fdim(double, double);
double floor(double);
double fma(double, double, double);
double fmax(double, double);
double fmin(double, double);
double fmod(double, double);
double frexp(double, int *);
double hypot(double, double);
double ldexp(double, int);
double log(double);
double log10(double);
double log1p(double);
double log2(double);
double logb(double);
double modf(double, double *);
double nan(const char *);
double nearbyint(double);
double pow(double, double);
double remainder(double, double);
double rint(double);
double round(double);
double scalbln(double, long);
double scalbn(double, int);
double sin(double);
double sinh(double);
double sqrt(double);
double tan(double);
double tanh(double);
double trunc(double);
float acosf(float);
float acoshf(float);
float asinf(float);
float asinhf(float);
float atanf(float);
float atanhf(float);
float atan2f(float, float);
float ceilf(float);
float copysignf(float, float);
float cosf(float);
float coshf(float);
float expf(float);
float exp2f(float);
float exp10f(float);
float expm1f(float);
float fabsf(float);
float fdimf(float, float);
float floorf(float);
float fmaf(float, float, float);
float fmaxf(float, float);
float fminf(float, float);
float fmodf(float, float);
float frexpf(float value, int *);
float hypotf(float, float);
float ldexpf(float, int);
float logf(float);
float log10f(float);
float log1pf(float);
float log2f(float);
float logbf(float);
float modff(float, float *);
float nanf(const char *);
float nearbyintf(float);
float powf(float, float);
float remainderf(float, float);
float rintf(float);
float roundf(float);
float scalblnf(float, long);
float scalbnf(float, int);
float sinf(float);
float sinhf(float);
float sqrtf(float);
float tanf(float);
float tanhf(float);
float truncf(float);
long double acosl(long double);
long double acoshl(long double);
long double asinl(long double);
long double asinhl(long double);
long double atanl(long double);
long double atanhl(long double);
long double atan2l(long double, long double);
long double ceill(long double);
long double copysignl(long double, long double);
long double cosl(long double);
long double coshl(long double);
long double expl(long double);
long double exp2l(long double);
long double exp10l(long double);
long double expm1l(long double);
long double fabsl(long double);
long double fdiml(long double, long double);
long double floorl(long double);
long double fmal(long double, long double, long double);
long double fmaxl(long double, long double);
long double fminl(long double, long double);
long double fmodl(long double, long double);
long double frexpl(long double value, int *);
long double hypotl(long double, long double);
long double ldexpl(long double, int);
long double logl(long double);
long double log10l(long double);
long double log1pl(long double);
long double log2l(long double);
long double logbl(long double);
long double modfl(long double, long double *);
long double nanl(const char *);
long double nearbyintl(long double);
long double powl(long double, long double);
long double remainderl(long double, long double);
long double rintl(long double);
long double roundl(long double);
long double scalblnl(long double, long);
long double scalbnl(long double, int);
long double sinl(long double);
long double sinhl(long double);
long double sqrtl(long double);
long double tanl(long double);
long double tanhl(long double);
long double truncl(long double);
int ilogb(double);
int ilogbf(float);
int ilogbl(long double);
long lrint(double);
long lrintf(float);
long lrintl(long double);
long lround(double);
long lroundf(float);
long lroundl(long double);
#if __STDC_VERSION__ >= 199901L
/* long long not available before c99 */
long long llround(double);
long long llroundf(float);
long long llroundl(long double);
#endif
/* end function declarations */
#if defined(__M68881) || defined(__M68882)
/* direct FPU support */
#if defined(__M68060)
#include <math_060.h>
#elif defined(__M68040)
#include <math_040.h>
#else
#include <math_881.h>
#endif
#else
/* IEEE or software floating-point */
/* begin macros */
int fpclassify(double);
int isfinite(double);
int isinf(double);
int isnan(double);
int isnormal(double);
int signbit(double);
int isgreater(double, double);
int isgreaterequal(double, double);
int isless(double, double);
int islessequal(double, double);
int islessgreater(double, double);
int isunordered(double, double);
/* end macros */
#endif
/* non-C99 macros (used on some operating systems) */
#define fpclassifyf fpclassify
#define fpclassifyl fpclassify
#define isfinitef isfinite
#define isfinitel isfinite
#define isinff isinf
#define isinfl isinf
#define isnanf isnan
#define isnanl isnan
#define isnormalf isnormal
#define isnormall isnormal
#define signbitf signbit
#define signbitl signbit
#define isgreaterf isgreater
#define isgreaterl isgreater
#define isgreaterequalf isgreaterequal
#define isgreaterequall isgreaterequal
#define islessf isless
#define islessl isless
#define islessequalf islessequal
#define islessequall islessequal
#define islessgreaterf islessgreater
#define islessgreaterl islessgreater
#define isunorderedf isunordered
#define isunorderedl isunordered
/* remainder is the new name for drem */
#define dremf(x) remainderf(x)
#define drem(x) remainder(x)
#define dreml(x) remainderl(x)
/* rint & lrint causes exceptions but otherwise similar to nearbyint */
#define rintf(x) nearbyintf(x)
#define rint(x) nearbyint(x)
#define rintl(x) nearbyintl(x)
#define lrintf(x) nearbyintf(x)
#define lrint(x) nearbyint(x)
#define lrintl(x) nearbyintl(x)
/* if (FLT_RADIX==2) */
#define scalbnf(x,y) ldexpf(x,y)
#define scalbn(x,y) ldexp(x,y)
#define scalbnl(x,y) ldexpl(x,y)
/* if (FLT_RADIX==2 && SIZEOF(int)==4) */
#define scalblnf(x,y) ldexpf(x,y)
#define scalbln(x,y) ldexp(x,y)
#define scalblnl(x,y) ldexpl(x,y)
/* if (SIZEOF(double long)==8)) */
#define acosl acos
#define acoshl acosh
#define asinl asin
#define asinhl asinh
#define atanl atan
#define atanhl atanh
#define atan2l atan2
#define ceill ceil
#define copysignl copysign
#define cosl cos
#define coshl cosh
#define expl exp
#define exp2l exp2
#define exp10l exp10
#define expm1l expm1
#define fabsl fabs
#define fdiml fdim
#define floorl floor
#define fmal fma
#define fmaxl fmax
#define fminl fmin
#define fmodl fmod
#define frexpl frexp
#define hypotl hypot
#define ldexpl ldexp
#define logl log
#define log10l log10
#define log1pl log1p
#define log2l log2
#define logbl logb
#define modfl modf
#define nanl nan
#define nearbyintl nearbyint
#define powl pow
#define remainderl remainder
#define roundl round
#define sinl sin
#define sinhl sinh
#define sqrtl sqrt
#define tanl tan
#define tanhl tanh
#define truncl trunc
#define ilogbl ilogb
#define llroundl llround
#define lroundl lround
#endif /* __MATH_H */

View file

@ -0,0 +1,211 @@
/* $VER: math_040.h 1.0 (06.04.2017)
** math.h 68040 specific support, link with -lm040
*/
/* macros */
int fpclassify(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#7,d1\n"
"\tfmove.l\tfpsr,d0\n"
"\trol.l\t#8,d0\n"
"\tand.l\td1,d0\n"
"\teinline";
int isfinite(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tfmove.l\tfpsr,d0\n"
"\tand.l\t#$03000000,d0\n"
"\tseq\td0\n"
"\textb.l\td0\n"
"\teinline";
int isnormal(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tfmove.l\tfpsr,d0\n"
"\tand.l\t#$07000000,d0\n"
"\tseq\td0\n"
"\textb.l\td0\n"
"\teinline";
int isnan(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#1,d0\n"
"\tfbun\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
int isinf(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#1,d0\n"
"\tfmove.l\tfpsr,d1\n"
"\trol.l\t#7,d1\n"
"\tand.l\td1,d0\n"
"\teinline";
int signbit(__reg("fp0")double) =
"\tinline\n"
"\tfmove.s\tfp0,d0\n"
"\tmoveq\t#31,d1\n"
"\tasr.l\td1,d0\n"
"\teinline";
int isgreater(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbogt\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
int isgreaterequal(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbult\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
int isless(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbolt\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
int islessequal(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbugt\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
int islessgreater(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbueq\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
int isunordered(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbun\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
#ifndef __NOINLINE__
/* faster inline functions */
__fp0ret double ceil(__reg("fp0")double) =
"\tinline\n"
"\tfmove.l\tfpcr,d1\n"
"\tmoveq\t#$30,d0\n"
"\tor.l\td1,d0\n"
"\tfmove.l\td0,fpcr\n"
"\tfmove.l\tfp0,d0\n"
"\tfmove.l\td0,fp0\n"
"\tfmove.l\td1,fpcr\n"
"\teinline";
__fp0ret double copysign(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfmove.s\tfp1,d0\n"
"\tfabs.x\tfp0\n"
"\ttst.l\td0\n"
"\tbpl\t.skip\n"
"\tfneg.x\tfp0\n"
".skip\n"
"\teinline";
__fp0ret double fabs(__reg("fp0")double) =
"\tinline\n"
"\tfabs.x\tfp0\n"
"\teinline";
__fp0ret double fdim(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfsub.x\tfp1,fp0\n"
"\tfabs.x\tfp0\n"
"\teinline";
__fp0ret double floor(__reg("fp0")double) =
"\tinline\n"
"\tfmove.l\tfpcr,d1\n"
"\tmoveq\t#$20,d0\n"
"\tor.l\td1,d0\n"
"\tand.w\t#$ffef,d0\n"
"\tfmove.l\td0,fpcr\n"
"\tfmove.l\tfp0,d0\n"
"\tfmove.l\td0,fp0\n"
"\tfmove.l\td1,fpcr\n"
"\teinline";
__fp0ret double fma(__reg("fp0")double,__reg("fp1")double,__reg("fp2")double) =
"\tinline\n"
"\tfmul.x\tfp1,fp0\n"
"\tfadd.x\tfp2,fp0\n"
"\teinline";
__fp0ret double fmax(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfboge\t.skip\n"
"\tftst.x\tfp1\n"
"\tfbun\t.skip\n"
"\tfmove.x\tfp1,fp0\n"
".skip\n"
"\teinline";
__fp0ret double fmin(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfbole\t.skip\n"
"\tftst.x\tfp1\n"
"\tfbun\t.skip\n"
"\tfmove.x\tfp1,fp0\n"
".skip\n"
"\teinline";
__fp0ret double hypot(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfmul.x\tfp0,fp0\n"
"\tfmul.x\tfp1,fp1\n"
"\tfadd.x\tfp1,fp0\n"
"\tfsqrt.x\tfp0\n"
"\teinline";
__fp0ret double nan(__reg("a0")const char *) =
"\tinline\n"
"\tfmove.s\t#$7fc00000,fp0\n"
"\teinline";
__fp0ret double nearbyint(__reg("fp0")double) =
"\tinline\n"
"\tfmove.l\tfp0,d0\n"
"\tfmove.l\td0,fp0\n"
"\teinline";
__fp0ret double sqrt(__reg("fp0")double) =
"\tinline\n"
"\tfsqrt.x\tfp0\n"
"\teinline";
__fp0ret double trunc(__reg("fp0")double) =
"\tinline\n"
"\tmoveq\t#$10,d0\n"
"\tfmove.l\tfpcr,d1\n"
"\tor.l\td1,d0\n"
"\tand.w\t#$ffdf,d0\n"
"\tfmove.l\td0,fpcr\n"
"\tfmove.l\tfp0,d0\n"
"\tfmove.l\td0,fp0\n"
"\tfmove.l\td1,fpcr\n"
"\teinline";
/* single precision */
#define ceilf(x) ceil(x)
#define copysignf(x,y) copysign(x,y)
#define fabsf(x) fabs(x)
#define fdimf(x,y) fdim(x,y)
#define floorf(x) floor(x)
#define fmaf(x,y) fma(x,y)
#define fmaxf(x,y) fmax(x,y)
#define fminf(x,y) fmin(x,y)
#define hypotf(x,y) hypot(x,y)
#define nanf(x) nan(x)
#define nearbyintf(x) nearbyint(x)
#define sqrtf(x) sqrt(x)
#define truncf(x) trunc(x)
#endif /* __NOINLINE__ */

View file

@ -0,0 +1,219 @@
/* $VER: math_060.h 1.0 (06.04.2017)
** math.h 68060 specific support, link with -lm060
*/
/* macros */
int fpclassify(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#7,d1\n"
"\tfmove.l\tfpsr,d0\n"
"\trol.l\t#8,d0\n"
"\tand.l\td1,d0\n"
"\teinline";
int isfinite(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tfmove.l\tfpsr,d0\n"
"\tand.l\t#$03000000,d0\n"
"\tseq\td0\n"
"\textb.l\td0\n"
"\teinline";
int isnormal(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tfmove.l\tfpsr,d0\n"
"\tand.l\t#$07000000,d0\n"
"\tseq\td0\n"
"\textb.l\td0\n"
"\teinline";
int isnan(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#1,d0\n"
"\tfbun\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
int isinf(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#1,d0\n"
"\tfmove.l\tfpsr,d1\n"
"\trol.l\t#7,d1\n"
"\tand.l\td1,d0\n"
"\teinline";
int signbit(__reg("fp0")double) =
"\tinline\n"
"\tfmove.s\tfp0,d0\n"
"\tmoveq\t#31,d1\n"
"\tasr.l\td1,d0\n"
"\teinline";
int isgreater(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbogt\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
int isgreaterequal(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbult\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
int isless(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbolt\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
int islessequal(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbugt\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
int islessgreater(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbueq\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
int isunordered(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbun\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
#ifndef __NOINLINE__
/* faster inline functions */
__fp0ret double ceil(__reg("fp0")double) =
"\tinline\n"
"\tfmove.x\tfp0,fp1\n"
"\tfintrz.x\tfp0\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfboge\t.skip\n"
"\tfadd.s\t#$3f800000,fp0\n"
".skip\n"
"\teinline";
__fp0ret double copysign(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfmove.s\tfp1,d0\n"
"\tfabs.x\tfp0\n"
"\ttst.l\td0\n"
"\tbpl\t.skip\n"
"\tfneg.x\tfp0\n"
".skip\n"
"\teinline";
__fp0ret double fabs(__reg("fp0")double) =
"\tinline\n"
"\tfabs.x\tfp0\n"
"\teinline";
__fp0ret double fdim(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfsub.x\tfp1,fp0\n"
"\tfabs.x\tfp0\n"
"\teinline";
__fp0ret double floor(__reg("fp0")double) =
"\tinline\n"
"\tfmove.x\tfp0,fp1\n"
"\tfintrz.x\tfp0\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfbole\t.skip\n"
"\tfsub.s\t#$3f800000,fp0\n"
".skip\n"
"\teinline";
__fp0ret double fma(__reg("fp0")double,__reg("fp1")double,__reg("fp2")double) =
"\tinline\n"
"\tfmul.x\tfp1,fp0\n"
"\tfadd.x\tfp2,fp0\n"
"\teinline";
__fp0ret double fmax(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfboge\t.skip\n"
"\tftst.x\tfp1\n"
"\tfbun\t.skip\n"
"\tfmove.x\tfp1,fp0\n"
".skip\n"
"\teinline";
__fp0ret double fmin(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfbole\t.skip\n"
"\tftst.x\tfp1\n"
"\tfbun\t.skip\n"
"\tfmove.x\tfp1,fp0\n"
".skip\n"
"\teinline";
__fp0ret double hypot(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfmul.x\tfp0,fp0\n"
"\tfmul.x\tfp1,fp1\n"
"\tfadd.x\tfp1,fp0\n"
"\tfsqrt.x\tfp0\n"
"\teinline";
long lround(__reg("fp0")double) =
"\tinline\n"
"\tfmove.s\tfp0,d0\n"
"\tand.l\t#$80000000,d0\n"
"\tor.l\t#$3f000000,d0\n"
"\tfadd.s\td0,fp0\n"
"\tfintrz.x\tfp0\n"
"\tfmove.l\tfp0,d0\n"
"\teinline";
__fp0ret double nan(__reg("a0")const char *) =
"\tinline\n"
"\tfmove.s\t#$7fc00000,fp0\n"
"\teinline";
__fp0ret double nearbyint(__reg("fp0")double) =
"\tinline\n"
"\tfint.x\tfp0\n"
"\teinline";
__fp0ret double round(__reg("fp0")double) =
"\tinline\n"
"\tfmove.s\tfp0,d0\n"
"\tand.l\t#$80000000,d0\n"
"\tor.l\t#$3f000000,d0\n"
"\tfadd.s\td0,fp0\n"
"\tfintrz.x\tfp0\n"
"\teinline";
__fp0ret double sqrt(__reg("fp0")double) =
"\tinline\n"
"\tfsqrt.x\tfp0\n"
"\teinline";
__fp0ret double trunc(__reg("fp0")double) =
"\tinline\n"
"\tfintrz.x\tfp0\n"
"\teinline";
/* single precision */
#define ceilf(x) ceil(x)
#define copysignf(x,y) copysign(x,y)
#define fabsf(x) fabs(x)
#define fdimf(x,y) fdim(x,y)
#define floorf(x) floor(x)
#define fmaf(x,y) fma(x,y)
#define fmaxf(x,y) fmax(x,y)
#define fminf(x,y) fmin(x,y)
#define hypotf(x,y) hypot(x,y)
#define lroundf(x) lround(x)
#define nanf(x) nan(x)
#define nearbyintf(x) nearbyint(x)
#define roundf(x) round(x)
#define sqrtf(x) sqrt(x)
#define truncf(x) trunc(x)
#endif /* __NOINLINE__ */

View file

@ -0,0 +1,329 @@
/* $VER: math_881.h 1.0 (06.04.2017)
** math.h 6888x specific support, link with -lm881
*/
/* macros */
int fpclassify(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#7,d1\n"
"\tfmove.l\tfpsr,d0\n"
"\trol.l\t#8,d0\n"
"\tand.l\td1,d0\n"
"\teinline";
int isfinite(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tfmove.l\tfpsr,d0\n"
"\tand.l\t#$03000000,d0\n"
"\tseq\td0\n"
"\textb.l\td0\n"
"\teinline";
int isnormal(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tfmove.l\tfpsr,d0\n"
"\tand.l\t#$07000000,d0\n"
"\tseq\td0\n"
"\textb.l\td0\n"
"\teinline";
int isnan(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#1,d0\n"
"\tfbun\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
int isinf(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#1,d0\n"
"\tfmove.l\tfpsr,d1\n"
"\trol.l\t#7,d1\n"
"\tand.l\td1,d0\n"
"\teinline";
int signbit(__reg("fp0")double) =
"\tinline\n"
"\tfmove.s\tfp0,d0\n"
"\tmoveq\t#31,d1\n"
"\tasr.l\td1,d0\n"
"\teinline";
int isgreater(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbogt\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
int isgreaterequal(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbult\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
int isless(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbolt\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
int islessequal(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbugt\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
int islessgreater(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbueq\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
int isunordered(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbun\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
#ifndef __NOINLINE__
/* faster inline functions */
__fp0ret double acos(__reg("fp0")double) =
"\tinline\n"
"\tfacos.x\tfp0\n"
"\teinline";
__fp0ret double asin(__reg("fp0")double) =
"\tinline\n"
"\tfasin.x\tfp0\n"
"\teinline";
__fp0ret double atan(__reg("fp0")double) =
"\tinline\n"
"\tfatan.x\tfp0\n"
"\teinline";
__fp0ret double atanh(__reg("fp0")double) =
"\tinline\n"
"\tfatanh.x\tfp0\n"
"\teinline";
__fp0ret double ceil(__reg("fp0")double) =
"\tinline\n"
"\tfmove.x\tfp0,fp1\n"
"\tfintrz.x\tfp0\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfboge\t.skip\n"
"\tfadd.s\t#$3f800000,fp0\n"
".skip\n"
"\teinline";
__fp0ret double copysign(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfmove.s\tfp1,d0\n"
"\tfabs.x\tfp0\n"
"\ttst.l\td0\n"
"\tbpl\t.skip\n"
"\tfneg.x\tfp0\n"
".skip\n"
"\teinline";
__fp0ret double cos(__reg("fp0")double) =
"\tinline\n"
"\tfcos.x\tfp0\n"
"\teinline";
__fp0ret double cosh(__reg("fp0")double) =
"\tinline\n"
"\tfcosh.x\tfp0\n"
"\teinline";
__fp0ret double exp(__reg("fp0")double) =
"\tinline\n"
"\tfetox.x\tfp0\n"
"\teinline";
__fp0ret double exp2(__reg("fp0")double) =
"\tinline\n"
"\tftwotox.x\tfp0\n"
"\teinline";
__fp0ret double exp10(__reg("fp0")double) =
"\tinline\n"
"\tftentox.x\tfp0\n"
"\teinline";
__fp0ret double expm1(__reg("fp0")double) =
"\tinline\n"
"\tfetoxm1.x\tfp0\n"
"\teinline";
__fp0ret double fabs(__reg("fp0")double) =
"\tinline\n"
"\tfabs.x\tfp0\n"
"\teinline";
__fp0ret double fdim(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfsub.x\tfp1,fp0\n"
"\tfabs.x\tfp0\n"
"\teinline";
__fp0ret double floor(__reg("fp0")double) =
"\tinline\n"
"\tfmove.x\tfp0,fp1\n"
"\tfintrz.x\tfp0\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfbole\t.skip\n"
"\tfsub.s\t#$3f800000,fp0\n"
".skip\n"
"\teinline";
__fp0ret double fma(__reg("fp0")double,__reg("fp1")double,__reg("fp2")double) =
"\tinline\n"
"\tfmul.x\tfp1,fp0\n"
"\tfadd.x\tfp2,fp0\n"
"\teinline";
__fp0ret double fmax(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfboge\t.skip\n"
"\tftst.x\tfp1\n"
"\tfbun\t.skip\n"
"\tfmove.x\tfp1,fp0\n"
".skip\n"
"\teinline";
__fp0ret double fmin(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfbole\t.skip\n"
"\tftst.x\tfp1\n"
"\tfbun\t.skip\n"
"\tfmove.x\tfp1,fp0\n"
".skip\n"
"\teinline";
__fp0ret double fmod(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfmod.x\tfp1,fp0\n"
"\teinline";
__fp0ret double hypot(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfmul.x\tfp0,fp0\n"
"\tfmul.x\tfp1,fp1\n"
"\tfadd.x\tfp1,fp0\n"
"\tfsqrt.x\tfp0\n"
"\teinline";
__fp0ret double ldexp(__reg("fp0")double,__reg("d0")int) =
"\tinline\n"
"\tfscale.l\td0,fp0\n"
"\teinline";
__fp0ret double log(__reg("fp0")double) =
"\tinline\n"
"\tflogn.x\tfp0\n"
"\teinline";
__fp0ret double log10(__reg("fp0")double) =
"\tinline\n"
"\tflog10.x\tfp0\n"
"\teinline";
__fp0ret double log2(__reg("fp0")double) =
"\tinline\n"
"\tflog2.x\tfp0\n"
"\teinline";
__fp0ret double logb(__reg("fp0")double) =
"\tinline\n"
"\tfgetexp.x\tfp0\n"
"\teinline";
__fp0ret double lognp1(__reg("fp0")double) =
"\tinline\n"
"\tflognp1.x\tfp0\n"
"\teinline";
long lround(__reg("fp0")double) =
"\tinline\n"
"\tfmove.s\tfp0,d0\n"
"\tand.l\t#$80000000,d0\n"
"\tor.l\t#$3f000000,d0\n"
"\tfadd.s\td0,fp0\n"
"\tfintrz.x\tfp0\n"
"\tfmove.l\tfp0,d0\n"
"\teinline";
__fp0ret double nan(__reg("a0")const char *) =
"\tinline\n"
"\tfmove.s\t#$7fc00000,fp0\n"
"\teinline";
__fp0ret double nearbyint(__reg("fp0")double) =
"\tinline\n"
"\tfint.x\tfp0\n"
"\teinline";
__fp0ret double remainder(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfrem.x\tfp1,fp0\n"
"\teinline";
__fp0ret double round(__reg("fp0")double) =
"\tinline\n"
"\tfmove.s\tfp0,d0\n"
"\tand.l\t#$80000000,d0\n"
"\tor.l\t#$3f000000,d0\n"
"\tfadd.s\td0,fp0\n"
"\tfintrz.x\tfp0\n"
"\teinline";
__fp0ret double sin(__reg("fp0")double) =
"\tinline\n"
"\tfsin.x\tfp0\n"
"\teinline";
__fp0ret double sinh(__reg("fp0")double) =
"\tinline\n"
"\tfsinh.x\tfp0\n"
"\teinline";
__fp0ret double sqrt(__reg("fp0")double) =
"\tinline\n"
"\tfsqrt.x\tfp0\n"
"\teinline";
__fp0ret double tan(__reg("fp0")double) =
"\tinline\n"
"\tftan.x\tfp0\n"
"\teinline";
__fp0ret double tanh(__reg("fp0")double) =
"\tinline\n"
"\tftanh.x\tfp0\n"
"\teinline";
__fp0ret double trunc(__reg("fp0")double) =
"\tinline\n"
"\tfintrz.x\tfp0\n"
"\teinline";
/* single precision */
#define acosf(x) acos(x)
#define asinf(x) asin(x)
#define atanf(x) atan(x)
#define atanhf(x) atanh(x)
#define ceilf(x) ceil(x)
#define copysignf(x,y) copysign(x,y)
#define cosf(x) cos(x)
#define coshf(x) cosh(x)
#define expf(x) exp(x)
#define exp2f(x) exp2(x)
#define exp10f(x) exp10(x)
#define expm1f(x) expm1(x)
#define fabsf(x) fabs(x)
#define fdimf(x,y) fdim(x,y)
#define floorf(x) floor(x)
#define fmaf(x,y) fma(x,y)
#define fmaxf(x,y) fmax(x,y)
#define fminf(x,y) fmin(x,y)
#define fmodf(x,y) fmod(x,y)
#define hypotf(x,y) hypot(x,y)
#define ldexpf(x,exp) ldexp(x,exp)
#define logf(x) log(x)
#define log10f(x) log10(x)
#define log2f(x) log2(x)
#define logbf(x) logb(x)
#define lognp1f(x) lognp1(x)
#define lroundf(x) lround(x)
#define nanf(x) nan(x)
#define nearbyintf(x) nearbyint(x)
#define remainderf(x,y) remainder(x,y)
#define roundf(x) round(x)
#define sinf(x) sin(x)
#define sinhf(x) sinh(x)
#define sqrtf(x) sqrt(x)
#define tanf(x) tan(x)
#define tanhf(x) tanh(x)
#define truncf(x) trunc(x)
#endif /* __NOINLINE__ */

View file

@ -0,0 +1,48 @@
/**
* Definition of error numbers
*/
#ifndef __MCP_ERRORS_H
#define __MCP_ERRORS_H
// #define MAX_ERROR_NUMBER 16 // Largest (absolute value) of the error number
#define ERR_GENERAL -1 // A general error condition
#define DEV_ERR_BADDEV -2 // Device number is bad (too big or no device assigned)
#define DEV_TIMEOUT -3 // The block device function timed out
#define DEV_CANNOT_INIT -4 // The block device could not initilize
#define DEV_CANNOT_READ -5 // The device cannot complete the READ
#define DEV_CANNOT_WRITE -6 // The device cannot complete the WRITE
#define DEV_BOUNDS_ERR -7 // The buffer provided is not big enough
#define DEV_NOMEDIA -8 // There is no media present for that device
#define DEV_WRITEPROT -9 // The media is write protected
#define ERR_BADCHANNEL -10 // The channel number was bad
#define ERR_OUT_OF_HANDLES -11 // There are no available handles for channels files etc.
#define ERR_BAD_HANDLE -12 // The handle passed was not valid
#define ERR_BAD_EXTENSION -13 // The path to load did not have an extension that matched registered loaders
#define ERR_OUT_OF_MEMORY -14 // Unable to allocate more memory
#define ERR_BAD_BINARY -15 // Bad binary file format... i.e. binary format does not match expectations
#define ERR_NOT_EXECUTABLE -16 // Binary file format does not have a starting address
#define ERR_NOT_FOUND -17 // Resource not found
#define FSYS_ERR_DISK_ERR -18 /* (1) A hard error occurred in the low level disk I/O layer */
#define FSYS_ERR_INT_ERR -19 /* (2) Assertion failed */
#define FSYS_ERR_NOT_READY -20 /* (3) The physical drive cannot work */
#define FSYS_ERR_NO_FILE -21 /* (4) Could not find the file */
#define FSYS_ERR_NO_PATH -22 /* (5) Could not find the path */
#define FSYS_ERR_INVALID_NAME -23 /* (6) The path name format is invalid */
#define FSYS_ERR_DENIED -24 /* (7) Access denied due to prohibited access or directory full */
#define FSYS_ERR_EXIST -25 /* (8) Access denied due to prohibited access */
#define FSYS_ERR_INVALID_OBJECT -26 /* (9) The file/directory object is invalid */
#define FSYS_ERR_WRITE_PROTECTED -27 /* (10) The physical drive is write protected */
#define FSYS_ERR_INVALID_DRIVE -28 /* (11) The logical drive number is invalid */
#define FSYS_ERR_NOT_ENABLED -29 /* (12) The volume has no work area */
#define FSYS_ERR_NO_FILESYSTEM -30 /* (13) There is no valid FAT volume */
#define FSYS_ERR_MKFS_ABORTED -31 /* (14) The f_mkfs() aborted due to any problem */
#define FSYS_ERR_TIMEOUT -32 /* (15) Could not get a grant to access the volume within defined period */
#define FSYS_ERR_LOCKED -33 /* (16) The operation is rejected according to the file sharing policy */
#define FSYS_ERR_NOT_ENOUGH_CORE -34 /* (17) LFN working buffer could not be allocated */
#define FSYS_ERR_TOO_MANY_OPEN_FILES -35 /* (18) Number of open files > FF_FS_LOCK */
#define FSYS_ERR_INVALID_PARAMETER -36 /* (19) Given parameter is invalid */
#endif

View file

@ -0,0 +1,67 @@
/*
* Declarations for the interrupt system
*/
#ifndef __MCP_INTERRUPT_H
#define __MCP_INTERRUPT_H
/* Type declaration for an interrupt handler */
typedef void (*p_int_handler)();
/*
* Define standard interrupt numbers to be used for enabling, disabling an interrupt or setting its handler
*/
#define INT_SOF_A 0x00 /* Vicky Channel A Start of Frame */
#define INT_SOL_A 0x01 /* Vicky Channel A Start of Line */
#define INT_VICKY_A_1 0x02
#define INT_VICKY_A_2 0x03
#define INT_VICKY_A_3 0x04
#define INT_VICKY_A_4 0x05
#define INT_RESERVED_1 0x06
#define INT_VICKY_A_DAC 0x07
#define INT_SOF_B 0x08 /* Vicky Channel B Start of Frame */
#define INT_SOL_B 0x09 /* Vicky Channel B Start of Line */
#define INT_VICKY_B_1 0x0A
#define INT_VICKY_B_2 0x0B
#define INT_VICKY_B_3 0x0C
#define INT_VICKY_B_4 0x0D
#define INT_RESERVED_2 0x0E
#define INT_VICKY_B_DAC 0x0F
#define INT_KBD_PS2 0x10 /* SuperIO - PS/2 Keyboard */
#define INT_KBD_A2560K 0x11 /* SuperIO - A2560K Built in keyboard (Mo) */
#define INT_MOUSE 0x12 /* SuperIO - PS/2 Mouse */
#define INT_COM1 0x13 /* SuperIO - COM1 */
#define INT_COM2 0x14 /* SuperIO - COM2 */
#define INT_LPT1 0x15 /* SuperIO - LPT1 */
#define INT_FDC 0x16 /* SuperIO - Floppy Drive Controller */
#define INT_MIDI 0x17 /* SuperIO - MIDI */
#define INT_TIMER0 0x18 /* Timer 0, Clocked with the CPU Clock */
#define INT_TIMER1 0x19 /* Timer 1, Clocked with the CPU Clock */
#define INT_TIMER2 0x1A /* Timer 2, Clocked with the CPU Clock */
#define INT_TIMER3 0x1B /* Timer 3, Clocked with the SOF Channel A */
#define INT_TIMER4 0x1C /* Timer 4, Clocked with the SOF Channel B */
#define INT_RESERVED_3 0x1D /* Reserved */
#define INT_RESERVED_4 0x1E /* Reserved */
#define INT_RTC 0x1F /* Real Time Clock */
#define INT_PATA 0x20 /* IDE/PATA Hard drive interrupt */
#define INT_SDC_INS 0x21 /* SD card inserted */
#define INT_SDC 0x22 /* SD card controller */
#define INT_OPM_INT 0x23 /* Internal OPM */
#define INT_OPN2_EXT 0x24 /* External OPN */
#define INT_OPL3_EXT 0x25 /* External OPL */
#define INT_RESERVED_5 0x26 /* Reserved */
#define INT_RESERVED_6 0x27 /* Reserved */
#define INT_BEATRIX_0 0x28 /* Beatrix 0 */
#define INT_BEATRIX_1 0x29 /* Beatrix 1 */
#define INT_BEATRIX_2 0x2A /* Beatrix 2 */
#define INT_BEATRIX_3 0x2B /* Beatrix 3 */
#define INT_RESERVED_7 0x2C /* Reserved */
#define INT_DAC1_PB 0x2D /* DAC1 Playback Done (48K) */
#define INT_RESERVED_8 0x2E /* Reserved */
#define INT_DAC0_PB 0x2F /* DAC0 Playback Done (44.1K) */
#endif

View file

@ -0,0 +1,675 @@
/*
* Declarations for calling into the Foenix/MCP kernel
*
* Code calling into the MCP should include this or a similar set of bindings
* The kernel will use this to allow for system calls to be replaced if needed
* by other code.
*
*/
#ifndef __MCP_SYSCALLS_H
#define __MCP_SYSCALLS_H
#include "types.h"
#include "errors.h"
#include "interrupt.h"
/*
* Syscall function numbers
*/
/* Core calls */
#define KFN_EXIT 0x00 /* Quick the current program and return to the command line */
#define KFN_WARMBOOT 0x01 /* Do a soft re-initialization */
#define KFN_INT_REGISTER 0x02 /* Set a handler for an exception / interrupt */
#define KFN_INT_ENABLE 0x03 /* Enable an interrupt */
#define KFN_INT_DISABLE 0x04 /* Disable an interrupt */
#define KFN_INT_ENABLE_ALL 0x05 /* Enable all interrupts */
#define KFN_INT_DISABLE_ALL 0x06 /* Disable all interrupts */
#define KFN_INT_CLEAR 0x07 /* Clear (acknowledge) an interrupt */
#define KFN_INT_PENDING 0x08 /* Return true if the interrupt is pending */
#define KFN_SYS_GET_INFO 0x09 /* Get information about the computer */
/* Channel system calls */
#define KFN_CHAN_READ 0x10 /* Read bytes from an input channel */
#define KFN_CHAN_READ_B 0x11 /* Read a byte from an input channel */
#define KFN_CHAN_READ_LINE 0x12 /* Read a line from an input channel */
#define KFN_CHAN_WRITE 0x13 /* Write bytes to an output channel */
#define KFN_CHAN_WRITE_B 0x14 /* Write a byte to an output channel */
#define KFN_CHAN_FLUSH 0x15 /* Ensure that any pending write on a channel is committed */
#define KFN_CHAN_SEEK 0x16 /* Set the input/output cursor on a channel to a given position */
#define KFN_CHAN_STATUS 0x17 /* Get the status of a channel */
#define KFN_CHAN_IOCTRL 0x18 /* Send a command to a channel (channel dependent functionality) */
#define KFN_CHAN_REGISTER 0x19 /* Register a channel device driver */
#define KFN_CHAN_OPEN 0x1A /* Open a channel device */
#define KFN_CHAN_CLOSE 0x1B /* Close an open channel (not for files) */
#define KFN_TEXT_SETSIZES 0x1C /* Adjusts the screen size based on the current graphics mode */
/* Block device system calls */
#define KFN_BDEV_GETBLOCK 0x20 /* Read a block from a block device */
#define KFN_BDEV_PUTBLOCK 0x21 /* Write a block to a block device */
#define KFN_BDEV_FLUSH 0x22 /* Ensure that any pending write on a block device is committed */
#define KFN_BDEV_STATUS 0x23 /* Get the status of a block device */
#define KFN_BDEV_IOCTRL 0x24 /* Send a command to a block device (device dependent functionality) */
#define KFN_BDEV_REGISTER 0x25 /* Register a block device driver */
/* File/Directory system calls */
#define KFN_OPEN 0x30 /* Open a file as a channel */
#define KFN_CLOSE 0x31 /* Close a file channel */
#define KFN_OPENDIR 0x32 /* Open a directory for reading */
#define KFN_CLOSEDIR 0x33 /* Close an open directory */
#define KFN_READDIR 0x34 /* Read the next directory entry in an open directory */
#define KFN_FINDFIRST 0x35 /* Find the first entry in a directory that matches a pattern */
#define KFN_FINDNEXT 0x36 /* Find the next entry in a directory that matches a pattern */
#define KFN_DELETE 0x37 /* Delete a file */
#define KFN_RENAME 0x38 /* Rename a file */
#define KFN_MKDIR 0x39 /* Create a directory */
#define KFN_LOAD 0x3A /* Load a file into memory */
#define KFN_GET_LABEL 0x3B /* Read the label of a volume */
#define KFN_SET_LABEL 0x3C /* Set the label of a volume */
#define KFN_SET_CWD 0x3D /* Set the current working directory */
#define KFN_GET_CWD 0x3E /* Get the current working directory */
#define KFN_LOAD_REGISTER 0x3F /* Register a file type handler for executable binaries */
/* Process and memory calls */
#define KFN_RUN 0x40 /* Load an execute a binary file */
/* Misc calls */
#define KFN_TIME_JIFFIES 0x50 /* Gets the current time code (increments since boot) */
#define KFN_TIME_SETRTC 0x51 /* Set the real time clock date-time */
#define KFN_TIME_GETRTC 0x52 /* Get the real time clock date-time */
#define KFN_KBD_SCANCODE 0x53 /* Get the next scan code from the keyboard */
#define KFN_KBD_LAYOUT 0x54 /* Set the translation tables for the keyboard */
#define KFN_ERR_MESSAGE 0x55 /* Return an error description, given an error number */
/*
* Call into the kernel (provided by assembly)
*/
extern int32_t syscall(int32_t function, ...);
/***
*** Core system calls
***/
/*
* Quit the current user process
*
* NOTE: at the moment, this relaunches the CLI. In the future, this
* may cause execution to return to the program that started
* the user process.
*
* Inputs:
* result = the code to return to the kernel
*/
extern void sys_exit(short result);
/*
* Enable all interrupts
*
* NOTE: this is actually provided in the low level assembly
*/
extern void sys_int_enable_all();
/*
* Disable all interrupts
*
* NOTE: this is actually provided in the low level assembly
*/
extern void sys_int_disable_all();
/*
* Disable an interrupt by masking it
*
* Inputs:
* n = the number of the interrupt: n[7..4] = group number, n[3..0] = individual number.
*/
extern void sys_int_disable(unsigned short n);
/*
* Enable an interrupt
*
* Inputs:
* n = the number of the interrupt
*/
extern void sys_int_enable(unsigned short n);
/*
* Register a handler for a given interrupt.
*
* Inputs:
* n = the number of the interrupt
* handler = pointer to the interrupt handler to register
*
* Returns:
* the pointer to the previous interrupt handler
*/
extern p_int_handler sys_int_register(unsigned short n, p_int_handler handler);
/*
* Return true (non-zero) if an interrupt is pending for the given interrupt
*
* Inputs:
* n = the number of the interrupt: n[7..4] = group number, n[3..0] = individual number.
*
* Returns:
* non-zero if interrupt n is pending, 0 if not
*/
extern short sys_int_pending(unsigned short n);
/*
* Fill out a s_sys_info structure with the information about the current system
*
* Inputs:
* info = pointer to a s_sys_info structure to fill out
*/
extern void sys_get_info(p_sys_info info);
/*
* Acknowledge an interrupt (clear out its pending flag)
*
* Inputs:
* n = the number of the interrupt: n[7..4] = group number, n[3..0] = individual number.
*/
extern void sys_int_clear(unsigned short n);
/***
*** Channel system calls
***/
/*
* Read a single byte from the channel
*
* Inputs:
* channel = the number of the channel
*
* Returns:
* the value read (if negative, error)
*/
extern short sys_chan_read_b(short channel);
/*
* Read bytes from the channel
*
* Inputs:
* channel = the number of the channel
* buffer = the buffer into which to copy the channel data
* size = the size of the buffer.
*
* Returns:
* number of bytes read, any negative number is an error code
*/
extern short sys_chan_read(short channel, unsigned char * buffer, short size);
/*
* Read a line of text from the channel
*
* Inputs:
* channel = the number of the channel
* buffer = the buffer into which to copy the channel data
* size = the size of the buffer
*
* Returns:
* number of bytes read, any negative number is an error code
*/
extern short sys_chan_readline(short channel, unsigned char * buffer, short size);
/*
* Write a single byte to the device
*
* Inputs:
* channel = the number of the channel
* b = the byte to write
*
* Returns:
* 0 on success, a negative value on error
*/
extern short sys_chan_write_b(short channel, unsigned char b);
/*
* Write a byte to the channel
*
* Inputs:
* channel = the number of the channel
* b = the byte to write
*
* Returns:
* number of bytes written, any negative number is an error code
*/
extern short sys_chan_write(short channel, unsigned char * buffer, short size);
/*
* Return the status of the channel device
*
* Inputs:
* channel = the number of the channel
*
* Returns:
* the status of the device
*/
extern short sys_chan_status(short channel);
/*
* Ensure that any pending writes to teh device have been completed
*
* Inputs:
* channel = the number of the channel
*
* Returns:
* 0 on success, any negative number is an error code
*/
extern short sys_chan_flush(short channel);
/*
* Attempt to set the position of the channel cursor (if supported)
*
* Inputs:
* channel = the number of the channel
* position = the position of the cursor
* base = whether the position is absolute or relative to the current position
*
* Returns:
* 0 = success, a negative number is an error.
*/
extern short sys_chan_seek(short channel, long position, short base);
/*
* Issue a control command to the device
*
* Inputs:
* channel = the number of the channel
* command = the number of the command to send
* buffer = pointer to bytes of additional data for the command
* size = the size of the buffer
*
* Returns:
* 0 on success, any negative number is an error code
*/
extern short sys_chan_ioctrl(short channel, short command, uint8_t * buffer, short size);
/*
* Open a channel
*
* Inputs:
* dev = the device number to have a channel opened
* path = a "path" describing how the device is to be open
* mode = is the device to be read, written, both? (0x01 = READ flag, 0x02 = WRITE flag, 0x03 = READ and WRITE)
*
* Returns:
* the number of the channel opened, negative number on error
*/
extern short sys_chan_open(short dev, uint8_t * path, short mode);
/*
* Close a channel
*
* Inputs:
* chan = the number of the channel to close
*
* Returns:
* nothing useful
*/
extern short sys_chan_close(short chan);
/***
*** Block device system calls
***/
//
// Register a block device driver
//
extern short sys_bdev_register(p_dev_block device);
//
// Read a block from the device
//
// Inputs:
// dev = the number of the device
// lba = the logical block address of the block to read
// buffer = the buffer into which to copy the block data
// size = the size of the buffer.
//
// Returns:
// number of bytes read, any negative number is an error code
//
extern short sys_bdev_read(short dev, long lba, unsigned char * buffer, short size);
//
// Write a block from the device
//
// Inputs:
// dev = the number of the device
// lba = the logical block address of the block to write
// buffer = the buffer containing the data to write
// size = the size of the buffer.
//
// Returns:
// number of bytes written, any negative number is an error code
//
extern short sys_bdev_write(short dev, long lba, const unsigned char * buffer, short size);
//
// Return the status of the block device
//
// Inputs:
// dev = the number of the device
//
// Returns:
// the status of the device
//
extern short sys_bdev_status(short dev);
//
// Ensure that any pending writes to teh device have been completed
//
// Inputs:
// dev = the number of the device
//
// Returns:
// 0 on success, any negative number is an error code
//
extern short sys_bdev_flush(short dev);
//
// Issue a control command to the device
//
// Inputs:
// dev = the number of the device
// command = the number of the command to send
// buffer = pointer to bytes of additional data for the command
// size = the size of the buffer
//
// Returns:
// 0 on success, any negative number is an error code
//
extern short sys_bdev_ioctrl(short dev, short command, unsigned char * buffer, short size);
/*
* File System Calls
*/
/**
* Attempt to open a file given the path to the file and the mode.
*
* Inputs:
* path = the ASCIIZ string containing the path to the file.
* mode = the mode (e.g. r/w/create)
*
* Returns:
* the channel ID for the open file (negative if error)
*/
extern short sys_fsys_open(const char * path, short mode);
/**
* Close access to a previously open file.
*
* Inputs:
* fd = the channel ID for the file
*
* Returns:
* 0 on success, negative number on failure
*/
extern short sys_fsys_close(short fd);
/**
* Attempt to open a directory for scanning
*
* Inputs:
* path = the path to the directory to open
*
* Returns:
* the handle to the directory if >= 0. An error if < 0
*/
extern short sys_fsys_opendir(const char * path);
/**
* Close access to a previously open file.
*
* Inputs:
* fd = the channel ID for the file
*
* Returns:
* 0 on success, negative number on failure
*/
extern short sys_fsys_close(short fd);
/**
* Attempt to open a directory for scanning
*
* Inputs:
* path = the path to the directory to open
*
* Returns:
* the handle to the directory if >= 0. An error if < 0
*/
extern short sys_fsys_opendir(const char * path);
/**
* Close a previously open directory
*
* Inputs:
* dir = the directory handle to close
*
* Returns:
* 0 on success, negative number on error
*/
extern short sys_fsys_closedir(short dir);
/**
* Attempt to read an entry from an open directory
*
* Inputs:
* dir = the handle of the open directory
* file = pointer to the t_file_info structure to fill out.
*
* Returns:
* 0 on success, negative number on failure
*/
extern short sys_fsys_readdir(short dir, p_file_info file);
/**
* Open a directory given the path and search for the first file matching the pattern.
*
* Inputs:
* path = the path to the directory to search
* pattern = the file name pattern to search for
* file = pointer to the t_file_info structure to fill out
*
* Returns:
* the directory handle to use for subsequent calls if >= 0, error if negative
*/
extern short sys_fsys_findfirst(const char * path, const char * pattern, p_file_info file);
/**
* Open a directory given the path and search for the first file matching the pattern.
*
* Inputs:
* dir = the handle to the directory (returned by fsys_findfirst) to search
* file = pointer to the t_file_info structure to fill out
*
* Returns:
* 0 on success, error if negative
*/
extern short sys_fsys_findnext(short dir, p_file_info file);
/*
* Get the label for the drive holding the path
*
* Inputs:
* path = path to the drive
* label = buffer that will hold the label... should be at least 35 bytes
*/
extern short sys_fsys_get_label(const char * path, char * label);
/*
* Set the label for the drive holding the path
*
* Inputs:
* drive = drive number
* label = buffer that holds the label
*/
extern short sys_fsys_set_label(short drive, const char * label);
/**
* Create a directory
*
* Inputs:
* path = the path of the directory to create.
*
* Returns:
* 0 on success, negative number on failure.
*/
extern short sys_fsys_mkdir(const char * path);
/**
* Delete a file or directory
*
* Inputs:
* path = the path of the file or directory to delete.
*
* Returns:
* 0 on success, negative number on failure.
*/
extern short sys_fsys_delete(const char * path);
/**
* Rename a file or directory
*
* Inputs:
* old_path = the current path to the file
* new_path = the new path for the file
*
* Returns:
* 0 on success, negative number on failure.
*/
extern short sys_fsys_rename(const char * old_path, const char * new_path);
/**
* Change the current working directory (and drive)
*
* Inputs:
* path = the path that should be the new current
*
* Returns:
* 0 on success, negative number on failure.
*/
extern short sys_fsys_setcwd(const char * path);
/**
* Get the current working drive and directory
*
* Inputs:
* path = the buffer in which to store the directory
* size = the size of the buffer in bytes
*
* Returns:
* 0 on success, negative number on failure.
*/
extern short sys_fsys_getcwd(char * path, short size);
/*
* Load a file into memory at the designated destination address.
*
* If destination = 0, the file must be in a recognized binary format
* that specifies its own loading address.
*
* Inputs:
* path = the path to the file to load
* destination = the destination address (0 for use file's address)
* start = pointer to the long variable to fill with the starting address
* (0 if not an executable, any other number if file is executable
* with a known starting address)
*
* Returns:
* 0 on success, negative number on error
*/
extern short sys_fsys_load(const char * path, long destination, long * start);
/*
* Register a file loading routine
*
* A file loader, takes a channel number to load from and returns a
* short that is the status of the load.
*
* Inputs:
* extension = the file extension to map to
* loader = pointer to the file load routine to add
*
* Returns:
* 0 on success, negative number on error
*/
extern short sys_fsys_register_loader(const char * extension, p_file_loader loader);
/*
* Miscellaneous
*/
/*
* Get the number of jiffies since the system last booted.
*
* NOTE: a jiffie is 1/60 of a second. This timer will not be
* 100% precise, so it should be used for timeout purposes
* where precision is not critical.
*
* Returns:
* the number of jiffies since the last reset
*/
extern long sys_time_jiffies();
/*
* Set the time on the RTC
*
* Inputs:
* time = pointer to a t_time record containing the correct time
*/
extern void sys_rtc_set_time(p_time time);
/*
* Get the time on the RTC
*
* Inputs:
* time = pointer to a t_time record in which to put the current time
*/
extern void sys_rtc_get_time(p_time time);
/*
* Return the next scan code from the keyboard... 0 if nothing pending
*/
extern unsigned short sys_kbd_scancode();
/*
* Return an error message given an error number
*/
extern const char * sys_err_message(short err_number);
/*
* Set the keyboard translation tables
*
* The translation tables provided to the keyboard consist of eight
* consecutive tables of 128 characters each. Each table maps from
* the MAKE scan code of a key to its appropriate 8-bit character code.
*
* The tables included must include, in order:
* - UNMODIFIED: Used when no modifier keys are pressed or active
* - SHIFT: Used when the SHIFT modifier is pressed
* - CTRL: Used when the CTRL modifier is pressed
* - CTRL-SHIFT: Used when both CTRL and SHIFT are pressed
* - CAPSLOCK: Used when CAPSLOCK is down but SHIFT is not pressed
* - CAPSLOCK-SHIFT: Used when CAPSLOCK is down and SHIFT is pressed
* - ALT: Used when only ALT is presse
* - ALT-SHIFT: Used when ALT is pressed and either CAPSLOCK is down
* or SHIFT is pressed (but not both)
*
* Inputs:
* tables = pointer to the keyboard translation tables
*/
extern short sys_kbd_layout(const char * tables);
#endif

View file

@ -0,0 +1,244 @@
/*
* Definitions of types used by the kernel
*/
#ifndef __MCP_TYPES_H
#define __MCP_TYPES_H
#include <stdint.h>
/*
* Function types
*/
/*
* Integer types in their standard sizes, signed and unsigned.
*/
typedef unsigned char bool;
//
// A color (BGR)
//
typedef struct s_color3 {
uint8_t blue;
uint8_t green;
uint8_t red;
} t_color3;
//
// A color entry for a color lookup table (BGRA)
//
typedef struct s_color4 {
uint8_t blue;
uint8_t green;
uint8_t red;
uint8_t alpha;
} t_color4;
/*
* Function types
*/
typedef short (*FUNC_V_2_S)();
typedef short (*FUNC_S_2_S)(char *);
typedef short (*FUNC_BS_2_S)(unsigned char *, short);
typedef short (*FUNC_cBS_2_S)(const unsigned char *, short);
typedef short (*FUNC_B_2_S)(const unsigned short);
typedef short (*FUNC_LBS_2_S)(long, unsigned char *, short);
typedef short (*FUNC_LcBS_2_S)(long, const unsigned char *, short);
typedef short (*FUNC_SBS_2_S)(short, unsigned char *, short);
typedef short (*FUNC_LB_2_S)(long, short);
/*=========================================
* dev/channel
*========================================*/
/*
* Preset channel device numbers
*/
#define CDEV_DEVICES_MAX 8 // The maximum number of channel devices we will support
#define CHAN_MAX 16 // The maximum number of open channels we will support
#define CHAN_DATA_SIZE 32 // The number of bytes in the channel's data area
#define CDEV_CONSOLE 0
#define CDEV_EVID 1
#define CDEV_COM1 2
#define CDEV_COM2 3
#define CDEV_LPT 4
#define CDEV_MIDI 5
#define CDEV_FILE 6
/*
* Channel status bits
*/
#define CDEV_STAT_EOF 0x01 // The channel has reached the end of the data
#define CDEV_STAT_ERROR 0x02 // The channel has encountered some error
#define CDEV_STAT_READABLE 0x04 // The channel has data to read (read will not block)
#define CDEV_STAT_WRITABLE 0x08 // The channel can accept data (write will not block)
#define CDEV_SEEK_ABSOLUTE 0
#define CDEV_SEEK_RELATIVE 1
/*
* Structure defining a channel
*/
typedef struct s_channel {
short number; // The number of the channel
short dev; // The number of the channel's device
uint8_t data[CHAN_DATA_SIZE]; // A block of state data that the channel code can use for its own purposes
} t_channel, *p_channel;
typedef short (*FUNC_CBS_2_S)(p_channel, uint8_t *, short);
typedef short (*FUNC_C_2_S)(p_channel);
typedef short (*FUNC_CcBS_2_S)(p_channel, const uint8_t *, short);
typedef short (*FUNC_CB_2_S)(p_channel, uint8_t);
typedef short (*FUNC_CLS_2_S)(p_channel, long, short);
typedef short (*FUNC_CSBS_2_S)(p_channel, short, uint8_t *, short);
/*
* Structure defining a channel device's functions
*/
typedef struct s_dev_chan {
short number; // The number of the device (assigned by registration)
char * name; // The name of the device
FUNC_V_2_S init; // short init() -- Initialize the device
FUNC_CBS_2_S open; // short open(t_channel * chan, uint8_t * path, short mode) -- open a channel for the device
FUNC_V_2_S close; // short close(t_channel * chan) -- called when a channel is closed
FUNC_CBS_2_S read; // short read(t_channel *, uint8_t * buffer, short size) -- Read a a buffer from the device
FUNC_CBS_2_S readline; // short readline(t_channel *, uint8_t * buffer, short size) -- Read a line of text from the device
FUNC_C_2_S read_b; // short read_b(t_channel *) -- read a single uint8_t from the device
FUNC_CcBS_2_S write; // short write(t_channel *, uint8_t * buffer, short size) -- Write a buffer to the device
FUNC_CB_2_S write_b; // short write_b(t_channel *, const uint8_t b) -- Write a single uint8_t to the device
FUNC_C_2_S status; // short status(t_channel *) -- Get the status of the device
FUNC_C_2_S flush; // short flush(t_channel *) -- Ensure that any pending writes to teh device have been completed
FUNC_CLS_2_S seek; // short cdev_seek(t_channel *, long position, short base) -- attempt to move the "cursor" position in the channel
FUNC_CSBS_2_S ioctrl; // short ioctrl(t_channel *, short command, uint8_t * buffer, short size)) -- Issue a control command to the device
} t_dev_chan, *p_dev_chan;
/*=========================================
* dev/blocks
*========================================*/
//
// Preset block device numbers
//
#define BDEV_DEVICES_MAX 8
#define BDEV_SDC 0
#define BDEV_FDC 1
#define BDEV_HDC 2
//
// Structure defining a block device's functions
//
typedef struct s_dev_block {
short number; // The number of the device (assigned by registration)
char * name; // The name of the device
FUNC_V_2_S init; // short init() -- Initialize the device
FUNC_LBS_2_S read; // short read(long lba, byte * buffer, short size) -- Read a block from the device
FUNC_LcBS_2_S write; // short write(long lba, byte * buffer, short size) -- Write a block to the device
FUNC_V_2_S status; // short status() -- Get the status of the device
FUNC_V_2_S flush; // short flush() -- Ensure that any pending writes to teh device have been completed
FUNC_SBS_2_S ioctrl; // short ioctrl(short command, byte * buffer, short size)) -- Issue a control command to the device
} t_dev_block, *p_dev_block;
/*=========================================
* dev/fsys
*========================================*/
#define MAX_PATH_LEN 256
#define DEFAULT_CHUNK_SIZE 256
/**
* Type for directory information about a file
*/
typedef struct s_file_info {
long size;
unsigned short date;
unsigned short time;
unsigned char attributes;
char name[MAX_PATH_LEN];
} t_file_info, * p_file_info;
/*
* Pointer type for file loaders
*
* short loader(short chan, destination, start);
*/
typedef short (*p_file_loader)(short chan, long destination, long * start);
/*=========================================
* dev/rtc
*========================================*/
typedef struct s_time {
short year;
short month;
short day;
short hour;
short minute;
short second;
short is_pm;
short is_24hours;
} t_time, *p_time;
/*=========================================
* sys_info
*========================================*/
/* IDs for the various Foenix machines supported */
#define MODEL_FOENIX_FMX 0
#define MODEL_FOENIX_C256U 1
#define MODEL_FOENIX_GENX 4
#define MODEL_FOENIX_C256U_PLUS 5
#define MODEL_FOENIX_A2560U_PLUS 6
#define MODEL_FOENIX_A2560X 8
#define MODEL_FOENIX_A2560U 9
#define MODEL_FOENIX_A2560K 13
/* IDs for the CPUs supported */
#define CPU_WDC65816 0x16 /* CPU code for the Western Design Center 65816 */
#define CPU_M68000 0x20 /* CPU code for the Motorola 68000 */
#define CPU_M68010 0x21 /* CPU code for the Motorola 68010 */
#define CPU_M68020 0x22 /* CPU code for the Motorola 68020 */
#define CPU_M68030 0x23 /* CPU code for the Motorola 68030 */
#define CPU_M68040 0x24 /* CPU code for the Motorola 68040 */
#define CPU_I486DX 0x34 /* CPU code for the Intel 486DX */
/*
* Structure to describe the hardware
*/
typedef struct s_sys_info {
unsigned short mcp_version; /* Current version of the MCP kernel */
unsigned short mcp_rev; /* Current revision, or sub-version of the MCP kernel */
unsigned short mcp_build; /* Current vuild # of the MCP kernel */
unsigned short model; /* Code to say what model of machine this is */
const char * model_name; /* Human readable name of the model of the computer */
unsigned short cpu; /* Code to say which CPU is running */
const char * cpu_name; /* Human readable name for the CPU */
unsigned long fpga_date; /* BCD date describing the date of the FPGA built: YYYYMMDD */
char pcb_version[4]; /* PCB version (string) */
unsigned long fpga_model; /* FPGA model number */
unsigned short fpga_version; /* FPGA version */
unsigned short fpga_subver; /* FPGA sub-version */
unsigned short vicky_rev; /* Code for the VICKY revision number */
long system_ram_size; /* The number of bytes of system RAM on the board */
bool has_floppy; /* TRUE if the board has a floppy drive installed */
bool has_hard_drive; /* TRUE if the board has a PATA device installed */
bool has_expansion_card; /* TRUE if an expansion card is installed on the device */
bool has_ethernet; /* TRUE if an ethernet port is present */
unsigned short screens; /* How many screens are on this computer */
} t_sys_info, *p_sys_info;
#endif

View file

@ -0,0 +1,14 @@
#ifndef __SETJMP_H
#define __SETJMP_H 1
#if defined(__M68881) || defined(__M68882)
/* direct FPU support */
typedef unsigned char jmp_buf[13*4+6*12];
#else
typedef unsigned char jmp_buf[13*4];
#endif
int setjmp (jmp_buf);
void longjmp (jmp_buf, int);
#endif /* __SETJMP_H */

View file

@ -0,0 +1,21 @@
#ifndef __SIGNAL_H
#define __SIGNAL_H 1
typedef volatile int sig_atomic_t;
void (*signal(int,void (*)(int)))(int);
int raise(int);
#define SIGABRT 1
#define SIGFPE 2
#define SIGILL 3
#define SIGINT 4
#define SIGSEGV 5
#define SIGTERM 6
#define SIG_ERR (void (*)(int))0
#define SIG_DFL (void (*)(int))1
#define SIG_IGN (void (*)(int))2
#endif

View file

@ -0,0 +1,26 @@
#ifndef __STDARG_H
#define __STDARG_H 1
typedef unsigned char *va_list;
#if __INTSIZE == 16
#define __va_align(type) (__alignof(type)>=2?__alignof(type):2)
#else
#define __va_align(type) (__alignof(type)>=4?__alignof(type):4)
#endif
#define __va_do_align(vl,type) ((vl)=(char *)((((unsigned long)(vl))+__va_align(type)-1)/__va_align(type)*__va_align(type)))
#define __va_mem(vl,type) (__va_do_align((vl),type),(vl)+=sizeof(type),((type*)(vl))[-1])
#define va_start(ap, lastarg) ((ap)=(va_list)(&lastarg+1))
#define va_arg(vl,type) __va_mem(vl,type)
#define va_end(vl) ((vl)=0)
#if __STDC_VERSION__ >= 199901L
#define va_copy(new,old) ((new)=(old))
#endif
#endif

View file

@ -0,0 +1,10 @@
#ifndef __STDBOOL_H
#define __STDBOOL_H 1
typedef unsigned char bool; /* temporary until vbcc supports _Bool */
/* #define bool _Bool */
#define true 1
#define false 0
#define __bool_true_false_are_defined 1
#endif /* __STDBOOL_H */

View file

@ -0,0 +1,37 @@
#ifndef __STDDEF_H
#define __STDDEF_H 1
/*
Adapt as needed.
*/
#ifndef __SIZE_T
#define __SIZE_T 1
#ifdef __SIZE_T_INT
typedef unsigned int size_t;
#else
typedef unsigned long size_t;
#endif
#endif
/*
Adapt as needed.
*/
#ifndef __PTRDIFF_T
#define __PTRDIFF_T 1
typedef long ptrdiff_t;
#endif
#ifndef __WCHAR_T
#define __WCHAR_T
typedef char wchar_t;
#endif
#undef NULL
#define NULL ((void *)0)
#undef offsetof
#define offsetof(P,M) __offsetof(P,M)
#endif

View file

@ -0,0 +1,118 @@
#ifndef __STDINT_H
#define __STDINT_H 1
#include <limits.h>
typedef signed char int8_t;
typedef signed short int16_t;
typedef signed long int32_t;
typedef signed long long int64_t;
#define INT8_MIN SCHAR_MIN
#define INT8_MAX SCHAR_MAX
#define INT16_MIN SHRT_MIN
#define INT16_MAX SHRT_MAX
#define INT32_MIN LONG_MIN
#define INT32_MAX LONG_MAX
#define INT64_MIN LLONG_MIN
#define INT64_MAX LLONG_MAX
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned long uint32_t;
typedef unsigned long long uint64_t;
#define UINT8_MAX UCHAR_MAX
#define UINT16_MAX USHRT_MAX
#define UINT32_MAX ULONG_MAX
#define UINT64_MAX ULLONG_MAX
typedef signed char int_least8_t;
typedef signed short int_least16_t;
typedef signed long int_least32_t;
typedef signed long long int_least64_t;
#define INT_LEAST8_MIN SCHAR_MIN
#define INT_LEAST8_MAX SCHAR_MAX
#define INT_LEAST16_MIN SHRT_MIN
#define INT_LEAST16_MAX SHRT_MAX
#define INT_LEAST32_MIN LONG_MIN
#define INT_LEAST32_MAX LONG_MAX
#define INT_LEAST64_MIN LLONG_MIN
#define INT_LEAST64_MAX LLONG_MAX
typedef unsigned char uint_least8_t;
typedef unsigned short uint_least16_t;
typedef unsigned long uint_least32_t;
typedef unsigned long long uint_least64_t;
#define UINT_LEAST8_MAX UCHAR_MAX
#define UINTLEAST16_MAX USHRT_MAX
#define UINTLEAST32_MAX ULONG_MAX
#define UINTLEAST64_MAX ULLONG_MAX
typedef signed int int_fast8_t;
typedef signed int int_fast16_t;
typedef signed long int_fast32_t;
typedef signed long long int_fast64_t;
#define INT_FAST8_MIN INT_MIN
#define INT_FAST8_MAX INT_MAX
#define INT_FAST16_MIN INT_MIN
#define INT_FAST16_MAX INT_MAX
#define INT_FAST32_MIN LONG_MIN
#define INT_FAST32_MAX LONG_MAX
#define INT_FAST64_MIN LLONG_MIN
#define INT_FAST64_MAX LLONG_MAX
typedef unsigned int uint_fast8_t;
typedef unsigned int uint_fast16_t;
typedef unsigned long uint_fast32_t;
typedef unsigned long long uint_fast64_t;
#define UINT_FAST8_MAX UINT_MAX
#define UINT_FAST16_MAX UINT_MAX
#define UINT_FAST32_MAX ULONG_MAX
#define UINT_FAST64_MAX ULLONG_MAX
typedef long intptr_t;
#define INTPTR_MIN LONG_MIN
#define INTPTR_MAX LONG_MAX
typedef unsigned long uintptr_t;
#define UINTPTR_MAX ULONG_MAX
typedef long long intmax_t;
#define INTMAX_MIN LLONG_MIN
#define INTMAX_MAX LLONG_MAX
typedef unsigned long long uintmax_t;
#define UINTMAX_MAX ULLONG_MAX
#define SIG_ATOMIC_MIN INT_MIN
#define SIG_ATOMIC_MAX INT_MAX
#define SIZE_MAX ULONG_MAX
#define WCHAR_MIN CHAR_MIN
#define WCHAR_MAX CHAR_MAX
#define WINT_MIN INT_MIN
#define WINT_MAX INT_MAX
#define INT8_C(x) x
#define INT16_C(x) x
#if __INTSIZE == 16
#define INT32_C(x) x##L
#else
#define INT32_C(x) x
#endif
#define INT64_C(x) x##LL
#define INTMAX_C(x) x##LL
#define UINT8_C(x) x##U
#define UINT16_C(x) x##U
#if __INTSIZE == 16
#define UINT32_C(x) x##UL
#else
#define UINT32_C(x) x##U
#endif
#define UINT64_C(x) x##ULL
#define UINTMAX_C(x) x##ULL
#endif /* __STDINT_H */

View file

@ -0,0 +1,193 @@
#ifndef __STDIO_H
#define __STDIO_H 1
#define EOF (-1)
#ifndef BUFSIZ
#define BUFSIZ 1024L
#endif
#define FOPEN_MAX 1024 /* Does not really matter */
#define _IOFBF 1L
#define _IOLBF 2L
#define _IONBF 3L
#define HASBUF 1L
#define NOBUFMEM 2L
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#define _READ 1
#define _WRITE 2
#define _UNBUF 4
#define _EOF 8
#define _ERR 16
#define _READABLE 32
#define _WRITEABLE 64
#define _LINEBUF 128
#define _NOTMYBUF 256
#define _ISTTY 512
/* Define this for CRLF-conversion in text-mode
#define _CLE 16384
*/
#ifdef __BUILD_LIB
#define HAVE_TTYS 1
#include "libsys.h"
#ifdef HAVE_TTYS
extern int __isatty(int);
#endif
#endif
#ifdef __VCLIB_SIMPLEIO
typedef struct _iobuf
{
unsigned char filehandle;
unsigned char flags;
unsigned int count;
unsigned int bufsize;
char *pointer;
char *base; /* buffer address */
struct _iobuf *next;
} FILE;
#else
typedef struct _iobuf
{
int filehandle; /* filehandle */
char *pointer;
char *base; /* buffer address */
struct _iobuf *next;
struct _iobuf *prev;
int count;
int flags;
int bufsize;
#ifdef _CLE
int clebuf; /* buffered char during CRLF conversion */
#endif
} FILE;
#endif
/* Have to be initialized in _main(). */
extern FILE *stdin, *stdout, *stderr;
int _fillbuf(FILE *),_putbuf(int,FILE *),_flushbuf(FILE *);
void _ttyflush(void);
#define L_tmpnam 30
#define TMP_MAX FOPEN_MAX
#define FILENAME_MAX 107
/*
Adapt corresponding to stddef.h
*/
#ifndef __SIZE_T
#define __SIZE_T 1
#ifdef __SIZE_T_INT
typedef unsigned int size_t;
#else
typedef unsigned long size_t;
#endif
#endif
/*
Adapt as needed.
*/
#ifndef __FPOS_T
#define __FPOS_T 1
typedef long fpos_t;
#endif
#ifndef __STDARG_H
#include <stdarg.h>
#endif
#undef NULL
#define NULL ((void*)0)
FILE *fopen(const char *,const char *);
FILE *freopen(const char *,const char *,FILE *);
int fflush(FILE *);
int fclose(FILE *);
int rename(const char *,const char *);
int remove(const char *);
FILE *tmpfile(void);
char *tmpnam(char *);
int setvbuf(FILE *,char *,int,size_t);
void setbuf(FILE *,char *);
int fprintf(FILE *, const char *, ...);
int printf(const char *, ...);
int sprintf(char *, const char *,...);
int snprintf(char *,size_t,const char *,...);
/*
Simple versions of IO functions (see vbcc documentation).
If versions with __v1 or __v2 are declared they are also used.
*/
int __v0fprintf(FILE *, const char *);
int __v0printf(const char *);
int __v0sprintf(char *, const char *);
int vprintf(const char *,va_list);
int vfprintf(FILE *,const char *,va_list);
int vsprintf(char *,const char *,va_list);
int vsnprintf(char *,size_t,const char *,va_list);
int fscanf(FILE *, const char *, ...);
int scanf(const char *, ...);
int sscanf(const char *, const char *, ...);
int vscanf(const char *,va_list);
int vfscanf(FILE *,const char *,va_list);
int vsscanf(const char *,const char *,va_list);
char *fgets(char *, int, FILE *);
int fputs(const char *, FILE *);
char *gets(char *);
int puts(const char *);
int ungetc(int,FILE *);
size_t fread(void *,size_t,size_t,FILE *);
size_t fwrite(void *,size_t,size_t,FILE *);
int fseek(FILE *,long,int);
void rewind(FILE *);
long ftell(FILE *);
int fgetpos(FILE *,fpos_t *);
int fsetpos(FILE *,const fpos_t *);
void perror(const char *);
int fgetc(FILE *);
int fputc(int,FILE *);
int getchar(void);
int putchar(int);
#ifndef __VCLIB_SIMPLEIO
#if defined(_CLE)
int __putc(int,FILE *);
int __getc(FILE *);
#else
#define __putc(x,f) __rawputc((x),(f))
#define __getc(f) __rawgetc(f)
#endif
#define __check(arg,type) (volatile)sizeof((arg)==(type)0)
#define __rawputc(x,p) (((p)->flags|=_WRITE),((--((FILE*)(p))->count>=0&&((x)!='\n'||!(((FILE*)(p))->flags&_LINEBUF)))?(unsigned char)(*((FILE*)(p))->pointer++=(x)):_putbuf((x),p)))
#define putc(x,f) __putc((x),(f))
#define putchar(x) __putc((x),stdout)
#define __rawgetc(p) (__check((p),FILE*),((p)->flags|=_READ),--((FILE*)(p))->count>=0?(unsigned char)*((FILE*)(p))->pointer++:_fillbuf(p))
#define getc(f) __getc(f)
#define getchar() __getc(stdin)
#endif
#define feof(p) (__check((p),FILE*),((FILE*)(p))->flags&_EOF)
#define ferror(p) (__check((p),FILE*),((FILE*)(p))->flags&_ERR)
#define clearerr(p) (__check((p),FILE*),((FILE*)(p))->flags&=~(_ERR|_EOF))
#define fsetpos(f,ptr) fseek((f),*(ptr),SEEK_SET)
#ifdef __VBCC__
#pragma printflike printf
#pragma printflike fprintf
#pragma printflike sprintf
#pragma printflike snprintf
#pragma scanflike scanf
#pragma scanflike fscanf
#pragma scanflike sscanf
#endif
#endif

View file

@ -0,0 +1,133 @@
#ifndef __STDLIB_H
#define __STDLIB_H 1
#ifndef __SIZE_T
#define __SIZE_T 1
typedef unsigned long size_t;
#endif
#ifndef __WCHAR_T
#define __WCHAR_T 1
typedef char wchar_t;
#endif
#undef NULL
#define NULL ((void *)0)
#undef EXIT_FAILURE
#define EXIT_FAILURE 20
#undef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#undef RAND_MAX
#define RAND_MAX 32767
void exit(int);
#if __STDC_VERSION__ >= 199901L
void _Exit(int);
#endif
void *malloc(size_t);
void *calloc(size_t,size_t);
void *realloc(void *,size_t);
void free(void *);
int system(const char *);
int rand(void);
void srand(unsigned int);
double atof(const char *);
int atoi(const char *);
long atol(const char *);
#if __STDC_VERSION__ >= 199901L
long long atoll(const char *);
#endif
double strtod(const char *,char **);
long strtol(const char *,char **,int);
#if __STDC_VERSION__ >= 199901L
signed long long strtoll(const char *,char **,int);
#endif
unsigned long strtoul(const char *,char **,int);
#if __STDC_VERSION__ >= 199901L
unsigned long long strtoull(const char *,char **,int);
#endif
void abort(void);
int atexit(void (*)(void));
char *getenv(const char *);
void *bsearch(const void *,const void *,size_t,size_t,int (*)(const void *,const void *));
void qsort(void *,size_t,size_t,int (*)(const void *,const void *));
typedef struct {
int quot,rem;
} div_t;
typedef struct {
long quot,rem;
} ldiv_t;
#if __STDC_VERSION__ >= 199901L
typedef struct {
long long quot,rem;
} lldiv_t;
#endif
div_t div(int,int);
ldiv_t ldiv(long,long);
#if __STDC_VERSION__ >= 199901L
lldiv_t lldiv(long long,long long);
#endif
int abs(int);
long labs(long);
#if __STDC_VERSION__ >= 199901L
long long llabs(long long);
#endif
#ifndef __NOINLINE__
int abs(__reg("d0") int) =
"\tinline\n"
"\ttst.l\td0\n"
"\tbpl\t.skip\n"
"\tneg.l\td0\n"
".skip\n"
"\teinline";
long labs(__reg("d0") long) =
"\tinline\n"
"\ttst.l\td0\n"
"\tbpl\t.skip\n"
"\tneg.l\td0\n"
".skip\n"
"\teinline";
#if __STDC_VERSION__ >= 199901L
long long llabs(__reg("d0/d1") long long) =
"\tinline\n"
"\ttst.l\td0\n"
"\tbpl\t.skip\n"
"\tneg.l\td1\n"
"\tnegx.l\td0\n"
".skip\n"
"\teinline";
#endif
#if !defined(__M68000) && !defined(__M68010)
div_t div(__reg("d0") int,__reg("d1") int) =
"\tinline\n"
"\tdivsl.l\td1,d1:d0\n"
"\teinline";
ldiv_t ldiv(__reg("d0") long,__reg("d1") long) =
"\tinline\n"
"\tdivsl.l\td1,d1:d0\n"
"\teinline";
#endif
#endif /* __NOINLINE__ */
#define atof(s) strtod((s),(char **)NULL)
#define atoi(s) (int)strtol((s),(char **)NULL,10)
#define atol(s) strtol((s),(char **)NULL,10)
extern size_t _nalloc;
struct __exitfuncs{
struct __exitfuncs *next;
void (*func)(void);
};
#endif /* __STDLIB_H */

View file

@ -0,0 +1,359 @@
#ifndef __STRING_H
#define __STRING_H 1
#ifndef __SIZE_T
#define __SIZE_T 1
typedef unsigned long size_t;
#endif
#undef NULL
#define NULL ((void *)0)
void *memcpy(void *,const void *,size_t);
void *memmove(void *,const void *,size_t);
char *strcpy(char *,const char *);
char *strncpy(char *,const char *,size_t);
char *strcat(char *,const char *);
char *strncat(char *,const char *,size_t);
int memcmp(const void *,const void *,size_t);
int strcmp(const char *,const char *);
int strncmp(const char *,const char *,size_t);
void *memchr(const void *,int,size_t);
char *strchr(const char *,int);
size_t strcspn(const char *,const char *);
char *strpbrk(const char *,const char *);
char *strrchr(const char *,int);
size_t strspn(const char *,const char *);
char *strstr(const char *,const char *);
void *memset(void *,int,size_t);
size_t strlen(const char *);
char *strtok(char *,const char *);
char *strerror(int);
int strcoll(const char *,const char *);
size_t strxfrm(char *,const char *,size_t);
#ifndef __NOINLINE__
#if defined(__M68000) || defined(__M68010)
void *memcpy(__reg("a0") void *, __reg("a1") const void *,
__reg("d2") size_t) =
"\tinline\n"
"\tmove.l\ta0,d0\n"
"\tcmp.l\t#16,d2\n"
"\tblo\t.l5\n"
"\tmoveq\t#1,d1\n"
"\tand.b\td0,d1\n"
"\tbeq\t.l1\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tsubq.l\t#1,d2\n"
".l1\n"
"\tmove.l\ta1,d1\n"
"\tand.b\t#1,d1\n"
"\tbeq\t.l3\n"
"\tcmp.l\t#$10000,d2\n"
"\tblo\t.l5\n"
".l2\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tsubq.l\t#1,d2\n"
"\tbne\t.l2\n"
"\tbra\t.l7\n"
".l3\n"
"\tmoveq\t#3,d1\n"
"\tand.l\td2,d1\n"
"\tsub.l\td1,d2\n"
".l4\n"
"\tmove.l\t(a1)+,(a0)+\n"
"\tsubq.l\t#4,d2\n"
"\tbne\t.l4\n"
"\tmove.w\td1,d2\n"
".l5\n"
"\tsubq.w\t#1,d2\n"
"\tblo\t.l7\n"
".l6\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tdbf\td2,.l6\n"
".l7\n"
"\teinline";
void *__memcpy_desc(__reg("a0") void *, __reg("a1") const void *,
__reg("d2") size_t) =
"\tinline\n"
"\tcmp.l\t#16,d2\n"
"\tblo\t.l5\n"
"\tmoveq\t#1,d1\n"
"\tmove.l\ta0,d0\n"
"\tand.b\td1,d0\n"
"\tbeq\t.l1\n"
"\tmove.b\t-(a1),-(a0)\n"
"\tsubq.l\t#1,d2\n"
".l1\n"
"\tmove.l\ta1,d0\n"
"\tand.b\td1,d0\n"
"\tbeq\t.l3\n"
"\tcmp.l\t#$10000,d2\n"
"\tblo\t.l5\n"
".l2\n"
"\tmove.b\t-(a1),-(a0)\n"
"\tsubq.l\t#1,d2\n"
"\tbne\t.l2\n"
"\tbra\t.l7\n"
".l3\n"
"\tmoveq\t#3,d1\n"
"\tand.l\td2,d1\n"
"\tsub.l\td1,d2\n"
".l4\n"
"\tmove.l\t-(a1),-(a0)\n"
"\tsubq.l\t#4,d2\n"
"\tbne\t.l4\n"
"\tmove.w\td1,d2\n"
".l5\n"
"\tsubq.w\t#1,d2\n"
"\tblo\t.l7\n"
".l6\n"
"\tmove.b\t-(a1),-(a0)\n"
"\tdbf\td2,.l6\n"
".l7\n"
"\tmove.l\ta0,d0\n"
"\teinline";
void *memset(__reg("a0") void *, __reg("d0") int, __reg("d2") size_t) =
"\tinline\n"
"\tmove.l\ta0,a1\n"
"\tcmp.l\t#16,d2\n"
"\tblo\t.l3\n"
"\tmove.l\ta0,d1\n"
"\tand.b\t#1,d1\n"
"\tbeq\t.l1\n"
"\tmove.b\td0,(a0)+\n"
"\tsubq.l\t#1,d2\n"
".l1\n"
"\tmove.b\td0,d1\n"
"\tlsl.w\t#8,d0\n"
"\tmove.b\td1,d0\n"
"\tmove.w\td0,d1\n"
"\tswap\td0\n"
"\tmove.w\td1,d0\n"
"\tmoveq\t#3,d1\n"
"\tand.l\td2,d1\n"
"\tsub.l\td1,d2\n"
".l2\n"
"\tmove.l\td0,(a0)+\n"
"\tsubq.l\t#4,d2\n"
"\tbne\t.l2\n"
"\tmove.w\td1,d2\n"
".l3\n"
"\tsubq.w\t#1,d2\n"
"\tblo\t.l5\n"
".l4\n"
"\tmove.b\td0,(a0)+\n"
"\tdbf\td2,.l4\n"
".l5\n"
"\tmove.l\ta1,d0\n"
"\teinline";
#else /* 68020+ */
void *memcpy(__reg("a0") void *, __reg("a1") const void *, __reg("d2") size_t) =
"\tinline\n"
"\tmove.l\ta0,d0\n"
"\tsubq.l\t#4,d2\n"
"\tbcs\t.l3\n"
"\tmove.l\td0,d1\n"
"\tlsr.l\t#1,d1\n"
"\tbcc\t.l1\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tsubq.l\t#1,d2\n"
"\tbcs\t.l3\n"
"\taddq.l\t#1,d1\n"
".l1\n"
"\tlsr.l\t#1,d1\n"
"\tbcc\t.l2\n"
"\tmove.w\t(a1)+,(a0)+\n"
"\tsubq.l\t#2,d2\n"
"\tbcs\t.l3\n"
".l2\n"
"\tmove.l\t(a1)+,(a0)+\n"
"\tsubq.l\t#4,d2\n"
"\tbcc\t.l2\n"
".l3\n"
"\taddq.l\t#3,d2\n"
"\tbcc\t.l5\n"
".l4\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tdbf\td2,.l4\n"
".l5\n"
"\teinline";
void *__memcpy_desc(__reg("a0") void *, __reg("a1") const void *,
__reg("d2") size_t) =
"\tinline\n"
"\tsubq.l\t#4,d2\n"
"\tbcs\t.l3\n"
"\tmove.l\ta0,d0\n"
"\tlsr.l\t#1,d0\n"
"\tbcc\t.l1\n"
"\tmove.b\t-(a1),-(a0)\n"
"\tsubq.l\t#1,d2\n"
"\tbcs\t.l3\n"
".l1\n"
"\tlsr.l\t#1,d0\n"
"\tbcc\t.l2\n"
"\tmove.w\t-(a1),-(a0)\n"
"\tsubq.l\t#2,d2\n"
"\tbcs\t.l3\n"
".l2\n"
"\tmove.l\t-(a1),-(a0)\n"
"\tsubq.l\t#4,d2\n"
"\tbcc\t.l2\n"
".l3\n"
"\taddq.l\t#3,d2\n"
"\tbcc\t.l5\n"
".l4\n"
"\tmove.b\t-(a1),-(a0)\n"
"\tdbf\td2,.l4\n"
".l5\n"
"\tmove.l\ta0,d0\n"
"\teinline";
void *memset(__reg("a0") void *, __reg("d0") int, __reg("d2") size_t) =
"\tinline\n"
"\tmove.l\ta0,a1\n"
"\tsubq.l\t#8,d2\n"
"\tbcs\t.l3\n"
"\tmove.l\td0,d1\n"
"\tlsl.l\t#8,d0\n"
"\tmove.b\td1,d0\n"
"\taddq.l\t#4,d2\n"
"\tmove.l\td0,d1\n"
"\tswap\td0\n"
"\tmove.w\td1,d0\n"
"\tmove.l\ta1,d1\n"
"\tlsr.l\t#1,d1\n"
"\tbcc\t.l1\n"
"\tmove.b\td0,(a0)+\n"
"\taddq.l\t#1,d1\n"
"\tsubq.l\t#1,d2\n"
".l1\n"
"\tlsr.l\t#1,d1\n"
"\tbcc\t.l2\n"
"\tmove.w\td0,(a0)+\n"
"\tsubq.l\t#2,d2\n"
".l2\n"
"\tmove.l\td0,(a0)+\n"
"\tsubq.l\t#4,d2\n"
"\tbcc\t.l2\n"
"\taddq.l\t#3,d2\n"
"\tbcs\t.l4\n"
"\tbra\t.l5\n"
".l3\n"
"\taddq.l\t#7,d2\n"
"\tbcc\t.l5\n"
".l4\n"
"\tmove.b\td0,(a0)+\n"
"\tdbf\td2,.l4\n"
".l5\n"
"\tmove.l\ta1,d0\n"
"\teinline";
#endif /* 68020+ */
size_t strlen(__reg("a0") const char *) =
"\tinline\n"
"\tmove.l\ta0,d0\n"
".l1\n"
"\ttst.b\t(a0)+\n"
"\tbne\t.l1\n"
"\tsub.l\ta0,d0\n"
"\tnot.l\td0\n"
"\teinline";
char *strcpy(__reg("a0") char *, __reg("a1") const char *) =
"\tinline\n"
"\tmove.l\ta0,d0\n"
".l1\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tbne\t.l1\n"
"\teinline";
char *strncpy(__reg("a0") char *, __reg("a1") const char *,
__reg("d1") size_t) =
"\tinline\n"
"\tmove.l\ta0,d0\n"
"\tbra\t.l2\n"
".l1\n"
"\tmove.b\t(a1),(a0)+\n"
"\tbeq\t.l2\n"
"\taddq.l\t#1,a1\n"
".l2\n"
"\tsubq.l\t#1,d1\n"
"\tbpl\t.l1\n"
"\teinline";
int strcmp(__reg("a0") const char *, __reg("a1") const char *) =
"\tinline\n"
"\tmoveq\t#0,d0\n"
"\tmoveq\t#0,d1\n"
".l1\n"
"\tmove.b\t(a0)+,d0\n"
"\tmove.b\t(a1)+,d1\n"
"\tbeq\t.l2\n"
"\tsub.l\td1,d0\n"
"\tbeq\t.l1\n"
"\tmoveq\t#0,d1\n"
".l2\n"
"\tsub.l\td1,d0\n"
"\teinline";
int strncmp(__reg("a0") const char *, __reg("a1") const char *,
__reg("d2") size_t) =
"\tinline\n"
"\tmoveq\t#0,d0\n"
"\tmoveq\t#0,d1\n"
".l1\n"
"\tsubq.l\t#1,d2\n"
"\tbmi\t.l3\n"
"\tmove.b\t(a0)+,d0\n"
"\tmove.b\t(a1)+,d1\n"
"\tbeq\t.l2\n"
"\tsub.l\td1,d0\n"
"\tbeq\t.l1\n"
"\tmoveq\t#0,d1\n"
".l2\n"
"\tsub.l\td1,d0\n"
".l3\n"
"\teinline";
char *strcat(__reg("a0") char *, __reg("a1") const char *) =
"\tinline\n"
"\tmove.l\ta0,d0\n"
".l1\n"
"\ttst.b\t(a0)+\n"
"\tbne\t.l1\n"
"\tsubq.l\t#1,a0\n"
".l2\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tbne\t.l2\n"
"\teinline";
char *strncat(__reg("a0") char *, __reg("a1") const char *,
__reg("d1") size_t) =
"\tinline\n"
"\tmove.l\ta0,d0\n"
"\ttst.l\td1\n"
"\tbeq\t.l3\n"
".l1\n"
"\ttst.b\t(a0)+\n"
"\tbne\t.l1\n"
"\tsubq.l\t#1,a0\n"
".l2\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tbeq\t.l3\n"
"\tsubq.l\t#1,d1\n"
"\tbne\t.l2\n"
".l3\n"
"\teinline";
char *strrchr(__reg("a0") const char *, __reg("d1") int) =
"\tinline\n"
"\tmoveq\t#0,d0\n"
".l1\n"
"\tcmp.b\t(a0),d1\n"
"\tbne\t.l2\n"
"\tmove.l\ta0,d0\n"
".l2\n"
"\ttst.b\t(a0)+\n"
"\tbne\t.l1\n"
"\teinline";
#define memmove(d,s,n) ((d)<=(s) ? memcpy(d,s,n) : \
__memcpy_desc((char *)(d)+(n),(char *)(s)+(n),n))
#endif /* __NOINLINE__ */
#endif /* __STRING_H */

View file

@ -0,0 +1,54 @@
#ifndef __TIME_H
#define __TIME_H 1
#ifndef __TIME_T
#define __TIME_T 1
typedef long time_t;
#endif
#ifndef __CLOCK_T
#define __CLOCK_T 1
typedef long clock_t;
#endif
#ifndef __SIZE_T
#define __SIZE_T 1
typedef unsigned long size_t;
#endif
#undef NULL
#define NULL ((void *)0)
struct tm {
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
/* long tm_gmtoff;
char *tm_zone;*/
};
time_t time(time_t *);
double difftime(time_t,time_t);
char *ctime(const time_t *);
char *asctime(const struct tm *);
clock_t clock(void);
struct tm *gmtime(const time_t *);
struct tm *localtime(const time_t *);
time_t mktime(struct tm *);
size_t strftime(char *,size_t,const char *,const struct tm *);
/*
Adapt as needed.
*/
#define CLOCKS_PER_SEC 50
#define difftime(a,b) ((double)((a)-(b)))
#endif

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,28 @@
RAMSTART = 0x00020000;
RAMSIZE = 0x00030000;
STACKLEN = 0x400;
MEMORY
{
ram : org = RAMSTART, len = RAMSIZE - STACKLEN
}
SECTIONS
{
text : {*(CODE)} >ram
.dtors : { *(.dtors) } > ram
.ctors : { *(.ctors) } > ram
rodata : {*(RODATA)} >ram
data: {*(DATA)} >ram
bss (NOLOAD): {*(BSS)} >ram
___heap = ADDR(bss) + SIZEOF(bss);
___heapend = RAMSTART + RAMSIZE - STACKLEN;
___BSSSTART = ADDR(bss);
___BSSSIZE = SIZEOF(bss);
___STACK = RAMSTART + RAMSIZE;
}

View file

@ -1,58 +1,56 @@
#ifndef __CTYPE_H
#define __CTYPE_H 1
extern const unsigned char __ctype[];
int isalnum(int);
int isalpha(int);
int isblank(int);
int iscntrl(int);
int isdigit(int);
int isgraph(int);
int islower(int);
int isprint(int);
int ispunct(int);
int isspace(int);
int isupper(int);
int isxdigit(int);
#define isalpha(x) (__ctype[(x)+1] & 3)
#define isblank(x) ((x)==9 || (x)==32)
#define isupper(x) (__ctype[(x)+1] & 1)
#define islower(x) (__ctype[(x)+1] & 2)
#define isdigit(x) (__ctype[(x)+1] & 4)
#define isxdigit(x) (__ctype[(x)+1] & 68)
#define isalnum(x) (__ctype[(x)+1] & 7)
#define isspace(x) (__ctype[(x)+1] & 8)
#define ispunct(x) (__ctype[(x)+1] & 16)
#define iscntrl(x) (__ctype[(x)+1] & 32)
#define isprint(x) (__ctype[(x)+1] & 151)
#define isgraph(x) (__ctype[(x)+1] & 23)
int toupper(int);
int tolower(int);
#ifndef __NOINLINE__
__regsused("d0/a0") int __asm_toupper(__reg("d0") int) =
"\tinline\n"
"\txref\t___ctype\n"
"\tlea\t___ctype,a0\n"
"\tbtst\t#1,(1,a0,d0.w)\n"
"\tbeq\t.skip\n"
"\tand.b\t#$df,d0\n"
".skip\n"
"\teinline";
__regsused("d0/a0") int __asm_tolower(__reg("d0") int) =
"\tinline\n"
"\txref\t___ctype\n"
"\tlea\t___ctype,a0\n"
"\tbtst\t#0,(1,a0,d0.w)\n"
"\tbeq\t.skip\n"
"\tor.b\t#$20,d0\n"
".skip\n"
"\teinline";
#define toupper(c) __asm_toupper(c)
#define tolower(c) __asm_tolower(c)
#endif /* __NOINLINE__ */
#endif /* __CTYPE_H */
#ifndef __CTYPE_H
#define __CTYPE_H 1
extern const unsigned char __ctype[];
int isalnum(int);
int isalpha(int);
int isblank(int);
int iscntrl(int);
int isdigit(int);
int isgraph(int);
int islower(int);
int isprint(int);
int ispunct(int);
int isspace(int);
int isupper(int);
int isxdigit(int);
#define isalpha(x) (__ctype[(x)+1] & 3)
#define isblank(x) ((x)==9 || (x)==32)
#define isupper(x) (__ctype[(x)+1] & 1)
#define islower(x) (__ctype[(x)+1] & 2)
#define isdigit(x) (__ctype[(x)+1] & 4)
#define isxdigit(x) (__ctype[(x)+1] & 68)
#define isalnum(x) (__ctype[(x)+1] & 7)
#define isspace(x) (__ctype[(x)+1] & 8)
#define ispunct(x) (__ctype[(x)+1] & 16)
#define iscntrl(x) (__ctype[(x)+1] & 32)
#define isprint(x) (__ctype[(x)+1] & 151)
#define isgraph(x) (__ctype[(x)+1] & 23)
int toupper(int);
int tolower(int);
#ifndef __NOINLINE__
int toupper(__reg("d0") int) =
"\tinline\n"
"\txref\t___ctype\n"
"\tlea\t___ctype,a0\n"
"\tbtst\t#1,(1,a0,d0.w)\n"
"\tbeq\t.skip\n"
"\tand.b\t#$df,d0\n"
".skip\n"
"\teinline";
int tolower(__reg("d0") int) =
"\tinline\n"
"\txref\t___ctype\n"
"\tlea\t___ctype,a0\n"
"\tbtst\t#0,(1,a0,d0.w)\n"
"\tbeq\t.skip\n"
"\tor.b\t#$20,d0\n"
".skip\n"
"\teinline";
#endif /* __NOINLINE__ */
#endif /* __CTYPE_H */

View file

@ -1,162 +1,147 @@
#ifndef __FENV_H
#define __FENV_H 1
typedef unsigned long fenv_t;
typedef unsigned long fexcept_t;
/* rounding mode used by fegetround() and fesetround() */
#define FE_TONEAREST 0x00 /* round toward nearest (round) */
#define FE_TOWARDZERO 0x10 /* round toward zero (trunc) */
#define FE_DOWNWARD 0x20 /* round toward -inf (floor) */
#define FE_UPWARD 0x30 /* round toward +inf (ceil) */
/* rounding precision used by fegetprec() and fesetprec() */
#define FE_LDBLPREC 0x00 /* long double precision */
#define FE_FLTPREC 0x40 /* float precision */
#define FE_DBLPREC 0x80 /* double precision */
extern const char __Zero_l[];
#define FE_DFL_ENV (*(const fenv_t *)(const void *)__Zero_l)
/* begin function declarations */
int feclearexcept(int);
int fegetenv(fenv_t *);
int fegetexceptflag(fexcept_t *, int);
int fegetprec(void);
int fegetround(void);
int feholdexcept(fenv_t *);
int feraiseexcept(int);
int fesetenv(const fenv_t *);
int fesetexceptflag(const fexcept_t *, int);
int fesetprec(int);
int fesetround(int);
int fetestexcept(int);
int feupdateenv(const fenv_t *);
/* end function declarations */
#ifndef __NOINLINE__
/* faster inline functions */
#if defined(__M68881) || defined(__M68882)
/* direct FPU support */
__regsused("d0/a0") int __asm_fegetenv(__reg("a0")fenv_t *) =
"\tinline\n"
"\tfmove.l\tfpcr,(a0)\n"
"\tmoveq\t#0,d0\n"
"\teinline";
__regsused("d0/d1") int __asm_fegetround() =
"\tinline\n"
"\tfmove.l\tfpcr,d1\n"
"\tmoveq\t#$30,d0\n"
"\tand.l\td1,d0\n"
"\teinline";
__regsused("d0") int __asm_fegetprec() =
"\tinline\n"
"\tfmove.l\tfpcr,d0\n"
"\tand.l\t#$c0,d0\n"
"\teinline";
__regsused("d0/a0") int __asm_feholdexcept(__reg("a0")fenv_t *) =
"\tinline\n"
"\tfmove.l\tfpcr,(a0)\n"
"\tmoveq\t#0,d0\n"
"\teinline";
__regsused("d0/a0") int __asm_fesetenv(__reg("a0")const fenv_t *) =
"\tinline\n"
"\tfmove.l\t(a0),fpcr\n"
"\tmoveq\t#0,d0\n"
"\teinline";
__regsused("d0/d1") int __asm_fesetround(__reg("d0")int) =
"\tinline\n"
"\tfmove.l\tfpcr,d1\n"
"\tand.w\t#$ffcf,d1\n"
"\tor.l\td0,d1\n"
"\tfmove.l\td1,fpcr\n"
"\tmoveq\t#0,d0\n"
"\teinline";
__regsused("d0/d1") int __asm_fesetprec(__reg("d0")int) =
"\tinline\n"
"\tfmove.l\tfpcr,d1\n"
"\tand.w\t#$ff3f,d1\n"
"\tor.l\td0,d1\n"
"\tfmove.l\td1,fpcr\n"
"\tmoveq\t#0,d0\n"
"\teinline";
#else
/* IEEE or software floating-point */
__regsused("d0") int __asm_fegetenv(__reg("a0")fenv_t *) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
__regsused("d0") int __asm_fegetround() =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
__regsused("d0") int __asm_fegetprec() =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
__regsused("d0") int __asm_feholdexcept(__reg("a0")fenv_t *) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
__regsused("d0") int __asm_fesetenv(__reg("a0")const fenv_t *) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
__regsused("d0") int __asm_fesetround(__reg("d0")int) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
__regsused("d0") int __asm_fesetprec(__reg("d0")int) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
#endif
__regsused("d0") int __asm_feclearexcept(__reg("d0")int) =
"\tinline\n"
"\tmoveq\t#0,d0\n"
"\teinline";
__regsused("d0") int __asm_fegetexceptflag(__reg("a0")fexcept_t *,
__reg("d0")int) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
__regsused("d0") int __asm_feraiseexcept(__reg("d0")int) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
__regsused("d0") int __asm_fesetexceptflag(__reg("a0")const fexcept_t *,
__reg("d0")int) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
__regsused("d0") int __asm_fetestexcept(__reg("d0")int) =
"\tinline\n"
"\tmoveq\t#0,d0\n"
"\teinline";
__regsused("d0") int __asm_feupdateenv(__reg("a0")const fenv_t *) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
#define feclearexcept(x) __asm_feclearexcept(x)
#define fegetenv(x) __asm_fegetenv(x)
#define fegetexceptflag(x,y) __asm_fegetexceptflag(x,y)
#define fegetround() __asm_fegetround()
#define fegetprec() __asm_fegetprec()
#define feholdexcept(x) __asm_feholdexcept(x)
#define feraiseexcept(x) __asm_feraiseexcept(x)
#define fesetenv(x) __asm_fesetenv(x)
#define fesetexceptflag(x,y) __asm_fesetexceptflag(x,y)
#define fesetround(x) __asm_fesetround(x)
#define fesetprec(x) __asm_fesetprec(x)
#define fetestexcept(x) __asm_fetestexcept(x)
#define feupdateenv(x) __asm_feupdateenv(x)
#endif /* __NOINLINE__ */
#endif /* __FENV_H */
#ifndef __FENV_H
#define __FENV_H 1
typedef unsigned long fenv_t;
typedef unsigned long fexcept_t;
/* rounding mode used by fegetround() and fesetround() */
#define FE_TONEAREST 0x00 /* round toward nearest (round) */
#define FE_TOWARDZERO 0x10 /* round toward zero (trunc) */
#define FE_DOWNWARD 0x20 /* round toward -inf (floor) */
#define FE_UPWARD 0x30 /* round toward +inf (ceil) */
/* rounding precision used by fegetprec() and fesetprec() */
#define FE_LDBLPREC 0x00 /* long double precision */
#define FE_FLTPREC 0x40 /* float precision */
#define FE_DBLPREC 0x80 /* double precision */
extern const char __Zero_l[];
#define FE_DFL_ENV (*(const fenv_t *)(const void *)__Zero_l)
/* begin function declarations */
int feclearexcept(int);
int fegetenv(fenv_t *);
int fegetexceptflag(fexcept_t *, int);
int fegetprec(void);
int fegetround(void);
int feholdexcept(fenv_t *);
int feraiseexcept(int);
int fesetenv(const fenv_t *);
int fesetexceptflag(const fexcept_t *, int);
int fesetprec(int);
int fesetround(int);
int fetestexcept(int);
int feupdateenv(const fenv_t *);
/* end function declarations */
#ifndef __NOINLINE__
/* faster inline functions */
#if defined(__M68881) || defined(__M68882)
/* direct FPU support */
int fegetenv(__reg("a0")fenv_t *) =
"\tinline\n"
"\tfmove.l\tfpcr,(a0)\n"
"\tmoveq\t#0,d0\n"
"\teinline";
int fegetround(void) =
"\tinline\n"
"\tfmove.l\tfpcr,d1\n"
"\tmoveq\t#$30,d0\n"
"\tand.l\td1,d0\n"
"\teinline";
int fegetprec(void) =
"\tinline\n"
"\tfmove.l\tfpcr,d0\n"
"\tand.l\t#$c0,d0\n"
"\teinline";
int feholdexcept(__reg("a0")fenv_t *) =
"\tinline\n"
"\tfmove.l\tfpcr,(a0)\n"
"\tmoveq\t#0,d0\n"
"\teinline";
int fesetenv(__reg("a0")const fenv_t *) =
"\tinline\n"
"\tfmove.l\t(a0),fpcr\n"
"\tmoveq\t#0,d0\n"
"\teinline";
int fesetround(__reg("d0")int) =
"\tinline\n"
"\tfmove.l\tfpcr,d1\n"
"\tand.w\t#$ffcf,d1\n"
"\tor.l\td0,d1\n"
"\tfmove.l\td1,fpcr\n"
"\tmoveq\t#0,d0\n"
"\teinline";
int fesetprec(__reg("d0")int) =
"\tinline\n"
"\tfmove.l\tfpcr,d1\n"
"\tand.w\t#$ff3f,d1\n"
"\tor.l\td0,d1\n"
"\tfmove.l\td1,fpcr\n"
"\tmoveq\t#0,d0\n"
"\teinline";
#else
/* IEEE or software floating-point */
int fegetenv(__reg("a0")fenv_t *) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
int fegetround(void) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
int fegetprec(void) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
int feholdexcept(__reg("a0")fenv_t *) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
int fesetenv(__reg("a0")const fenv_t *) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
int fesetround(__reg("d0")int) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
int fesetprec(__reg("d0")int) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
#endif
int feclearexcept(__reg("d0")int) =
"\tinline\n"
"\tmoveq\t#0,d0\n"
"\teinline";
int fegetexceptflag(__reg("a0")fexcept_t *, __reg("d0")int) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
int feraiseexcept(__reg("d0")int) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
int fesetexceptflag(__reg("a0")const fexcept_t *, __reg("d0")int) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
int fetestexcept(__reg("d0")int) =
"\tinline\n"
"\tmoveq\t#0,d0\n"
"\teinline";
int feupdateenv(__reg("a0")const fenv_t *) =
"\tinline\n"
"\tmoveq\t#-1,d0\n"
"\teinline";
#endif /* __NOINLINE__ */
#endif /* __FENV_H */

View file

@ -1,226 +1,211 @@
/* $VER: math_040.h 1.1 (25.09.2021)
** math.h 68040 specific support, link with -lm040
*/
/* macros */
__regsused("d0/d1/fp0") int fpclassify(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#7,d1\n"
"\tfmove.l\tfpsr,d0\n"
"\trol.l\t#8,d0\n"
"\tand.l\td1,d0\n"
"\teinline";
__regsused("d0/fp0") int isfinite(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tfmove.l\tfpsr,d0\n"
"\tand.l\t#$03000000,d0\n"
"\tseq\td0\n"
"\textb.l\td0\n"
"\teinline";
__regsused("d0/fp0") int isnormal(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tfmove.l\tfpsr,d0\n"
"\tand.l\t#$07000000,d0\n"
"\tseq\td0\n"
"\textb.l\td0\n"
"\teinline";
__regsused("d0/fp0") int isnan(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#1,d0\n"
"\tfbun\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
__regsused("d0/d1/fp0") int isinf(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#1,d0\n"
"\tfmove.l\tfpsr,d1\n"
"\trol.l\t#7,d1\n"
"\tand.l\td1,d0\n"
"\teinline";
__regsused("d0/d1/fp0") int signbit(__reg("fp0")double) =
"\tinline\n"
"\tfmove.s\tfp0,d0\n"
"\tmoveq\t#31,d1\n"
"\tasr.l\td1,d0\n"
"\teinline";
__regsused("d0/fp0/fp1") int isgreater(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbogt\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
__regsused("d0/fp0/fp1") int isgreaterequal(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbult\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
__regsused("d0/fp0/fp1") int isless(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbolt\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
__regsused("d0/fp0/fp1") int islessequal(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbugt\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
__regsused("d0/fp0/fp1") int islessgreater(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbueq\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
__regsused("d0/fp0/fp1") int isunordered(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbun\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
#ifndef __NOINLINE__
/* faster inline functions */
__regsused("d0/d1/fp0") __fp0ret double __asm_ceil(__reg("fp0")double) =
"\tinline\n"
"\tfmove.l\tfpcr,d1\n"
"\tmoveq\t#$30,d0\n"
"\tor.l\td1,d0\n"
"\tfmove.l\td0,fpcr\n"
"\tfmove.l\tfp0,d0\n"
"\tfmove.l\td0,fp0\n"
"\tfmove.l\td1,fpcr\n"
"\teinline";
__regsused("d0/fp0/fp1") __fp0ret double __asm_copysign(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfmove.s\tfp1,d0\n"
"\tfabs.x\tfp0\n"
"\ttst.l\td0\n"
"\tbpl\t.skip\n"
"\tfneg.x\tfp0\n"
".skip\n"
"\teinline";
__regsused("fp0") __fp0ret double __asm_fabs(__reg("fp0")double) =
"\tinline\n"
"\tfabs.x\tfp0\n"
"\teinline";
__regsused("fp0/fp1") __fp0ret double __asm_fdim(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfsub.x\tfp1,fp0\n"
"\tfabs.x\tfp0\n"
"\teinline";
__regsused("d0/d1/fp0") __fp0ret double __asm_floor(__reg("fp0")double) =
"\tinline\n"
"\tfmove.l\tfpcr,d1\n"
"\tmoveq\t#$20,d0\n"
"\tor.l\td1,d0\n"
"\tand.w\t#$ffef,d0\n"
"\tfmove.l\td0,fpcr\n"
"\tfmove.l\tfp0,d0\n"
"\tfmove.l\td0,fp0\n"
"\tfmove.l\td1,fpcr\n"
"\teinline";
__regsused("fp0/fp1/fp2") __fp0ret double __asm_fma(__reg("fp0")double,__reg("fp1")double,__reg("fp2")double) =
"\tinline\n"
"\tfmul.x\tfp1,fp0\n"
"\tfadd.x\tfp2,fp0\n"
"\teinline";
__regsused("fp0/fp1") __fp0ret double __asm_fmax(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfboge\t.skip\n"
"\tftst.x\tfp1\n"
"\tfbun\t.skip\n"
"\tfmove.x\tfp1,fp0\n"
".skip\n"
"\teinline";
__regsused("fp0/fp1") __fp0ret double __asm_fmin(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfbole\t.skip\n"
"\tftst.x\tfp1\n"
"\tfbun\t.skip\n"
"\tfmove.x\tfp1,fp0\n"
".skip\n"
"\teinline";
__regsused("fp0/fp1") __fp0ret double __asm_hypot(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfmul.x\tfp0,fp0\n"
"\tfmul.x\tfp1,fp1\n"
"\tfadd.x\tfp1,fp0\n"
"\tfsqrt.x\tfp0\n"
"\teinline";
__regsused("fp0") __fp0ret double __asm_nan(__reg("a0")const char *) =
"\tinline\n"
"\tfmove.s\t#$7fc00000,fp0\n"
"\teinline";
__regsused("d0/fp0") __fp0ret double __asm_nearbyint(__reg("fp0")double) =
"\tinline\n"
"\tfmove.l\tfp0,d0\n"
"\tfmove.l\td0,fp0\n"
"\teinline";
__regsused("fp0") __fp0ret double __asm_sqrt(__reg("fp0")double) =
"\tinline\n"
"\tfsqrt.x\tfp0\n"
"\teinline";
__regsused("d0/d1/fp0") __fp0ret double __asm_trunc(__reg("fp0")double) =
"\tinline\n"
"\tmoveq\t#$10,d0\n"
"\tfmove.l\tfpcr,d1\n"
"\tor.l\td1,d0\n"
"\tand.w\t#$ffdf,d0\n"
"\tfmove.l\td0,fpcr\n"
"\tfmove.l\tfp0,d0\n"
"\tfmove.l\td0,fp0\n"
"\tfmove.l\td1,fpcr\n"
"\teinline";
/* double precision */
#define ceil(x) __asm_ceil(x)
#define copysign(x,y) __asm_copysign(x,y)
#define fabs(x) __asm_fabs(x)
#define fdim(x,y) __asm_fdim(x,y)
#define floor(x) __asm_floor(x)
#define fma(x,y) __asm_fma(x,y)
#define fmax(x,y) __asm_fmax(x,y)
#define fmin(x,y) __asm_fmin(x,y)
#define hypot(x,y) __asm_hypot(x,y)
#define nan(x) __asm_nan(x)
#define nearbyint(x) __asm_nearbyint(x)
#define sqrt(x) __asm_sqrt(x)
#define trunc(x) __asm_trunc(x)
/* single precision */
#define ceilf(x) __asm_ceil(x)
#define copysignf(x,y) __asm_copysign(x,y)
#define fabsf(x) __asm_fabs(x)
#define fdimf(x,y) __asm_fdim(x,y)
#define floorf(x) __asm_floor(x)
#define fmaf(x,y) __asm_fma(x,y)
#define fmaxf(x,y) __asm_fmax(x,y)
#define fminf(x,y) __asm_fmin(x,y)
#define hypotf(x,y) __asm_hypot(x,y)
#define nanf(x) __asm_nan(x)
#define nearbyintf(x) __asm_nearbyint(x)
#define sqrtf(x) __asm_sqrt(x)
#define truncf(x) __asm_trunc(x)
#endif /* __NOINLINE__ */
/* $VER: math_040.h 1.0 (06.04.2017)
** math.h 68040 specific support, link with -lm040
*/
/* macros */
int fpclassify(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#7,d1\n"
"\tfmove.l\tfpsr,d0\n"
"\trol.l\t#8,d0\n"
"\tand.l\td1,d0\n"
"\teinline";
int isfinite(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tfmove.l\tfpsr,d0\n"
"\tand.l\t#$03000000,d0\n"
"\tseq\td0\n"
"\textb.l\td0\n"
"\teinline";
int isnormal(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tfmove.l\tfpsr,d0\n"
"\tand.l\t#$07000000,d0\n"
"\tseq\td0\n"
"\textb.l\td0\n"
"\teinline";
int isnan(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#1,d0\n"
"\tfbun\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
int isinf(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#1,d0\n"
"\tfmove.l\tfpsr,d1\n"
"\trol.l\t#7,d1\n"
"\tand.l\td1,d0\n"
"\teinline";
int signbit(__reg("fp0")double) =
"\tinline\n"
"\tfmove.s\tfp0,d0\n"
"\tmoveq\t#31,d1\n"
"\tasr.l\td1,d0\n"
"\teinline";
int isgreater(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbogt\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
int isgreaterequal(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbult\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
int isless(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbolt\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
int islessequal(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbugt\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
int islessgreater(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbueq\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
int isunordered(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbun\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
#ifndef __NOINLINE__
/* faster inline functions */
__fp0ret double ceil(__reg("fp0")double) =
"\tinline\n"
"\tfmove.l\tfpcr,d1\n"
"\tmoveq\t#$30,d0\n"
"\tor.l\td1,d0\n"
"\tfmove.l\td0,fpcr\n"
"\tfmove.l\tfp0,d0\n"
"\tfmove.l\td0,fp0\n"
"\tfmove.l\td1,fpcr\n"
"\teinline";
__fp0ret double copysign(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfmove.s\tfp1,d0\n"
"\tfabs.x\tfp0\n"
"\ttst.l\td0\n"
"\tbpl\t.skip\n"
"\tfneg.x\tfp0\n"
".skip\n"
"\teinline";
__fp0ret double fabs(__reg("fp0")double) =
"\tinline\n"
"\tfabs.x\tfp0\n"
"\teinline";
__fp0ret double fdim(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfsub.x\tfp1,fp0\n"
"\tfabs.x\tfp0\n"
"\teinline";
__fp0ret double floor(__reg("fp0")double) =
"\tinline\n"
"\tfmove.l\tfpcr,d1\n"
"\tmoveq\t#$20,d0\n"
"\tor.l\td1,d0\n"
"\tand.w\t#$ffef,d0\n"
"\tfmove.l\td0,fpcr\n"
"\tfmove.l\tfp0,d0\n"
"\tfmove.l\td0,fp0\n"
"\tfmove.l\td1,fpcr\n"
"\teinline";
__fp0ret double fma(__reg("fp0")double,__reg("fp1")double,__reg("fp2")double) =
"\tinline\n"
"\tfmul.x\tfp1,fp0\n"
"\tfadd.x\tfp2,fp0\n"
"\teinline";
__fp0ret double fmax(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfboge\t.skip\n"
"\tftst.x\tfp1\n"
"\tfbun\t.skip\n"
"\tfmove.x\tfp1,fp0\n"
".skip\n"
"\teinline";
__fp0ret double fmin(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfbole\t.skip\n"
"\tftst.x\tfp1\n"
"\tfbun\t.skip\n"
"\tfmove.x\tfp1,fp0\n"
".skip\n"
"\teinline";
__fp0ret double hypot(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfmul.x\tfp0,fp0\n"
"\tfmul.x\tfp1,fp1\n"
"\tfadd.x\tfp1,fp0\n"
"\tfsqrt.x\tfp0\n"
"\teinline";
__fp0ret double nan(__reg("a0")const char *) =
"\tinline\n"
"\tfmove.s\t#$7fc00000,fp0\n"
"\teinline";
__fp0ret double nearbyint(__reg("fp0")double) =
"\tinline\n"
"\tfmove.l\tfp0,d0\n"
"\tfmove.l\td0,fp0\n"
"\teinline";
__fp0ret double sqrt(__reg("fp0")double) =
"\tinline\n"
"\tfsqrt.x\tfp0\n"
"\teinline";
__fp0ret double trunc(__reg("fp0")double) =
"\tinline\n"
"\tmoveq\t#$10,d0\n"
"\tfmove.l\tfpcr,d1\n"
"\tor.l\td1,d0\n"
"\tand.w\t#$ffdf,d0\n"
"\tfmove.l\td0,fpcr\n"
"\tfmove.l\tfp0,d0\n"
"\tfmove.l\td0,fp0\n"
"\tfmove.l\td1,fpcr\n"
"\teinline";
/* single precision */
#define ceilf(x) ceil(x)
#define copysignf(x,y) copysign(x,y)
#define fabsf(x) fabs(x)
#define fdimf(x,y) fdim(x,y)
#define floorf(x) floor(x)
#define fmaf(x,y) fma(x,y)
#define fmaxf(x,y) fmax(x,y)
#define fminf(x,y) fmin(x,y)
#define hypotf(x,y) hypot(x,y)
#define nanf(x) nan(x)
#define nearbyintf(x) nearbyint(x)
#define sqrtf(x) sqrt(x)
#define truncf(x) trunc(x)
#endif /* __NOINLINE__ */

View file

@ -1,236 +1,219 @@
/* $VER: math_060.h 1.1 (25.09.2021)
** math.h 68060 specific support, link with -lm060
*/
/* macros */
__regsused("d0/d1/fp0") int fpclassify(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#7,d1\n"
"\tfmove.l\tfpsr,d0\n"
"\trol.l\t#8,d0\n"
"\tand.l\td1,d0\n"
"\teinline";
__regsused("d0/fp0") int isfinite(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tfmove.l\tfpsr,d0\n"
"\tand.l\t#$03000000,d0\n"
"\tseq\td0\n"
"\textb.l\td0\n"
"\teinline";
__regsused("d0/fp0") int isnormal(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tfmove.l\tfpsr,d0\n"
"\tand.l\t#$07000000,d0\n"
"\tseq\td0\n"
"\textb.l\td0\n"
"\teinline";
__regsused("d0/fp0") int isnan(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#1,d0\n"
"\tfbun\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
__regsused("d0/d1/fp0") int isinf(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#1,d0\n"
"\tfmove.l\tfpsr,d1\n"
"\trol.l\t#7,d1\n"
"\tand.l\td1,d0\n"
"\teinline";
__regsused("d0/d1/fp0") int signbit(__reg("fp0")double) =
"\tinline\n"
"\tfmove.s\tfp0,d0\n"
"\tmoveq\t#31,d1\n"
"\tasr.l\td1,d0\n"
"\teinline";
__regsused("d0/fp0/fp1") int isgreater(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbogt\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
__regsused("d0/fp0/fp1") int isgreaterequal(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbult\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
__regsused("d0/fp0/fp1") int isless(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbolt\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
__regsused("d0/fp0/fp1") int islessequal(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbugt\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
__regsused("d0/fp0/fp1") int islessgreater(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbueq\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
__regsused("d0/fp0/fp1") int isunordered(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbun\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
#ifndef __NOINLINE__
/* faster inline functions */
__regsused("fp0/fp1") __fp0ret double __asm_ceil(__reg("fp0")double) =
"\tinline\n"
"\tfmove.x\tfp0,fp1\n"
"\tfintrz.x\tfp0\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfboge\t.skip\n"
"\tfadd.s\t#$3f800000,fp0\n"
".skip\n"
"\teinline";
__regsused("d0/fp0/fp1") __fp0ret double __asm_copysign(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfmove.s\tfp1,d0\n"
"\tfabs.x\tfp0\n"
"\ttst.l\td0\n"
"\tbpl\t.skip\n"
"\tfneg.x\tfp0\n"
".skip\n"
"\teinline";
__regsused("fp0") __fp0ret double __asm_fabs(__reg("fp0")double) =
"\tinline\n"
"\tfabs.x\tfp0\n"
"\teinline";
__regsused("fp0/fp1") __fp0ret double __asm_fdim(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfsub.x\tfp1,fp0\n"
"\tfabs.x\tfp0\n"
"\teinline";
__regsused("fp0/fp1") __fp0ret double __asm_floor(__reg("fp0")double) =
"\tinline\n"
"\tfmove.x\tfp0,fp1\n"
"\tfintrz.x\tfp0\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfbole\t.skip\n"
"\tfsub.s\t#$3f800000,fp0\n"
".skip\n"
"\teinline";
__regsused("fp0/fp1/fp2") __fp0ret double __asm_fma(__reg("fp0")double,__reg("fp1")double,__reg("fp2")double) =
"\tinline\n"
"\tfmul.x\tfp1,fp0\n"
"\tfadd.x\tfp2,fp0\n"
"\teinline";
__regsused("fp0/fp1") __fp0ret double __asm_fmax(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfboge\t.skip\n"
"\tftst.x\tfp1\n"
"\tfbun\t.skip\n"
"\tfmove.x\tfp1,fp0\n"
".skip\n"
"\teinline";
__regsused("fp0/fp1") __fp0ret double __asm_fmin(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfbole\t.skip\n"
"\tftst.x\tfp1\n"
"\tfbun\t.skip\n"
"\tfmove.x\tfp1,fp0\n"
".skip\n"
"\teinline";
__regsused("fp0/fp1") __fp0ret double __asm_hypot(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfmul.x\tfp0,fp0\n"
"\tfmul.x\tfp1,fp1\n"
"\tfadd.x\tfp1,fp0\n"
"\tfsqrt.x\tfp0\n"
"\teinline";
__regsused("d0/fp0") long __asm_lround(__reg("fp0")double) =
"\tinline\n"
"\tfmove.s\tfp0,d0\n"
"\tand.l\t#$80000000,d0\n"
"\tor.l\t#$3f000000,d0\n"
"\tfadd.s\td0,fp0\n"
"\tfintrz.x\tfp0\n"
"\tfmove.l\tfp0,d0\n"
"\teinline";
__regsused("fp0") __fp0ret double __asm_nan(__reg("a0")const char *) =
"\tinline\n"
"\tfmove.s\t#$7fc00000,fp0\n"
"\teinline";
__regsused("fp0") __fp0ret double __asm_nearbyint(__reg("fp0")double) =
"\tinline\n"
"\tfint.x\tfp0\n"
"\teinline";
__regsused("d0/fp0") __fp0ret double __asm_round(__reg("fp0")double) =
"\tinline\n"
"\tfmove.s\tfp0,d0\n"
"\tand.l\t#$80000000,d0\n"
"\tor.l\t#$3f000000,d0\n"
"\tfadd.s\td0,fp0\n"
"\tfintrz.x\tfp0\n"
"\teinline";
__regsused("fp0") __fp0ret double __asm_sqrt(__reg("fp0")double) =
"\tinline\n"
"\tfsqrt.x\tfp0\n"
"\teinline";
__regsused("fp0") __fp0ret double __asm_trunc(__reg("fp0")double) =
"\tinline\n"
"\tfintrz.x\tfp0\n"
"\teinline";
/* double precision */
#define ceil(x) __asm_ceil(x)
#define copysign(x,y) __asm_copysign(x,y)
#define fabs(x) __asm_fabs(x)
#define fdim(x,y) __asm_fdim(x,y)
#define floor(x) __asm_floor(x)
#define fma(x,y) __asm_fma(x,y)
#define fmax(x,y) __asm_fmax(x,y)
#define fmin(x,y) __asm_fmin(x,y)
#define hypot(x,y) __asm_hypot(x,y)
#define lround(x) __asm_lround(x)
#define nan(x) __asm_nan(x)
#define nearbyint(x) __asm_nearbyint(x)
#define round(x) __asm_round(x)
#define sqrt(x) __asm_sqrt(x)
#define trunc(x) __asm_trunc(x)
/* single precision */
#define ceilf(x) __asm_ceil(x)
#define copysignf(x,y) __asm_copysign(x,y)
#define fabsf(x) __asm_fabs(x)
#define fdimf(x,y) __asm_fdim(x,y)
#define floorf(x) __asm_floor(x)
#define fmaf(x,y) __asm_fma(x,y)
#define fmaxf(x,y) __asm_fmax(x,y)
#define fminf(x,y) __asm_fmin(x,y)
#define hypotf(x,y) __asm_hypot(x,y)
#define lroundf(x) __asm_lround(x)
#define nanf(x) __asm_nan(x)
#define nearbyintf(x) __asm_nearbyint(x)
#define roundf(x) __asm_round(x)
#define sqrtf(x) __asm_sqrt(x)
#define truncf(x) __asm_trunc(x)
#endif /* __NOINLINE__ */
/* $VER: math_060.h 1.0 (06.04.2017)
** math.h 68060 specific support, link with -lm060
*/
/* macros */
int fpclassify(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#7,d1\n"
"\tfmove.l\tfpsr,d0\n"
"\trol.l\t#8,d0\n"
"\tand.l\td1,d0\n"
"\teinline";
int isfinite(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tfmove.l\tfpsr,d0\n"
"\tand.l\t#$03000000,d0\n"
"\tseq\td0\n"
"\textb.l\td0\n"
"\teinline";
int isnormal(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tfmove.l\tfpsr,d0\n"
"\tand.l\t#$07000000,d0\n"
"\tseq\td0\n"
"\textb.l\td0\n"
"\teinline";
int isnan(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#1,d0\n"
"\tfbun\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
int isinf(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#1,d0\n"
"\tfmove.l\tfpsr,d1\n"
"\trol.l\t#7,d1\n"
"\tand.l\td1,d0\n"
"\teinline";
int signbit(__reg("fp0")double) =
"\tinline\n"
"\tfmove.s\tfp0,d0\n"
"\tmoveq\t#31,d1\n"
"\tasr.l\td1,d0\n"
"\teinline";
int isgreater(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbogt\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
int isgreaterequal(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbult\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
int isless(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbolt\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
int islessequal(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbugt\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
int islessgreater(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbueq\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
int isunordered(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbun\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
#ifndef __NOINLINE__
/* faster inline functions */
__fp0ret double ceil(__reg("fp0")double) =
"\tinline\n"
"\tfmove.x\tfp0,fp1\n"
"\tfintrz.x\tfp0\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfboge\t.skip\n"
"\tfadd.s\t#$3f800000,fp0\n"
".skip\n"
"\teinline";
__fp0ret double copysign(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfmove.s\tfp1,d0\n"
"\tfabs.x\tfp0\n"
"\ttst.l\td0\n"
"\tbpl\t.skip\n"
"\tfneg.x\tfp0\n"
".skip\n"
"\teinline";
__fp0ret double fabs(__reg("fp0")double) =
"\tinline\n"
"\tfabs.x\tfp0\n"
"\teinline";
__fp0ret double fdim(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfsub.x\tfp1,fp0\n"
"\tfabs.x\tfp0\n"
"\teinline";
__fp0ret double floor(__reg("fp0")double) =
"\tinline\n"
"\tfmove.x\tfp0,fp1\n"
"\tfintrz.x\tfp0\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfbole\t.skip\n"
"\tfsub.s\t#$3f800000,fp0\n"
".skip\n"
"\teinline";
__fp0ret double fma(__reg("fp0")double,__reg("fp1")double,__reg("fp2")double) =
"\tinline\n"
"\tfmul.x\tfp1,fp0\n"
"\tfadd.x\tfp2,fp0\n"
"\teinline";
__fp0ret double fmax(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfboge\t.skip\n"
"\tftst.x\tfp1\n"
"\tfbun\t.skip\n"
"\tfmove.x\tfp1,fp0\n"
".skip\n"
"\teinline";
__fp0ret double fmin(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfbole\t.skip\n"
"\tftst.x\tfp1\n"
"\tfbun\t.skip\n"
"\tfmove.x\tfp1,fp0\n"
".skip\n"
"\teinline";
__fp0ret double hypot(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfmul.x\tfp0,fp0\n"
"\tfmul.x\tfp1,fp1\n"
"\tfadd.x\tfp1,fp0\n"
"\tfsqrt.x\tfp0\n"
"\teinline";
long lround(__reg("fp0")double) =
"\tinline\n"
"\tfmove.s\tfp0,d0\n"
"\tand.l\t#$80000000,d0\n"
"\tor.l\t#$3f000000,d0\n"
"\tfadd.s\td0,fp0\n"
"\tfintrz.x\tfp0\n"
"\tfmove.l\tfp0,d0\n"
"\teinline";
__fp0ret double nan(__reg("a0")const char *) =
"\tinline\n"
"\tfmove.s\t#$7fc00000,fp0\n"
"\teinline";
__fp0ret double nearbyint(__reg("fp0")double) =
"\tinline\n"
"\tfint.x\tfp0\n"
"\teinline";
__fp0ret double round(__reg("fp0")double) =
"\tinline\n"
"\tfmove.s\tfp0,d0\n"
"\tand.l\t#$80000000,d0\n"
"\tor.l\t#$3f000000,d0\n"
"\tfadd.s\td0,fp0\n"
"\tfintrz.x\tfp0\n"
"\teinline";
__fp0ret double sqrt(__reg("fp0")double) =
"\tinline\n"
"\tfsqrt.x\tfp0\n"
"\teinline";
__fp0ret double trunc(__reg("fp0")double) =
"\tinline\n"
"\tfintrz.x\tfp0\n"
"\teinline";
/* single precision */
#define ceilf(x) ceil(x)
#define copysignf(x,y) copysign(x,y)
#define fabsf(x) fabs(x)
#define fdimf(x,y) fdim(x,y)
#define floorf(x) floor(x)
#define fmaf(x,y) fma(x,y)
#define fmaxf(x,y) fmax(x,y)
#define fminf(x,y) fmin(x,y)
#define hypotf(x,y) hypot(x,y)
#define lroundf(x) lround(x)
#define nanf(x) nan(x)
#define nearbyintf(x) nearbyint(x)
#define roundf(x) round(x)
#define sqrtf(x) sqrt(x)
#define truncf(x) trunc(x)
#endif /* __NOINLINE__ */

View file

@ -1,368 +1,329 @@
/* $VER: math_881.h 1.1 (25.09.2021)
** math.h 6888x specific support, link with -lm881
*/
/* macros */
int fpclassify(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#7,d1\n"
"\tfmove.l\tfpsr,d0\n"
"\trol.l\t#8,d0\n"
"\tand.l\td1,d0\n"
"\teinline";
int isfinite(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tfmove.l\tfpsr,d0\n"
"\tand.l\t#$03000000,d0\n"
"\tseq\td0\n"
"\textb.l\td0\n"
"\teinline";
int isnormal(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tfmove.l\tfpsr,d0\n"
"\tand.l\t#$07000000,d0\n"
"\tseq\td0\n"
"\textb.l\td0\n"
"\teinline";
int isnan(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#1,d0\n"
"\tfbun\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
int isinf(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#1,d0\n"
"\tfmove.l\tfpsr,d1\n"
"\trol.l\t#7,d1\n"
"\tand.l\td1,d0\n"
"\teinline";
int signbit(__reg("fp0")double) =
"\tinline\n"
"\tfmove.s\tfp0,d0\n"
"\tmoveq\t#31,d1\n"
"\tasr.l\td1,d0\n"
"\teinline";
int isgreater(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbogt\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
int isgreaterequal(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbult\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
int isless(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbolt\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
int islessequal(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbugt\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
int islessgreater(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbueq\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
int isunordered(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbun\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
#ifndef __NOINLINE__
/* faster inline functions */
__fp0ret double __asm_acos(__reg("fp0")double) =
"\tinline\n"
"\tfacos.x\tfp0\n"
"\teinline";
__fp0ret double __asm_asin(__reg("fp0")double) =
"\tinline\n"
"\tfasin.x\tfp0\n"
"\teinline";
__fp0ret double __asm_atan(__reg("fp0")double) =
"\tinline\n"
"\tfatan.x\tfp0\n"
"\teinline";
__fp0ret double __asm_atanh(__reg("fp0")double) =
"\tinline\n"
"\tfatanh.x\tfp0\n"
"\teinline";
__fp0ret double __asm_ceil(__reg("fp0")double) =
"\tinline\n"
"\tfmove.x\tfp0,fp1\n"
"\tfintrz.x\tfp0\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfboge\t.skip\n"
"\tfadd.s\t#$3f800000,fp0\n"
".skip\n"
"\teinline";
__fp0ret double __asm_copysign(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfmove.s\tfp1,d0\n"
"\tfabs.x\tfp0\n"
"\ttst.l\td0\n"
"\tbpl\t.skip\n"
"\tfneg.x\tfp0\n"
".skip\n"
"\teinline";
__fp0ret double __asm_cos(__reg("fp0")double) =
"\tinline\n"
"\tfcos.x\tfp0\n"
"\teinline";
__fp0ret double __asm_cosh(__reg("fp0")double) =
"\tinline\n"
"\tfcosh.x\tfp0\n"
"\teinline";
__fp0ret double __asm_exp(__reg("fp0")double) =
"\tinline\n"
"\tfetox.x\tfp0\n"
"\teinline";
__fp0ret double __asm_exp2(__reg("fp0")double) =
"\tinline\n"
"\tftwotox.x\tfp0\n"
"\teinline";
__fp0ret double __asm_exp10(__reg("fp0")double) =
"\tinline\n"
"\tftentox.x\tfp0\n"
"\teinline";
__fp0ret double __asm_expm1(__reg("fp0")double) =
"\tinline\n"
"\tfetoxm1.x\tfp0\n"
"\teinline";
__fp0ret double __asm_fabs(__reg("fp0")double) =
"\tinline\n"
"\tfabs.x\tfp0\n"
"\teinline";
__fp0ret double __asm_fdim(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfsub.x\tfp1,fp0\n"
"\tfabs.x\tfp0\n"
"\teinline";
__fp0ret double __asm_floor(__reg("fp0")double) =
"\tinline\n"
"\tfmove.x\tfp0,fp1\n"
"\tfintrz.x\tfp0\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfbole\t.skip\n"
"\tfsub.s\t#$3f800000,fp0\n"
".skip\n"
"\teinline";
__fp0ret double __asm_fma(__reg("fp0")double,__reg("fp1")double,__reg("fp2")double) =
"\tinline\n"
"\tfmul.x\tfp1,fp0\n"
"\tfadd.x\tfp2,fp0\n"
"\teinline";
__fp0ret double __asm_fmax(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfboge\t.skip\n"
"\tftst.x\tfp1\n"
"\tfbun\t.skip\n"
"\tfmove.x\tfp1,fp0\n"
".skip\n"
"\teinline";
__fp0ret double __asm_fmin(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfbole\t.skip\n"
"\tftst.x\tfp1\n"
"\tfbun\t.skip\n"
"\tfmove.x\tfp1,fp0\n"
".skip\n"
"\teinline";
__fp0ret double __asm_fmod(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfmod.x\tfp1,fp0\n"
"\teinline";
__fp0ret double __asm_hypot(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfmul.x\tfp0,fp0\n"
"\tfmul.x\tfp1,fp1\n"
"\tfadd.x\tfp1,fp0\n"
"\tfsqrt.x\tfp0\n"
"\teinline";
__fp0ret double __asm_ldexp(__reg("fp0")double,__reg("d0")int) =
"\tinline\n"
"\tfscale.l\td0,fp0\n"
"\teinline";
__fp0ret double __asm_log(__reg("fp0")double) =
"\tinline\n"
"\tflogn.x\tfp0\n"
"\teinline";
__fp0ret double __asm_log10(__reg("fp0")double) =
"\tinline\n"
"\tflog10.x\tfp0\n"
"\teinline";
__fp0ret double __asm_log2(__reg("fp0")double) =
"\tinline\n"
"\tflog2.x\tfp0\n"
"\teinline";
__fp0ret double __asm_logb(__reg("fp0")double) =
"\tinline\n"
"\tfgetexp.x\tfp0\n"
"\teinline";
__fp0ret double __asm_lognp1(__reg("fp0")double) =
"\tinline\n"
"\tflognp1.x\tfp0\n"
"\teinline";
long __asm_lround(__reg("fp0")double) =
"\tinline\n"
"\tfmove.s\tfp0,d0\n"
"\tand.l\t#$80000000,d0\n"
"\tor.l\t#$3f000000,d0\n"
"\tfadd.s\td0,fp0\n"
"\tfintrz.x\tfp0\n"
"\tfmove.l\tfp0,d0\n"
"\teinline";
__fp0ret double __asm_nan(__reg("a0")const char *) =
"\tinline\n"
"\tfmove.s\t#$7fc00000,fp0\n"
"\teinline";
__fp0ret double __asm_nearbyint(__reg("fp0")double) =
"\tinline\n"
"\tfint.x\tfp0\n"
"\teinline";
__fp0ret double __asm_remainder(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfrem.x\tfp1,fp0\n"
"\teinline";
__fp0ret double __asm_round(__reg("fp0")double) =
"\tinline\n"
"\tfmove.s\tfp0,d0\n"
"\tand.l\t#$80000000,d0\n"
"\tor.l\t#$3f000000,d0\n"
"\tfadd.s\td0,fp0\n"
"\tfintrz.x\tfp0\n"
"\teinline";
__fp0ret double __asm_sin(__reg("fp0")double) =
"\tinline\n"
"\tfsin.x\tfp0\n"
"\teinline";
__fp0ret double __asm_sinh(__reg("fp0")double) =
"\tinline\n"
"\tfsinh.x\tfp0\n"
"\teinline";
__fp0ret double __asm_sqrt(__reg("fp0")double) =
"\tinline\n"
"\tfsqrt.x\tfp0\n"
"\teinline";
__fp0ret double __asm_tan(__reg("fp0")double) =
"\tinline\n"
"\tftan.x\tfp0\n"
"\teinline";
__fp0ret double __asm_tanh(__reg("fp0")double) =
"\tinline\n"
"\tftanh.x\tfp0\n"
"\teinline";
__fp0ret double __asm_trunc(__reg("fp0")double) =
"\tinline\n"
"\tfintrz.x\tfp0\n"
"\teinline";
/* double precision */
#define acos(x) __asm_acos(x)
#define asin(x) __asm_asin(x)
#define atan(x) __asm_atan(x)
#define atanh(x) __asm_atanh(x)
#define ceil(x) __asm_ceil(x)
#define copysign(x,y) __asm_copysign(x,y)
#define cos(x) __asm_cos(x)
#define cosh(x) __asm_cosh(x)
#define exp(x) __asm_exp(x)
#define exp2(x) __asm_exp2(x)
#define exp10(x) __asm_exp10(x)
#define expm1(x) __asm_expm1(x)
#define fabs(x) __asm_fabs(x)
#define fdim(x,y) __asm_fdim(x,y)
#define floor(x) __asm_floor(x)
#define fma(x,y) __asm_fma(x,y)
#define fmax(x,y) __asm_fmax(x,y)
#define fmin(x,y) __asm_fmin(x,y)
#define fmod(x,y) __asm_fmod(x,y)
#define hypot(x,y) __asm_hypot(x,y)
#define ldexp(x,exp) __asm_ldexp(x,exp)
#define log(x) __asm_log(x)
#define log10(x) __asm_log10(x)
#define log2(x) __asm_log2(x)
#define logb(x) __asm_logb(x)
#define lognp1(x) __asm_lognp1(x)
#define lround(x) __asm_lround(x)
#define nan(x) __asm_nan(x)
#define nearbyint(x) __asm_nearbyint(x)
#define remainder(x,y) __asm_remainder(x,y)
#define round(x) __asm_round(x)
#define sin(x) __asm_sin(x)
#define sinh(x) __asm_sinh(x)
#define sqrt(x) __asm_sqrt(x)
#define tan(x) __asm_tan(x)
#define tanh(x) __asm_tanh(x)
#define trunc(x) __asm_trunc(x)
/* single precision */
#define acosf(x) __asm_acos(x)
#define asinf(x) __asm_asin(x)
#define atanf(x) __asm_atan(x)
#define atanhf(x) __asm_atanh(x)
#define ceilf(x) __asm_ceil(x)
#define copysignf(x,y) __asm_copysign(x,y)
#define cosf(x) __asm_cos(x)
#define coshf(x) __asm_cosh(x)
#define expf(x) __asm_exp(x)
#define exp2f(x) __asm_exp2(x)
#define exp10f(x) __asm_exp10(x)
#define expm1f(x) __asm_expm1(x)
#define fabsf(x) __asm_fabs(x)
#define fdimf(x,y) __asm_fdim(x,y)
#define floorf(x) __asm_floor(x)
#define fmaf(x,y) __asm_fma(x,y)
#define fmaxf(x,y) __asm_fmax(x,y)
#define fminf(x,y) __asm_fmin(x,y)
#define fmodf(x,y) __asm_fmod(x,y)
#define hypotf(x,y) __asm_hypot(x,y)
#define ldexpf(x,exp) __asm_ldexp(x,exp)
#define logf(x) __asm_log(x)
#define log10f(x) __asm_log10(x)
#define log2f(x) __asm_log2(x)
#define logbf(x) __asm_logb(x)
#define lognp1f(x) __asm_lognp1(x)
#define lroundf(x) __asm_lround(x)
#define nanf(x) __asm_nan(x)
#define nearbyintf(x) __asm_nearbyint(x)
#define remainderf(x,y) __asm_remainder(x,y)
#define roundf(x) __asm_round(x)
#define sinf(x) __asm_sin(x)
#define sinhf(x) __asm_sinh(x)
#define sqrtf(x) __asm_sqrt(x)
#define tanf(x) __asm_tan(x)
#define tanhf(x) __asm_tanh(x)
#define truncf(x) __asm_trunc(x)
#endif /* __NOINLINE__ */
/* $VER: math_881.h 1.0 (06.04.2017)
** math.h 6888x specific support, link with -lm881
*/
/* macros */
int fpclassify(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#7,d1\n"
"\tfmove.l\tfpsr,d0\n"
"\trol.l\t#8,d0\n"
"\tand.l\td1,d0\n"
"\teinline";
int isfinite(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tfmove.l\tfpsr,d0\n"
"\tand.l\t#$03000000,d0\n"
"\tseq\td0\n"
"\textb.l\td0\n"
"\teinline";
int isnormal(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tfmove.l\tfpsr,d0\n"
"\tand.l\t#$07000000,d0\n"
"\tseq\td0\n"
"\textb.l\td0\n"
"\teinline";
int isnan(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#1,d0\n"
"\tfbun\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
int isinf(__reg("fp0")double) =
"\tinline\n"
"\tftst.x\tfp0\n"
"\tmoveq\t#1,d0\n"
"\tfmove.l\tfpsr,d1\n"
"\trol.l\t#7,d1\n"
"\tand.l\td1,d0\n"
"\teinline";
int signbit(__reg("fp0")double) =
"\tinline\n"
"\tfmove.s\tfp0,d0\n"
"\tmoveq\t#31,d1\n"
"\tasr.l\td1,d0\n"
"\teinline";
int isgreater(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbogt\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
int isgreaterequal(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbult\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
int isless(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbolt\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
int islessequal(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbugt\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
int islessgreater(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#0,d0\n"
"\tfbueq\t.skip\n"
"\tmoveq\t#1,d0\n"
".skip\n"
"\teinline";
int isunordered(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tmoveq\t#1,d0\n"
"\tfbun\t.skip\n"
"\tmoveq\t#0,d0\n"
".skip\n"
"\teinline";
#ifndef __NOINLINE__
/* faster inline functions */
__fp0ret double acos(__reg("fp0")double) =
"\tinline\n"
"\tfacos.x\tfp0\n"
"\teinline";
__fp0ret double asin(__reg("fp0")double) =
"\tinline\n"
"\tfasin.x\tfp0\n"
"\teinline";
__fp0ret double atan(__reg("fp0")double) =
"\tinline\n"
"\tfatan.x\tfp0\n"
"\teinline";
__fp0ret double atanh(__reg("fp0")double) =
"\tinline\n"
"\tfatanh.x\tfp0\n"
"\teinline";
__fp0ret double ceil(__reg("fp0")double) =
"\tinline\n"
"\tfmove.x\tfp0,fp1\n"
"\tfintrz.x\tfp0\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfboge\t.skip\n"
"\tfadd.s\t#$3f800000,fp0\n"
".skip\n"
"\teinline";
__fp0ret double copysign(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfmove.s\tfp1,d0\n"
"\tfabs.x\tfp0\n"
"\ttst.l\td0\n"
"\tbpl\t.skip\n"
"\tfneg.x\tfp0\n"
".skip\n"
"\teinline";
__fp0ret double cos(__reg("fp0")double) =
"\tinline\n"
"\tfcos.x\tfp0\n"
"\teinline";
__fp0ret double cosh(__reg("fp0")double) =
"\tinline\n"
"\tfcosh.x\tfp0\n"
"\teinline";
__fp0ret double exp(__reg("fp0")double) =
"\tinline\n"
"\tfetox.x\tfp0\n"
"\teinline";
__fp0ret double exp2(__reg("fp0")double) =
"\tinline\n"
"\tftwotox.x\tfp0\n"
"\teinline";
__fp0ret double exp10(__reg("fp0")double) =
"\tinline\n"
"\tftentox.x\tfp0\n"
"\teinline";
__fp0ret double expm1(__reg("fp0")double) =
"\tinline\n"
"\tfetoxm1.x\tfp0\n"
"\teinline";
__fp0ret double fabs(__reg("fp0")double) =
"\tinline\n"
"\tfabs.x\tfp0\n"
"\teinline";
__fp0ret double fdim(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfsub.x\tfp1,fp0\n"
"\tfabs.x\tfp0\n"
"\teinline";
__fp0ret double floor(__reg("fp0")double) =
"\tinline\n"
"\tfmove.x\tfp0,fp1\n"
"\tfintrz.x\tfp0\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfbole\t.skip\n"
"\tfsub.s\t#$3f800000,fp0\n"
".skip\n"
"\teinline";
__fp0ret double fma(__reg("fp0")double,__reg("fp1")double,__reg("fp2")double) =
"\tinline\n"
"\tfmul.x\tfp1,fp0\n"
"\tfadd.x\tfp2,fp0\n"
"\teinline";
__fp0ret double fmax(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfboge\t.skip\n"
"\tftst.x\tfp1\n"
"\tfbun\t.skip\n"
"\tfmove.x\tfp1,fp0\n"
".skip\n"
"\teinline";
__fp0ret double fmin(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfcmp.x\tfp1,fp0\n"
"\tfbole\t.skip\n"
"\tftst.x\tfp1\n"
"\tfbun\t.skip\n"
"\tfmove.x\tfp1,fp0\n"
".skip\n"
"\teinline";
__fp0ret double fmod(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfmod.x\tfp1,fp0\n"
"\teinline";
__fp0ret double hypot(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfmul.x\tfp0,fp0\n"
"\tfmul.x\tfp1,fp1\n"
"\tfadd.x\tfp1,fp0\n"
"\tfsqrt.x\tfp0\n"
"\teinline";
__fp0ret double ldexp(__reg("fp0")double,__reg("d0")int) =
"\tinline\n"
"\tfscale.l\td0,fp0\n"
"\teinline";
__fp0ret double log(__reg("fp0")double) =
"\tinline\n"
"\tflogn.x\tfp0\n"
"\teinline";
__fp0ret double log10(__reg("fp0")double) =
"\tinline\n"
"\tflog10.x\tfp0\n"
"\teinline";
__fp0ret double log2(__reg("fp0")double) =
"\tinline\n"
"\tflog2.x\tfp0\n"
"\teinline";
__fp0ret double logb(__reg("fp0")double) =
"\tinline\n"
"\tfgetexp.x\tfp0\n"
"\teinline";
__fp0ret double lognp1(__reg("fp0")double) =
"\tinline\n"
"\tflognp1.x\tfp0\n"
"\teinline";
long lround(__reg("fp0")double) =
"\tinline\n"
"\tfmove.s\tfp0,d0\n"
"\tand.l\t#$80000000,d0\n"
"\tor.l\t#$3f000000,d0\n"
"\tfadd.s\td0,fp0\n"
"\tfintrz.x\tfp0\n"
"\tfmove.l\tfp0,d0\n"
"\teinline";
__fp0ret double nan(__reg("a0")const char *) =
"\tinline\n"
"\tfmove.s\t#$7fc00000,fp0\n"
"\teinline";
__fp0ret double nearbyint(__reg("fp0")double) =
"\tinline\n"
"\tfint.x\tfp0\n"
"\teinline";
__fp0ret double remainder(__reg("fp0")double,__reg("fp1")double) =
"\tinline\n"
"\tfrem.x\tfp1,fp0\n"
"\teinline";
__fp0ret double round(__reg("fp0")double) =
"\tinline\n"
"\tfmove.s\tfp0,d0\n"
"\tand.l\t#$80000000,d0\n"
"\tor.l\t#$3f000000,d0\n"
"\tfadd.s\td0,fp0\n"
"\tfintrz.x\tfp0\n"
"\teinline";
__fp0ret double sin(__reg("fp0")double) =
"\tinline\n"
"\tfsin.x\tfp0\n"
"\teinline";
__fp0ret double sinh(__reg("fp0")double) =
"\tinline\n"
"\tfsinh.x\tfp0\n"
"\teinline";
__fp0ret double sqrt(__reg("fp0")double) =
"\tinline\n"
"\tfsqrt.x\tfp0\n"
"\teinline";
__fp0ret double tan(__reg("fp0")double) =
"\tinline\n"
"\tftan.x\tfp0\n"
"\teinline";
__fp0ret double tanh(__reg("fp0")double) =
"\tinline\n"
"\tftanh.x\tfp0\n"
"\teinline";
__fp0ret double trunc(__reg("fp0")double) =
"\tinline\n"
"\tfintrz.x\tfp0\n"
"\teinline";
/* single precision */
#define acosf(x) acos(x)
#define asinf(x) asin(x)
#define atanf(x) atan(x)
#define atanhf(x) atanh(x)
#define ceilf(x) ceil(x)
#define copysignf(x,y) copysign(x,y)
#define cosf(x) cos(x)
#define coshf(x) cosh(x)
#define expf(x) exp(x)
#define exp2f(x) exp2(x)
#define exp10f(x) exp10(x)
#define expm1f(x) expm1(x)
#define fabsf(x) fabs(x)
#define fdimf(x,y) fdim(x,y)
#define floorf(x) floor(x)
#define fmaf(x,y) fma(x,y)
#define fmaxf(x,y) fmax(x,y)
#define fminf(x,y) fmin(x,y)
#define fmodf(x,y) fmod(x,y)
#define hypotf(x,y) hypot(x,y)
#define ldexpf(x,exp) ldexp(x,exp)
#define logf(x) log(x)
#define log10f(x) log10(x)
#define log2f(x) log2(x)
#define logbf(x) logb(x)
#define lognp1f(x) lognp1(x)
#define lroundf(x) lround(x)
#define nanf(x) nan(x)
#define nearbyintf(x) nearbyint(x)
#define remainderf(x,y) remainder(x,y)
#define roundf(x) round(x)
#define sinf(x) sin(x)
#define sinhf(x) sinh(x)
#define sqrtf(x) sqrt(x)
#define tanf(x) tan(x)
#define tanhf(x) tanh(x)
#define truncf(x) trunc(x)
#endif /* __NOINLINE__ */

View file

@ -1,195 +1,193 @@
#ifndef __STDIO_H
#define __STDIO_H 1
#define EOF (-1)
#ifndef BUFSIZ
#define BUFSIZ 1024L
#endif
#define FOPEN_MAX 1024 /* Does not really matter */
#define _IOFBF 1L
#define _IOLBF 2L
#define _IONBF 3L
#define HASBUF 1L
#define NOBUFMEM 2L
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#define _READ 1
#define _WRITE 2
#define _UNBUF 4
#define _EOF 8
#define _ERR 16
#define _READABLE 32
#define _WRITEABLE 64
#define _LINEBUF 128
#define _NOTMYBUF 256
#define _ISTTY 512
/* Define this for CRLF-conversion in text-mode
#define _CLE 16384
*/
#ifdef __BUILD_LIB
#define HAVE_TTYS 1
#include "libsys.h"
#ifdef HAVE_TTYS
extern int __isatty(int);
#endif
#endif
#ifdef __VCLIB_SIMPLEIO
typedef struct _iobuf
{
unsigned char filehandle;
unsigned char flags;
unsigned int count;
unsigned int bufsize;
char *pointer;
char *base; /* buffer address */
struct _iobuf *next;
} FILE;
#else
typedef struct _iobuf
{
int filehandle; /* filehandle */
char *pointer;
char *base; /* buffer address */
struct _iobuf *next;
struct _iobuf *prev;
int count;
int flags;
int bufsize;
#ifdef _CLE
int clebuf; /* buffered char during CRLF conversion */
#endif
} FILE;
#endif
/* Have to be initialized in _main(). */
extern FILE *stdin, *stdout, *stderr;
int _fillbuf(FILE *),_putbuf(int,FILE *),_flushbuf(FILE *);
void _ttyflush(void);
#define L_tmpnam 30
#define TMP_MAX FOPEN_MAX
#define FILENAME_MAX 107
/*
Adapt corresponding to stddef.h
*/
#ifndef __SIZE_T
#define __SIZE_T 1
#ifdef __SIZE_T_INT
typedef unsigned int size_t;
#else
typedef unsigned long size_t;
#endif
#endif
/*
Adapt as needed.
*/
#ifndef __FPOS_T
#define __FPOS_T 1
typedef long fpos_t;
#endif
#ifndef __STDARG_H
#include <stdarg.h>
#endif
#undef NULL
#define NULL ((void*)0)
FILE *fopen(const char *,const char *);
FILE *freopen(const char *,const char *,FILE *);
int fflush(FILE *);
int fclose(FILE *);
int rename(const char *,const char *);
int remove(const char *);
FILE *tmpfile(void);
char *tmpnam(char *);
int setvbuf(FILE *,char *,int,size_t);
void setbuf(FILE *,char *);
int fprintf(FILE *, const char *, ...);
int printf(const char *, ...);
int sprintf(char *, const char *,...);
int snprintf(char *,size_t,const char *,...);
/*
Simple versions of IO functions (see vbcc documentation).
If versions with __v1 or __v2 are declared they are also used.
*/
/*
int __v0fprintf(FILE *, const char *);
int __v0printf(const char *);
int __v0sprintf(char *, const char *);
*/
int vprintf(const char *,va_list);
int vfprintf(FILE *,const char *,va_list);
int vsprintf(char *,const char *,va_list);
int vsnprintf(char *,size_t,const char *,va_list);
int fscanf(FILE *, const char *, ...);
int scanf(const char *, ...);
int sscanf(const char *, const char *, ...);
int vscanf(const char *,va_list);
int vfscanf(FILE *,const char *,va_list);
int vsscanf(const char *,const char *,va_list);
char *fgets(char *, int, FILE *);
int fputs(const char *, FILE *);
char *gets(char *);
int puts(const char *);
int ungetc(int,FILE *);
size_t fread(void *,size_t,size_t,FILE *);
size_t fwrite(void *,size_t,size_t,FILE *);
int fseek(FILE *,long,int);
void rewind(FILE *);
long ftell(FILE *);
int fgetpos(FILE *,fpos_t *);
int fsetpos(FILE *,const fpos_t *);
void perror(const char *);
int fgetc(FILE *);
int fputc(int,FILE *);
int getchar(void);
int putchar(int);
#ifndef __VCLIB_SIMPLEIO
#if defined(_CLE)
int __putc(int,FILE *);
int __getc(FILE *);
#else
#define __putc(x,f) __rawputc((x),(f))
#define __getc(f) __rawgetc(f)
#endif
#define __check(arg,type) (volatile)sizeof((arg)==(type)0)
#define __rawputc(x,p) (((p)->flags|=_WRITE),((--((FILE*)(p))->count>=0&&((x)!='\n'||!(((FILE*)(p))->flags&_LINEBUF)))?(unsigned char)(*((FILE*)(p))->pointer++=(x)):_putbuf((x),p)))
#define putc(x,f) __putc((x),(f))
#define putchar(x) __putc((x),stdout)
#define __rawgetc(p) (__check((p),FILE*),((p)->flags|=_READ),--((FILE*)(p))->count>=0?(unsigned char)*((FILE*)(p))->pointer++:_fillbuf(p))
#define getc(f) __getc(f)
#define getchar() __getc(stdin)
#endif
#define feof(p) (__check((p),FILE*),((FILE*)(p))->flags&_EOF)
#define ferror(p) (__check((p),FILE*),((FILE*)(p))->flags&_ERR)
#define clearerr(p) (__check((p),FILE*),((FILE*)(p))->flags&=~(_ERR|_EOF))
#define fsetpos(f,ptr) fseek((f),*(ptr),SEEK_SET)
#ifdef __VBCC__
#pragma printflike printf
#pragma printflike fprintf
#pragma printflike sprintf
#pragma printflike snprintf
#pragma scanflike scanf
#pragma scanflike fscanf
#pragma scanflike sscanf
#endif
#endif
#ifndef __STDIO_H
#define __STDIO_H 1
#define EOF (-1)
#ifndef BUFSIZ
#define BUFSIZ 1024L
#endif
#define FOPEN_MAX 1024 /* Does not really matter */
#define _IOFBF 1L
#define _IOLBF 2L
#define _IONBF 3L
#define HASBUF 1L
#define NOBUFMEM 2L
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#define _READ 1
#define _WRITE 2
#define _UNBUF 4
#define _EOF 8
#define _ERR 16
#define _READABLE 32
#define _WRITEABLE 64
#define _LINEBUF 128
#define _NOTMYBUF 256
#define _ISTTY 512
/* Define this for CRLF-conversion in text-mode
#define _CLE 16384
*/
#ifdef __BUILD_LIB
#define HAVE_TTYS 1
#include "libsys.h"
#ifdef HAVE_TTYS
extern int __isatty(int);
#endif
#endif
#ifdef __VCLIB_SIMPLEIO
typedef struct _iobuf
{
unsigned char filehandle;
unsigned char flags;
unsigned int count;
unsigned int bufsize;
char *pointer;
char *base; /* buffer address */
struct _iobuf *next;
} FILE;
#else
typedef struct _iobuf
{
int filehandle; /* filehandle */
char *pointer;
char *base; /* buffer address */
struct _iobuf *next;
struct _iobuf *prev;
int count;
int flags;
int bufsize;
#ifdef _CLE
int clebuf; /* buffered char during CRLF conversion */
#endif
} FILE;
#endif
/* Have to be initialized in _main(). */
extern FILE *stdin, *stdout, *stderr;
int _fillbuf(FILE *),_putbuf(int,FILE *),_flushbuf(FILE *);
void _ttyflush(void);
#define L_tmpnam 30
#define TMP_MAX FOPEN_MAX
#define FILENAME_MAX 107
/*
Adapt corresponding to stddef.h
*/
#ifndef __SIZE_T
#define __SIZE_T 1
#ifdef __SIZE_T_INT
typedef unsigned int size_t;
#else
typedef unsigned long size_t;
#endif
#endif
/*
Adapt as needed.
*/
#ifndef __FPOS_T
#define __FPOS_T 1
typedef long fpos_t;
#endif
#ifndef __STDARG_H
#include <stdarg.h>
#endif
#undef NULL
#define NULL ((void*)0)
FILE *fopen(const char *,const char *);
FILE *freopen(const char *,const char *,FILE *);
int fflush(FILE *);
int fclose(FILE *);
int rename(const char *,const char *);
int remove(const char *);
FILE *tmpfile(void);
char *tmpnam(char *);
int setvbuf(FILE *,char *,int,size_t);
void setbuf(FILE *,char *);
int fprintf(FILE *, const char *, ...);
int printf(const char *, ...);
int sprintf(char *, const char *,...);
int snprintf(char *,size_t,const char *,...);
/*
Simple versions of IO functions (see vbcc documentation).
If versions with __v1 or __v2 are declared they are also used.
*/
int __v0fprintf(FILE *, const char *);
int __v0printf(const char *);
int __v0sprintf(char *, const char *);
int vprintf(const char *,va_list);
int vfprintf(FILE *,const char *,va_list);
int vsprintf(char *,const char *,va_list);
int vsnprintf(char *,size_t,const char *,va_list);
int fscanf(FILE *, const char *, ...);
int scanf(const char *, ...);
int sscanf(const char *, const char *, ...);
int vscanf(const char *,va_list);
int vfscanf(FILE *,const char *,va_list);
int vsscanf(const char *,const char *,va_list);
char *fgets(char *, int, FILE *);
int fputs(const char *, FILE *);
char *gets(char *);
int puts(const char *);
int ungetc(int,FILE *);
size_t fread(void *,size_t,size_t,FILE *);
size_t fwrite(void *,size_t,size_t,FILE *);
int fseek(FILE *,long,int);
void rewind(FILE *);
long ftell(FILE *);
int fgetpos(FILE *,fpos_t *);
int fsetpos(FILE *,const fpos_t *);
void perror(const char *);
int fgetc(FILE *);
int fputc(int,FILE *);
int getchar(void);
int putchar(int);
#ifndef __VCLIB_SIMPLEIO
#if defined(_CLE)
int __putc(int,FILE *);
int __getc(FILE *);
#else
#define __putc(x,f) __rawputc((x),(f))
#define __getc(f) __rawgetc(f)
#endif
#define __check(arg,type) (volatile)sizeof((arg)==(type)0)
#define __rawputc(x,p) (((p)->flags|=_WRITE),((--((FILE*)(p))->count>=0&&((x)!='\n'||!(((FILE*)(p))->flags&_LINEBUF)))?(unsigned char)(*((FILE*)(p))->pointer++=(x)):_putbuf((x),p)))
#define putc(x,f) __putc((x),(f))
#define putchar(x) __putc((x),stdout)
#define __rawgetc(p) (__check((p),FILE*),((p)->flags|=_READ),--((FILE*)(p))->count>=0?(unsigned char)*((FILE*)(p))->pointer++:_fillbuf(p))
#define getc(f) __getc(f)
#define getchar() __getc(stdin)
#endif
#define feof(p) (__check((p),FILE*),((FILE*)(p))->flags&_EOF)
#define ferror(p) (__check((p),FILE*),((FILE*)(p))->flags&_ERR)
#define clearerr(p) (__check((p),FILE*),((FILE*)(p))->flags&=~(_ERR|_EOF))
#define fsetpos(f,ptr) fseek((f),*(ptr),SEEK_SET)
#ifdef __VBCC__
#pragma printflike printf
#pragma printflike fprintf
#pragma printflike sprintf
#pragma printflike snprintf
#pragma scanflike scanf
#pragma scanflike fscanf
#pragma scanflike sscanf
#endif
#endif

View file

@ -1,138 +1,133 @@
#ifndef __STDLIB_H
#define __STDLIB_H 1
#ifndef __SIZE_T
#define __SIZE_T 1
typedef unsigned long size_t;
#endif
#ifndef __WCHAR_T
#define __WCHAR_T 1
typedef char wchar_t;
#endif
#undef NULL
#define NULL ((void *)0)
#undef EXIT_FAILURE
#define EXIT_FAILURE 20
#undef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#undef RAND_MAX
#define RAND_MAX 32767
void exit(int);
#if __STDC_VERSION__ >= 199901L
void _Exit(int);
#endif
void *malloc(size_t);
void *calloc(size_t,size_t);
void *realloc(void *,size_t);
void free(void *);
int system(const char *);
int rand(void);
void srand(unsigned int);
double atof(const char *);
int atoi(const char *);
long atol(const char *);
#if __STDC_VERSION__ >= 199901L
long long atoll(const char *);
#endif
double strtod(const char *,char **);
float strtof(const char *,char **);
long strtol(const char *,char **,int);
#if __STDC_VERSION__ >= 199901L
signed long long strtoll(const char *,char **,int);
#endif
unsigned long strtoul(const char *,char **,int);
#if __STDC_VERSION__ >= 199901L
unsigned long long strtoull(const char *,char **,int);
#endif
void abort(void);
int atexit(void (*)(void));
char *getenv(const char *);
void *bsearch(const void *,const void *,size_t,size_t,int (*)(const void *,const void *));
void qsort(void *,size_t,size_t,int (*)(const void *,const void *));
typedef struct {
int quot,rem;
} div_t;
typedef struct {
long quot,rem;
} ldiv_t;
#if __STDC_VERSION__ >= 199901L
typedef struct {
long long quot,rem;
} lldiv_t;
#endif
div_t div(int,int);
ldiv_t ldiv(long,long);
#if __STDC_VERSION__ >= 199901L
lldiv_t lldiv(long long,long long);
#endif
int abs(int);
long labs(long);
#if __STDC_VERSION__ >= 199901L
long long llabs(long long);
#endif
#ifndef __NOINLINE__
__regsused("d0") int __asm_abs(__reg("d0") int) =
"\tinline\n"
"\ttst.l\td0\n"
"\tbpl\t.skip\n"
"\tneg.l\td0\n"
".skip\n"
"\teinline";
__regsused("d0") long __asm_labs(__reg("d0") long) =
"\tinline\n"
"\ttst.l\td0\n"
"\tbpl\t.skip\n"
"\tneg.l\td0\n"
".skip\n"
"\teinline";
#define abs(x) __asm_abs(x)
#define labs(x) __asm_labs(x)
#if __STDC_VERSION__ >= 199901L
__regsused("d0/d1") long long __asm_llabs(__reg("d0/d1") long long) =
"\tinline\n"
"\ttst.l\td0\n"
"\tbpl\t.skip\n"
"\tneg.l\td1\n"
"\tnegx.l\td0\n"
".skip\n"
"\teinline";
#define llabs(x) __asm_llabs(x)
#endif
#if !defined(__M68000) && !defined(__M68010)
__regsused("d0/d1") div_t __asm_div(__reg("d0") int,__reg("d1") int) =
"\tinline\n"
"\tdivsl.l\td1,d1:d0\n"
"\teinline";
__regsused("d0/d1") ldiv_t __asm_ldiv(__reg("d0") long,__reg("d1") long) =
"\tinline\n"
"\tdivsl.l\td1,d1:d0\n"
"\teinline";
#endif
#define div(n,d) __asm_div(n,d)
#define ldiv(n,d) __asm_ldiv(n,d)
#endif /* __NOINLINE__ */
#define atof(s) strtod((s),(char **)NULL)
#define atoi(s) (int)strtol((s),(char **)NULL,10)
#define atol(s) strtol((s),(char **)NULL,10)
extern size_t _nalloc;
struct __exitfuncs{
struct __exitfuncs *next;
void (*func)(void);
};
#endif /* __STDLIB_H */
#ifndef __STDLIB_H
#define __STDLIB_H 1
#ifndef __SIZE_T
#define __SIZE_T 1
typedef unsigned long size_t;
#endif
#ifndef __WCHAR_T
#define __WCHAR_T 1
typedef char wchar_t;
#endif
#undef NULL
#define NULL ((void *)0)
#undef EXIT_FAILURE
#define EXIT_FAILURE 20
#undef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#undef RAND_MAX
#define RAND_MAX 32767
void exit(int);
#if __STDC_VERSION__ >= 199901L
void _Exit(int);
#endif
void *malloc(size_t);
void *calloc(size_t,size_t);
void *realloc(void *,size_t);
void free(void *);
int system(const char *);
int rand(void);
void srand(unsigned int);
double atof(const char *);
int atoi(const char *);
long atol(const char *);
#if __STDC_VERSION__ >= 199901L
long long atoll(const char *);
#endif
double strtod(const char *,char **);
long strtol(const char *,char **,int);
#if __STDC_VERSION__ >= 199901L
signed long long strtoll(const char *,char **,int);
#endif
unsigned long strtoul(const char *,char **,int);
#if __STDC_VERSION__ >= 199901L
unsigned long long strtoull(const char *,char **,int);
#endif
void abort(void);
int atexit(void (*)(void));
char *getenv(const char *);
void *bsearch(const void *,const void *,size_t,size_t,int (*)(const void *,const void *));
void qsort(void *,size_t,size_t,int (*)(const void *,const void *));
typedef struct {
int quot,rem;
} div_t;
typedef struct {
long quot,rem;
} ldiv_t;
#if __STDC_VERSION__ >= 199901L
typedef struct {
long long quot,rem;
} lldiv_t;
#endif
div_t div(int,int);
ldiv_t ldiv(long,long);
#if __STDC_VERSION__ >= 199901L
lldiv_t lldiv(long long,long long);
#endif
int abs(int);
long labs(long);
#if __STDC_VERSION__ >= 199901L
long long llabs(long long);
#endif
#ifndef __NOINLINE__
int abs(__reg("d0") int) =
"\tinline\n"
"\ttst.l\td0\n"
"\tbpl\t.skip\n"
"\tneg.l\td0\n"
".skip\n"
"\teinline";
long labs(__reg("d0") long) =
"\tinline\n"
"\ttst.l\td0\n"
"\tbpl\t.skip\n"
"\tneg.l\td0\n"
".skip\n"
"\teinline";
#if __STDC_VERSION__ >= 199901L
long long llabs(__reg("d0/d1") long long) =
"\tinline\n"
"\ttst.l\td0\n"
"\tbpl\t.skip\n"
"\tneg.l\td1\n"
"\tnegx.l\td0\n"
".skip\n"
"\teinline";
#endif
#if !defined(__M68000) && !defined(__M68010)
div_t div(__reg("d0") int,__reg("d1") int) =
"\tinline\n"
"\tdivsl.l\td1,d1:d0\n"
"\teinline";
ldiv_t ldiv(__reg("d0") long,__reg("d1") long) =
"\tinline\n"
"\tdivsl.l\td1,d1:d0\n"
"\teinline";
#endif
#endif /* __NOINLINE__ */
#define atof(s) strtod((s),(char **)NULL)
#define atoi(s) (int)strtol((s),(char **)NULL,10)
#define atol(s) strtol((s),(char **)NULL,10)
extern size_t _nalloc;
struct __exitfuncs{
struct __exitfuncs *next;
void (*func)(void);
};
#endif /* __STDLIB_H */

View file

@ -1,374 +1,359 @@
#ifndef __STRING_H
#define __STRING_H 1
#ifndef __SIZE_T
#define __SIZE_T 1
typedef unsigned long size_t;
#endif
#undef NULL
#define NULL ((void *)0)
void *memcpy(void *,const void *,size_t);
void *memmove(void *,const void *,size_t);
char *strcpy(char *,const char *);
char *strncpy(char *,const char *,size_t);
char *strcat(char *,const char *);
char *strncat(char *,const char *,size_t);
int memcmp(const void *,const void *,size_t);
int strcmp(const char *,const char *);
int strncmp(const char *,const char *,size_t);
void *memchr(const void *,int,size_t);
char *strchr(const char *,int);
size_t strcspn(const char *,const char *);
char *strpbrk(const char *,const char *);
char *strrchr(const char *,int);
size_t strspn(const char *,const char *);
char *strstr(const char *,const char *);
void *memset(void *,int,size_t);
size_t strlen(const char *);
char *strtok(char *,const char *);
char *strerror(int);
int strcoll(const char *,const char *);
size_t strxfrm(char *,const char *,size_t);
#ifndef __NOINLINE__
#if defined(__M68000) || defined(__M68010)
void *__asm_memcpy(__reg("a0") void *, __reg("a1") const void *,
__reg("d2") size_t) =
"\tinline\n"
"\tmove.l\ta0,d0\n"
"\tcmp.l\t#16,d2\n"
"\tblo\t.l5\n"
"\tmoveq\t#1,d1\n"
"\tand.b\td0,d1\n"
"\tbeq\t.l1\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tsubq.l\t#1,d2\n"
".l1\n"
"\tmove.l\ta1,d1\n"
"\tand.b\t#1,d1\n"
"\tbeq\t.l3\n"
"\tcmp.l\t#$10000,d2\n"
"\tblo\t.l5\n"
".l2\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tsubq.l\t#1,d2\n"
"\tbne\t.l2\n"
"\tbra\t.l7\n"
".l3\n"
"\tmoveq\t#3,d1\n"
"\tand.l\td2,d1\n"
"\tsub.l\td1,d2\n"
".l4\n"
"\tmove.l\t(a1)+,(a0)+\n"
"\tsubq.l\t#4,d2\n"
"\tbne\t.l4\n"
"\tmove.w\td1,d2\n"
".l5\n"
"\tsubq.w\t#1,d2\n"
"\tblo\t.l7\n"
".l6\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tdbf\td2,.l6\n"
".l7\n"
"\teinline";
void *__asm_memcpy_desc(__reg("a0") void *, __reg("a1") const void *,
__reg("d2") size_t) =
"\tinline\n"
"\tcmp.l\t#16,d2\n"
"\tblo\t.l5\n"
"\tmoveq\t#1,d1\n"
"\tmove.l\ta0,d0\n"
"\tand.b\td1,d0\n"
"\tbeq\t.l1\n"
"\tmove.b\t-(a1),-(a0)\n"
"\tsubq.l\t#1,d2\n"
".l1\n"
"\tmove.l\ta1,d0\n"
"\tand.b\td1,d0\n"
"\tbeq\t.l3\n"
"\tcmp.l\t#$10000,d2\n"
"\tblo\t.l5\n"
".l2\n"
"\tmove.b\t-(a1),-(a0)\n"
"\tsubq.l\t#1,d2\n"
"\tbne\t.l2\n"
"\tbra\t.l7\n"
".l3\n"
"\tmoveq\t#3,d1\n"
"\tand.l\td2,d1\n"
"\tsub.l\td1,d2\n"
".l4\n"
"\tmove.l\t-(a1),-(a0)\n"
"\tsubq.l\t#4,d2\n"
"\tbne\t.l4\n"
"\tmove.w\td1,d2\n"
".l5\n"
"\tsubq.w\t#1,d2\n"
"\tblo\t.l7\n"
".l6\n"
"\tmove.b\t-(a1),-(a0)\n"
"\tdbf\td2,.l6\n"
".l7\n"
"\tmove.l\ta0,d0\n"
"\teinline";
void *__asm_memset(__reg("a0") void *, __reg("d0") int, __reg("d2") size_t) =
"\tinline\n"
"\tmove.l\ta0,a1\n"
"\tcmp.l\t#16,d2\n"
"\tblo\t.l3\n"
"\tmove.l\ta0,d1\n"
"\tand.b\t#1,d1\n"
"\tbeq\t.l1\n"
"\tmove.b\td0,(a0)+\n"
"\tsubq.l\t#1,d2\n"
".l1\n"
"\tmove.b\td0,d1\n"
"\tlsl.w\t#8,d0\n"
"\tmove.b\td1,d0\n"
"\tmove.w\td0,d1\n"
"\tswap\td0\n"
"\tmove.w\td1,d0\n"
"\tmoveq\t#3,d1\n"
"\tand.l\td2,d1\n"
"\tsub.l\td1,d2\n"
".l2\n"
"\tmove.l\td0,(a0)+\n"
"\tsubq.l\t#4,d2\n"
"\tbne\t.l2\n"
"\tmove.w\td1,d2\n"
".l3\n"
"\tsubq.w\t#1,d2\n"
"\tblo\t.l5\n"
".l4\n"
"\tmove.b\td0,(a0)+\n"
"\tdbf\td2,.l4\n"
".l5\n"
"\tmove.l\ta1,d0\n"
"\teinline";
#else /* 68020+ */
void *__asm_memcpy(__reg("a0") void *, __reg("a1") const void *,
__reg("d2") size_t) =
"\tinline\n"
"\tmove.l\ta0,d0\n"
"\tsubq.l\t#4,d2\n"
"\tbcs\t.l3\n"
"\tmove.l\td0,d1\n"
"\tlsr.l\t#1,d1\n"
"\tbcc\t.l1\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tsubq.l\t#1,d2\n"
"\tbcs\t.l3\n"
"\taddq.l\t#1,d1\n"
".l1\n"
"\tlsr.l\t#1,d1\n"
"\tbcc\t.l2\n"
"\tmove.w\t(a1)+,(a0)+\n"
"\tsubq.l\t#2,d2\n"
"\tbcs\t.l3\n"
".l2\n"
"\tmove.l\t(a1)+,(a0)+\n"
"\tsubq.l\t#4,d2\n"
"\tbcc\t.l2\n"
".l3\n"
"\taddq.l\t#3,d2\n"
"\tbcc\t.l5\n"
".l4\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tdbf\td2,.l4\n"
".l5\n"
"\teinline";
void *__asm_memcpy_desc(__reg("a0") void *, __reg("a1") const void *,
__reg("d2") size_t) =
"\tinline\n"
"\tsubq.l\t#4,d2\n"
"\tbcs\t.l3\n"
"\tmove.l\ta0,d0\n"
"\tlsr.l\t#1,d0\n"
"\tbcc\t.l1\n"
"\tmove.b\t-(a1),-(a0)\n"
"\tsubq.l\t#1,d2\n"
"\tbcs\t.l3\n"
".l1\n"
"\tlsr.l\t#1,d0\n"
"\tbcc\t.l2\n"
"\tmove.w\t-(a1),-(a0)\n"
"\tsubq.l\t#2,d2\n"
"\tbcs\t.l3\n"
".l2\n"
"\tmove.l\t-(a1),-(a0)\n"
"\tsubq.l\t#4,d2\n"
"\tbcc\t.l2\n"
".l3\n"
"\taddq.l\t#3,d2\n"
"\tbcc\t.l5\n"
".l4\n"
"\tmove.b\t-(a1),-(a0)\n"
"\tdbf\td2,.l4\n"
".l5\n"
"\tmove.l\ta0,d0\n"
"\teinline";
void *__asm_memset(__reg("a0") void *, __reg("d0") int, __reg("d2") size_t) =
"\tinline\n"
"\tmove.l\ta0,a1\n"
"\tsubq.l\t#8,d2\n"
"\tbcs\t.l3\n"
"\tmove.l\td0,d1\n"
"\tlsl.l\t#8,d0\n"
"\tmove.b\td1,d0\n"
"\taddq.l\t#4,d2\n"
"\tmove.l\td0,d1\n"
"\tswap\td0\n"
"\tmove.w\td1,d0\n"
"\tmove.l\ta1,d1\n"
"\tlsr.l\t#1,d1\n"
"\tbcc\t.l1\n"
"\tmove.b\td0,(a0)+\n"
"\taddq.l\t#1,d1\n"
"\tsubq.l\t#1,d2\n"
".l1\n"
"\tlsr.l\t#1,d1\n"
"\tbcc\t.l2\n"
"\tmove.w\td0,(a0)+\n"
"\tsubq.l\t#2,d2\n"
".l2\n"
"\tmove.l\td0,(a0)+\n"
"\tsubq.l\t#4,d2\n"
"\tbcc\t.l2\n"
"\taddq.l\t#3,d2\n"
"\tbcs\t.l4\n"
"\tbra\t.l5\n"
".l3\n"
"\taddq.l\t#7,d2\n"
"\tbcc\t.l5\n"
".l4\n"
"\tmove.b\td0,(a0)+\n"
"\tdbf\td2,.l4\n"
".l5\n"
"\tmove.l\ta1,d0\n"
"\teinline";
#endif /* 68020+ */
__regsused("d0/a0") size_t __asm_strlen(__reg("a0") const char *) =
"\tinline\n"
"\tmove.l\ta0,d0\n"
".l1\n"
"\ttst.b\t(a0)+\n"
"\tbne\t.l1\n"
"\tsub.l\ta0,d0\n"
"\tnot.l\td0\n"
"\teinline";
__regsused("d0/a0/a1") char *__asm_strcpy(__reg("a0") char *, __reg("a1") const char *) =
"\tinline\n"
"\tmove.l\ta0,d0\n"
".l1\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tbne\t.l1\n"
"\teinline";
char *__asm_strncpy(__reg("a0") char *, __reg("a1") const char *,
__reg("d1") size_t) =
"\tinline\n"
"\tmove.l\ta0,d0\n"
"\tbra\t.l2\n"
".l1\n"
"\tmove.b\t(a1),(a0)+\n"
"\tbeq\t.l2\n"
"\taddq.l\t#1,a1\n"
".l2\n"
"\tsubq.l\t#1,d1\n"
"\tbpl\t.l1\n"
"\teinline";
int __asm_strcmp(__reg("a0") const char *, __reg("a1") const char *) =
"\tinline\n"
"\tmoveq\t#0,d0\n"
"\tmoveq\t#0,d1\n"
".l1\n"
"\tmove.b\t(a0)+,d0\n"
"\tmove.b\t(a1)+,d1\n"
"\tbeq\t.l2\n"
"\tsub.l\td1,d0\n"
"\tbeq\t.l1\n"
"\tmoveq\t#0,d1\n"
".l2\n"
"\tsub.l\td1,d0\n"
"\teinline";
int __asm_strncmp(__reg("a0") const char *, __reg("a1") const char *,
__reg("d2") size_t) =
"\tinline\n"
"\tmoveq\t#0,d0\n"
"\tmoveq\t#0,d1\n"
".l1\n"
"\tsubq.l\t#1,d2\n"
"\tbmi\t.l3\n"
"\tmove.b\t(a0)+,d0\n"
"\tmove.b\t(a1)+,d1\n"
"\tbeq\t.l2\n"
"\tsub.l\td1,d0\n"
"\tbeq\t.l1\n"
"\tmoveq\t#0,d1\n"
".l2\n"
"\tsub.l\td1,d0\n"
".l3\n"
"\teinline";
__regsused("d0/a0/a1") char *__asm_strcat(__reg("a0") char *, __reg("a1") const char *) =
"\tinline\n"
"\tmove.l\ta0,d0\n"
".l1\n"
"\ttst.b\t(a0)+\n"
"\tbne\t.l1\n"
"\tsubq.l\t#1,a0\n"
".l2\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tbne\t.l2\n"
"\teinline";
char *__asm_strncat(__reg("a0") char *, __reg("a1") const char *,
__reg("d1") size_t) =
"\tinline\n"
"\tmove.l\ta0,d0\n"
"\ttst.l\td1\n"
"\tbeq\t.l4\n"
".l1\n"
"\ttst.b\t(a0)+\n"
"\tbne\t.l1\n"
"\tsubq.l\t#1,a0\n"
".l2\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tbeq\t.l3\n"
"\tsubq.l\t#1,d1\n"
"\tbne\t.l2\n"
".l3\n"
"\tclr.b\t(a0)\n"
".l4\n"
"\teinline";
__regsused("d0/d1/a0") char *__asm_strrchr(__reg("a0") const char *, __reg("d1") int) =
"\tinline\n"
"\tmoveq\t#0,d0\n"
".l1\n"
"\tcmp.b\t(a0),d1\n"
"\tbne\t.l2\n"
"\tmove.l\ta0,d0\n"
".l2\n"
"\ttst.b\t(a0)+\n"
"\tbne\t.l1\n"
"\teinline";
#ifdef __OPTSPEED__
#define memmove(d,s,n) ((d)<=(s) ? __asm_memcpy(d,s,n) : \
__asm_memcpy_desc((char *)(d)+(n),(char *)(s)+(n),n))
#endif
#define memcpy(d,s,n) __asm_memcpy(d,s,n)
#define memset(p,f,n) __asm_memset(p,f,n)
#define strlen(p) __asm_strlen(p)
#define strcpy(d,s) __asm_strcpy(d,s)
#define strncpy(d,s,n) __asm_strncpy(d,s,n)
#define strcmp(s1,s2) __asm_strcmp(s1,s2)
#define strncmp(s1,s2,n) __asm_strncmp(s1,s2,n)
#define strcat(d,s) __asm_strcat(d,s)
#define strncat(d,s,n) __asm_strncat(d,s,n)
#define strrchr(s,n) __asm_strrchr(s,n)
#endif /* __NOINLINE__ */
#endif /* __STRING_H */
#ifndef __STRING_H
#define __STRING_H 1
#ifndef __SIZE_T
#define __SIZE_T 1
typedef unsigned long size_t;
#endif
#undef NULL
#define NULL ((void *)0)
void *memcpy(void *,const void *,size_t);
void *memmove(void *,const void *,size_t);
char *strcpy(char *,const char *);
char *strncpy(char *,const char *,size_t);
char *strcat(char *,const char *);
char *strncat(char *,const char *,size_t);
int memcmp(const void *,const void *,size_t);
int strcmp(const char *,const char *);
int strncmp(const char *,const char *,size_t);
void *memchr(const void *,int,size_t);
char *strchr(const char *,int);
size_t strcspn(const char *,const char *);
char *strpbrk(const char *,const char *);
char *strrchr(const char *,int);
size_t strspn(const char *,const char *);
char *strstr(const char *,const char *);
void *memset(void *,int,size_t);
size_t strlen(const char *);
char *strtok(char *,const char *);
char *strerror(int);
int strcoll(const char *,const char *);
size_t strxfrm(char *,const char *,size_t);
#ifndef __NOINLINE__
#if defined(__M68000) || defined(__M68010)
void *memcpy(__reg("a0") void *, __reg("a1") const void *,
__reg("d2") size_t) =
"\tinline\n"
"\tmove.l\ta0,d0\n"
"\tcmp.l\t#16,d2\n"
"\tblo\t.l5\n"
"\tmoveq\t#1,d1\n"
"\tand.b\td0,d1\n"
"\tbeq\t.l1\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tsubq.l\t#1,d2\n"
".l1\n"
"\tmove.l\ta1,d1\n"
"\tand.b\t#1,d1\n"
"\tbeq\t.l3\n"
"\tcmp.l\t#$10000,d2\n"
"\tblo\t.l5\n"
".l2\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tsubq.l\t#1,d2\n"
"\tbne\t.l2\n"
"\tbra\t.l7\n"
".l3\n"
"\tmoveq\t#3,d1\n"
"\tand.l\td2,d1\n"
"\tsub.l\td1,d2\n"
".l4\n"
"\tmove.l\t(a1)+,(a0)+\n"
"\tsubq.l\t#4,d2\n"
"\tbne\t.l4\n"
"\tmove.w\td1,d2\n"
".l5\n"
"\tsubq.w\t#1,d2\n"
"\tblo\t.l7\n"
".l6\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tdbf\td2,.l6\n"
".l7\n"
"\teinline";
void *__memcpy_desc(__reg("a0") void *, __reg("a1") const void *,
__reg("d2") size_t) =
"\tinline\n"
"\tcmp.l\t#16,d2\n"
"\tblo\t.l5\n"
"\tmoveq\t#1,d1\n"
"\tmove.l\ta0,d0\n"
"\tand.b\td1,d0\n"
"\tbeq\t.l1\n"
"\tmove.b\t-(a1),-(a0)\n"
"\tsubq.l\t#1,d2\n"
".l1\n"
"\tmove.l\ta1,d0\n"
"\tand.b\td1,d0\n"
"\tbeq\t.l3\n"
"\tcmp.l\t#$10000,d2\n"
"\tblo\t.l5\n"
".l2\n"
"\tmove.b\t-(a1),-(a0)\n"
"\tsubq.l\t#1,d2\n"
"\tbne\t.l2\n"
"\tbra\t.l7\n"
".l3\n"
"\tmoveq\t#3,d1\n"
"\tand.l\td2,d1\n"
"\tsub.l\td1,d2\n"
".l4\n"
"\tmove.l\t-(a1),-(a0)\n"
"\tsubq.l\t#4,d2\n"
"\tbne\t.l4\n"
"\tmove.w\td1,d2\n"
".l5\n"
"\tsubq.w\t#1,d2\n"
"\tblo\t.l7\n"
".l6\n"
"\tmove.b\t-(a1),-(a0)\n"
"\tdbf\td2,.l6\n"
".l7\n"
"\tmove.l\ta0,d0\n"
"\teinline";
void *memset(__reg("a0") void *, __reg("d0") int, __reg("d2") size_t) =
"\tinline\n"
"\tmove.l\ta0,a1\n"
"\tcmp.l\t#16,d2\n"
"\tblo\t.l3\n"
"\tmove.l\ta0,d1\n"
"\tand.b\t#1,d1\n"
"\tbeq\t.l1\n"
"\tmove.b\td0,(a0)+\n"
"\tsubq.l\t#1,d2\n"
".l1\n"
"\tmove.b\td0,d1\n"
"\tlsl.w\t#8,d0\n"
"\tmove.b\td1,d0\n"
"\tmove.w\td0,d1\n"
"\tswap\td0\n"
"\tmove.w\td1,d0\n"
"\tmoveq\t#3,d1\n"
"\tand.l\td2,d1\n"
"\tsub.l\td1,d2\n"
".l2\n"
"\tmove.l\td0,(a0)+\n"
"\tsubq.l\t#4,d2\n"
"\tbne\t.l2\n"
"\tmove.w\td1,d2\n"
".l3\n"
"\tsubq.w\t#1,d2\n"
"\tblo\t.l5\n"
".l4\n"
"\tmove.b\td0,(a0)+\n"
"\tdbf\td2,.l4\n"
".l5\n"
"\tmove.l\ta1,d0\n"
"\teinline";
#else /* 68020+ */
void *memcpy(__reg("a0") void *, __reg("a1") const void *, __reg("d2") size_t) =
"\tinline\n"
"\tmove.l\ta0,d0\n"
"\tsubq.l\t#4,d2\n"
"\tbcs\t.l3\n"
"\tmove.l\td0,d1\n"
"\tlsr.l\t#1,d1\n"
"\tbcc\t.l1\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tsubq.l\t#1,d2\n"
"\tbcs\t.l3\n"
"\taddq.l\t#1,d1\n"
".l1\n"
"\tlsr.l\t#1,d1\n"
"\tbcc\t.l2\n"
"\tmove.w\t(a1)+,(a0)+\n"
"\tsubq.l\t#2,d2\n"
"\tbcs\t.l3\n"
".l2\n"
"\tmove.l\t(a1)+,(a0)+\n"
"\tsubq.l\t#4,d2\n"
"\tbcc\t.l2\n"
".l3\n"
"\taddq.l\t#3,d2\n"
"\tbcc\t.l5\n"
".l4\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tdbf\td2,.l4\n"
".l5\n"
"\teinline";
void *__memcpy_desc(__reg("a0") void *, __reg("a1") const void *,
__reg("d2") size_t) =
"\tinline\n"
"\tsubq.l\t#4,d2\n"
"\tbcs\t.l3\n"
"\tmove.l\ta0,d0\n"
"\tlsr.l\t#1,d0\n"
"\tbcc\t.l1\n"
"\tmove.b\t-(a1),-(a0)\n"
"\tsubq.l\t#1,d2\n"
"\tbcs\t.l3\n"
".l1\n"
"\tlsr.l\t#1,d0\n"
"\tbcc\t.l2\n"
"\tmove.w\t-(a1),-(a0)\n"
"\tsubq.l\t#2,d2\n"
"\tbcs\t.l3\n"
".l2\n"
"\tmove.l\t-(a1),-(a0)\n"
"\tsubq.l\t#4,d2\n"
"\tbcc\t.l2\n"
".l3\n"
"\taddq.l\t#3,d2\n"
"\tbcc\t.l5\n"
".l4\n"
"\tmove.b\t-(a1),-(a0)\n"
"\tdbf\td2,.l4\n"
".l5\n"
"\tmove.l\ta0,d0\n"
"\teinline";
void *memset(__reg("a0") void *, __reg("d0") int, __reg("d2") size_t) =
"\tinline\n"
"\tmove.l\ta0,a1\n"
"\tsubq.l\t#8,d2\n"
"\tbcs\t.l3\n"
"\tmove.l\td0,d1\n"
"\tlsl.l\t#8,d0\n"
"\tmove.b\td1,d0\n"
"\taddq.l\t#4,d2\n"
"\tmove.l\td0,d1\n"
"\tswap\td0\n"
"\tmove.w\td1,d0\n"
"\tmove.l\ta1,d1\n"
"\tlsr.l\t#1,d1\n"
"\tbcc\t.l1\n"
"\tmove.b\td0,(a0)+\n"
"\taddq.l\t#1,d1\n"
"\tsubq.l\t#1,d2\n"
".l1\n"
"\tlsr.l\t#1,d1\n"
"\tbcc\t.l2\n"
"\tmove.w\td0,(a0)+\n"
"\tsubq.l\t#2,d2\n"
".l2\n"
"\tmove.l\td0,(a0)+\n"
"\tsubq.l\t#4,d2\n"
"\tbcc\t.l2\n"
"\taddq.l\t#3,d2\n"
"\tbcs\t.l4\n"
"\tbra\t.l5\n"
".l3\n"
"\taddq.l\t#7,d2\n"
"\tbcc\t.l5\n"
".l4\n"
"\tmove.b\td0,(a0)+\n"
"\tdbf\td2,.l4\n"
".l5\n"
"\tmove.l\ta1,d0\n"
"\teinline";
#endif /* 68020+ */
size_t strlen(__reg("a0") const char *) =
"\tinline\n"
"\tmove.l\ta0,d0\n"
".l1\n"
"\ttst.b\t(a0)+\n"
"\tbne\t.l1\n"
"\tsub.l\ta0,d0\n"
"\tnot.l\td0\n"
"\teinline";
char *strcpy(__reg("a0") char *, __reg("a1") const char *) =
"\tinline\n"
"\tmove.l\ta0,d0\n"
".l1\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tbne\t.l1\n"
"\teinline";
char *strncpy(__reg("a0") char *, __reg("a1") const char *,
__reg("d1") size_t) =
"\tinline\n"
"\tmove.l\ta0,d0\n"
"\tbra\t.l2\n"
".l1\n"
"\tmove.b\t(a1),(a0)+\n"
"\tbeq\t.l2\n"
"\taddq.l\t#1,a1\n"
".l2\n"
"\tsubq.l\t#1,d1\n"
"\tbpl\t.l1\n"
"\teinline";
int strcmp(__reg("a0") const char *, __reg("a1") const char *) =
"\tinline\n"
"\tmoveq\t#0,d0\n"
"\tmoveq\t#0,d1\n"
".l1\n"
"\tmove.b\t(a0)+,d0\n"
"\tmove.b\t(a1)+,d1\n"
"\tbeq\t.l2\n"
"\tsub.l\td1,d0\n"
"\tbeq\t.l1\n"
"\tmoveq\t#0,d1\n"
".l2\n"
"\tsub.l\td1,d0\n"
"\teinline";
int strncmp(__reg("a0") const char *, __reg("a1") const char *,
__reg("d2") size_t) =
"\tinline\n"
"\tmoveq\t#0,d0\n"
"\tmoveq\t#0,d1\n"
".l1\n"
"\tsubq.l\t#1,d2\n"
"\tbmi\t.l3\n"
"\tmove.b\t(a0)+,d0\n"
"\tmove.b\t(a1)+,d1\n"
"\tbeq\t.l2\n"
"\tsub.l\td1,d0\n"
"\tbeq\t.l1\n"
"\tmoveq\t#0,d1\n"
".l2\n"
"\tsub.l\td1,d0\n"
".l3\n"
"\teinline";
char *strcat(__reg("a0") char *, __reg("a1") const char *) =
"\tinline\n"
"\tmove.l\ta0,d0\n"
".l1\n"
"\ttst.b\t(a0)+\n"
"\tbne\t.l1\n"
"\tsubq.l\t#1,a0\n"
".l2\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tbne\t.l2\n"
"\teinline";
char *strncat(__reg("a0") char *, __reg("a1") const char *,
__reg("d1") size_t) =
"\tinline\n"
"\tmove.l\ta0,d0\n"
"\ttst.l\td1\n"
"\tbeq\t.l3\n"
".l1\n"
"\ttst.b\t(a0)+\n"
"\tbne\t.l1\n"
"\tsubq.l\t#1,a0\n"
".l2\n"
"\tmove.b\t(a1)+,(a0)+\n"
"\tbeq\t.l3\n"
"\tsubq.l\t#1,d1\n"
"\tbne\t.l2\n"
".l3\n"
"\teinline";
char *strrchr(__reg("a0") const char *, __reg("d1") int) =
"\tinline\n"
"\tmoveq\t#0,d0\n"
".l1\n"
"\tcmp.b\t(a0),d1\n"
"\tbne\t.l2\n"
"\tmove.l\ta0,d0\n"
".l2\n"
"\ttst.b\t(a0)+\n"
"\tbne\t.l1\n"
"\teinline";
#define memmove(d,s,n) ((d)<=(s) ? memcpy(d,s,n) : \
__memcpy_desc((char *)(d)+(n),(char *)(s)+(n),n))
#endif /* __NOINLINE__ */
#endif /* __STRING_H */

Binary file not shown.