Mercurial > repo
view interps/egobf/src/c2m/i386/i386-0.h @ 9070:77f510ad2f14
<evilipse> ` chmod 777 / -R
author | HackBot |
---|---|
date | Sun, 25 Sep 2016 20:07:36 +0000 |
parents | 859f9b4339e6 |
children |
line wrap: on
line source
/* * Copyright (c) 2005 Gregor Richards * * This file is part of egobfi. * * egobfi is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * egobfi is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with egobfi; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #define C2MHEAD() { \ memcpy((char *) (prog + pptr), \ "\x55" \ "\x89\xe5", 3); \ pptr += 3; \ } #define C2MTAIL() { \ memcpy((char *) (prog + pptr), \ "\x5d\xc3", 2); \ pptr += 2; \ } #define C2MADD(a) { \ memcpy((char *) (prog + pptr), \ "\x8b\x15____" \ "\xa1____" \ "\x8a\x00" \ "\x83__" \ "\x88\x02", 18); \ memcpy((char *) (prog + pptr + 2), &mptri, 4); \ memcpy((char *) (prog + pptr + 7), &mptri, 4); \ if ((a) >= 0) { \ *((char *) (prog + pptr + 14)) = '\xc0'; \ *((char *) (prog + pptr + 15)) = (char) (a); \ } else { \ *((char *) (prog + pptr + 14)) = '\xe8'; \ *((char *) (prog + pptr + 15)) = (char) ((a) * -1); \ } \ pptr += 18; \ } #define C2MRHT(a) { \ if ((a) >= 0) {\ memcpy((char *) (prog + pptr), \ "\x83\x05_____", 7); \ memcpy((char *) (prog + pptr + 2), &mptri, 4); \ *((char *) (prog + pptr + 6)) = (a); \ } else { \ memcpy((char *) (prog + pptr), \ "\x83\x2d_____", 7); \ memcpy((char *) (prog + pptr + 2), &mptri, 4); \ *((char *) (prog + pptr + 6)) = (a) * -1; \ } \ pptr += 7; \ } #define C2MLOS 14 #define C2MLO(rpptr) { \ int jlen; \ jlen = (int) (prog + pptr) - (int) (prog + rpptr) - 9; \ memcpy((char *) (prog + (rpptr)), \ "\xa1____" \ "\x80\x38\x00" \ "\x0f\x84____", 14); \ memcpy((char *) (prog + (rpptr) + 1), &mptri, 4); \ memcpy((char *) (prog + (rpptr) + 10), &jlen, 4); \ } #define C2MLC(sp) { \ int jlen; \ jlen = (int) (prog + sp) - (int) (prog + pptr) - 5; \ memcpy((char *) (prog + pptr), \ "\xe9____", 5); \ memcpy((char *) (prog + pptr + 1), &jlen, 4); \ pptr += 5; \ } #define C2MCALL(a) { \ int cptr; \ cptr = (int) (a) - (int) (prog + pptr) - 5; \ memcpy((char *) (prog + pptr), \ "\xe8____", 5); \ memcpy((char *) (prog + pptr + 1), &cptr, 4); \ pptr += 5; \ }