Skip to content

Commit

Permalink
[NES] Set shift count to zero if RAM size is zero.
Browse files Browse the repository at this point in the history
Zero needs to be special cased, since the equation that computes the
shift count for a given size doesn't work with zero.

Fixes #98.
  • Loading branch information
mysterymath committed Dec 23, 2022
1 parent beb2b9a commit da558fc
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions mos-platform/nes/ines-header.ld
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,21 @@ BYTE(
)

BYTE(
((__prg_ram_size_raw ? __prg_ram_size_raw :
LOG2CEIL(__prg_ram_size*1024)-6) & 0xf) << 0 |
((__prg_nvram_size_raw ? __prg_nvram_size_raw :
LOG2CEIL(__prg_nvram_size*1024)-6) & 0xf) << 4
((__prg_ram_size_raw ?
__prg_ram_size_raw :
__prg_ram_size ? LOG2CEIL(__prg_ram_size*1024)-6 : 0) & 0xf) << 0 |
((__prg_nvram_size_raw ?
__prg_nvram_size_raw :
__prg_nvram_size ? LOG2CEIL(__prg_nvram_size*1024)-6 : 0) & 0xf) << 4
)

BYTE(
((__chr_ram_size_raw ? __chr_ram_size_raw :
LOG2CEIL(__chr_ram_size*1024)-6) & 0xf) << 0 |
((__chr_nvram_size_raw ? __chr_nvram_size_raw :
LOG2CEIL(__chr_nvram_size*1024)-6) & 0xf) << 4
((__chr_ram_size_raw ?
__chr_ram_size_raw :
__chr_ram_size ? LOG2CEIL(__chr_ram_size*1024)-6 : 0) & 0xf) << 0 |
((__chr_nvram_size_raw ?
__chr_nvram_size_raw :
__chr_nvram_size ? LOG2CEIL(__chr_nvram_size*1024)-6 : 0) & 0xf) << 4
)

BYTE(__timing & 3)
Expand Down

0 comments on commit da558fc

Please sign in to comment.