• R/O
  • SSH
  • HTTPS

oswanpsp: Commit


Commit MetaInfo

Revisão27 (tree)
Hora2009-08-26 10:18:30
Autorbird_may_nike

Mensagem de Log

(mensagem de log vazia)

Mudança Sumário

Diff

--- trunc/src/ws.c (revision 26)
+++ trunc/src/ws.c (revision 27)
@@ -888,6 +888,149 @@
888888 return frameFin;
889889 }
890890
891+int Interrupt(void)
892+{
893+ static int LCount=0, Joyz=0x0000;
894+ int i, j;
895+
896+ if(++LCount>=8) // 8回で1Hblank期間
897+ {
898+ LCount=0;
899+ }
900+
901+ switch(LCount)
902+ {
903+ case 0:
904+ break;
905+ case 2:
906+ // Hblank毎に1サンプルセットすることで12KHzのwaveデータが出来る
907+ apuWaveSet();
908+ break;
909+ case 4:
910+ if(RSTRL == 140)
911+ {
912+ sprRamBase = SprMap + IO[0x05];
913+ SprCount = IO[0x06];
914+ if (SprCount > 0x80) {
915+ SprCount = 0x80;
916+ }
917+ sprBuffer = (unsigned long*)SprTable;
918+ for (i = 0; i < SprCount; i++) {
919+ *sprBuffer++ = *sprRamBase++;
920+ }
921+ }
922+
923+ if(LCDSLP & 0x01)
924+ {
925+ if(RSTRL == 0)
926+ {
927+ SkipCnt--;
928+ if(SkipCnt < 0)
929+ {
930+ SkipCnt = 4;
931+ }
932+ }
933+ if(TblSkip[FrameSkip][SkipCnt])
934+ {
935+ if(render && (IO[0x02] < 144)) {
936+ if (IO[0x60] & 0x40)
937+ {
938+ gpuRenderScanLineColor();
939+ }
940+ else
941+ {
942+ gpuRenderScanLineMono();
943+ }
944+ }
945+ }
946+ }
947+ break;
948+ case 6:
949+ i = (HCNTH << 8) + HCNTL;
950+ j = (HPREH << 8) + HPREL;
951+ if((TIMCTL & 0x01) && i)
952+ {
953+ i--;
954+ if(!i)
955+ {
956+ if(TIMCTL & 0x02)
957+ {
958+ i = j;
959+ }
960+ if(IRQENA & HTM_IFLAG)
961+ {
962+ IRQACK |= HTM_IFLAG;
963+ }
964+ }
965+ HCNTH = (byte)(i >> 8);
966+ HCNTL = (byte)(i & 0xFF);
967+ }
968+ else if(j == 1)
969+ {
970+ if(IRQENA & HTM_IFLAG)
971+ {
972+ IRQACK |= HTM_IFLAG;
973+ }
974+ }
975+
976+
977+ // HBlank Timer Interrupt
978+ if (hblankTimer == 1) {
979+ IO[0xb6] |= 0x80;
980+ }
981+ // Update HBlank count
982+ (*(unsigned short*)(IO+0xA8))++;
983+ // HBLANK count down
984+ if (hblankTimer && (IO[0xa2] & 0x01)) {
985+ hblankTimer--;
986+ if (!hblankTimer && (IO[0xa2] & 0x02))
987+ hblankTimer = hblankTimerPreset;
988+ *(unsigned short*)(IO+0xA4) = hblankTimer;
989+ }
990+ if (IO[0x02] == 144) {
991+ frameFin = 1;
992+ // Update VBlank count
993+ vblankCount++;
994+ // 0xAAは4バイト境界に合わない
995+ //*(unsigned long*)(IO+0xAA) = vblankCount;
996+ *(unsigned short*)(IO+0xAA) = vblankCount & 0xFFFF;
997+ *(unsigned short*)(IO+0xAC) = vblankCount >> 16;
998+ // VBlank Begin Interrupt
999+ if (IO[0xb2] & 0x10) {
1000+ IO[0xb6] |= 0x40;
1001+ }
1002+ // VBlank Timer Interrupt
1003+ if ((IO[0xb2] & 0x20) && (vblankTimer == 1))
1004+ IO[0xb6] |= 0x20;
1005+ // VBLANK count down
1006+ if (vblankTimer && (IO[0xa2] & 0x04)) {
1007+ vblankTimer--;
1008+ if (!vblankTimer && (IO[0xa2] & 0x08))
1009+ vblankTimer = vblankTimerPreset;
1010+ *(unsigned short*)(IO+0xA6) = vblankTimer;
1011+ }
1012+ }
1013+ // Scanline Match Interrupt
1014+ if ((IO[0xb2] & 0x10) && (IO[0x02] == IO[0x03])) {
1015+ IO[0xb6] |= 0x10;
1016+ }
1017+
1018+ break;
1019+ case 7:
1020+ RSTRL++;
1021+ if(RSTRL>=159)
1022+ {
1023+ RSTRL=0;
1024+ }
1025+
1026+ break;
1027+ default:
1028+ break;
1029+ }
1030+
1031+ return IRQACK;
1032+}
1033+
8911034 /*-------------------------
8921035 エミュ実行ループ
8931036 -------------------------*/
Show on old repository browser