This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Messages - ProgrammerNerd
46
« on: December 18, 2013, 10:30:58 pm »
The few graphical glitches present are know issues. I do not have much time to work on it right now. I do know that some fonts do not display even though when compiling it for PC instead of for casio by typing make instead of make -f Makefile_casio then the fonts work just fine. Also yes there are minor hud issues that show on both PC and calculator. The only difference in code is that Instead of drawing to the casio's vram it draw's to an SDL surface that like the Casio's LCD display is 384x216 with 16bits per pixel. Also Keoni29 you were wondering how many changes I had to make to get this working on Casio prizm the answer is that it was a moderate change I ended up replacing all SDL functions now reflecting back I really should have just ported used the SDL port for casio prizm that was available. I did have to make changes to the code so that it uses less ram for example I found out that when loading level it takes ~160kb just to hold layout so I had to make this data stored in what is normally the Save/Load VRAM buffer this is used for graphs when you draw graph and exit and go back to the graph you will see it instantly without redraw. This works if and only if you have not changed any formulas or the "Window". The reason it appears instant to the user is because the already drawn graph is stored in that area of RAM. Jazz jackrabbit does not have a need to Save/Load VRAM so I can use it in my program. I also wrote a custom memory allocated that uses the stack it has an array of structs that contain a pointer to memory. When freeing alloacted memory the allocated memory around it will be moved to fill it's place instead of fragmentation.
47
« on: December 18, 2013, 07:25:05 pm »
@DJ Omnimaga (list post) There are a few different versions of jazz jackrabbit released by Epic. So therefor your list may not necessarily correspond with the version others have downloaded. As a general rule of thumb the files you need end with a number. You don't need the documentation or EXE files. Also you do need END.OSC and the FONT*.OFN files. If you get a file not found error add the relevant files.
48
« on: December 16, 2013, 12:48:17 am »
Edit I have released a new version that address some graphical issues on the HUD and fixes the fact that it is impossible to exit the game. The reason it is fixed is because instead of using a fixed Save/load vram address which may only be correct on a certian firmware version it instead searches for it. I have ported open Jazz jackrabbit to the casio prizm. Here are the controls keys[C_UP].key = KEY_PRGM_UP; keys[C_DOWN].key = KEY_PRGM_DOWN; keys[C_LEFT].key = KEY_PRGM_LEFT; keys[C_RIGHT].key = KEY_PRGM_RIGHT; keys[C_JUMP].key = KEY_PRGM_ALPHA; keys[C_SWIM].key = keys[C_JUMP].key; keys[C_FIRE].key = KEY_PRGM_SHIFT; keys[C_CHANGE].key = KEY_PRGM_OPTN;//change weapon keys[C_ENTER].key = KEY_PRGM_RETURN; keys[C_ESCAPE].key = KEY_PRGM_EXIT; keys[C_STATS].key = KEY_PRGM_F1; keys[C_PAUSE].key = KEY_PRGM_F2; keys[C_YES].key = KEY_PRGM_F3; keys[C_NO].key = KEY_PRGM_F4;
Here is the source code https://github.com/ComputerNerd/Open-Jazz-Jackrabbit-Casio-Prizm-portAnd here is the binary. http://www.casiopeia.net/forum/downloads.php?view=detail&df_id=145To use the program place openjazz.g3a in the root directory then create a folder called jazz place openjazz.000 in that folder then download one of the many versions of jazz jackrabbit and place the resource files in that folder. You do not need the sound files and you do not need the "extra" files for example the cd version includes a demo of another game you don't need that you also don't need the *.exe file also there are some unneeded cutscene files that take up lots of memory those are not needed when in doubt use grep on the source code to see if the file is needed. Edit Screenshots:
49
« on: September 25, 2013, 02:13:31 pm »
Yes fixed point math is part of the speedup however I would like you to take note of the comments in the function called ManIt() as you can see I credited the websites http://locklessinc.com/articles/mandelbrot/ and https://randomascii.wordpress.com/2011/08/13/faster-fractals-through-algebra/The first website contains some nice "early exit" code which speeds things up a lot. The second website contains some code to reduce the amount of multiplications needed. There are still some optimizations that I don't take advantage of such as the fact that 1/4 of the pixels are already calculated and don't need to be redrawn again. I already fixed that but there is still lots more work to be done before the next release. Also Xeda112358 what is up with your plot function? void plot(int x0, int y0, int color) { char* VRAM = (char*)0xA8000000; VRAM += 2*(y0*LCD_WIDTH_PX + x0); *(VRAM++) = (color&0x0000FF00)>>8; *(VRAM++) = (color&0x000000FF); return; }
Should be inline void plot(unsigned short x0, unsigned short y0, unsigned short color) { unsigned short* VRAM = (unsigned short*)0xA8000000; VRAM += (y0*LCD_WIDTH_PX) + x0; *VRAM = color; }
Not tested but should work. I access VRAM as unsigned short in my program and it draws just fine. The reason for the change is because your function seems kind of inefficient not to cause offense but just giving optimization tips.
50
« on: September 22, 2013, 10:03:22 am »
This topic reminded me of a program that I wrote awhile ago for the casio prizm. It takes less than a second in my program to do a mandelbrot. I actully wrote it about 6 months ago maybe more don't remeber. I did not spend too much time on it so there is much work needed to be done. I am working on improving it right now. Here is a video And the source code. #include <display_syscalls.h> #include <keyboard_syscalls.h> #include <keyboard.hpp> #include <color.h> #include <display.h>//display is 384x216 typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; typedef int int32_t; typedef int fixed_t; static fixed_t divX; static fixed_t addX; static fixed_t divY; static fixed_t addY; static fixed_t stepX; static fixed_t stepY; #define preMan 13 static fixed_t scaleM[4] = {-2<<preMan,1<<preMan,-1<<preMan,1<<preMan}; const unsigned short* keyboard_register = (unsigned short*)0xA44B0000; unsigned short lastkey[8]; unsigned short holdkey[8]; void keyupdate(void) { memcpy(holdkey, lastkey, sizeof(unsigned short)*8); memcpy(lastkey, keyboard_register, sizeof(unsigned short)*8); } int keydownlast(int basic_keycode){ int row, col, word, bit; row = basic_keycode%10; col = basic_keycode/10-1; word = row>>1; bit = col + 8*(row&1); return (0 != (lastkey[word] & 1<<bit)); } int keydownhold(int basic_keycode){ int row, col, word, bit; row = basic_keycode%10; col = basic_keycode/10-1; word = row>>1; bit = col + 8*(row&1); return (0 != (holdkey[word] & 1<<bit)); } inline fixed_t abs(fixed_t val){ if (val < 0) val*=-1; return val; } inline void plotMan(fixed_t x,fixed_t y,uint16_t col){ uint16_t * vramAd=(uint16_t *)0xA8000000; x+=addX; x=x*384/divX; y+=addY; y=y*216/divY; vramAd+=(y*384)+x; *vramAd=col; } inline fixed_t square(fixed_t x){ return x*x; } void setScale(fixed_t * scale){//format minx maxx miny maxy divX=abs(scale[0]-scale[1]); divY=abs(scale[2]-scale[3]); addX=scale[0]*-1; addY=scale[2]*-1; stepX=divX/384; stepY=divY/216; } uint16_t ManIt(fixed_t c_r,fixed_t c_i,uint16_t maxit){//manIt stands for mandelbrot iteration what did you think it stood for? //c_r = scaled x coordinate of pixel (must be scaled to lie somewhere in the mandelbrot X scale (-2.5, 1) //c_i = scaled y coordinate of pixel (must be scaled to lie somewhere in the mandelbrot Y scale (-1, 1) // squre optimaztion code below orgionally from http://randomascii.wordpress.com/2011/08/13/faster-fractals-through-algebra/ //early bailout code from http://locklessinc.com/articles/mandelbrot/ //changed by me to use fixed point math fixed_t ckr,cki; unsigned p=0,ptot=8; fixed_t z_r = c_r; fixed_t z_i = c_i; fixed_t zrsqr = (z_r * z_r)>>preMan; fixed_t zisqr = (z_i * z_i)>>preMan; //int zrsqr,zisqr; do{ ckr = z_r; cki = z_i; ptot += ptot; if (ptot > maxit) ptot = maxit; for (; p < ptot;++p){ z_i =(square(z_r+z_i)>>preMan)-zrsqr-zisqr; z_i += c_i; z_r = zrsqr-zisqr+c_r; zrsqr = (z_r*z_r)>>preMan; zisqr = (z_i*z_i)>>preMan; if ((zrsqr + zisqr) > (4<<preMan)) return p*0xFFFF/maxit; if ((z_r == ckr) && (z_i == cki)) return 0xFFFF; } } while (ptot != maxit); //plotMan(x0,y0,(uint32_t)iteration*(uint32_t)0xFFFF/(uint32_t)maxit); //return (uint32_t)p*(uint32_t)0xFFFF/(uint32_t)maxit; return 0xFFFF; } void mandel(uint16_t maxit){ fixed_t x,y; uint16_t xx; uint16_t * vramAd=(uint16_t *)0xA8000000; for (y=scaleM[2];y<scaleM[3];y+=stepY){ xx=0; for (x=scaleM[0];x<scaleM[1];x+=stepX){ if (xx > 400) return; *vramAd++=ManIt(x,y,maxit); xx++; } vramAd+=384-xx; } Bdisp_PutDisp_DD(); } void mandel4(uint16_t maxit){ static uint16_t temp[100]; fixed_t x,y; uint16_t xx; uint8_t yy,z; uint16_t * vramAd=(uint16_t *)0xA8000000; for (y=scaleM[2];y<scaleM[3];y+=stepY*4){ xx=0; for (x=scaleM[0];x<scaleM[1];x+=stepX*4){ if (xx > 96) return; temp[xx]=ManIt(x,y,maxit); xx++; } for (yy=0;yy<4;++yy){ for (x=0;x<96;++x){ *vramAd++=temp[x]; *vramAd++=temp[x]; *vramAd++=temp[x]; *vramAd++=temp[x]; } } // vramAd+=384-xx; // vramAd+=384*15; } Bdisp_PutDisp_DD(); } /*int PRGM_GetKey(void) { unsigned char buffer[12]; PRGM_GetKey_OS( buffer ); return ( buffer[1] & 0x0F ) * 10 + ( ( buffer[2] & 0xF0 ) >> 4 ); }*/ void main(void) { Bdisp_EnableColor(1); Bdisp_AllClr_VRAM(); setScale(scaleM); uint16_t z=31; mandel(z); uint8_t redraw=1; //uint16_t z=28;//good values for z 28 31 36 41 42 31 is my favoirte so far do{ keyupdate(); if (keydownlast(KEY_PRGM_F1) && keydownhold(KEY_PRGM_F1)){ z=0xFFFF; redraw=2; } if (keydownlast(KEY_PRGM_F2) && keydownhold(KEY_PRGM_F2)){ z=31; redraw=2; } if (keydownlast(KEY_PRGM_1) && keydownhold(KEY_PRGM_1)){ z--; redraw=2; } if (keydownlast(KEY_PRGM_2) && keydownhold(KEY_PRGM_2)){ z++; redraw=2; } if (keydownlast(KEY_PRGM_SHIFT) && keydownhold(KEY_PRGM_SHIFT)){ scaleM[0]+=256; scaleM[1]-=256; scaleM[2]+=144; scaleM[3]-=144; setScale(scaleM); redraw=2; } if (keydownlast(KEY_PRGM_ALPHA) && keydownhold(KEY_PRGM_ALPHA)){ scaleM[0]-=256; scaleM[1]+=256; scaleM[2]-=144; scaleM[3]+=144; setScale(scaleM); redraw=2; } if (keydownlast(KEY_PRGM_UP) && keydownhold(KEY_PRGM_UP)){ scaleM[2]-=144; scaleM[3]-=144; setScale(scaleM); redraw=2; } if (keydownlast(KEY_PRGM_DOWN) && keydownhold(KEY_PRGM_DOWN)) { scaleM[2]+=144; scaleM[3]+=144; setScale(scaleM); redraw=2; } if (keydownlast(KEY_PRGM_LEFT) && keydownhold(KEY_PRGM_LEFT)){ scaleM[0]-=256; scaleM[1]-=256; setScale(scaleM); redraw=2; } if (keydownlast(KEY_PRGM_RIGHT) && keydownhold(KEY_PRGM_RIGHT)){ scaleM[0]+=256; scaleM[1]+=256; setScale(scaleM); redraw=2; } if (redraw == 1){ mandel(z); redraw=0; } else if (redraw == 2){ mandel4(z); redraw=1; } } while (!(keydownlast(KEY_PRGM_EXIT) && keydownhold(KEY_PRGM_EXIT))); //MsgBoxPop(); return; }
|