From df843d10925960c6bfb262cb4d6389993ecb0b80 Mon Sep 17 00:00:00 2001 From: aorante Date: Sun, 8 May 2016 19:40:35 +0200 Subject: [PATCH] =?UTF-8?q?subimos=20la=20versi=C3=B3n=20v09b=20al=20githu?= =?UTF-8?q?b?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 + MAKE2bin.BAT | 2 + MAKEFILE.BAT | 3 + TARP.xprj | 20 + dist/tarp.ROM | Bin 0 -> 8192 bytes include/VDP_TMS9918.h | 178 ++++ include/functions.h | 47 + include/newTypes.h | 24 + libs/VDP_TMS9918.rel | 249 +++++ libs/VDP_TMS9918_BIOS.rel | 229 +++++ libs/crt0msx.16k.4000.rel | 13 + libs/functions.rel | 326 +++++++ src/tarp.c | 1926 +++++++++++++++++++++++++++++++++++++ 13 files changed, 3020 insertions(+) create mode 100644 MAKE2bin.BAT create mode 100644 MAKEFILE.BAT create mode 100644 TARP.xprj create mode 100644 dist/tarp.ROM create mode 100644 include/VDP_TMS9918.h create mode 100644 include/functions.h create mode 100644 include/newTypes.h create mode 100644 libs/VDP_TMS9918.rel create mode 100644 libs/VDP_TMS9918_BIOS.rel create mode 100644 libs/crt0msx.16k.4000.rel create mode 100644 libs/functions.rel create mode 100644 src/tarp.c diff --git a/.gitignore b/.gitignore index bbf313b..e36ddec 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,6 @@ # Debug files *.dSYM/ + +/build/* +/output.txt \ No newline at end of file diff --git a/MAKE2bin.BAT b/MAKE2bin.BAT new file mode 100644 index 0000000..3d3b459 --- /dev/null +++ b/MAKE2bin.BAT @@ -0,0 +1,2 @@ +hex2bin -s 4000 -l 8000 -e ROM build\tarp.ihx +pause diff --git a/MAKEFILE.BAT b/MAKEFILE.BAT new file mode 100644 index 0000000..92f7a67 --- /dev/null +++ b/MAKEFILE.BAT @@ -0,0 +1,3 @@ +sdcc -mz80 -o build\ --code-loc 0x4020 --data-loc 0xC000 --use-stdout --no-std-crt0 libs\crt0msx.16k.4000.rel libs\functions.rel libs\VDP_TMS9918_BIOS.rel src\tarp.c +hex2bin -s 0 -l 8000 build\tarp.ihx +pause diff --git a/TARP.xprj b/TARP.xprj new file mode 100644 index 0000000..3accdcb --- /dev/null +++ b/TARP.xprj @@ -0,0 +1,20 @@ + + + + + + + TARP + build + dist + include + REL + 1 + 4020 + C000 + + + + + + \ No newline at end of file diff --git a/dist/tarp.ROM b/dist/tarp.ROM new file mode 100644 index 0000000000000000000000000000000000000000..3e20e387cdfc0dae5ad594685a87e70f17e60d24 GIT binary patch literal 8192 zcmds6eRx#WnLqEjp9z6X2ni!ZGC{LoF-FRan?5PMdmP`f$K3`#BVRkZ^NW|mum|-YH z;B{mR_);*Lh(v;xh5155k($JOAX`cEIcYv8A?A~@Ad5$WlJDG$aRnX!?{xRk;>E_7 zlr*-`V-jNQTI}j_Ep>I7y-wF)*P&kXQ&+F+Lr{;7aQt6GeLWpT9P7!S8jZc~>NcmC z1*Y4aY8IOJo1d9U^Kx^B`Gxs8ygDwutfIw6svifOA-x@eB33~Y@JrBA^MYrFnRIuX zM~y8xGEUD?%F_xckGcWf0vhPf3f4)CiiTI@uzBIzSZ8_xZ8pH z2CY$qF;YZboSm?Oq8>(Z#mGiWR|aN-kr>)&1rW$6v1}u)!2%hj7K@}bC?NXKz#?la z2x0;aEI}v(+2;$OfkQBWoJb_mzySuM5JXXRsK(1^rAOyOXOM>>m)x*X;X1y<6o z%;)Gwt`jtkrc(i3NI#`@w1ygJmF}URO*sMFLpRe6w1}2a6~>wL5q+GZWTrV35B-6D zKo&hokI@$TcS-$m=JWJVQvNP_fHu&5w2pfyn>Mi=>{gOeVwkO zW%M^x1^&bIDg8`8K|K^zKcmm-PZTmXn8nFgACXUq(y#4Rk$5V{!`Yo4ksaASM~R$lw@VRmjfG@NPM@ zj+eRx>vILPRZ%tUjjoZ*P21Sq&*z zJ6HM+-Ck}`>`*w2MN5cltAp#L)3_`|cTey-+mZ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gl2YhOenBUp5Q|N;lDc8Eq+Ai?cN4Gq&129#0!d`20o5Z)vyb4_K z1>4$Xy&;P-9+au9GXS}Mt=p|_QeWqhP62oB3`xFbga`lo(F z0!_F7XYn()Tl|atH?FbRlTS{bfz7Zf`Rhj>*(A1wXb$t%1?uWB^4H-H&{tbq>yvn$ z!~?aPY6HLptd;atb%I`(mYacdO6Uc=cb=H9-&8O3L5-BFYYeOwc-^{+0&f zfPSd2mH6uVucdLp=d1N9!VkY24G`>-AE2y2;Hv|TQeRm?nSk~6<&w{z(lVM1;9l!@CYFqG9_Uo5|LB5$f;BY8AFAE#8`?B zs$pO#n=CJR2}wPuHN)5wjeQr-I9XHfy6dhfS!@I{=AJc6)&vUX)0&OCG z(%rRCR%_vcR^iFXR0XsI#+;%4i)rOB!Q-u%1Y4JV}hi4)nFch8!SXAzn(H#cY(LIZ3DF4!ifX;);63ImJ2I8%!@WoZ-%#aeQhYm=pGQZ&i3;xj E1bE0) setMSX2logoPal(); + + while(timec-->0) + { + HALT; + if((SNSMAT(7)|0xFB)==0xFB) break; // ESC + //if(SNSMAT(7)==127) break; // RETURN + if(SNSMAT(8)==0xFE) break; // SPACE + if (joytrig(1)<0 || joytrig(2)<0) break; //button 1, joy A & B + + } + + return; +} + + + + +void WorkWin() +{ + boolean isCasio=false; + boolean isTone=false; + boolean isDrum=false; + boolean isAB=true; + + boolean keyB6semaphore=false; + boolean keyB7semaphore=false; + + boolean joybool = false; + + + //uint t; + uint freqA; + uint freqB; + + + char amp; + char stone_step=0; //de 31 + char sdrum_step=31; + byte sdrum_size=0; + char sdrum_color=15; + char variacion=0; + + char B_offset =3; + + char Tempo = 4; + char tempoStep =4; + char pattern_step=0; + char last_step=0; + + char drum_type; + char tone_note; + char octave=2; + + char env_selected=0; + char env_speed=1; + byte env_step=0; + + char cursor_pos=0; + + byte i,o; + byte conta=0; + + byte keyPressed; + + byte joyval; + + //char pattern[16]={1,0,3,3,0,0,3,3,1,0,3,3,0,0,3,3}; + //char pattern[16]={1,0,3,0,2,0,2,0,1,0,3,0,2,0,3,0}; //rock1 + + INST_PERC Percu_casio[3]; + INST_PERC Percu_basic[3]; + + INST_PERC *tmp_INST; + + setupSprites(1,1); //16x16 zoom + setSprites(); + + // erase sprites 2 & 3 ??? + //setSpritePat(2,31); + //setSpritePat(3,31); + + setTileset(); + + if (VDP_type>0) setMSX2Palette(); + + setMainScr(); + + + // Instrumentos percusion - Kit Casio PT1 + // Kick + Percu_casio[0].isTone=true; + Percu_casio[0].isNoise=false; + Percu_casio[0].Tone=140; + Percu_casio[0].Noise=0; + Percu_casio[0].Shape=1; + Percu_casio[0].Period=800; + + // Snare + Percu_casio[1].isTone=false; + Percu_casio[1].isNoise=true; + Percu_casio[1].Tone=0; + Percu_casio[1].Noise=0; + Percu_casio[1].Shape=1; + Percu_casio[1].Period=1600; + + // Hi + Percu_casio[2].isTone=true; + Percu_casio[2].isNoise=false; + Percu_casio[2].Tone=66; + Percu_casio[2].Noise=0; + Percu_casio[2].Shape=1; + Percu_casio[2].Period=400; + + + // Instrumentos percusion Kit Basico + // Kick + Percu_basic[0].isTone=true; + Percu_basic[0].isNoise=false; + Percu_basic[0].Tone=1700; + Percu_basic[0].Noise=0; + Percu_basic[0].Shape=1; + Percu_basic[0].Period=800; + + // Snare + Percu_basic[1].isTone=true; + Percu_basic[1].isNoise=true; + Percu_basic[1].Tone=1000; + Percu_basic[1].Noise=0; + Percu_basic[1].Shape=1; + Percu_basic[1].Period=1200; + + // Hi + Percu_basic[2].isTone=false; + Percu_basic[2].isNoise=true; + Percu_basic[2].Tone=0; + Percu_basic[2].Noise=0; + Percu_basic[2].Shape=1; + Percu_basic[2].Period=200; + // end + + // genera las estructuras de datos de las envolventes + for(i=0;i<8;i++) + { + env_list[i].isLoop = enve_loop[i]; + for(o=0;o<16;o++) + { + env_list[i].ampValues[o] = enve_data[conta++]; + } + } + // end + + + // genera los patrones de percusion y tono + genDrumPattern(); + genTonePattern(); + + + poke(PLAY_HARDW,0); //selecciona AY interno + + fillRAM(PSG_RAM,13,0); //borra el area del buffer de registros del PSG + + // activa los canales A y B del AY (registro 7) + setChannel(0,true,false); + setChannel(1,true,false); + + vprintNumber(8,2, Tempo, 1); + + // muestra los valores de los controles + switcher(0x1909,isCasio); + switcher(0x19A9,isAB); + vprintNumber(6,14, B_offset, 3); + + showEnv(env_selected); + vprintNumber(8,17, env_speed, 1); + switcher(0x1A49,env_list[env_selected].isLoop); + + vprintNumber(8,20, octave, 1); + // end set visual controls values + + + // posiciona el cursor de seleccion de campo + vpoke(vaddr_cursor[cursor_pos],186); + + + while(1) + { + HALT; + play(); + if (peek(PSG_RAM+13)>0 && isDrum==true) sound_set(13,peek(PSG_RAM+13)); //lanza envolvente · dispara sonido percusion + + if (tempoStep>=Tempo) //control de tempo por ciclos de Vblank + { + tempoStep=0; + + // cursor de patron + vpoke(0x1AAE+last_step,239); //borra la ultima posicion + vpoke(0x1AAE+pattern_step,185); //muestra el cursor + last_step = pattern_step; + // + + + // control de la percusion + drum_type = drum_pattern[pattern_step]; + if(drum_type>0) + { + if(isCasio==true) tmp_INST= &Percu_casio[drum_type-1]; + else tmp_INST= &Percu_basic[drum_type-1]; + + setChannel(2,tmp_INST->isTone,tmp_INST->isNoise); + poke(PSG_RAM+4,tmp_INST->Tone & 0xFF); + poke(PSG_RAM+5,(tmp_INST->Tone & 0xFF00)/255); + poke(PSG_RAM+6,tmp_INST->Noise); //noise + poke(PSG_RAM+10,16); //volumen canal C + poke(PSG_RAM+11,tmp_INST->Period & 0xFF); + poke(PSG_RAM+12,(tmp_INST->Period & 0xFF00)/255); + poke(PSG_RAM+13,tmp_INST->Shape); //envelope wave form + + sdrum_size=7; + sdrum_color=drumcolor[drum_type]; + + }else{ + // es un silencio + poke(PSG_RAM+10,0); //volumen canal C + //sdrum_size=0; + } + + + // control del intrumento de acompañamiento + tone_note = tone_pattern[pattern_step]; + if(tone_note>0) + { + freqA = getFreq(tone_note+(octave*12)); //+ variacion; + freqB = freqA + B_offset; + //vprintNumber(20,0, tone_note, 3); // TEST ########################## + //vprintNumber(24,0, freq1, 5); + + poke(PSG_RAM,freqA & 0xFF); + poke(PSG_RAM+1,(freqA & 0xFF00)/255); + poke(PSG_RAM+2,freqB & 0xFF); + poke(PSG_RAM+3,(freqB & 0xFF00)/255); + + env_step=0; + } + + + // control de posicion de pattern + pattern_step++; + if(pattern_step>15)pattern_step=0; + }else{ + tempoStep++; + poke(PSG_RAM+13,0); //envelope wave form + drum_type=0; + } + + + + + if (isTone==true) + { + //control de volumen del tono (envolvente) ############################# + amp = env_list[env_selected].ampValues[env_step]; + + // calcula siguiente posicion. + env_step+=env_speed; + + if (env_step>15) //control de tamaño de envolvente + { + if (env_list[env_selected].isLoop==true) env_step=0; + else env_step=15; // ultimo valor de la envolvente + } + + }else{ + amp=0; + } + + poke(PSG_RAM+8,amp); + if(isAB==true) poke(PSG_RAM+9,amp); + else poke(PSG_RAM+9,0); + + + //sound_set(8,amp); + //sound_set(9,amp); + + //variacion = env00[pasos] * 2; + + + //sound_set(0,freq1 & 0xFF); + //sound_set(1,(freq1 & 0xFF00)/255); + //sound_set(2,freq2 & 0xFF); + //sound_set(3,(freq2 & 0xFF00)/255); + + + + // VISUALS ############################################################### + setSpritePos(0,xvalues[stone_step],yvalues[stone_step]); + setSpritePat(0,amp/2);// /2 + setSpriteCol(0,15); + stone_step++; + if (stone_step>63) stone_step=0; + + if (isDrum==false) + { + poke(PSG_RAM+10,0); //volumen canal C + sdrum_size=0; + } + +/* else + { + if (drum_type>0){ + sdrum_size=7; + sdrum_color=drumcolor[drum_type]; + } + }*/ + + if(sdrum_size==0) sdrum_color=drumcolor[0]; + setSpritePos(1,xvalues[sdrum_step],yvalues[sdrum_step]); + setSpritePat(1,sdrum_size); + setSpriteCol(1,sdrum_color); + + if (sdrum_size>0) sdrum_size--; + //vprintNumber(24,0, sdrum_size, 3); //test + sdrum_step++; + if (sdrum_step>63) sdrum_step=0; + // END VISUALS ########################################################### + + + + joyval=joystick(0); + if(joyval==0) joyval=joystick(1); + + if (joyval>0) + { + if (joybool==false) + { + joybool = true; + vpoke(vaddr_cursor[cursor_pos],32); + + if(joyval==1) // arriba + { + cursor_pos--; + if(cursor_pos<0)cursor_pos=8; + } + if(joyval==5) // abajo + { + cursor_pos++; + if(cursor_pos>8)cursor_pos=0; + } + if(joyval==3) // right + { + switch (cursor_pos) //{0x1841,0x1901,0x19A1,0x19C1,0x1A01,0x1A21,0x1A41,0x1A81,0x1AA1}; + { + case 0: //tempo + if (Tempo<8) Tempo++; + vprintNumber(8,2, Tempo, 1); + break; + case 1: //CASIO DRUMS? + isCasio=true; + switcher(0x1909,true); + break; + case 2: //A+B + isAB=true; + switcher(0x19A9,true); + break; + case 3: //B offset + if (B_offset<254) B_offset++; + vprintNumber(6,14, B_offset, 3); + break; + case 4: //envelope wave + if (env_selected<7) env_selected++; + showEnv(env_selected); + switcher(0x1A49,env_list[env_selected].isLoop); + break; + case 5: //envelope speed + if (env_speed<3) env_speed++; + vprintNumber(8,17, env_speed, 1); + break; + case 6: //loop + env_list[env_selected].isLoop=true; + switcher(0x1A49,true); + break; + case 7: // octave + + if (octave<6) octave++; + vprintNumber(8,20, octave, 1); + break; + case 8: + //if (_noteOffset<9) _noteOffset++; + //vprintNumber(8,21, _noteOffset, 1); + upNotePattern(); + break; + } + } + if(joyval==7) // left + { + switch (cursor_pos) + { + case 0: + if (Tempo>1) Tempo--; + vprintNumber(8,2, Tempo, 1); + break; + case 1: + isCasio=false; + switcher(0x1909,false); + break; + case 2: + isAB=false; + switcher(0x19A9,isAB); + break; + case 3: + if (B_offset>0) B_offset--; + vprintNumber(6,14, B_offset, 3); + break; + case 4: + if (env_selected>0) env_selected--; + showEnv(env_selected); + switcher(0x1A49,env_list[env_selected].isLoop); + break; + case 5: + if (env_speed>0) env_speed--; + vprintNumber(8,17, env_speed, 1); + break; + case 6: + env_list[env_selected].isLoop=false; + switcher(0x1A49,false); + break; + case 7: //octave - + if (octave>1) octave--; + vprintNumber(8,20, octave, 1); + break; + case 8: + //if (_noteOffset>-9) _noteOffset--; + //vprintNumber(8,21, _noteOffset, 1); + //modifyTonePattern(); + downNotePattern(); + break; + } + } + vpoke(vaddr_cursor[cursor_pos],186); + } + }else{ + joybool = false; + } + + + + + keyPressed = SNSMAT(6); + if (keyPressed!=0xFF) + { + if(keyB6semaphore==false) + { + switch (keyPressed) + { + /* case 0xFE: //0 SHIFT + fxMode=4; + keyB6semaphore=true; + break;*/ + + /* case 0xFD: //1 CTRL + fxMode=3; + keyB6semaphore=true; + break;*/ + + /* case 0xFB: //2 GRAPH + + keyB6semaphore=true; + break;*/ + + /* case 0xF7: //3 CAPS + keyB6semaphore=true; + break;*/ + + /* case 0xEF: // 4 CODE + + keyB6semaphore=true; + break;*/ + + case 0xDF: // 5 [F1] + genDrumPattern(); + genTonePattern(); + + keyB6semaphore=true; + break; + + case 0xBF: // 6 [F2] + genDrumPattern(); + + keyB6semaphore=true; + break; + + case 0x7F: // 7 [F3] + genTonePattern(); + + keyB6semaphore=true; + break; + + //default: + // break; + } + } + }else keyB6semaphore=false; + + keyPressed = SNSMAT(7); + if (keyPressed!=0xFF) + { + if(keyB7semaphore==false) + { + switch (keyPressed) + { + case 0xFE: // [F4] + if(isDrum==true) isDrum=false; + else isDrum=true; + + showSpeaker(0x18CA,isDrum); + + keyB7semaphore=true; + break; + + case 0xFD: // [F5] + if(isTone==true) isTone=false; + else isTone=true; + + showSpeaker(0x198A,isTone); + + keyB7semaphore=true; + break; + +/* case 0xFB: // [ESC] + + keyB7semaphore=true; + break;*/ + +/* case 0xF7: // [TAB] + + keyB7semaphore=true; + break;*/ + + case 239: // [STOP] + isDrum=false; + isTone=false; + showSpeaker(0x18CA,false); + showSpeaker(0x198A,false); + keyB7semaphore=true; + break; + +/* case 223: // [BS] Scrolltext negative/positive + + keyB7semaphore=true; + break;*/ + + case 191: // [SELECT] BG/noise OFF + if(isCasio==true) isCasio=false; + else isCasio=true; + switcher(0x1909,isCasio); + keyB7semaphore=true; + break; + +/* case 127: // [RETURN] Flash efect + + keyB7semaphore=true; + break;*/ + + //default: + //break; + } + } + }else keyB7semaphore=false; + + } + +} + + +void checkMSX(void) +{ + + // identifica modelo de MSX + //0 - MSX1, 1 - MSX2, 2 - MSX2+, 3 - TR, 4 - OCM + VDP_type = peek(0x2D); + + +//2BH b7 Periodo de sincronismo (VSYNC) 0:60Hz 1:50Hz +/* + ld a,($ffe8) + bit 1,a + jr z,its_60hz + + ;its_50Hz + +its_60hz: + + */ + + +} + + + +// activa tono y ruido de uno de los tres canales del PSG +void setChannel(byte NumChannel, boolean isTone, boolean isNoise) +{ + byte newValue; + + newValue = sound_get(7); + + if(NumChannel==0) + { + if(isTone==true){newValue&=254;}else{newValue|=1;} + if(isNoise==true){newValue&=247;}else{newValue|=8;} + } + if(NumChannel==1) + { + if(isTone==true){newValue&=253;}else{newValue|=2;} + if(isNoise==true){newValue&=239;}else{newValue|=16;} + } + if(NumChannel==2) + { + if(isTone==true){newValue&=251;}else{newValue|=4;} + if(isNoise==true){newValue&=223;}else{newValue|=32;} + } + //sound_set(7,newValue); + poke(PSG_RAM+7,newValue); +} + + +void sound_set(byte reg, byte val) +{ +reg; +val; +__asm + ld a, 4(ix) + ld e, 5(ix) + call 0x0093 +__endasm; +} + + + +byte sound_get(byte reg) +{ +reg; +__asm + ld A,4(ix) + call 0x0096 + ld L,A +__endasm; +} + + + +void showLogoScreen() +{ +__asm + ld hl,#TILESET1_B0 + ld de,#BASE12 + call unRLE2VR + + ld hl,#TILESET1_B1 + ld de,#BASE12 + 2048 + call unRLE2VR + + ld hl,#TILESET1_B2 + ld de,#BASE12 + 4096 + call unRLE2VR + + ld hl,#TILESET1_col_B0 + ld de,#BASE11 + call unRLE2VR + + ld hl,#TILESET1_col_B1 + ld de,#BASE11 + 2048 + call unRLE2VR + + ld hl,#TILESET1_col_B2 + ld de,#BASE11 + 4096 + call unRLE2VR + + ld bc,#32*4 ;32* num sprites + ld hl,#LOGO_SPR + ld de,#BASE14 + call 0x005C + + ret + + +; tileset +; pattern data BANK0 +; tiles: 0>255 +; RLE compressed - Original size:2048 - RLE size:799 +TILESET1_B0: +.db 0x04,0x00,0x02,0x03,0x06,0x00,0x02,0xF6,0x02,0xC7,0x06,0x00,0x01,0x87,0x01,0xCF +.db 0x07,0x00,0x01,0x80,0x04,0x00,0x02,0x1C,0x01,0x36,0x01,0x37,0x04,0x00,0x02,0x38 +.db 0x02,0x18,0x06,0x00,0x01,0x39,0x01,0x3D,0x06,0x00,0x01,0xE0,0x01,0xF0,0x04,0x00 +.db 0x02,0x07,0x02,0x06,0x04,0x00,0x02,0x80,0x01,0xC3,0x01,0xE3,0x06,0x00,0x01,0x9E +.db 0x01,0xDF,0x04,0x00,0x02,0x03,0x01,0x0F,0x01,0x1F,0x06,0x00,0x01,0x38,0x01,0x7C +.db 0x06,0x00,0x01,0xC4,0x01,0xEE,0x06,0x00,0x01,0x70,0x01,0xF0,0x04,0x00,0x04,0x03 +.db 0x04,0x00,0x02,0xC0,0x01,0x67,0x01,0x77,0x06,0x00,0x01,0xC7,0x01,0xEF,0x04,0x00 +.db 0x02,0x03,0x01,0x00,0x01,0x83,0x06,0x00,0x01,0x1C,0x01,0x3E,0x06,0x00,0x01,0x38 +.db 0x01,0x7C,0x04,0x00,0x02,0x30,0x02,0x78,0x06,0x00,0x02,0x03,0x06,0x00,0x01,0x33 +.db 0x01,0x37,0x06,0x00,0x01,0x80,0x01,0xC0,0x04,0x00,0x02,0x38,0x01,0x6C,0x01,0x6E +.db 0x04,0x00,0x02,0xC0,0x01,0xF0,0x01,0xF8,0x30,0x00,0x08,0xC6,0x01,0xCD,0x02,0x6F +.db 0x03,0x6C,0x01,0x6F,0x01,0x67,0x03,0x80,0x02,0x00,0x02,0xC0,0x01,0x80,0x01,0x33 +.db 0x02,0x3F,0x05,0x33,0x06,0x18,0x02,0x7E,0x01,0x0D,0x02,0x7D,0x03,0xCD,0x01,0xFD +.db 0x01,0x7D,0x01,0xB0,0x07,0x98,0x03,0x06,0x02,0x07,0x03,0x06,0x01,0x60,0x02,0x67 +.db 0x02,0xCC,0x01,0x8C,0x01,0xCF,0x01,0xC7,0x01,0xDB,0x07,0xD9,0x01,0x1B,0x05,0xB3 +.db 0x01,0xBF,0x01,0x9F,0x01,0x6C,0x05,0x66,0x01,0x7E,0x01,0x3C,0x03,0xFE,0x02,0xD6 +.db 0x03,0xC6,0x01,0xC0,0x02,0x78,0x02,0x0C,0x01,0xCC,0x01,0xFC,0x01,0x78,0x08,0x03 +.db 0x03,0x36,0x02,0xE6,0x03,0x06,0x01,0x6D,0x05,0x0C,0x01,0x0F,0x01,0x07,0x01,0x83 +.db 0x05,0xC3,0x01,0xCB,0x01,0x8B,0x01,0x36,0x02,0x3E,0x02,0x30,0x01,0x33,0x01,0x3F +.db 0x01,0x1E,0x01,0x64,0x04,0x60,0x01,0x66,0x01,0x7E,0x01,0x3C,0x05,0x30,0x01,0x34 +.db 0x01,0x3C,0x01,0x18,0x01,0x03,0x04,0x01,0x03,0x00,0x01,0x36,0x02,0xE6,0x02,0xE7 +.db 0x02,0xC7,0x01,0xC3,0x01,0xC0,0x04,0xE0,0x01,0x66,0x01,0xE6,0x01,0xC6,0x03,0x66 +.db 0x02,0x3E,0x01,0x06,0x01,0x0E,0x01,0x0C,0x01,0xD8,0x05,0xCC,0x01,0xFC,0x01,0xF8 +.db 0x34,0x00,0x02,0xC0,0x01,0xF1,0x01,0xF9,0x06,0x00,0x02,0x98,0x06,0x00,0x01,0x06 +.db 0x01,0x07,0x06,0x00,0x01,0x26,0x01,0x76,0x06,0x00,0x02,0x63,0x06,0x00,0x01,0x8E +.db 0x01,0xDF,0x04,0x00,0x02,0x3F,0x01,0x03,0x01,0x07,0x04,0x00,0x03,0x06,0x01,0x0C +.db 0x02,0x60,0x02,0x00,0x02,0x38,0x01,0x0C,0x01,0x1D,0x06,0x00,0x01,0xE0,0x01,0xF0 +.db 0x04,0x00,0x02,0xE6,0x01,0x37,0x01,0x77,0x06,0x00,0x01,0x87,0x01,0xCF,0x06,0x00 +.db 0x01,0x1E,0x01,0x9F,0x0C,0x00,0x02,0x3C,0x01,0x06,0x01,0x1E,0x06,0x00,0x01,0x70 +.db 0x01,0xF8,0x04,0x00,0x02,0x61,0x02,0xE0,0x02,0x06,0x02,0x00,0x02,0xE0,0x01,0x30 +.db 0x01,0xF0,0x70,0x00,0x01,0xD9,0x04,0xCD,0x01,0xCC,0x01,0xFC,0x01,0xF8,0x05,0x98 +.db 0x02,0xF8,0x01,0x18,0x03,0x07,0x05,0x06,0x01,0xF6,0x02,0xF3,0x02,0xB3,0x03,0x31 +.db 0x01,0x60,0x02,0xC7,0x02,0xCC,0x01,0x8C,0x01,0x8F,0x01,0x87,0x01,0xD9,0x04,0xD8 +.db 0x01,0xD9,0x01,0xDF,0x01,0xCF,0x01,0x06,0x04,0x0C,0x02,0x8C,0x03,0x0C,0x03,0x18 +.db 0x03,0x30,0x01,0x19,0x02,0x0D,0x02,0x4D,0x01,0xCD,0x01,0xFD,0x01,0x78,0x01,0xB0 +.db 0x02,0xB8,0x02,0xF9,0x01,0xDB,0x01,0xFB,0x01,0xF1,0x01,0x66,0x05,0x36,0x01,0xF7 +.db 0x01,0xE7,0x01,0xCC,0x05,0x6C,0x01,0xEF,0x01,0xC7,0x01,0x9B,0x04,0x19,0x02,0xD9 +.db 0x01,0x99,0x01,0x00,0x07,0x80,0x01,0x1C,0x02,0x30,0x03,0x60,0x02,0x7E,0x01,0xD8 +.db 0x02,0xDC,0x02,0xFC,0x01,0xEC,0x01,0xFD,0x01,0x79,0x01,0x60,0x02,0x61,0x03,0x63 +.db 0x02,0xFB,0x01,0xE0,0x02,0x80,0x03,0x00,0x02,0xF0,0x78,0x00,0x02,0xF0,0xAC,0x00 +.db 0x01,0x01,0x01,0x03,0x05,0x00,0x01,0x07,0x02,0xFF,0x04,0x00,0x04,0xFF,0x04,0x00 +.db 0x04,0xFF,0x05,0x00,0x01,0xF0,0x02,0xFF,0x07,0x00,0x01,0xC0,0x18,0x00,0xB3,0xFF +.db 0x01,0xFC,0x01,0xF8,0x01,0xF0,0x01,0xE0,0x01,0xC0,0x01,0xE0,0x01,0xC0,0x26,0x00 +.db 0x01,0x0F,0x01,0x07,0x01,0x03,0x01,0x01,0x04,0x00,0x05,0xFF,0x02,0x7F,0x01,0x3F +.db 0xBB,0xFF,0x02,0xFE,0x01,0xFC,0x01,0xF8,0x01,0xF9,0x02,0x80,0x04,0x00,0x01,0x40 +.db 0x01,0xC0,0x30,0x00,0x02,0x1F,0x03,0x0F,0x02,0x07,0x01,0x03,0x58,0xFF,0x04,0x00 +.db 0x01,0x03,0x01,0x0F,0x02,0x1F,0x03,0x00,0x01,0x70,0x01,0xFC,0x03,0xFF,0x06,0x00 +.db 0x02,0x80,0x02,0x00,0x01,0x07,0x01,0x1F,0x01,0x3F,0x02,0x7F,0x01,0xFE,0x02,0x00 +.db 0x01,0xE0,0x01,0xF8,0x02,0xFC,0x01,0xFE,0x01,0x3F,0x38,0xFF,0x01,0xF9,0x02,0xFB +.db 0x05,0xF7,0x01,0xC0,0x07,0x80,0x30,0x00,0x04,0x03,0x04,0x01,0x10,0xFF,0x00 + +; pattern data BANK1 +; tiles: 0>255 +; RLE compressed - Original size:2048 - RLE size:507 +TILESET1_B1: +.db 0x48,0x00,0x05,0x3F,0x02,0x1F,0x01,0x0F,0x01,0x00,0x01,0x70,0x03,0xF8,0x01,0x70 +.db 0x01,0x00,0x01,0x01,0x04,0x3F,0x02,0x7F,0x02,0xFF,0x03,0x03,0x01,0x01,0x01,0x80 +.db 0x01,0xC0,0x01,0xE0,0x01,0xF0,0x03,0xE0,0x01,0xC0,0x02,0x01,0x01,0x03,0x01,0x07 +.db 0x38,0xFF,0x01,0xF7,0x01,0xFF,0x04,0xF7,0x01,0xFF,0x01,0xF7,0x08,0x80,0x30,0x00 +.db 0x01,0x01,0x07,0x00,0x10,0xFF,0x48,0x00,0x08,0x01,0x07,0xFC,0x01,0xF8,0x04,0x00 +.db 0x02,0xFF,0x01,0x80,0x01,0xFF,0x04,0xF8,0x03,0xF0,0x01,0xF8,0x01,0xF0,0x03,0xE0 +.db 0x04,0xC0,0x38,0xFF,0x01,0xF7,0x02,0xFF,0x02,0xFB,0x03,0xFF,0x03,0x80,0x03,0xC0 +.db 0x02,0xE0,0x30,0x00,0x02,0xFF,0x05,0xFE,0x01,0xFC,0x52,0xFF,0x01,0xFC,0x01,0xF0 +.db 0x02,0xE0,0x02,0xC0,0x01,0xFD,0x01,0xF9,0x01,0x70,0x01,0x03,0x01,0x07,0x01,0x0F +.db 0x01,0x1F,0x01,0x3F,0x01,0x04,0x0F,0x00,0x01,0x18,0x07,0x00,0x01,0xBF,0x01,0x9C +.db 0x01,0xC0,0x01,0xE0,0x01,0xF0,0x02,0xF8,0x01,0xFC,0x01,0xFF,0x01,0x1F,0x01,0x0F +.db 0x01,0x07,0x02,0x03,0x02,0x01,0x38,0xFF,0x03,0xF0,0x02,0xF8,0x02,0xFC,0x01,0xFE +.db 0x30,0x00,0x02,0xFC,0x02,0xF8,0x01,0xF0,0x01,0xE0,0x01,0xC0,0x01,0x80,0x50,0xFF +.db 0x04,0xC0,0x01,0xE0,0x01,0xF8,0x02,0xFE,0x01,0xC0,0x05,0x80,0x07,0x00,0x02,0x01 +.db 0x07,0x00,0x01,0x80,0x01,0xC0,0x04,0x00,0x02,0x10,0x01,0x30,0x01,0x60,0x04,0x01 +.db 0x04,0x00,0x03,0xFE,0x01,0xFC,0x01,0xF8,0x01,0xE0,0x02,0xC0,0x40,0xFF,0x01,0x00 +.db 0x01,0x80,0x01,0xE0,0x01,0xF0,0x01,0xF8,0x01,0xFC,0x02,0xFF,0x07,0x00,0x01,0xF0 +.db 0x0F,0x00,0x01,0x01,0x05,0x00,0x01,0x01,0x01,0x0F,0x01,0xFF,0x01,0x00,0x01,0x01 +.db 0x01,0x03,0x01,0x0F,0x01,0x7F,0x1B,0xFF,0x3E,0x00,0x01,0x01,0x01,0x1F,0x04,0x01 +.db 0x01,0x03,0x01,0x1F,0x01,0xF8,0x01,0xC0,0x10,0x00,0x01,0x71,0x01,0x1F,0x06,0x00 +.db 0x01,0xC0,0x0F,0x00,0x02,0xC0,0x02,0xE0,0x01,0xFF,0x01,0x7F,0x06,0x00,0x01,0xF8 +.db 0x01,0xFF,0x01,0x1F,0x06,0x00,0x01,0x80,0x01,0xF0,0x01,0xFC,0xA9,0x00,0x03,0x01 +.db 0x04,0x03,0x01,0xFC,0x01,0xE0,0x01,0xC0,0x02,0x80,0x0A,0x00,0x01,0x3F,0x1D,0x00 +.db 0x01,0x09,0x01,0x1D,0x01,0x14,0x05,0x00,0x01,0x10,0x01,0xB0,0x01,0xE0,0x06,0x00 +.db 0x01,0x3F,0x01,0x7F,0x06,0x00,0x01,0xF8,0x01,0xFE,0x01,0x0F,0x01,0x03,0x02,0x01 +.db 0x05,0x00,0x02,0x80,0x05,0xC0,0xA0,0x00,0x08,0x07,0x09,0xFF,0x01,0xF0,0x01,0xE0 +.db 0x03,0xC0,0x02,0xE0,0x08,0x80,0x10,0x00,0x01,0x3E,0x02,0x22,0x05,0x00,0x03,0x40 +.db 0x05,0x00,0x08,0xE0,0x01,0x0F,0x01,0x07,0x06,0x03,0x08,0x00,0x07,0xC0,0x01,0x80 +.db 0xA0,0x00,0x02,0x03,0x02,0x01,0x04,0x00,0x02,0x80,0x01,0xC0,0x01,0xE1,0x01,0xFF +.db 0x01,0x3F,0x02,0x00,0x03,0xF1,0x01,0xE1,0x01,0xC1,0x01,0x81,0x02,0x01,0x08,0x80 +.db 0x20,0x00,0x07,0xE0,0x01,0xFC,0x01,0x03,0x02,0x01,0x05,0x00,0x01,0x01,0x01,0x83 +.db 0x01,0xFE,0x01,0x78,0x04,0x00,0x01,0x80,0x77,0x00,0x00 + +; pattern data BANK2 +; tiles: 0>255 +; RLE compressed - Original size:2048 - RLE size:413 +TILESET1_B2: +.db 0x40,0x00,0x08,0x03,0x16,0xFF,0x01,0xC0,0x01,0x80,0x06,0xFF,0x01,0xF8,0x01,0xFE +.db 0x08,0xFF,0x01,0xFE,0x01,0x0F,0x01,0x07,0x03,0x03,0x02,0x01,0x04,0x00,0x04,0x80 +.db 0xC0,0x00,0x08,0xFC,0x06,0xFF,0x02,0x80,0x01,0xFF,0x07,0xFE,0x01,0xE0,0x01,0xC0 +.db 0x06,0x80,0x01,0xF0,0x01,0xF8,0x02,0xFC,0x04,0xFE,0x03,0xFF,0x05,0x80,0x08,0x01 +.db 0x08,0x80,0x80,0x00,0x26,0xFF,0x01,0xFE,0x01,0x80,0x05,0x00,0x01,0x1F,0x01,0xFC +.db 0x05,0x00,0x01,0x0F,0x01,0xFE,0x05,0x00,0x01,0x0F,0x04,0xFF,0x01,0xFE,0x03,0xFF +.db 0x01,0x80,0x03,0x00,0x01,0xC0,0x01,0xF0,0x01,0x80,0x01,0xFF,0x04,0x00,0x01,0xFC +.db 0x01,0xC0,0x02,0xFF,0x04,0x00,0x04,0xFF,0x04,0x00,0x03,0xFE,0x02,0x00,0x01,0xE0 +.db 0x01,0xF8,0x01,0xFE,0x06,0x80,0x01,0xC0,0x01,0xE0,0x06,0x01,0x01,0x03,0x01,0x07 +.db 0x05,0x7F,0x01,0x03,0x01,0x07,0x07,0x00,0x01,0xFE,0x01,0x01,0x07,0x00,0x01,0xFE +.db 0x76,0x00,0x01,0x07,0x01,0x3F,0x04,0x00,0x01,0x0F,0x01,0xF8,0x01,0xC0,0x01,0x00 +.db 0x02,0xFF,0x02,0xF0,0x04,0x00,0x01,0x0F,0x01,0xFF,0x01,0x80,0x05,0x00,0x01,0xE0 +.db 0x3F,0x00,0x01,0x01,0x07,0x00,0x01,0x80,0x01,0xC0,0x01,0x7F,0x05,0x00,0x01,0xFE +.db 0x01,0xF8,0x01,0xF0,0x15,0x00,0x01,0x01,0x07,0x00,0x01,0xF8,0x01,0x07,0x07,0x00 +.db 0x01,0xF0,0x01,0x3F,0x01,0x01,0x04,0x00,0x02,0xFF,0x01,0x3F,0x01,0x01,0x01,0xF8 +.db 0x03,0xFF,0x04,0x00,0x01,0xF0,0x01,0x80,0x01,0xF8,0x01,0xFF,0x06,0x00,0x01,0xFC +.db 0x01,0x1F,0x07,0x00,0x01,0xE0,0x40,0x00,0x01,0xF8,0x01,0xC0,0xB6,0x00,0x01,0x7F +.db 0x01,0x0F,0x07,0x00,0x01,0xF0,0x01,0x7F,0x01,0x0F,0x07,0x00,0x01,0xF0,0x01,0xFE +.db 0x01,0xF0,0x02,0xFF,0x05,0x00,0x01,0xF0,0x01,0xFE,0x01,0x1F,0x07,0x00,0x01,0x80 +.db 0xF0,0x00,0x01,0x01,0x07,0x00,0x01,0xFC,0x01,0x1F,0x01,0x03,0x06,0x00,0x01,0x80 +.db 0x01,0xFC,0x01,0x7F,0x01,0x0F,0x01,0x01,0x02,0x00,0x03,0xFF,0x01,0x80,0x01,0xF0 +.db 0x01,0xFF,0x01,0xC0,0x01,0xF0,0x06,0x00,0x01,0xE0,0x01,0xF8,0xF8,0x00,0x01,0xFF +.db 0x01,0x3F,0x01,0x0F,0x01,0x01,0x05,0x00,0x01,0xF0,0x02,0xFF,0x01,0x3F,0x01,0x0F +.db 0x01,0x03,0xE3,0x00,0x01,0x3C,0x04,0x2A,0x03,0x00,0x01,0x8B,0x01,0x88,0x01,0x89 +.db 0x01,0x52,0x01,0x21,0x03,0x00,0x01,0xC7,0x01,0x28,0x01,0xE8,0x01,0x28,0x01,0xE7 +.db 0x02,0x00,0x01,0x78,0x02,0x08,0x01,0x10,0x02,0x20,0x01,0x00,0x00 + +; color data BANK0 +; tiles: 0>255 +; RLE compressed - Original size:2048 - RLE size:43 +TILESET1_col_B0: +.db 0xFF,0xF5,0xFF,0xF5,0x0A,0xF5,0x40,0xE5,0x02,0xF5,0x46,0xE5,0x02,0xF5,0x06,0xE5 +.db 0x70,0xF5,0x90,0xE5,0x68,0xF5,0x18,0xE5,0xE8,0x75,0xFF,0x57,0xFF,0x57,0x4A,0x57 +.db 0x1F,0x35,0x01,0x31,0x07,0x35,0x01,0x31,0x90,0x57,0x00 + +; color data BANK1 +; tiles: 0>255 +; RLE compressed - Original size:2048 - RLE size:141 +TILESET1_col_B1: +.db 0x50,0x35,0x07,0x13,0x09,0x53,0x04,0x13,0x04,0x53,0x04,0x13,0x04,0x53,0x90,0x57 +.db 0x55,0x35,0x02,0x31,0x01,0x3C,0x06,0x15,0x01,0x1C,0x01,0x35,0x05,0x53,0x02,0x13 +.db 0x01,0xC3,0x08,0x35,0x78,0x57,0x02,0x71,0x06,0x75,0x10,0x57,0x4B,0x51,0x05,0x31 +.db 0x01,0xC3,0x05,0x13,0x02,0x53,0x04,0x13,0x04,0x53,0x01,0xC3,0x05,0x13,0x02,0x53 +.db 0x02,0x51,0x06,0x31,0x08,0x51,0x70,0x57,0x08,0x75,0x10,0x57,0x47,0x51,0x01,0x5C +.db 0x03,0x13,0x05,0xC3,0x1A,0x13,0x06,0xC3,0x06,0x15,0x02,0xC5,0x88,0x57,0x46,0xC5 +.db 0x02,0xC3,0x10,0x53,0x18,0x13,0x04,0xC5,0x04,0xC3,0x05,0xC5,0x03,0xC3,0xB8,0xC5 +.db 0x50,0xC3,0xB0,0xC5,0x08,0x3C,0x08,0xC5,0x28,0xC3,0x10,0xC5,0x08,0xC3,0xB0,0xC5 +.db 0x05,0xC3,0x0B,0xC5,0x28,0xC3,0x10,0xC5,0x02,0xC3,0x7E,0xC5,0x00 + +; color data BANK2 +; tiles: 0>255 +; RLE compressed - Original size:2048 - RLE size:189 +TILESET1_col_B2: +.db 0x48,0xC5,0x04,0x3F,0x04,0x35,0x06,0x3F,0x02,0x35,0x06,0x3F,0x02,0x3C,0x06,0x3F +.db 0x02,0xC3,0x06,0x3F,0x02,0x35,0x01,0xC5,0x07,0xC3,0xC8,0xC5,0x08,0x5C,0x03,0x3F +.db 0x03,0x35,0x02,0xC3,0x01,0x35,0x07,0x3C,0x08,0xC5,0x08,0x5C,0x03,0x35,0x0D,0xC3 +.db 0x88,0xC5,0x28,0x51,0x06,0x15,0x02,0x16,0x05,0x15,0x03,0x16,0x05,0x15,0x03,0x61 +.db 0x03,0x5C,0x05,0x16,0x02,0xC3,0x01,0x51,0x05,0x16,0x02,0x3C,0x06,0x16,0x02,0x51 +.db 0x06,0x16,0x03,0x5C,0x05,0x61,0x10,0xC3,0x05,0x5C,0x01,0x51,0x02,0x16,0x07,0x15 +.db 0x01,0x16,0x85,0x15,0x03,0x16,0x03,0x51,0x05,0x16,0x01,0x15,0x4F,0x16,0x02,0x1C +.db 0x06,0x16,0x02,0xC6,0x01,0x16,0x05,0x56,0x18,0x16,0x01,0x15,0x07,0x16,0x02,0x15 +.db 0x06,0x16,0x04,0x51,0x04,0x61,0x05,0x15,0x03,0x61,0x07,0x15,0x01,0x16,0x48,0x15 +.db 0xC0,0x16,0x02,0x15,0x06,0x16,0x05,0x15,0x03,0x61,0x07,0x15,0x01,0x16,0x28,0x15 +.db 0xD8,0x16,0x01,0x15,0x07,0x16,0x03,0x15,0x05,0x16,0x03,0x55,0x03,0x15,0x02,0x61 +.db 0x10,0x15,0xF8,0x16,0x04,0x15,0xE4,0x16,0x18,0xE6,0x08,0x76,0x00 + +LOGO_SPR: +; 01 +.db 0x01,0x0F,0x38,0x60,0x40,0xC0,0xC0,0xC0,0xC0,0xC0,0x40,0x60,0x30,0x18,0x0C,0x06 +.db 0xC0,0xF0,0x1C,0x06,0x06,0x03,0x03,0x03,0x03,0x02,0x06,0x04,0x08,0x08,0x18,0x18 +; 02 +.db 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x02,0x04,0x08,0x10,0x20,0x40,0x40,0x80,0x80 +.db 0x08,0x08,0x08,0x08,0x0F,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +; 03 +.db 0x07,0x1C,0x30,0x60,0x40,0xC0,0xC0,0xC0,0xC0,0xE0,0x60,0x30,0x18,0x0C,0x04,0x06 +.db 0xE0,0x38,0x0C,0x04,0x06,0x03,0x03,0x03,0x03,0x03,0x06,0x06,0x0C,0x18,0x10,0x20 +; 04 +.db 0x06,0x06,0x0C,0x0C,0x0C,0x78,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +.db 0x20,0x60,0x40,0x40,0x40,0xC0,0x80,0x80,0x40,0x20,0x10,0x08,0x08,0x04,0x02,0x02 + + + +__endasm; +} + + + +void setTileset() +{ +__asm + ld bc,#2048 + ld hl,#TILESET_B0 + ld de,#BASE12 + call 0x005C + + ld bc,#2048 + ld hl,#TILESET_B0 + ld de,#BASE12 + 2048 + call 0x005C + + ld bc,#2048 + ld hl,#TILESET_B0 + ld de,#BASE12 + 4096 + call 0x005C + + ld hl,#TILESET_col_B0 + ld de,#BASE11 + call unRLE2VR + + ld hl,#TILESET_col_B0 + ld de,#BASE11 + 2048 + call unRLE2VR + + ld hl,#TILESET_col_B0 + ld de,#BASE11 + 4096 + jp unRLE2VR + + + +; tileset +; pattern data BANK0 +; tiles: 0>255 +TILESET_B0: +.db 0xFF,0xC1,0x9C,0x9C,0x9C,0xC1,0xFF,0x00,0xFF,0xE7,0xC7,0xE7,0xE7,0xC3,0xFF,0x00 +.db 0xFF,0x81,0xFC,0xC1,0x9F,0x80,0xFF,0xFF,0xFF,0x81,0xFC,0xE1,0xFC,0x81,0xFF,0xFF +.db 0xFF,0x9C,0x9C,0x80,0xFC,0xFC,0xFF,0xFF,0xFF,0x80,0x9F,0x81,0xFC,0x81,0xFF,0xFF +.db 0xFF,0xC1,0x9F,0x81,0x9C,0xC1,0xFF,0xFF,0xFF,0x80,0xFC,0xF9,0xF3,0xF3,0xFF,0xFF +.db 0xFF,0xC1,0x9C,0xC1,0x9C,0xC1,0xFF,0xFF,0xFF,0xC1,0x9C,0xC0,0xFC,0xC1,0xFF,0x00 +.db 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0xFF,0xFF,0xFF,0xC3,0xFF,0xFF,0xFF,0x00 +.db 0xFF,0xFF,0xFF,0x11,0x57,0x57,0x11,0xFF,0xFF,0xFF,0xFF,0x11,0xB5,0xB1,0xB5,0xFF +.db 0xFF,0xFF,0xFF,0x51,0x53,0x57,0xB1,0xFF,0x00,0x6E,0x48,0x4E,0x48,0x68,0x00,0x00 +.db 0x00,0xCC,0x24,0x44,0x84,0xEC,0x00,0x00,0x00,0xCC,0x24,0x44,0x24,0xCC,0x00,0x00 +.db 0x00,0xAC,0xA4,0xE4,0x24,0x2C,0x00,0x00,0x00,0xEC,0x84,0xC4,0x24,0xCC,0x00,0x00 +.db 0x00,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x60,0x78,0x7E,0x78,0x60,0x00,0x00 +.db 0x00,0x60,0x78,0x7E,0x78,0x60,0x00,0x00,0x00,0x7E,0x7E,0x7E,0x7E,0x7E,0x00,0x00 +.db 0x00,0x0F,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x88,0x88,0xF8,0x00,0x00 +.db 0x00,0x00,0x00,0x7B,0x0A,0x7A,0x0A,0x7B,0x00,0x00,0x00,0xDE,0x42,0x5E,0x42,0xDE +.db 0x00,0x00,0x00,0x80,0xF7,0x94,0x94,0xF7,0x00,0x00,0x00,0x00,0xB8,0x24,0x24,0xA4 +.db 0xFF,0xFF,0x9C,0x9C,0xC9,0xE3,0xFF,0xFF,0xFF,0x9F,0x81,0x9C,0x9C,0x81,0xFF,0xFF +.db 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF3,0xF3,0xF3,0xF3,0xFF,0xF3,0xFF +.db 0xFF,0xEB,0xEB,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xEB,0xC1,0xEB,0xC1,0xEB,0xFF,0xFF +.db 0xF7,0xC1,0x97,0xC1,0xF4,0xC1,0xF7,0xFF,0xFF,0xCC,0xC9,0xF3,0xE4,0xCC,0xFF,0xFF +.db 0xFF,0xC7,0x93,0xC2,0x99,0xC2,0xFF,0xFF,0xFF,0xE7,0xCF,0xFF,0xFF,0xFF,0xFF,0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.db 0xFF,0x81,0xE7,0xE7,0xE7,0xE7,0xFF,0xFF,0xFF,0x9C,0x9C,0x9C,0x9C,0xC1,0xFF,0xFF +.db 0xFF,0x9C,0x9C,0x9C,0xC9,0xE3,0xFF,0xFF,0xFF,0x9C,0x94,0x80,0x88,0x9C,0xFF,0xFF +.db 0xFF,0x9C,0xC9,0xE3,0xC9,0x9C,0xFF,0xFF,0xFF,0x99,0x99,0xC3,0xE7,0xE7,0xFF,0xFF +.db 0xFF,0x81,0xF3,0xE7,0xCF,0x81,0xFF,0xFF,0x00,0x18,0x18,0x00,0x18,0x18,0x00,0x00 +.db 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF +.db 0x00,0xF0,0x92,0x92,0x12,0x1E,0x00,0x00,0x00,0x7C,0xFE,0xBA,0x82,0x82,0x7C,0x00 +.db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x3E,0x63,0x7F,0x63,0x63,0x00,0x00 +.db 0x00,0x7E,0x63,0x7E,0x63,0x7E,0x00,0x00,0x00,0x3F,0x60,0x60,0x60,0x3F,0x00,0x00 +.db 0x00,0x7E,0x63,0x63,0x63,0x7E,0x00,0x00,0x00,0x7F,0x60,0x7C,0x60,0x7F,0x00,0x00 +.db 0x00,0x7F,0x60,0x7C,0x60,0x60,0x00,0x00,0x00,0x3F,0x60,0x67,0x63,0x3F,0x00,0x00 +.db 0x00,0x63,0x63,0x7F,0x63,0x63,0x00,0x00,0x00,0x1E,0x0C,0x0C,0x0C,0x1E,0x00,0x00 +.db 0x00,0x1E,0x0C,0x0C,0x6C,0x38,0x00,0x00,0x00,0x63,0x66,0x7C,0x66,0x63,0x00,0x00 +.db 0x00,0x60,0x60,0x60,0x60,0x7F,0x00,0x00,0x00,0x63,0x77,0x7F,0x6B,0x63,0x00,0x00 +.db 0x00,0x63,0x73,0x7B,0x6F,0x67,0x00,0x00,0x00,0x3E,0x63,0x63,0x63,0x3E,0x00,0x00 +.db 0x00,0x7E,0x63,0x63,0x7E,0x60,0x00,0x00,0x00,0x3E,0x63,0x6B,0x66,0x3D,0x00,0x00 +.db 0x00,0x7E,0x63,0x63,0x7E,0x63,0x00,0x00,0x00,0x3F,0x60,0x3E,0x03,0x7E,0x00,0x00 +.db 0x00,0x7E,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x63,0x63,0x63,0x63,0x3E,0x00,0x00 +.db 0x00,0x63,0x63,0x63,0x36,0x1C,0x00,0x00,0x00,0x63,0x6B,0x7F,0x77,0x63,0x00,0x00 +.db 0x00,0x63,0x36,0x1C,0x36,0x63,0x00,0x00,0x00,0x66,0x66,0x3C,0x18,0x18,0x00,0x00 +.db 0x00,0x7E,0x0C,0x18,0x30,0x7E,0x00,0x00,0x00,0x1C,0x11,0x18,0x10,0x1D,0x00,0x80 +.db 0x00,0xE6,0x08,0xC8,0x28,0xC6,0x00,0x00,0x00,0x72,0x46,0x72,0x42,0x47,0x00,0x80 +.db 0x00,0x76,0x41,0x72,0x44,0x47,0x00,0x80,0x00,0x76,0x41,0x72,0x41,0x46,0x00,0x80 +.db 0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF +.db 0x00,0x00,0x00,0x00,0x00,0xE0,0xE0,0xE0,0x07,0x07,0x07,0x00,0x00,0x07,0x07,0x07 +.db 0xFF,0xFF,0xFF,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0xC3,0xE7,0xE7 +.db 0xE0,0xE0,0xE0,0x00,0x00,0xE0,0xE0,0xE0,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07 +.db 0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7,0xE7 +.db 0xE7,0xE7,0xC3,0x00,0x00,0xFF,0xFF,0xFF,0xE7,0xE7,0xC7,0x07,0x07,0xC7,0xE7,0xE7 +.db 0x07,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00 +.db 0xE0,0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0xE7,0xE7,0xC7,0x07,0x07,0x07,0x07,0x07 +.db 0xE7,0xE7,0xE3,0xE0,0xE0,0xE3,0xE7,0xE7,0x00,0x00,0x00,0x00,0x00,0xC3,0xE7,0xE7 +.db 0xE0,0xE0,0xC0,0x00,0x00,0xFF,0xFF,0xFF,0xE7,0xE7,0xC3,0x00,0x00,0xC3,0xE7,0xE7 +.db 0x83,0x7D,0x7D,0x7D,0x7D,0x7D,0x83,0xFF,0x83,0x01,0x01,0x01,0x01,0x01,0x83,0xFF +.db 0x83,0x01,0x01,0x01,0x01,0x01,0x83,0xFF,0x83,0x01,0x01,0x01,0x01,0x01,0x83,0xFF +.db 0x83,0x01,0x01,0x01,0x01,0x01,0x83,0xFF,0x00,0x00,0x00,0x00,0x7C,0x38,0x10,0x00 +.db 0xFF,0x87,0x83,0x81,0x83,0x87,0xFF,0xFF,0x0C,0x14,0x64,0x64,0x64,0x14,0x0C,0x00 +.db 0x0C,0x14,0x64,0x64,0x64,0x14,0x0C,0x00,0x00,0x00,0x18,0x24,0x24,0x18,0x00,0x00 +.db 0xFF,0xFF,0xE7,0xC3,0xC3,0xE7,0xFF,0xFF,0xFF,0xFF,0xE7,0xC3,0xC3,0xE7,0xFF,0xFF +.db 0xFF,0x9F,0xE7,0xF9,0xFE,0xFF,0xFF,0x00,0xFF,0xFF,0xFF,0xFF,0x7F,0x9F,0xFF,0xFF +.db 0x00,0x00,0x01,0x06,0x18,0x60,0x00,0x00,0x00,0x60,0x80,0x00,0x00,0x00,0x00,0x00 +.db 0x00,0x40,0x20,0x11,0x0A,0x04,0x00,0x00,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00 +.db 0xFF,0xFB,0xF5,0xEE,0xDF,0xBF,0xFF,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x00,0x00 +.db 0xFF,0x81,0xBD,0xBD,0xFD,0xFC,0xFF,0x00,0xFF,0xFF,0xFF,0xEF,0xEF,0x0F,0xFF,0x00 +.db 0x00,0x18,0x24,0x42,0x01,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xEF,0xDF,0x3F,0xFF,0x00 +.db 0xFF,0x8F,0xF7,0xFB,0xFD,0xFE,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00 +.db 0xFF,0xBF,0xDF,0xE0,0xFF,0xFF,0xFF,0x00,0xFF,0xFF,0xFF,0x3F,0xDF,0xEF,0xFF,0x00 +.db 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0xE7,0xE7,0xC3,0x00,0x00,0x00,0x00,0x00 +.db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xE0,0xC0,0x00,0x00,0xC3,0xE7,0xE7 +.db 0xF8,0xF0,0xF0,0xF0,0xF0,0xF0,0xF8,0xFF,0x00,0x3C,0x22,0x22,0x22,0x3C,0x00,0xFF +.db 0xC0,0x80,0x80,0x80,0x80,0x80,0xC0,0xFF,0x03,0x01,0x01,0x01,0x01,0x01,0x03,0xFF +.db 0x00,0x18,0x00,0x38,0x18,0x3C,0x00,0x00,0x80,0x80,0x80,0xBE,0x80,0x80,0x80,0xFF +.db 0x80,0x88,0x88,0xBE,0x88,0x88,0x80,0xFF,0x80,0x80,0xBE,0x9C,0x88,0x80,0x80,0xFF +.db 0x80,0xBE,0x88,0x80,0x88,0x9C,0x80,0xFF,0x7F,0x80,0x80,0x80,0x80,0x80,0x7F,0xFF +.db 0xFE,0x81,0x81,0x81,0x81,0x81,0xFE,0xFF,0xFF,0xAB,0xAB,0xAB,0xAB,0xFF,0xFF,0xFF +.db 0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x1F,0x00,0x03,0x0F,0x7F,0xFF,0xFF,0xFF,0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0xFF,0xFF,0xFC +.db 0xFF,0xFF,0xFF,0xFF,0xFE,0xF0,0xC0,0x00,0xF8,0xE0,0xC0,0x00,0x00,0x00,0x00,0x00 +.db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + +; color data BANK0 +; tiles: 0>255 +; RLE compressed - Original size:2048 - RLE size:355 +TILESET_col_B0: +.db 0x07,0x2F,0x01,0xEE,0x07,0x2F,0x01,0xEE,0x07,0x2F,0x01,0xEE,0x07,0x2F,0x01,0xEE +.db 0x07,0x2F,0x01,0xEE,0x07,0x2F,0x01,0xEE,0x07,0x2F,0x01,0xEE,0x07,0x2F,0x01,0xEE +.db 0x07,0x2F,0x01,0xEE,0x07,0x2F,0x01,0xEE,0x07,0x2F,0x01,0xEE,0x07,0x2F,0x01,0xEE +.db 0x18,0xE4,0x28,0x4E,0x07,0xF4,0x01,0xFE,0x07,0x84,0x01,0x8E,0x07,0xF4,0x01,0xFE +.db 0x07,0xF4,0x01,0xFE,0x10,0x4E,0x10,0xE1,0x10,0x51,0x10,0xE1,0x08,0xED,0xFF,0xE1 +.db 0xF9,0xE1,0xD8,0xED,0x08,0xDE,0x10,0xED,0x10,0xD1,0x07,0xF4,0x01,0xE4,0x07,0xF4 +.db 0x01,0xFE,0x07,0xF4,0x01,0xFE,0x07,0xF4,0x01,0xFE,0x07,0xF4,0x01,0xFE,0x07,0xF4 +.db 0x01,0xFE,0x07,0xF4,0x01,0xFE,0x07,0xF4,0x01,0xFE,0x07,0xF4,0x01,0xFE,0x07,0xF4 +.db 0x01,0xFE,0x07,0xF4,0x01,0xFE,0x07,0xF4,0x01,0xFE,0x07,0xF4,0x01,0xFE,0x07,0xF4 +.db 0x01,0xFE,0x07,0xF4,0x01,0xFE,0x07,0xF4,0x01,0xFE,0x07,0xF4,0x01,0xFE,0x07,0xF4 +.db 0x01,0xFE,0x07,0xF4,0x01,0xFE,0x07,0xF4,0x01,0xFE,0x07,0xF4,0x01,0xFE,0x07,0xF4 +.db 0x01,0xFE,0x07,0xF4,0x01,0xFE,0x07,0xF4,0x01,0xFE,0x07,0xF4,0x01,0xFE,0x07,0xF4 +.db 0x01,0xFE,0x07,0xF4,0x01,0xFE,0x06,0x74,0x01,0xE4,0x01,0xEE,0x07,0x74,0x01,0x7E +.db 0x06,0x74,0x01,0xE4,0x01,0xEE,0x06,0x74,0x01,0xE4,0x01,0xEE,0x06,0x74,0x01,0xE4 +.db 0x01,0xEE,0xA0,0xE5,0x08,0x14,0x08,0x1C,0x08,0x18,0x08,0x17,0x08,0x1F,0x08,0x71 +.db 0x08,0xE8,0x08,0xFE,0x08,0x2E,0x08,0x1E,0x08,0xEC,0x08,0xE9,0x07,0xF4,0x01,0xEE +.db 0x07,0xF4,0x01,0xE4,0x07,0x4F,0x01,0x4E,0x07,0x4F,0x01,0x4E,0x07,0x4F,0x01,0xEE +.db 0x07,0x4F,0x01,0x1E,0x07,0xF4,0x01,0xFE,0x07,0x4F,0x01,0x1E,0x07,0xF4,0x01,0xFE +.db 0x07,0xF4,0x01,0xFE,0x07,0x4F,0x01,0x4E,0x07,0xF4,0x01,0xFE,0x07,0xF4,0x01,0x1E +.db 0x07,0x4F,0x01,0x1E,0x07,0xF4,0x01,0x1E,0x07,0xF4,0x01,0x1E,0x08,0xFE,0x18,0xE5 +.db 0x08,0xE4,0x07,0x84,0x11,0xE4,0x07,0xF4,0x01,0xFE,0x20,0xE4,0x01,0x15,0x05,0x1C +.db 0x01,0x15,0x01,0xE5,0x01,0x15,0x05,0x18,0x01,0x15,0x01,0xE5,0x07,0x15,0x01,0xE5 +.db 0xFF,0x61,0x00 + + +__endasm; +} + + + +// set sprites data in vram +void setSprites() +{ +__asm + ld bc,#32*8 ;32* num sprites + ld hl,#SPRITES_DATA + ld de,#BASE14 + call 0x005C + + ret + + +SPRITES_DATA: +; 0 +.db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01 +.db 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +.db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80 +.db 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +; 1 +.db 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03 +.db 0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00 +.db 0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0 +.db 0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00 +; 2 +.db 0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07 +.db 0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00 +.db 0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xE0 +.db 0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00 +; 3 +.db 0x00,0x00,0x00,0x00,0x03,0x07,0x0F,0x0F +.db 0x0F,0x0F,0x07,0x03,0x00,0x00,0x00,0x00 +.db 0x00,0x00,0x00,0x00,0xC0,0xE0,0xF0,0xF0 +.db 0xF0,0xF0,0xE0,0xC0,0x00,0x00,0x00,0x00 +; 4 +.db 0x00,0x00,0x00,0x01,0x07,0x0F,0x0F,0x1F +.db 0x1F,0x0F,0x0F,0x07,0x01,0x00,0x00,0x00 +.db 0x00,0x00,0x00,0x80,0xE0,0xF0,0xF0,0xF8 +.db 0xF8,0xF0,0xF0,0xE0,0x80,0x00,0x00,0x00 +; 5 +.db 0x00,0x00,0x03,0x0F,0x1F,0x1F,0x3F,0x3F +.db 0x3F,0x3F,0x1F,0x1F,0x0F,0x03,0x00,0x00 +.db 0x00,0x00,0xC0,0xF0,0xF8,0xF8,0xFC,0xFC +.db 0xFC,0xFC,0xF8,0xF8,0xF0,0xC0,0x00,0x00 +; 6 +.db 0x00,0x03,0x0F,0x1F,0x3F,0x3F,0x7F,0x7F +.db 0x7F,0x7F,0x3F,0x3F,0x1F,0x0F,0x03,0x00 +.db 0x00,0xC0,0xF0,0xF8,0xFC,0xFC,0xFE,0xFE +.db 0xFE,0xFE,0xFC,0xFC,0xF8,0xF0,0xC0,0x00 +; 7 +.db 0x07,0x1F,0x3F,0x7F,0x7F,0xFF,0xFF,0xFF +.db 0xFF,0xFF,0xFF,0x7F,0x7F,0x3F,0x1F,0x07 +.db 0xE0,0xF8,0xFC,0xFE,0xFE,0xFF,0xFF,0xFF +.db 0xFF,0xFF,0xFF,0xFE,0xFE,0xFC,0xF8,0xE0 + +__endasm; +} + + + + +// pantalla principal +void setMainScr() +{ +__asm + + ld hl,#SCR01 + ld de,#BASE10 + jp unRLE2VR + + +; tiles screen +; VRAM address= 1800h +; size=0300h +; start x=0 y=0 +; end x=31 y=23 +; RLE compressed - Original size:768 - RLE size:521 +SCR01: +.db 0x01,0xA0,0x0A,0xA1,0x01,0xA2,0x10,0xEF,0x01,0x1A,0x01,0x1B,0x01,0x1C,0x01,0x1D +.db 0x01,0xA7,0x01,0x73,0x01,0x6F,0x01,0x6E,0x01,0x67,0x06,0x20,0x01,0xA8,0x14,0xEF +.db 0x01,0xA7,0x01,0x20,0x01,0x54,0x01,0x45,0x01,0x4D,0x01,0x50,0x01,0x4F,0x01,0x20 +.db 0x01,0x0A,0x01,0xD9,0x01,0xDA,0x01,0xA8,0x14,0xEF,0x01,0xA7,0x0A,0x20,0x01,0xA8 +.db 0x14,0xEF,0x01,0xA7,0x03,0x20,0x01,0xD4,0x01,0x9D,0x01,0x80,0x01,0x92,0x01,0x8E +.db 0x01,0x84,0x01,0xD7,0x01,0xA8,0x14,0xEF,0x01,0xA3,0x0A,0xA4,0x01,0xA6,0x14,0xEF +.db 0x01,0xA7,0x01,0x64,0x01,0x72,0x01,0x75,0x01,0x6D,0x01,0x73,0x02,0x20,0x01,0x0F +.db 0x01,0x12,0x01,0xBC,0x01,0xA8,0x14,0xEF,0x01,0xA7,0x0A,0x20,0x01,0xA8,0x07,0xEF +.db 0x01,0xE0,0x01,0xE1,0x01,0xE2,0x01,0xE3,0x01,0xE4,0x01,0xE5,0x07,0xEF,0x01,0xA7 +.db 0x01,0x20,0x01,0x43,0x01,0x41,0x01,0x53,0x01,0x49,0x01,0x4F,0x02,0x20,0x01,0xDF +.db 0x01,0xDE,0x01,0xA8,0x06,0xEF,0x01,0xE6,0x01,0xE7,0x04,0xE8,0x01,0xE9,0x01,0xEA +.db 0x06,0xEF,0x01,0xA7,0x0A,0x20,0x01,0xA8,0x06,0xEF,0x01,0xEB,0x06,0xE8,0x01,0xEC +.db 0x06,0xEF,0x01,0xA7,0x03,0x20,0x01,0xD4,0x01,0x9E,0x01,0x80,0x01,0x92,0x01,0x8E +.db 0x01,0x84,0x01,0xD7,0x01,0xA8,0x06,0xEF,0x01,0xED,0x06,0xE8,0x01,0xEE,0x06,0xEF +.db 0x01,0xA3,0x0A,0xA4,0x01,0xA6,0x06,0xEF,0x01,0xF0,0x06,0xE8,0x01,0xF1,0x06,0xEF +.db 0x01,0xA7,0x01,0x74,0x01,0x6F,0x01,0x6E,0x01,0x65,0x01,0x18,0x01,0x19,0x01,0x20 +.db 0x01,0x0F,0x01,0x13,0x01,0xBC,0x01,0xA8,0x06,0xEF,0x01,0xF2,0x06,0xE8,0x01,0xF3 +.db 0x06,0xEF,0x01,0xA7,0x01,0x20,0x01,0x41,0x01,0x2B,0x01,0x42,0x04,0x20,0x01,0xDF +.db 0x01,0xDE,0x01,0xA8,0x06,0xEF,0x01,0xF4,0x01,0xF5,0x04,0xE8,0x01,0xF6,0x01,0xF7 +.db 0x06,0xEF,0x01,0xA7,0x01,0x20,0x01,0x4F,0x01,0x53,0x01,0x45,0x01,0x54,0x03,0x0A +.db 0x01,0xD9,0x01,0xDA,0x01,0xA8,0x07,0xEF,0x01,0xF8,0x01,0xF9,0x01,0xFA,0x01,0xFB +.db 0x01,0xFC,0x01,0xFD,0x07,0xEF,0x01,0xA7,0x0A,0x20,0x01,0xA8,0x14,0xEF,0x01,0xA7 +.db 0x01,0x20,0x01,0x45,0x01,0x4E,0x01,0x56,0x01,0x20,0x02,0xD0,0x01,0x0A,0x01,0xD9 +.db 0x01,0xDA,0x01,0xA8,0x14,0xEF,0x01,0xA7,0x01,0x20,0x01,0x53,0x01,0x50,0x02,0x45 +.db 0x01,0x44,0x01,0x20,0x01,0x0A,0x01,0xD9,0x01,0xDA,0x01,0xA8,0x14,0xEF,0x01,0xA7 +.db 0x01,0x20,0x01,0x4C,0x02,0x4F,0x01,0x50,0x03,0x20,0x01,0xDF,0x01,0xDE,0x01,0xA8 +.db 0x14,0xEF,0x01,0xA7,0x0A,0x20,0x01,0xA8,0x14,0xEF,0x01,0xA7,0x01,0x20,0x01,0x4F +.db 0x01,0x43,0x01,0x54,0x01,0x41,0x01,0x56,0x01,0x45,0x01,0x0A,0x01,0xD9,0x01,0xDA +.db 0x01,0xA8,0x14,0xEF,0x01,0xA7,0x01,0x20,0x01,0x55,0x01,0x50,0x01,0x2F,0x01,0x44 +.db 0x01,0x4F,0x01,0x57,0x01,0x4E,0x01,0xD9,0x01,0xDA,0x01,0xA8,0x14,0xEF,0x01,0xA7 +.db 0x03,0x20,0x01,0xD4,0x01,0x9F,0x01,0x80,0x01,0x92,0x01,0x8E,0x01,0x84,0x01,0xD7 +.db 0x01,0xA8,0x01,0xEF,0x01,0x7E,0x10,0xB4,0x02,0xEF,0x01,0xAC,0x0A,0xAD,0x01,0xAE +.db 0x01,0xEF,0x01,0x7F,0x10,0xB4,0x02,0xEF,0x00 + + +__endasm; +} + + + + +// vuelca desde una area de la RAM (PSG_RAM), +// los valores de los registros del PSG +// a tres diferentes chips (AY interno, AY Pazos y SCC) +void play() +{ +__asm + ld HL,#PSG_RAM ; direccion de memoria del buffer + ld B,#13 ; numero de registros + + ld A,(#PLAY_HARDW) ;//indica que chip utiliza (0=AY interno, 1=AY pazos) + cp #0 + jr NZ,MFR_CPY + + ;PSG intern + xor A + ld C,#0xA1 +ILOOP: + out (#0xA0),A + inc A + outi + JR NZ,ILOOP + ret + +MFR_CPY: + cp #1 + jr NZ,SCC_CPY + + ;MEGAFLASHROM PSG + xor A + ld C,#0x11 +MLOOP: + out (#0x10),A + inc A + outi + JR NZ,MLOOP + ret + +SCC_CPY: + ;SCC + ret + +__endasm; +} + + +// genera un valor aleatorio de 8 bits y le aplica una máscara +// necesita de un byte en la RAM (SEED) +byte Rnd(char value) +{ +value; +__asm + ld C,4(ix) ;recoge el valor de la mascara + + ld A,R ; + ld B,A + + ld A,(SEED) + SRA A + + add A,B + ;add A,A + + ld B,A + + ld A,R ; + add A,B + + inc a + + ld (SEED),A + + AND C ;aplica la mascara + + + ld L,A +__endasm; +} + + +void pressKey() +{ +__asm + call #0x009F ;CHGET +__endasm; +} + + +// llena una area de la RAM con un valor +void fillRAM(uint address, int size, byte value) +{ +address;value;size; + +__asm + ld L, 4(ix) ; HL direccion de origen + ld H, 5(ix) + + ld C, 6(ix) ; DE num de bytes a copiar + ld B, 7(ix) + + ld A, 8(ix) ; value + + dec BC + + ld D,H + ld E,L + + inc DE + + ld (HL),A + ldir + +__endasm; +} + + + +// HL > DATA ADDR +// DE > VRAM ADDR +// descompresor RLE a VRAM +void unRLE2VRAM() +{ +__asm +unRLE2VR: + ; direccion de VRAM (DE) + in A,(0x99) + di + ld A,E + out (0x99),A + ld A,D + add A,#0x40 + out (0x99),A + ei + +getCMD: ;mira byte de instruccion 1-255 repeticion + ld A,(HL) + cp #0 ;si es 0 es fin + ret Z ;sale de la funcion + + inc HL + ld B,A ;numero de repeticiones + + ld A,(HL) ;recoge el valor + +RLE_bucle: + out (0x98),A + nop + nop + djnz RLE_bucle + + inc HL + + jr getCMD + +__endasm; +} + + +// =========================================================================== +// 16-bit Integer to ASCII (decimal) +// by baze +// Input: HL = number to convert, DE = location of ASCII string +// Output: ASCII string at (DE) +// =========================================================================== +void Num2Dec16(int aNumber, char *address) +{ + aNumber; + address; +__asm + ld l,4(ix) + ld h,5(ix) + + ld e,6(ix) + ld d,7(ix) + + ld bc,#-10000 + call $Num1 + ld bc,#-1000 + call $Num1 + ld bc,#-100 + call $Num1 + ld c,#-10 + call $Num1 + ld c,b + call $Num1 + jr $Num3 +$Num1: + ld a,#-1 ;ASCII-1 47 +$Num2: + inc a + add hl,bc + jr c,$Num2 + sbc hl,bc + ld (de),a + inc de + ret +$Num3: + +__endasm; +} + + +// genera un patron de ritmo de forma aleatoria +void genDrumPattern() +{ + char hits; + char kicks; + char snares; + char conta=0; + byte increment=0; + uint vaddr =0x1aee; + + char i; + + for(i=0;i<16;i++) drum_pattern[i]=0; + + hits=Rnd(3); + if(hits>0) + { + //hits++; + do{ + conta+=hits; + if(conta<16) drum_pattern[conta]=3; + }while(conta<16); + } + + conta=0; + kicks=Rnd(3)*2; + if(kicks>0) + { + do{ + drum_pattern[conta]=1; + conta+=kicks; + }while(conta<16); + } + + conta=0; + snares=Rnd(3)*4; + if(snares>0) + { + do{ + conta+=snares; + if(conta<16) drum_pattern[conta]=2; + }while(conta<16); + } + + for (i=0;i<16;i++) vpoke(vaddr++,drum_pattern[i]+180); + +} + + + +// genera un patron de tono de forma aleatoria +void genTonePattern() +{ + byte type; + byte value; + byte conta=0; + byte increment=0; + uint vaddr =0x1aCe; + + byte i; + + for(i=0;i<16;i++) tone_pattern[i]=0; + + type=Rnd(3)+1; + if (type==1) increment=0; + if (type==2) increment=4; + if (type>2) increment=2; + + //vprintNumber(20,1, type, 3); //test + //vprintNumber(24,1, increment, 3); + + type++; + for(i=1;i11) value=0; + tone_pattern[conta]=value+1; + conta=conta+increment; + } + for(i=0;i<8;i++) + { + tone_pattern[i+8]=tone_pattern[i]; + } + + for (i=0;i<16;i++){ + if(tone_pattern[i]==0) vpoke(vaddr++,180); + else vpoke(vaddr++,184); + } + return; +} + + +// sube una nota el patron de tono +void upNotePattern() +{ + char i; + byte value; + + for(i=0;i<16;i++) + { + value = tone_pattern[i]; + if(value>0 && value<96) tone_pattern[i]=value+1; + } + + return; +} + + +// baja una nota el patron de tono +void downNotePattern() +{ + char i; + byte value; + + for(i=0;i<16;i++) + { + value = tone_pattern[i]; + if(value>1) tone_pattern[i]=value-1; + } + + return; +} + + + +// proporciona la frecuencia a partir de un numero de nota +// A=num de nota (0>96) HL=valor freq +int getFreq(byte value) //__naked +{ +value; +__asm + + //push IX + + ld A,4(IX) + +;GETFREQ: + SLA A ; x2 (rotacion izquierda sin acarreo) + ld D,#0 + ld E,A + ld IY,#VNOTAS + add IY,DE + + ld L,(IY) + ld H,1(IY) + + pop IX + ret + +VNOTAS: + .dw 0 + ; Octava 0 (0) + .dw 0x0D5D,0x0C9C,0x0BE7,0x0B3C,0x0A9B,0x0A02,0x0973,0x08EB,0x086B,0x07F2,0x0780,0x0714 + ; Octava 1 (24) + .dw 0x06AE,0x064E,0x05F4,0x059E,0x054D,0x0501,0x04B9,0x0475,0x0435,0x03F9,0x03C0,0x038A + ; Octava 2 (48) + .dw 0x0357,0x0327,0x02FA,0x02CF,0x02AF,0x0281,0x025D,0x023B,0x021B,0x01FC,0x01E0,0x01C5 + ; Octava 3 (72) + .dw 0x01AC,0x0194,0x017D,0x0168,0x0153,0x0140,0x012E,0x011D,0x010D,0x00FE,0x00F0,0x00E2 + ; Octava 4 (96) + .dw 0x00D6,0x00CA,0x00BE,0x00B4,0x00AA,0x00A0,0x0097,0x008F,0x0087,0x007F,0x0078,0x0071 + ; Octava 5 (120) + .dw 0x006B,0x0065,0x005F,0x005A,0x0055,0x0050,0x004C,0x0047,0x0043,0x0040,0x003B,0x0039 + ; Octava 6 (144) + .dw 0x0035,0x0032,0x0030,0x002D,0x002A,0x0028,0x0026,0x0024,0x0022,0x0020,0x001E,0x001C + ; Octava 7 (168) + .dw 0x001B,0x0019,0x0018,0x0016,0x0015,0x0014,0x0013,0x0012,0x0011,0x0010,0x000F,0x000E + + + + + ;.db 0,0 ;valor nulo + ; Octava 0 (0) + ;.db 0x5D,0x0D,0x9C,0x0C,0xE7,0x0B,0x3C,0x0B,0x9B,0x0A,0x02,0x0A,0x73,0x09,0xEB,0x08,0x6B,0x08,0xF2,0x07,0x80,0x07,0x14,0x07 + ; Octava 1 (24) + ;.db 0xAE,0x06,0x4E,0x06,0xF4,0x05,0x9E,0x05,0x4D,0x05,0x01,0x05,0xB9,0x04,0x75,0x04,0x35,0x04,0xF9,0x03,0xC0,0x03,0x8A,0x03 + ; Octava 2 (48) + ;.db 0x57,0x03,0x27,0x03,0xFA,0x02,0xCF,0x02,0xAF,0x02,0x81,0x02,0x5D,0x02,0x3B,0x02,0x1B,0x02,0xFC,0x01,0xE0,0x01,0xC5,0x01 + ; Octava 3 (72) + ;.db 0xAC,0x01,0x94,0x01,0x7D,0x01,0x68,0x01,0x53,0x01,0x40,0x01,0x2E,0x01,0x1D,0x01,0x0D,0x01,0xFE,0x00,0xF0,0x00,0xE2,0x00 + ; Octava 4 (96) + ;.db 0xD6,0x00,0xCA,0x00,0xBE,0x00,0xB4,0x00,0xAA,0x00,0xA0,0x00,0x97,0x00,0x8F,0x00,0x87,0x00,0x7F,0x00,0x78,0x00,0x71,0x00 + ; Octava 5 (120) + ;.db 0x6B,0x00,0x65,0x00,0x5F,0x00,0x5A,0x00,0x55,0x00,0x50,0x00,0x4C,0x00,0x47,0x00,0x43,0x00,0x40,0x00,0x3B,0x00,0x39,0x00 + ; Octava 6 (144) + ;.db 0x35,0x00,0x32,0x00,0x30,0x00,0x2D,0x00,0x2A,0x00,0x28,0x00,0x26,0x00,0x24,0x00,0x22,0x00,0x20,0x00,0x1E,0x00,0x1C,0x00 + ; Octava 7 (168) + ;.db 0x1B,0x00,0x19,0x00,0x18,0x00,0x16,0x00,0x15,0x00,0x14,0x00,0x13,0x00,0x12,0x00,0x11,0x00,0x10,0x00,0x0F,0x00,0x0E,0x00 + +__endasm; +} + + +// =========================================================================== +// muestra un numero +// posx - numero de columna (0 a 31) +// posy - numero de fila (0 a 23) +// aNumber (uint) - valor +// aLength (byte) - numero de cifras +// =========================================================================== +void vprintNumber(byte posx, byte posy, uint aNumber, byte aLength) +{ + byte pos=5; + uint tiladdre=0; + + char strBuff[5]; + + Num2Dec16(aNumber, strBuff); + + // proporciona la direccion de la VRAM a partir de una posicion + tiladdre = getVAddressByPosition(posx, posy); + + //coloca el puntero en la posicion donde se ha de empezar a mostrar + pos = 5-aLength; + + // muestra el numero en la pantalla + while (aLength-->0){ vpoke(tiladdre++,strBuff[pos++]);} +} + + + +// muestra un control tipo switch (interruptor) +void switcher(uint vaddr, boolean value) +{ + if(value==true) + { + vpoke(vaddr++,221); + vpoke(vaddr,223); + }else{ + vpoke(vaddr++,223); + vpoke(vaddr,222); + } + return; +} + + +// muestra el valor de la envolvente +void showEnv(char value) +{ + vprintNumber(8,16, value, 3); + value=value*2+192; + vpoke(0x1A06,value++); + vpoke(0x1A07,value++); +} + + +// muestra el indicador de activación de canal de audio (altavoz) +void showSpeaker(uint vaddr, boolean value) +{ + if(value==true) vpoke(vaddr,187); + else vpoke(vaddr,188); + + return; +} + + +// cambia la paleta de colores del logo (MSX2) +void setMSX2logoPal() +{ +__asm + + ld hl,#PALETTE00 + xor a + di + out (#0x99),a + ld a,#144 + out (#0x99),a + ld bc,#0x209A + otir + ei + ret + +; Default Palette +; RB,G +PALETTE00: +.db 0x00,0x00 +.db 0x00,0x00 +.db 0x22,0x05 +.db 0x22,0x06 +.db 0x25,0x02 +.db 0x33,0x03 +.db 0x61,0x01 +.db 0x07,0x06 +.db 0x62,0x02 +.db 0x73,0x03 +.db 0x63,0x06 +.db 0x64,0x06 +.db 0x11,0x04 +.db 0x55,0x03 +.db 0x66,0x06 +.db 0x77,0x07 + +__endasm; +} + + +// cambia la paleta de colores (MSX2) +void setMSX2Palette() +{ +__asm + + ld hl,#PALETTE01 + xor a + di + out (#0x99),a + ld a,#144 + out (#0x99),a + ld bc,#0x209A + otir + ei + ret + +; alanRandoms +; RB,G +PALETTE01: +.db 0x00,0x00 +.db 0x00,0x00 +.db 0x44,0x04 +.db 0x32,0x07 +.db 0x25,0x02 +.db 0x37,0x03 +.db 0x61,0x01 +.db 0x27,0x06 +.db 0x71,0x01 +.db 0x73,0x03 +.db 0x60,0x06 +.db 0x74,0x07 +.db 0x00,0x05 +.db 0x65,0x01 +.db 0x66,0x06 +.db 0x77,0x07 + +__endasm; +} \ No newline at end of file