2 * Copyright 2010-2012 Chris Spiegel.
4 * This file is part of Bocfel.
6 * Bocfel is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License, version
8 * 2 or 3, as published by the Free Software Foundation.
10 * Bocfel is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with Bocfel. If not, see <http://www.gnu.org/licenses/>.
26 uint8_t *memory, *dynamic_memory;
29 void user_store_byte(uint16_t addr, uint8_t v)
31 /* If safety checks are off, there’s no point in checking these
33 #ifndef ZTERP_NO_SAFETY_CHECKS
37 ZASSERT(v == BYTE(addr) || (BYTE(addr) ^ v) == 8, "not allowed to modify any bits but 3 at 0x0001");
42 /* 0x10 can’t be modified, but let it slide if the story is storing
43 * the same value that’s already there. This is useful because the
44 * flags at 0x10 are stored in a word, so the story possibly could use
45 * @storew at 0x10 to modify the bits in 0x11.
47 if(addr == 0x10 && BYTE(addr) == v)
56 ZASSERT((BYTE(addr) ^ v) < 8, "not allowed to modify bits 3-7 at 0x0011");
58 if(!output_stream((v & FLAGS2_TRANSCRIPT) ? OSTREAM_SCRIPT : -OSTREAM_SCRIPT, 0)) v &= ~FLAGS2_TRANSCRIPT;
60 header_fixed_font = v & FLAGS2_FIXED;
66 ZASSERT(addr >= 0x40 && addr < header.static_start, "attempt to write to read-only address 0x%lx", (unsigned long)addr);
72 void user_store_word(uint16_t addr, uint16_t v)
74 user_store_byte(addr + 0, v >> 8);
75 user_store_byte(addr + 1, v & 0xff);