📄 regs.inc
字号:
NEWSYM nexthprior, db 0NEWSYM doirqnext, db 0NEWSYM vramincby8var, dw 0NEWSYM screstype, db 0NEWSYM extlatch, db 0NEWSYM cfield, db 0NEWSYM interlval, db 0NEWSYM HIRQLoc, dw 0 ; HIRQ X locationNEWSYM KeyOnStA, db 0NEWSYM KeyOnStB, db 0NEWSYM SDD1BankA, db 0NEWSYM SDD1BankB, db 1NEWSYM SDD1BankC, db 2NEWSYM SDD1BankD, db 3NEWSYM vramread2, db 0 ; previous character for vram readNEWSYM nosprincr, db 0NEWSYM poamaddrs, dw 0NEWSYM ioportval, db 255NEWSYM iohvlatch, db 0NEWSYM ppustatus, db 0NEWSYM hdmastartsc, db 0NEWSYM hdmarestart, db 0NEWSYM hdmadelay, db 0NEWSYM nohdmaframe, db 0 ; no hdma for current frameNEWSYM tempdat, times 474 db 0 ; expandable areanum2writeppureg equ $-sndrot; pharos equ hack *sigh*NEWSYM PHnum2writeppureg, dd num2writeppuregNEWSYM scrndis, db 0 ; which background is disabledALIGN32NEWSYM oamaddr, dd 0 ; oam addressNEWSYM bg1ptrx, dd 0 ; pointer to background1NEWSYM bg2ptrx, dd 0 ; pointer to background2NEWSYM bg3ptrx, dd 0 ; pointer to background3NEWSYM bg4ptrx, dd 0 ; pointer to background4NEWSYM bg1ptry, dd 0 ; pointer to background1NEWSYM bg2ptry, dd 0 ; pointer to background2NEWSYM bg3ptry, dd 0 ; pointer to background3NEWSYM bg4ptry, dd 0 ; pointer to background4NEWSYM Voice0Disable, db 1 ; Disable Voice 0NEWSYM Voice1Disable, db 1 ; Disable Voice 1NEWSYM Voice2Disable, db 1 ; Disable Voice 2NEWSYM Voice3Disable, db 1 ; Disable Voice 3NEWSYM Voice4Disable, db 1 ; Disable Voice 4NEWSYM Voice5Disable, db 1 ; Disable Voice 5NEWSYM Voice6Disable, db 1 ; Disable Voice 6NEWSYM Voice7Disable, db 1 ; Disable Voice 7NEWSYM BG116x16t, db 0NEWSYM BG216x16t, db 0NEWSYM BG316x16t, db 0NEWSYM BG416x16t, db 0NEWSYM SPC700read, dd 0NEWSYM SPC700write, dd 0NEWSYM JoyCRead, db 0NEWSYM nssdip1, db 0NEWSYM nssdip2, db 0NEWSYM nssdip3, db 0NEWSYM nssdip4, db 0NEWSYM nssdip5, db 0NEWSYM nssdip6, db 0SECTION .textNEWSYM ClearRegs mov word[VIRQLoc],0 mov word[bg1ptr],0 mov word[bg2ptr],0 mov word[bg3ptr],0 mov word[bg4ptr],0 mov word[bg1ptrb],0 mov word[bg2ptrb],0 mov word[bg3ptrb],0 mov word[bg4ptrb],0 mov word[bg1ptrc],0 mov word[bg2ptrc],0 mov word[bg3ptrc],0 mov word[bg4ptrc],0 mov word[bg1ptrd],0 mov word[bg2ptrd],0 mov word[bg3ptrd],0 mov word[bg4ptrd],0 mov word[bg1objptr],0 mov word[bg2objptr],0 mov word[bg3objptr],0 mov word[bg4objptr],0 mov byte[ioportval],0FFh mov byte[hdmastartsc],0 mov byte[hdmarestart],0 mov byte[nohdmaframe],0 mov byte[hdmadelay],0 retreg2100r: ;Should be Openbus mov al,[vidbright] or al,[forceblnk] ret; Multiply Result Lowreg2134r: checkmultchange mov al,[compmult] ret; Multiply Result Middlereg2135r: checkmultchange mov al,[compmult+1] ret; Multiply Result Highreg2136r: checkmultchange mov al,[compmult+2] ret; Software latch for horizontal/vertical counterreg2137r:; mov byte[debstop3],1%ifndef NO_DEBUGGER cmp byte[debuggeron],1 je .debugger%endif cmp byte[iohvlatch],1 je .dolatch test byte[ioportval],80h jz .nolatch.dolatch xor ebx,ebx mov bl,[cycpl] sub bl,dh add bx,bx mov [latchx],bx mov bx,[curypos] mov [latchy],bx mov bl,[INTEnab] and bl,30h cmp bl,30h jne .novhirq cmp word[HIRQLoc],0F0h ja .incry cmp dh,30 jae .noincly.incry inc word[latchy].novhirq.noincly.nolatch xor al,al mov byte[extlatch],0 ret.debuggerdebblah: cmp byte[iohvlatch],1 je .dolatch2 test byte[ioportval],80h jz near .nolatch2.dolatch2 xor ebx,ebx mov bl,[cycpl] sub bl,[pdh] add bx,bx mov [latchx],bx mov bx,[curypos] mov [latchy],bx mov bl,[INTEnab] and bl,30h cmp bl,30h jne .novhirq cmp word[HIRQLoc],0F0h; ja .incry cmp word[latchx],80; jb .noincly.incry inc word[latchy].novhirq.noincly xor al,al mov byte[extlatch],0 ret push eax push edx xor eax,eax xor ebx,ebx mov al,[cycpl] sub al,[pdh] mov bx,339 mul bx xor ebx,ebx mov bl,[cycpl] div bx mov [latchx],ax pop edx pop eax mov bx,[curypos] mov [latchy],bx mov bl,[INTEnab] and bl,30h cmp bl,30h jne .novhirq2 cmp word[HIRQLoc],0F0h ja .incry2 cmp word[latchx],80 jb .noincly2.incry2 inc word[latchy].novhirq2.noincly2.nolatch2 xor al,al mov byte[extlatch],0 ret; Read OAM Data (Low, High)reg2138r: xor ebx,ebx mov bx,[oamaddr] add ebx,oamram mov al,[ebx] inc word[oamaddr] cmp word[oamaddr],543 ja .wrapoam ret.wrapoam mov word[oamaddr],0 ret; Read VRAM Data (Low)reg2139r: mov al,[vramread] xor ebx,ebx mov bx,[vramaddr] add ebx,[vram] mov bl,[ebx] mov [vramread],bl cmp byte[vramincr],0 je near .noincr mov bx,[addrincr] add [vramaddr],bx cmp byte[vramincby8on],1 jne .noincr dec byte[vramincby8left] jnz .noincr add word[vramaddr],2 mov bl,[vramincby8totl] mov [vramincby8left],bl dec byte[vramincby8rowl] jz .nextrow mov bx,[vramincby8ptri] sub [vramaddr],bx jmp .noincr.nextrow mov byte[vramincby8rowl],8 sub word[vramaddr],16.noincr ret; Read VRAM Data (High)reg213Ar: mov al,[vramread2] xor ebx,ebx mov bx,[vramaddr] add ebx,[vram] mov bl,[ebx+1] mov [vramread2],bl cmp byte[vramincr],1 je near .noincr mov bx,[addrincr] add [vramaddr],bx cmp byte[vramincby8on],1 jne .noincr dec byte[vramincby8left] jnz .noincr add word[vramaddr],2 mov bl,[vramincby8totl] mov [vramincby8left],bl dec byte[vramincby8rowl] jz .nextrow mov bx,[vramincby8ptri] sub [vramaddr],bx jmp .noincr.nextrow mov byte[vramincby8rowl],8 sub word[vramaddr],16.noincr ret; Read CGRAM Datareg213Br: xor ebx,ebx mov bx,[cgaddr] mov al,[cgram+ebx] inc word[cgaddr] and word[cgaddr],01FFh ret; H counter data by external or software latchreg213Cr: cmp byte[latchxr],1 je .highv mov al,[latchx] mov byte[latchxr],1 ret.highv mov al,[latchx] and al,0FEh or al,byte[latchx+1] mov byte[latchxr],0 ret; V counter data by external or software latchreg213Dr: cmp byte[latchyr],1 je .highv mov al,[latchy] mov byte[latchyr],1 ret.highv mov al,[latchy] and al,0FEh or al,byte[latchy+1] mov byte[latchyr],0 ret; PPU Status Flag & Version number (OBJ over flags)reg213Er: mov al,01h ret; PPU Status Flag & Version number (NTSC/PAL/EXTRN Latch flag)reg213Fr:; mov byte[debstop3],1 mov al,[romispal] shl al,4 or al,[ppustatus] or al,[cfield] mov byte[latchxr],0 mov byte[latchyr],0 or al,[extlatch] ret; Sound Reg #1reg2140r: cmp byte[spcon],0 je .nosound inc dword[SPC700read] mov al,[reg1read] mov byte[spcnumread],0 ret.nosound ; Find for D0 mov ebx,esi cmp word[ebx],0FB10h jne .noret mov word[ebx],0EAEAh.noret mov al,5.tryagain cmp byte[ebx],0D0h je .foundit inc ebx dec al jnz .tryagain jmp .notfound.foundit mov byte[ebx],0EAh mov byte[ebx+1],0EAh.notfound inc byte[sndrot2] cmp byte[sndrot2],3 jne .a mov byte[sndrot2],0.a xor al,al test byte[sndrot2],01h jz .n mov al,[xa].n ret; Sound Reg #2reg2141r: cmp byte[spcon],0 je .nosound inc dword[SPC700read] mov al,[reg2read] mov byte[spcnumread],0 ret.nosound ; Find for D0 mov ebx,esi mov al,3.tryagain cmp byte[ebx],0D0h je .foundit inc ebx dec al jnz .tryagain jmp .notfound.foundit
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -