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/>.
28 void zcopy_table(void)
30 uint16_t first = zargs[0], second = zargs[1], size = zargs[2];
34 for(uint16_t i = 0; i < size; i++) user_store_byte(first + i, 0);
36 else if( (first > second) || (int16_t)size < 0 )
38 long n = labs((int16_t)size);
39 for(long i = 0; i < n; i++) user_store_byte(second + i, user_byte(first + i));
43 for(uint16_t i = 0; i < size; i++) user_store_byte(second + size - i - 1, user_byte(first + size - i - 1));
47 void zscan_table(void)
49 uint16_t addr = zargs[1];
51 if(znargs < 4) zargs[3] = 0x82;
53 for(uint16_t i = 0; i < zargs[2]; i++)
56 ( (zargs[3] & 0x80) && (user_word(addr) == zargs[0])) ||
57 (!(zargs[3] & 0x80) && (user_byte(addr) == zargs[0]))
65 addr += zargs[3] & 0x7f;
74 store(user_word(zargs[0] + (2 * zargs[1])));
79 store(user_byte(zargs[0] + zargs[1]));
84 user_store_byte(zargs[0] + zargs[1], zargs[2]);
89 user_store_word(zargs[0] + (2 * zargs[1]), zargs[2]);