⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 7110proc.asm

📁 linux下的任天堂模拟器代码。供大家参考。
💻 ASM
📖 第 1 页 / 共 2 页
字号:
    retSPC4814:    mov al,[SPCROMAdj]    retSPC4815:    mov al,[SPCROMAdj+1]    retSPC4816:    mov al,[SPCROMInc]    retSPC4817:    mov al,[SPCROMInc+1]    retSPC4818:    mov al,[SPCROMCom]    retSPC481A:    cmp dword[SPCCheckFix],0    jne .okay    xor al,al    ret.okay    push ebx    xor ebx,ebx    mov bx,[SPCROMAdj]    add ebx,[SPCROMPtr]    add ebx,[romdata]    add ebx,100000h    mov al,[ebx]    cmp byte[SPCROMCom+1],4     ; 16bit 4814    jne .notincr    mov ebx,[SPCROMAdj]    push ecx    mov ecx,[SPCROMtoI]    add [ecx],ebx    pop ecx.notincr    pop ebx    retSPC4811w:    mov [SPCROMPtr],al    mov byte[SPCCheckFix],1    retSPC4812w:    mov [SPCROMPtr+1],al    retSPC4813w:    mov [SPCROMPtr+2],al    retSPC4814w:    mov [SPCROMAdj],al    cmp byte[SPCROMCom+1],2     ; 8 bit 4814    jne .notincr    mov ebx,[SPCROMtoI]    xor ecx,ecx    mov cl,[SPCROMAdj]    test byte[SPCROMCom],08h    jz .noneg    movsx ecx,byte[SPCROMAdj].noneg    add dword[ebx],ecx.notincr    retSPC4815w:    mov [SPCROMAdj+1],al    mov word[SPCROMAdj+2],0    test byte[SPCROMCom],08h    jz .noneg    test byte[SPCROMAdj+1],80h    jz .noneg    mov word[SPCROMAdj+2],0FFFFh.noneg    cmp byte[SPCROMCom+1],3     ; 16bit 4814    jne .notincr    push ebx    push ecx    mov ecx,[SPCROMtoI]    mov ebx,[SPCROMAdj]    add [ecx],ebx    pop ecx    pop ebx.notincr    retSPC4816w:    mov [SPCROMInc],al    retSPC4817w:    mov [SPCROMInc+1],al    mov word[SPCROMInc+2],0    test byte[SPCROMCom],04h    jz .noneg    test byte[SPCROMInc+1],40h    jz .noneg    mov word[SPCROMInc+2],0FFFFh.noneg    retSPC4818w:    mov [SPCROMCom],al    mov word[SPCROMAdj+2],0    test byte[SPCROMCom],08h    jz .noneg    test byte[SPCROMAdj+1],80h    jz .noneg    mov word[SPCROMAdj+2],0FFFFh.noneg    mov word[SPCROMInc+2],0    test byte[SPCROMCom],04h    jz .noneg2    test byte[SPCROMInc+1],40h    jz .noneg2    mov word[SPCROMInc+2],0FFFFh.noneg2    mov dword[SPCROMtoI],SPCROMPtr    test byte[SPCROMCom],10h    jz .nouseadjust    mov dword[SPCROMtoI],SPCROMAdj.nouseadjust    test al,02h    jz .no4814    test al,40h    jz .no16b    test al,20h    jz .not481A    mov byte[SPCROMCom+1],4     ; 16bit 4814 after 481A    jmp .fin.not481A    mov byte[SPCROMCom+1],3     ; 16bit 4814    jmp .fin.no16b    test al,20h    jz .nooffsetadd    mov byte[SPCROMCom+1],2     ; 8 bit 4814    jmp .fin.nooffsetadd    mov byte[SPCROMCom+1],0FFh    jmp .fin.no4814    test al,01h    jz .incrval0    mov byte[SPCROMCom+1],1     ; add 4816 after 4810 read    jmp .fin.incrval0    mov byte[SPCROMCom+1],0     ; add 1 after 4810 read.fin    ret;Data Rom Command Mode Byte:;X6543210;||||||||;|||||| \__ : 00 - use 1 as the offset increment value, add immediately after reading $4810;||||||     : 01 - use $4816 as offset increment, add immediately after reading $4810;||||||     : 10 - use $4814 as offset increment, see below for when to add;||||||     : 11 - unused;||||||____ : 0 - unsigned calculation for $4816;|||||        1 - signed calculation for $4816;|||||_____ : 0 - unsigned calculation for $4814;||||         1 - signed calculation for $4814;||||______ : 0 - offset increment gets added to $4811/2/3;|||          1 - offset increment gets added to $4814/5;| \_______ : 00 - disable offset addition;|          : 01 - 8 bit offset addition using $4814, immediately after writing to $4814/5;|          : 10 - 16 bit offset addition using $4814/5, immediately after writing to $4814/5;|          : 11 - 16 bit offset addition using $4814/5, only after reading $481A;|_________ : unusedSPC4820:    mov al,[SPCMultA];    mov byte[debstop3],1    retSPC4821:    mov al,[SPCMultA+1]    retSPC4822:    mov al,[SPCMultA+2]    retSPC4823:    mov al,[SPCMultA+3]    retSPC4824:    mov al,[SPCMultB]    retSPC4825:    mov al,[SPCMultB+1]    retSPC4826:    mov al,[SPCDivEnd]    retSPC4827:    mov al,[SPCDivEnd+1]    retSPC4820w:    mov [SPCMultA],al    retSPC4821w:    mov [SPCMultA+1],al    retSPC4822w:    mov [SPCMultA+2],al    retSPC4823w:    mov [SPCMultA+3],al    retSPC4824w:    mov [SPCMultB],al    retSPC4825w:    mov [SPCMultB+1],al    ; Calculate SPCMultA*SPCMultB -> SPCMulRes    test byte[SPCSignedVal],1    jnz .signed    push edx    push eax    push ebx    xor eax,eax    xor ebx,ebx    mov ax,[SPCMultA]    mov bx,[SPCMultB]    mul ebx    mov [SPCMulRes],eax    pop ebx    pop eax    pop edx    ret.signed    push edx    push eax    push ebx    movsx eax,word[SPCMultA]    movsx ebx,word[SPCMultB]    imul ebx    mov [SPCMulRes],eax    pop ebx    pop eax    pop edx    retSPC4826w:    mov [SPCDivEnd],al    retSPC4827w:    mov [SPCDivEnd+1],al    ; Calculte SPCMultA/SPCDivEnd -> SPCMulRes, rem SPCDivRes    cmp word[SPCDivEnd],0    je near .nodivide    test byte[SPCSignedVal],1    jnz .signed    push edx    push eax    push ebx    xor edx,edx    xor ebx,ebx    mov eax,[SPCMultA]    mov bx,[SPCDivEnd]    div ebx    mov [SPCMulRes],eax    mov [SPCDivRes],dx    pop ebx    pop eax    pop edx    ret.signed    push edx    push eax    push ebx    xor edx,edx    mov eax,[SPCMultA]    test eax,80000000h    jz .nd    mov edx,0FFFFFFFFh.nd    movsx ebx,word[SPCDivEnd]    idiv ebx    mov [SPCMulRes],eax    mov [SPCDivRes],dx    pop ebx    pop eax    pop edx    ret.nodivide    mov dword[SPCMulRes],0FFFFFFFFh    mov dword[SPCDivRes],0FFFFh    retSPC4828:    mov al,[SPCMulRes]    retSPC4829:    mov al,[SPCMulRes+1]    retSPC482A:    mov al,[SPCMulRes+2]    retSPC482B:    mov al,[SPCMulRes+3]    retSPC482C:    mov al,[SPCDivRes]    retSPC482D:    mov al,[SPCDivRes+1]    retSPC482E:    xor al,al    retSPC482Ew:    mov [SPCSignedVal],al    mov dword[SPCMultA],0    mov dword[SPCMultB],0    mov dword[SPCDivEnd],0    mov dword[SPCMulRes],0    mov dword[SPCDivRes],0    retSPC482F:    xor al,al    retSPC4831w:    BankSwitchSPC7110 0,0D0h    retSPC4832w:    BankSwitchSPC7110 1,0E0h    retSPC4833w:;    mov byte[debstop3],1    BankSwitchSPC7110 2,0F0h    retSPC4831:    mov al,[SPC7110BankA]    retSPC4832:    mov al,[SPC7110BankA+1]    retSPC4833:    mov al,[SPC7110BankA+2]    retSPC4834:    xor al,al    ret;$4840   RTC CHIP ENABLE/DISABLE: bit 0: on = enable, off = disable, defval:00;$4841   RTC INDEX/DATA PORT:;            first write after rtc enable: rtc command mode byte (see rtc command modes);            subsequent writes: index of rtc register to read/write (00-0f);            read: returns value of indexed rtc register;            auto-increment of register index occurs after each subsequent read/write;$4842   RTC READY STATUS: bit 7: on = ready, off = still processing, tested before reading rtc data;            high bit cleared after successful readSPC4840w:    test al,1    jz .notreset    mov [SPC7110RTCStat],al    mov byte[SPC7110RTCStat+1],0FEh.notreset    retSPC4841w:    cmp byte[SPC7110RTCStat+1],0FEh    je .commandbyte    cmp byte[SPC7110RTCStat+1],0FFh    je .commandindex    push ebx    xor ebx,ebx    mov bl,[SPC7110RTCStat+1]    mov [SPC7110RTC+ebx],al    cmp ebx,0Fh    jne .notlast    test al,01h    jz .notlast    mov dword[SPC7110RTC],0    mov dword[SPC7110RTC+4],010000h    mov dword[SPC7110RTC+8],01h    mov byte[SPC7110RTC+12],0.notlast    pop ebx    inc byte[SPC7110RTCStat+1]    and byte[SPC7110RTCStat+1],0Fh    ret.commandbyte    inc byte[SPC7110RTCStat+1]    mov [SPC7110RTCStat+2],al    ret.commandindex    push eax    and al,0Fh    mov [SPC7110RTCStat+1],al    pop eax    retSPC4842w:    retSPC4840:    mov al,[SPC7110RTCStat]    retSPC4841:    cmp byte[SPC7110RTCStat+1],0FEh    je near .commandbyte    cmp byte[SPC7110RTCStat+1],0FFh    je near .commandbyte    push ebx    xor ebx,ebx    mov bl,[SPC7110RTCStat+1]    or ebx,ebx    jnz near .dontupdate    test byte[SPC7110RTC+0Fh],03h    jnz near .dontupdate    test byte[SPC7110RTC+0Dh],01h    jnz near .dontupdate;00 - seconds 1's digit                 00;01 - seconds 10's digit                00;02 - minutes 1's digit                 00;03 - minutes 10's digit                00;04 - hours 1's digit                   00;05 - hours 10's digit                  00;06 - day of month 1's digit            01;07 - day of month 10's digit           00;08 - month 1's digit                   01;09 - month 10's digit                  00;0a - year 1's digit                    00;0b - year 10's digit                   00;0c - day of week                       00%ifndef NO_DEBUGGER    cmp byte[debuggeron],1    je near .dontupdate%endif    ; fill time/date    push ebx    push eax    call Get_Time    mov bl,al    and bl,0Fh    mov [SPC7110RTC],bl  ; seconds    shr eax,4    mov bl,al    and bl,0Fh    mov [SPC7110RTC+1],bl    shr eax,4    mov bl,al    and bl,0Fh    mov [SPC7110RTC+2],bl  ; minutes    shr eax,4    mov bl,al    and bl,0Fh    mov [SPC7110RTC+3],bl    test byte[SPC7110RTC+0Fh],4;    jz .not24hrs;    jmp .not24hrs    shr eax,4    mov bl,al    and bl,0Fh    mov [SPC7110RTC+4],bl  ; hours    shr eax,4    mov bl,al    and bl,0Fh    mov [SPC7110RTC+5],bl    jmp .24hrs.not24hrs    shr eax,4    xor ebx,ebx    mov bl,al    mov al,[SPCTimerVal+ebx]    mov bl,al    and bl,0Fh    mov [SPC7110RTC+4],bl  ; hours    shr eax,4    mov bl,al    and bl,0Fh    mov [SPC7110RTC+5],bl.24hrs    call Get_TimeDate    mov bl,al    and bl,0Fh    mov [SPC7110RTC+6],bl  ; day    shr eax,4    mov bl,al    and bl,0Fh    mov [SPC7110RTC+7],bl    shr eax,4    mov bl,al    and bl,0Fh    xor bh,bh    cmp bl,9    jbe .less    sub bl,10    mov bh,1.less    mov [SPC7110RTC+8],bl  ; month    mov [SPC7110RTC+9],bh  ; month    shr eax,8    mov bl,al    and bl,0Fh    mov [SPC7110RTC+10],bl  ; year    shr eax,4    mov bl,al    and bl,01Fh    xor bh,bh.notokay    cmp bl,9    jbe .okay    inc bh    sub bl,10    jmp .notokay.okay    mov [SPC7110RTC+11],bl    shr eax,8    and al,0Fh    mov [SPC7110RTC+12],al ; day of week.done    pop eax    pop ebx.dontupdate;    test byte[SPC7110RTC+0Fh],1;    jz .realtime;    cmp ebx,0Dh;    jae .realtime;    mov al,[SPC7110RTCB+ebx];    jmp .next;.realtime    mov al,[SPC7110RTC+ebx];.next    pop ebx    inc byte[SPC7110RTCStat+1]    and byte[SPC7110RTCStat+1],0Fh    ret.commandbyte    inc byte[SPC7110RTCStat+1]    mov al,[SPC7110RTCStat+2]    retSECTION .dataSPCTimerVal: db 12h,01h,02h,03h,04h,05h,06h,07h,08h,09h,0,0,0,0,0,0 db 10h,11h,32h,21h,22h,23h,24h,25h,26h,27h,0,0,0,0,0,0 db 28h,29hSECTION .textSPC4842:    mov al,80h    retSPC4850:    mov al,[SPC7110RTC]    retSPC4851:    mov al,[SPC7110RTC+01h]    retSPC4852:    mov al,[SPC7110RTC+02h]    retSPC4853:    mov al,[SPC7110RTC+03h]    retSPC4854:    mov al,[SPC7110RTC+04h]    retSPC4855:    mov al,[SPC7110RTC+05h]    retSPC4856:    mov al,[SPC7110RTC+06h]    retSPC4857:    mov al,[SPC7110RTC+07h]    retSPC4858:    mov al,[SPC7110RTC+08h]    retSPC4859:    mov al,[SPC7110RTC+09h]    retSPC485A:    mov al,[SPC7110RTC+0Ah]    retSPC485B:    mov al,[SPC7110RTC+0Bh]    retSPC485C:    mov al,[SPC7110RTC+0Ch]    retSPC485D:    mov al,[SPC7110RTC+0Dh]    retSPC485E:    mov al,[SPC7110RTC+0Eh]    retSPC485F:    mov al,[SPC7110RTC+0Fh]    ret;$4820   16 BIT MULTIPLICAND: ($00FF) low byte, defval:00;        32 BIT DIVI: ($000000FF) low byte of low word, defval:00;$4821   16 BIT MULTIPLICAND: ($FF00) high byte, defval:00;        32 BIT DIVI: ($0000FF00) high byte of low word, defval:00;$4822   32 BIT DIVI: ($00FF0000) low byte of high word, defval:00;$4823   32 BIT DIVI: ($FF000000) high byte of high word, defval:00;$4824   16 BIT MULTIPLIER: ($00FF) low byte, defval:00;$4825   16 BIT MULTIPLIER: ($FF00) high byte, defval:00;$4826   16 BIT DIVISOR: ($00FF), defval:00;$4827   16 BIT DIVISOR: ($FF00), defval:00;$4828   32 BIT PRODUCT: ($000000FF) low byte of low word, defval:00;        32 BIT QUOTIENT:($000000FF) low byte of low word, defval:00;$4829   32 BIT PRODUCT: ($0000FF00) high byte of low word, defval:00;        32 BIT QUOTIENT:($0000FF00) high byte of low word, defval:00;$482A   32 BIT PRODUCT: ($00FF0000) low byte of high word, defval:00;        32 BIT QUOTIENT:($00FF0000) low byte of high word, defval:00;$482B   32 BIT PRODUCT: ($FF000000) high byte of high word, defval:00;        32 BIT QUOTIENT:($FF000000) high byte of high word, defval:00;$482C   16 BIT REMAINDER: ($00FF) low byte, defval:00;$482D   16 BIT REMAINDER: ($FF00) high byte, defval:00;$482E   MUL/DIV RESET, write = reset $4820 to $482D, defval:00;$482F   MUL/DIV FINISHED STATUS: bit 7: on = processing, off = finished,;            high bit is set after a write to multiplier or divisor regs $4825/$4827, defval:00;SPC7110 Sram Map;$006000 - $007FFF sram 8k (slow rom?);$306000 - $307FFF mirrored sram from $006000 - $007FFF (fast rom?)%macro SRAMAccessSPC7110 1    test ecx,8000h    jnz memaccessbank%1    cmp ecx,6000h    jb regaccessbank%1    push ecx    sub ecx,6000h    shl ebx,13    add ecx,ebx    and ecx,0FFFFh    call sramaccessbank%1b    pop ecx%endmacroNEWSYM SPC7110ReadSRAM8b    SRAMAccessSPC7110 r8    retNEWSYM SPC7110ReadSRAM16b    SRAMAccessSPC7110 r16    retNEWSYM SPC7110WriteSRAM8b    SRAMAccessSPC7110 w8    retNEWSYM SPC7110WriteSRAM16b    SRAMAccessSPC7110 w16    ret;data decompressed from data rom by spc7110 mapped to $50:0000-$50:FFFFNEWSYM memaccessspc7110r8    push ebx    movzx ebx,word[SPCDecmPtr]    add ebx,[SPC7110PackPtr]    mov al,[ebx]    pop ebx    dec word[SPCCompCounter]    inc word[SPCDecmPtr]    inc word[CurDecompSize]    retNEWSYM memaccessspc7110r16    mov ebx,[SPC7110PackPtr]    mov ax,[ebx+ecx]    cmp cx,[CurDecompPtr]    jb .noptr    mov [CurDecompPtr],cx    mov bx,cx    sub bx,[PrevDecompPtr]    add bx,2    mov [CurDecompSize],bx.noptr    xor ebx,ebx    retNEWSYM memaccessspc7110w8    mov ebx,[SPC7110PackPtr]    mov [ebx+ecx],al    xor ebx,ebx    retNEWSYM memaccessspc7110w16    mov ebx,[SPC7110PackPtr]    mov [ebx+ecx],ax    xor ebx,ebx    ret

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -