4 * Ullrich von Bassewitz, 20.09.1998
14 /* Possible returns of getcpu() */
19 unsigned char getcpu (void);
20 /* Detect the CPU the program is running on */
24 /* Macros for CPU instructions */
25 #define BRK() __asm__ ("\tbrk")
26 #define CLI() __asm__ ("\tcli")
27 #define SEI() __asm__ ("\tsei")
31 /* Struct that holds the registers for the sys function */
33 unsigned char a; /* A register value */
34 unsigned char x; /* X register value */
35 unsigned char y; /* Y register value */
36 unsigned char flags; /* Flags value */
37 unsigned pc; /* Program counter */
40 /* Defines for the flags in the regs structure */
41 #define F_NEG 0x80 /* N flag */
42 #define F_OVF 0x40 /* V flag */
43 #define F_BRK 0x10 /* B flag */
44 #define F_DEC 0x08 /* D flag */
45 #define F_IEN 0x04 /* I flag */
46 #define F_ZERO 0x02 /* Z flag */
47 #define F_CARRY 0x01 /* C flag */
49 /* Function to call any machine language subroutine. All registers in the
50 * regs structure are passed into the routine and the results are passed
51 * out. Some of the flags are ignored on input. The called routine must
54 void __fastcall__ _sys (struct regs* r);
58 /* Set and reset the break vector. The given user function is called if
59 * a break occurs. The values of the registers may be read from the brk_...
60 * variables. The value in brk_pc will point to the address that contains
61 * the brk instruction.
62 * The set_brk function will install an exit handler that will reset the
63 * vector if the program ends.
66 extern unsigned char brk_a; /* A register value */
67 extern unsigned char brk_x; /* X register value */
68 extern unsigned char brk_y; /* Y register value */
69 extern unsigned char brk_sr; /* Status register */
70 extern unsigned brk_pc; /* PC value */
72 typedef void (*brk_handler) (void);
73 /* Type of the break handler */
75 void __fastcall__ set_brk (brk_handler f);
76 /* Set the break vector to the given address, return the old address */
78 void reset_brk (void);
79 /* Reset the break vector to the original value */