os.h (1497B)
1 /* 2 * Copyright 2021 Gerd Beuster (gerd@frombelow.net). This is free 3 * software under the GNU GPL v3 license or any later version. See 4 * COPYING in the root directory for details. 5 */ 6 7 #ifndef OS_H 8 #define OS_H 9 10 /* For detecting memory leaks. */ 11 void __fastcall__ get_stack_pointers(unsigned char *hw_sp, unsigned *eris_sp, 12 unsigned *cc65_sp); 13 14 /* Access to resources */ 15 16 #define IRQ_ISR = 0x7ffe 17 18 #ifdef SYMON 19 #define ACIA_BASE = 0x8800 20 #else 21 #define ACIA_BASE = 0xc000 22 #endif 23 #define ACIA_DATA_REG ACIA_BASE 24 #define ACIA_STATUS_REG (ACIA_BASE+0x1) 25 #define ACIA_CMD_REG (ACIA_BASE+0x2) 26 #define ACIA_CTRL_REG (ACIA_BASE+0x3) 27 28 #ifdef SYMON 29 #define VIA_BASE 0x8000 30 #else 31 #define VIA_BASE 0xc800 32 #endif 33 #define VIA_RB VIA_BASE 34 #define VIA_RA (VIA_BASE+0x1) 35 #define VIA_DDRB (VIA_BASE+0x2) 36 #define VIA_DDRA (VIA_BASE+0x3) 37 #define VIA_T1CL (VIA_BASE+0x4) 38 #define VIA_T1CH (VIA_BASE+0x5) 39 #define VIA_T1LL (VIA_BASE+0x6) 40 #define VIA_T1LH (VIA_BASE+0x7) 41 #define VIA_T2CL (VIA_BASE+0x8) 42 #define VIA_T2CH (VIA_BASE+0x9) 43 #define VIA_SR (VIA_BASE+0xA) 44 #define VIA_ACR (VIA_BASE+0xB) 45 #define VIA_PCR (VIA_BASE+0xC) 46 #define VIA_IFR (VIA_BASE+0xD) 47 #define VIA_IER (VIA_BASE+0xE) 48 #define VIA_RA2 (VIA_BASE+0xF) 49 50 // https://github.com/cc65/wiki/wiki/PEEK-and-POKE 51 #define POKE(addr,val) (*(unsigned char*) (addr) = (val)) 52 #define POKEW(addr,val) (*(unsigned*) (addr) = (val)) 53 #define PEEK(addr) (*(unsigned char*) (addr)) 54 #define PEEKW(addr) (*(unsigned*) (addr)) 55 56 #endif 57