Re-write of 2bit Character Conversion mode 1.

This commit is contained in:
zsknight
2001-05-25 08:55:41 +00:00
parent a11acec10e
commit bce41a6f39

View File

@@ -189,7 +189,7 @@ RTC2800:
ret ret
RTC2801w: RTC2801w:
mov byte[debstop3],1 ; mov byte[debstop3],1
mov dword[RTCRest],0 mov dword[RTCRest],0
mov dword[RTCPtr],0 mov dword[RTCPtr],0
cmp al,0Eh cmp al,0Eh
@@ -628,7 +628,7 @@ SPC4806w:
mov [SPCDecmPtr+1],al mov [SPCDecmPtr+1],al
cmp dword[SPCCompPtr],0124AD48h cmp dword[SPCCompPtr],0124AD48h
jne .nodata jne .nodata
mov byte[debstop3],1 ; mov byte[debstop3],1
.nodata .nodata
pushad pushad
@@ -1453,6 +1453,10 @@ SPC4842:
;$482F MUL/DIV FINISHED STATUS: bit 7: on = processing, off = finished, ;$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 ; high bit is set after a write to multiplier or divisor regs $4825/$4827, defval:00
; SA-1 Start
; ----------
ALIGN32 ALIGN32
; IRQ Stuff ; IRQ Stuff
@@ -1489,8 +1493,13 @@ NEWSYM SA1IRQTemp, dd 0
NEWSYM SA1BankSw, dd 1 NEWSYM SA1BankSw, dd 1
NEWSYM SA1BankVal, db 0,1,2,3 NEWSYM SA1BankVal, db 0,1,2,3
NEWSYM BWShift, dd 0
NEWSYM BWAndAddr, dd 0
NEWSYM BWAnd, dd 0
NEWSYM BWRAnd, dd 0
SA1Reserved times 472 db 0 SA1Reserved times 460 db 0
; SA1 Swap Stuff ; SA1 Swap Stuff
NEWSYM SA1xa, dd 0 NEWSYM SA1xa, dd 0
@@ -1616,7 +1625,7 @@ NEWSYM SA1Reset
mov dword[SA1IRQExec],0 mov dword[SA1IRQExec],0
mov dword[SA1IRQEnable],0 mov dword[SA1IRQEnable],0
mov dword[SA1Message],0 mov dword[SA1Message],0
mov byte[SA1Overflow],0 mov word[SA1Overflow],0
ret ret
NEWSYM UpdateBanks NEWSYM UpdateBanks
@@ -1865,6 +1874,10 @@ NEWSYM sa12224w ; BWRAM
.nosnes .nosnes
ret ret
NEWSYM sa12225w ; BWRAM NEWSYM sa12225w ; BWRAM
EXTSYM BWUsed2
mov [BWUsed2],al
test al,80h
jnz .upper
mov bl,al mov bl,al
and ebx,1Fh and ebx,1Fh
shl ebx,13 shl ebx,13
@@ -1872,9 +1885,41 @@ NEWSYM sa12225w ; BWRAM
add ebx,1024*4096-6000h add ebx,1024*4096-6000h
mov dword[SA1BWPtr],ebx mov dword[SA1BWPtr],ebx
cmp byte[SA1Status],0 cmp byte[SA1Status],0
je .nosa1b
mov dword[CurBWPtr],ebx
.nosa1b
mov byte[BWShift],0
mov byte[BWAndAddr],0
mov byte[BWAnd],0FFh
mov byte[BWRAnd],0h
ret
.upper
mov bl,al
and ebx,7Fh
test byte[SA1Overflow+1],80h
jz .16col
shl ebx,11
mov byte[BWShift],2
mov byte[BWAndAddr],03h
mov byte[BWAnd],03h
mov byte[BWRAnd],0FCh
jmp .4col
.16col
mov byte[BWShift],1
mov byte[BWAndAddr],01h
mov byte[BWAnd],0Fh
mov byte[BWRAnd],0F0h
and ebx,3Fh
shl ebx,12
.4col
add ebx,[romdata]
add ebx,1024*4096
mov dword[SA1BWPtr],ebx
cmp byte[SA1Status],0
je .nosa1 je .nosa1
mov dword[CurBWPtr],ebx mov dword[CurBWPtr],ebx
.nosa1 .nosa1
mov byte[debstop3],1
ret ret
NEWSYM sa12250w NEWSYM sa12250w
mov byte[SA1ARC],al mov byte[SA1ARC],al
@@ -2297,11 +2342,22 @@ executesa1dma:
pop edx pop edx
ret ret
tempblah db 0
%macro setbit2b 2
test al,%1
jz %%nosb
or word[ebx],%2
%%nosb
%endmacro
; Character Conversion DMA ; Character Conversion DMA
sa1chconv: sa1chconv:
; or byte[SA1DoIRQ],4 ; or byte[SA1DoIRQ],4
or byte[SA1DoIRQ],8 or byte[SA1DoIRQ],8
ret ; mov byte[debstop3],1
mov ebx,[SA1DMADest] mov ebx,[SA1DMADest]
mov byte[debstop4],1 mov byte[debstop4],1
@@ -2329,110 +2385,73 @@ sa1chconv:
push ecx push ecx
pop ecx pop ecx
ret ret
.2bit .2bit
push ecx pushad
mov ecx,8
mov ebx,[sa1dmaptr]
push edx
mov edx,[sa1dmaptrs] mov edx,[sa1dmaptrs]
; sub ebx,1000h mov ebx,[romdata]
jmp .skipall add ebx,4096*1024+1024*1024
mov ecx,1000h mov edi,16
.loops .loop3
and edx,07FFh push ebx
mov al,[ebx] push edx
mov [IRAM+edx],al mov ecx,32
inc ebx .loop
inc edx mov esi,8
loop .loops push ebx
pop edx push edx
pop ecx .loop2
ret mov word[ebx],0
.skipall mov al,[edx+1]
jmp .conv setbit2b 40h,0001h
; repeat for 320 tiles setbit2b 80h,0100h
mov ecx,320 setbit2b 10h,0002h
.chl2 setbit2b 20h,0200h
mov al,[ebx] setbit2b 04h,0004h
mov dword[.numrows],16 setbit2b 08h,0400h
.chl setbit2b 01h,0008h
mov [edx],al setbit2b 02h,0800h
inc edx mov al,[edx]
dec dword[.numrows] setbit2b 40h,0010h
jne .chl setbit2b 80h,1000h
inc ebx setbit2b 10h,0020h
dec ecx setbit2b 20h,2000h
jnz .chl2 setbit2b 04h,0040h
pop edx setbit2b 08h,4000h
pop ecx setbit2b 01h,0080h
ret setbit2b 02h,8000h
; Convert 10 rows into bitplane from ebx to edx add ebx,2
.conv add edx,64
mov dword[.numrows],10 dec esi
.cloop3 jnz near .loop2
mov ch,32 pop edx
.cloop pop ebx
mov cl,8 add edx,2
.cloop2 add ebx,16
mov ax,[ebx] dec ecx
add ax,ax jnz near .loop
rcl byte[edx+8],1 pop edx
add ax,ax pop ebx
rcl byte[edx],1 add edx,64*8
add ax,ax add ebx,64*8
rcl byte[edx+8],1 dec edi
add ax,ax jnz near .loop3
rcl byte[edx],1
add ax,ax mov ecx,10*64*8
rcl byte[edx+8],1 mov edx,[sa1dmaptrs]
add ax,ax mov ebx,[romdata]
rcl byte[edx],1 add ebx,4096*1024+1024*1024
add ax,ax .next
rcl byte[edx+8],1 mov al,[ebx]
add ax,ax mov [edx],al
rcl byte[edx],1 inc ebx
add ax,ax inc edx
rcl byte[edx+8],1 loop .next
add ax,ax
rcl byte[edx],1 popad
add ax,ax
rcl byte[edx+8],1
add ax,ax
rcl byte[edx],1
add ax,ax
rcl byte[edx+8],1
add ax,ax
rcl byte[edx],1
add ax,ax
rcl byte[edx+8],1
add ax,ax
rcl byte[edx],1
add ebx,64
inc edx
dec cl
jnz near .cloop2
add edx,8
sub ebx,64*8-2
dec ch
jnz near .cloop
sub ebx,2*32
add ebx,8*64
dec dword[.numrows]
jnz near .cloop3
pop edx
pop ecx
mov ebx,[sa1dmaptr]
push ecx
mov ecx,32
.loop
; mov dword[IRAM+ebx],0FFFFFFFFh
add ebx,4
loop .loop
pop ecx
ret ret
.numrows dd 0 .numrows dd 0
NEWSYM initSA1regs NEWSYM initSA1regs
setreg 2300h*4,sa12300r setreg 2300h*4,sa12300r
setreg 2301h*4,sa12301r setreg 2301h*4,sa12301r
@@ -2492,6 +2511,8 @@ NEWSYM initSA1regsw
setregw 2224h*4,sa12224w setregw 2224h*4,sa12224w
setregw 2225h*4,sa12225w setregw 2225h*4,sa12225w
; Missing 2226-222A
; Missing 2240-224F (Bitmap register file)
setregw 2230h*4,sa12230w setregw 2230h*4,sa12230w
setregw 2231h*4,sa12231w setregw 2231h*4,sa12231w
@@ -2552,7 +2573,7 @@ NEWSYM initSDD1regs
ret ret
dbstop: dbstop:
mov byte[debstop3],1 ; mov byte[debstop3],1
ret ret
NEWSYM sdd14801w NEWSYM sdd14801w