BIOSF UPLOAD: Difference between revisions

From NeoGeo Development Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
== BIOSF_UPLOAD ($C00546): Upload data to [[DRAM]] ==
The BIOSF_UPLOAD ($C00546) call copies data to the NeoGeo CD [[DRAM]].


{{BR|BIOS_UPSRC}} (32bit): Source (Long)
The parameters are:


{{BR|BIOS_UPDEST}} (32bit): Destination (Long)
*{{BR|BIOS_UPSRC}} (longword): Data source address
*{{BR|BIOS_UPDEST}} (longword): Data destination address
*{{BR|BIOS_UPSIZE}} (longword): Data size
*{{BR|BIOS_UPZONE}} (byte): Zone/method, see below
*{{BR|BIOS_UPBANK}} (byte): DRAM bank


{{BR|BIOS_UPSIZE}} (32bit): Size (Long)
When the call returns, BIOS_UPDEST points to the end of the copied data, allowing multiple consecutive uploads without setting the destination address again.


{{BR|BIOS_UPZONE}} (8bit):  Zone (Byte, 0=PRG, 1=FIX, 2=SPR, 3=Z80, 4=PCM, 5=PAT)
=Banks=


{{BR|BIOS_UPBANK}} (8bit):  Bank (Byte)
Some DRAM zones have banks: SPR has 4 banks (each 1MiB), PCM has 2 banks (each 512KiB).


For FIX, Z80 (, PAT ?) and PCM upload, the destination (and size ?) has to be multiplied by 2 (8bit busses).
=Zones/methods=
The SPR bank size is 1MiB (4 banks), PCM bank size is 512KiB (4 banks). The other zones aren't banked.


BIOS_UPDEST (and BIOS_UPSRC ?) is incremented by the size upon completion, which allows to do multiple consecutive uploads.
==$00: Copy PRG words (DMA)==
Loads word copy DMA microcode.


==Steps==
==$01: Copy Fix graphics bytes (DMA)==
*$FF0004.w and $10FD80 are pushed
Loads byte copy DMA microcode. Dest = Dest + Size * 2.
*$FF0004.w = 1
*$10FD80=0, system mode
*Mapping
*$FF016F.b=1 disable interrupts ?
*Copy
*Watchdog kicked
*$FF016F.b=0 enable interrupts ?
*Unmapping
*Restore $10FD80.w and $FF0004.w


==Modes==
==$02: Copy Sprite graphics words (DMA)==
Loads word copy DMA microcode. Copies over 1MiB are possible, the bank is incremented automatically.


*BIOS_UPZONE=0: Upload PRG DMA words
==$03: Copy Z80 program bytes (DMA)==
**Load word copy microcode
Loads byte copy DMA microcode.
**Dest=size+dest
**LoadMicrocodeA0
**DoDMAWordCopyBypass


*BIOS_UPZONE=1: Upload Fix DMA bytes
The destination address must be multiplied by 2 (8bit bus) ? Size doesn't have to be multiplied, but has to be an even number ?
**$FF0129.b=0, $FF0105.b=5 (FIX set, upload type)
**Load byte copy microcode
**DoDMAWordCopy
**Dest=Dest+(size*2)
**$FF0149.b=0 FIX unset


*BIOS_UPZONE=2: Upload Srites DMA words
==$04: Copy PCM bytes (CPU)==
**$FF0121.b=0, $FF0105.b=0, $FF01A1.b=UploadBank (SPR set, upload type)
Loads byte copy DMA microcode.
**Load word copy microcode
**Upload (>1MiB possible, bank is autoincremented)
**DoDMAWordCopy
**$FF0141.b=0 SPR unset


*BIOS_UPZONE=3: Upload Z80 DMA bytes
The destination address must be multiplied by 2 (8bit bus). Size doesn't have to be multiplied, but has to be an even number. Copies over 1MiB are possible, the bank is incremented automatically.
**$FF0127.b=0, $FF0105.b=4  (Z80 set, upload type)
**Load byte copy microcode
**DoByteCopy
**Dest=Dest+(size*2)
**$FF0147.b=0 Z80 unset


*BIOS_UPZONE=4: Upload PCM DMA bytes
==$05: Install [[PAT file]]==
**$FF0123.b=0, $FF0105.b=1, $FF01A3.b=UploadBank (PCM set, upload type)
Notes:
**Load byte copy microcode
*10F736.l=((Bank*$10000)+Dest)/256
**Upload (>1MiB possible, bank is autoincremented)
*10F736+Address/2
**DoByteCopy
**$FF0143.b=0 PCM unset


*BIOS_UPZONE=5: Install PAT
==$06: Copy palette words (DMA)==
**$FF0127.b=0, Z80 set
Loads word copy DMA microcode.
**$FF0105.b=4, upload type
**10F736.l=((Bank*$10000)+Dest)/256
**10F736+Address/2
**See [[PAT file]] for data format


*BIOS_UPZONE=6: Upload palette words
==$07: Copy compressed sprite graphics (CPU)==
**Load word copy microcode
The first longword's value indicates the size of the '''compressed''' data, BIOS_UPSIZE isn't used.
**move.l #$00400000,d0 ;0BEC6: 203C00400000
When a longword zero is copied, the following longword indicates how many zero longwords to insert.
**bsr DoDMAWordCopyBypass    ;0BECC: 61000018
**Dest=size+dest


*BIOS_UPZONE=7: Upload sprites loop longwords (?)
This method allows compression of large transparent zones. Is it ever used by games ?
**$FF0121.b=0, $FF0105.b=0, $FF01A1.b=UploadBank (SPR set, upload type)
**A1=Dest+$E00000
**Size.l=(Src.l)
**Size=0 ? Yes: Dest=A1-$E00000
**Copy src to dest
**...weird longword copy in a loop to upload zone
**$FF0141.b=0 SPR unset


*BIOS_UPZONE=8: Upload PRG DMA
==$08: Copy PRG words (DMA)==
**Same as 0
Same as method $00.


*BIOS_UPZONE=10: Upload PRG loop longwords
==$10: Copy PRG longwords (CPU)==
**Load word copy microcode
Size must be a multiple of 4.
**$FF0004.w=$31
**DoLongwordCopyBypass
**$FF0004.w=$0331
**Dest=Dest+Size


*BIOS_UPZONE=11: Upload FIX loop words
==$11: Copy Fix graphics words (CPU)==
**$FF0129.b=0, $FF0105.b=5 (FIX set, upload type)
The destination address must be multiplied by 2 (8bit bus). Size doesn't have to be multiplied, but has to be an even number.
**DoWordToByteCopy
**Dest=Dest+(size*2)
**$FF0149.b=0 FIX unset


*BIOS_UPZONE=12: Upload Sprites loop longwords
==$12: Copy Sprite graphics longwords (CPU)==
**$FF0121.b=0, $FF0105.b=0, $FF01A1.b=UploadBank (SPR set, upload type)
Size must be a multiple of 4.
**bsr DoLongwordCopy ;0BC48: 610002BC
**Dest=Dest+Size
**$FF0141.b=0 SPR unset


*BIOS_UPZONE=13: Upload Z80 loop bytes
==$13: Copy Z80 program bytes (CPU)==
**$FF0127.b=0, $FF0105.b=4  (Z80 set, upload type)
The destination address must be multiplied by 2 (8bit bus). Size doesn't have to be multiplied, but has to be an even number.
**bsr DoByteCopy ;0BCF8: 61000250
**Dest=Dest+(size*2)
**$FF0147.b=0 Z80 unset


*BIOS_UPZONE=14: Upload PCM loop bytes
==$14: Copy PCM bytes (CPU)==
**$FF0123.b=0, $FF0105.b=1, $FF01A3.b=UploadBank (PCM set, upload type)
The destination address must be multiplied by 2 (8bit bus). Size doesn't have to be multiplied, but has to be an even number. Copies over 1MiB are possible, the bank is incremented automatically.
**DoByteCopy ;0BCCC: 6100027C
**Dest=Dest+(size*2)
**Auto bank++
**$FF0143.b=0 PCM unset


*BIOS_UPZONE=15: Install PAT
Difference with $04 ?
**Same as 5


*BIOS_UPZONE=16: Upload palette longwords
==$15: Install PAT file==
**Load word copy microcode
Same as method $05.
**move.l #$00400000,d0 ;0BD42: 203C00400000
**bsr DoLongwordCopyBypass ;0BD48: 610001C2
**Dest=Dest+Size


*BIOS_UPZONE=17: Upload sprites loop longwords (?)
==$16: Copy palette longwords (CPU)==
**$FF0121.b=0, $FF0105.b=0, $FF01A1.b=UploadBank (SPR set, upload type)
Size must be a multiple of 4.
**Similar to 7, longword copy in a loop to upload zone
**$FF0141.b=0 SPR unset


*BIOS_UPZONE=18
==$17: Copy compressed sprite graphics (CPU)==
**Same as 10
Same as method $07.
 
==$18: Copy PRG longwords (CPU)==
Same as method $10.


[[Category:BIOS calls]]
[[Category:BIOS calls]]

Latest revision as of 20:15, 15 May 2024

The BIOSF_UPLOAD ($C00546) call copies data to the NeoGeo CD DRAM.

The parameters are:

BIOS_UPSRC ($10FEF8 ) (longword): Data source address

BIOS_UPDEST ($10FEF4 ) (longword): Data destination address

BIOS_UPSIZE ($10FEFC ) (longword): Data size

BIOS_UPZONE ($10FEDA ) (byte): Zone/method, see below

BIOS_UPBANK ($10FEDB ) (byte): DRAM bank

When the call returns, BIOS_UPDEST points to the end of the copied data, allowing multiple consecutive uploads without setting the destination address again.

Banks

Some DRAM zones have banks: SPR has 4 banks (each 1MiB), PCM has 2 banks (each 512KiB).

Zones/methods

$00: Copy PRG words (DMA)

Loads word copy DMA microcode.

$01: Copy Fix graphics bytes (DMA)

Loads byte copy DMA microcode. Dest = Dest + Size * 2.

$02: Copy Sprite graphics words (DMA)

Loads word copy DMA microcode. Copies over 1MiB are possible, the bank is incremented automatically.

$03: Copy Z80 program bytes (DMA)

Loads byte copy DMA microcode.

The destination address must be multiplied by 2 (8bit bus) ? Size doesn't have to be multiplied, but has to be an even number ?

$04: Copy PCM bytes (CPU)

Loads byte copy DMA microcode.

The destination address must be multiplied by 2 (8bit bus). Size doesn't have to be multiplied, but has to be an even number. Copies over 1MiB are possible, the bank is incremented automatically.

$05: Install PAT file

Notes:

  • 10F736.l=((Bank*$10000)+Dest)/256
  • 10F736+Address/2

$06: Copy palette words (DMA)

Loads word copy DMA microcode.

$07: Copy compressed sprite graphics (CPU)

The first longword's value indicates the size of the compressed data, BIOS_UPSIZE isn't used. When a longword zero is copied, the following longword indicates how many zero longwords to insert.

This method allows compression of large transparent zones. Is it ever used by games ?

$08: Copy PRG words (DMA)

Same as method $00.

$10: Copy PRG longwords (CPU)

Size must be a multiple of 4.

$11: Copy Fix graphics words (CPU)

The destination address must be multiplied by 2 (8bit bus). Size doesn't have to be multiplied, but has to be an even number.

$12: Copy Sprite graphics longwords (CPU)

Size must be a multiple of 4.

$13: Copy Z80 program bytes (CPU)

The destination address must be multiplied by 2 (8bit bus). Size doesn't have to be multiplied, but has to be an even number.

$14: Copy PCM bytes (CPU)

The destination address must be multiplied by 2 (8bit bus). Size doesn't have to be multiplied, but has to be an even number. Copies over 1MiB are possible, the bank is incremented automatically.

Difference with $04 ?

$15: Install PAT file

Same as method $05.

$16: Copy palette longwords (CPU)

Size must be a multiple of 4.

$17: Copy compressed sprite graphics (CPU)

Same as method $07.

$18: Copy PRG longwords (CPU)

Same as method $10.