Skip to content

Commit

Permalink
fixed sprite at 0 thing, messily
Browse files Browse the repository at this point in the history
  • Loading branch information
aappleby committed May 28, 2019
1 parent ecba9c4 commit 0049bba
Show file tree
Hide file tree
Showing 25 changed files with 613 additions and 110 deletions.
6 changes: 3 additions & 3 deletions MetroBoy.vcxproj
Expand Up @@ -15,18 +15,18 @@
<ProjectGuid>{69BF9C9C-30CB-4225-9D65-F1990A7C7E4F}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>MetroBoy</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down
1 change: 0 additions & 1 deletion codegen/ppu_sprite0_scx0_a.s
@@ -1,4 +1,3 @@

.gbheader
name "microtest"
nintendologo
Expand Down
17 changes: 12 additions & 5 deletions microtests/header.inc
Expand Up @@ -276,12 +276,9 @@
cp expected
jr z, +
ld a, $FF
- ld (VRAM), a
jr -

test_end
+ ld a, $55
- ld (VRAM), a
jr -
test_end
.endm

.macro test_finish_b ARGS expected
Expand Down Expand Up @@ -311,6 +308,16 @@
test_finish_a expected
.endm

.macro assert_stat ARGS expected
ldh a, (STAT)
cp expected
jr z, +
ld a, $FF
- ld (VRAM), a
jr -
+ nop
.endm

;-------------------------------------------------------------------------------

.define VBLANK_INT_VECTOR $40
Expand Down
20 changes: 0 additions & 20 deletions microtests/ppu_sprite0_scx0_a.s

This file was deleted.

2 changes: 1 addition & 1 deletion microtests/ppu_sprite0_scx0_b.s
@@ -1,6 +1,6 @@
.include "header.inc"

.define DELAY 63
.define DELAY 62
.define RESULT $80
.define SPRITEX 0
.define SPRITEY 0
Expand Down
52 changes: 45 additions & 7 deletions microtests/ppu_sprite0_scx1_a.s
@@ -1,20 +1,58 @@
.include "header.inc"

.define DELAY 64
.define RESULT $83
.define SPRITEX 0
.define SPRITEY 0
.define SPRITEY 16
.define SCROLL 1
.define RESULT $83

.define FLAG_LCD_ON %10000000
.define FLAG_WIN_MAP1 %01000000
.define FLAG_WIN_ON %00100000
.define FLAG_TILE0 %00010000
.define FLAG_BG_MAP1 %00001000
.define FLAG_TALL_OBJ %00000100
.define FLAG_OBJ_ON %00000010
.define FLAG_BG_ON %00000001

main:
lcd_off_unsafe
ld a, 0
ldh (LCDC), a

ld a, 0
ld b, 160
ld hl, $FE00
- ld (hl+), a
dec b
jr nz, -

load_sprite 0 SPRITEY SPRITEX 0 0
ld hl, $FE00
ld a, SPRITEY
ld (hl+), a
ld a, SPRITEX
ld (hl+), a
ld a, 0
ld (hl+), a
ld a, 0
ld (hl+), a

ld a, 1
ld a, SCROLL
ldh (SCX), a

lcd_on_sprites
ld a, FLAG_LCD_ON | FLAG_BG_ON | FLAG_TILE0 | FLAG_OBJ_ON
ldh (LCDC), a
nops 114 - 2

nops DELAY
test_finish_stat RESULT

ldh a, (STAT)

cp RESULT
jr z, +
ld a, $FF
- ld (VRAM), a
jr -

+ ld a, $F0
- ld (VRAM), a
jr -
52 changes: 45 additions & 7 deletions microtests/ppu_sprite0_scx1_b.s
@@ -1,20 +1,58 @@
.include "header.inc"

.define DELAY 65
.define RESULT $80
.define SPRITEX 0
.define SPRITEY 0
.define SPRITEY 16
.define SCROLL 1
.define RESULT $80

.define FLAG_LCD_ON %10000000
.define FLAG_WIN_MAP1 %01000000
.define FLAG_WIN_ON %00100000
.define FLAG_TILE0 %00010000
.define FLAG_BG_MAP1 %00001000
.define FLAG_TALL_OBJ %00000100
.define FLAG_OBJ_ON %00000010
.define FLAG_BG_ON %00000001

main:
lcd_off_unsafe
ld a, 0
ldh (LCDC), a

ld a, 0
ld b, 160
ld hl, $FE00
- ld (hl+), a
dec b
jr nz, -

load_sprite 0 SPRITEY SPRITEX 0 0
ld hl, $FE00
ld a, SPRITEY
ld (hl+), a
ld a, SPRITEX
ld (hl+), a
ld a, 0
ld (hl+), a
ld a, 0
ld (hl+), a

ld a, 1
ld a, SCROLL
ldh (SCX), a

lcd_on_sprites
ld a, FLAG_LCD_ON | FLAG_BG_ON | FLAG_TILE0 | FLAG_OBJ_ON
ldh (LCDC), a
nops 114 - 2

nops DELAY
test_finish_stat RESULT

ldh a, (STAT)

cp RESULT
jr z, +
ld a, $FF
- ld (VRAM), a
jr -

+ ld a, $F0
- ld (VRAM), a
jr -
2 changes: 1 addition & 1 deletion microtests/ppu_sprite0_scx2_a.s
@@ -1,6 +1,6 @@
.include "header.inc"

.define DELAY 64
.define DELAY 61
.define RESULT $83
.define SPRITEX 0
.define SPRITEY 0
Expand Down
2 changes: 1 addition & 1 deletion microtests/ppu_sprite0_scx2_b.s
@@ -1,6 +1,6 @@
.include "header.inc"

.define DELAY 65
.define DELAY 62
.define RESULT $80
.define SPRITEX 0
.define SPRITEY 0
Expand Down
2 changes: 1 addition & 1 deletion microtests/ppu_sprite0_scx3_a.s
@@ -1,6 +1,6 @@
.include "header.inc"

.define DELAY 64
.define DELAY 61
.define RESULT $83
.define SPRITEX 0
.define SPRITEY 0
Expand Down
2 changes: 1 addition & 1 deletion microtests/ppu_sprite0_scx3_b.s
@@ -1,6 +1,6 @@
.include "header.inc"

.define DELAY 65
.define DELAY 62
.define RESULT $80
.define SPRITEX 0
.define SPRITEY 0
Expand Down
2 changes: 1 addition & 1 deletion microtests/ppu_sprite0_scx4_a.s
@@ -1,6 +1,6 @@
.include "header.inc"

.define DELAY 64
.define DELAY 62
.define RESULT $83
.define SPRITEX 0
.define SPRITEY 0
Expand Down
2 changes: 1 addition & 1 deletion microtests/ppu_sprite0_scx4_b.s
@@ -1,6 +1,6 @@
.include "header.inc"

.define DELAY 65
.define DELAY 63
.define RESULT $80
.define SPRITEX 0
.define SPRITEY 0
Expand Down
2 changes: 1 addition & 1 deletion microtests/ppu_sprite0_scx5_a.s
@@ -1,6 +1,6 @@
.include "header.inc"

.define DELAY 64
.define DELAY 62
.define RESULT $83
.define SPRITEX 0
.define SPRITEY 0
Expand Down
2 changes: 1 addition & 1 deletion microtests/ppu_sprite0_scx5_b.s
@@ -1,6 +1,6 @@
.include "header.inc"

.define DELAY 65
.define DELAY 63
.define RESULT $80
.define SPRITEX 0
.define SPRITEY 0
Expand Down
2 changes: 1 addition & 1 deletion microtests/ppu_sprite0_scx6_a.s
@@ -1,6 +1,6 @@
.include "header.inc"

.define DELAY 64
.define DELAY 62
.define RESULT $83
.define SPRITEX 0
.define SPRITEY 0
Expand Down
2 changes: 1 addition & 1 deletion microtests/ppu_sprite0_scx6_b.s
@@ -1,6 +1,6 @@
.include "header.inc"

.define DELAY 65
.define DELAY 63
.define RESULT $80
.define SPRITEX 0
.define SPRITEY 0
Expand Down
2 changes: 1 addition & 1 deletion microtests/ppu_sprite0_scx7_a.s
@@ -1,6 +1,6 @@
.include "header.inc"

.define DELAY 64
.define DELAY 62
.define RESULT $83
.define SPRITEX 0
.define SPRITEY 0
Expand Down
2 changes: 1 addition & 1 deletion microtests/ppu_sprite0_scx7_b.s
@@ -1,6 +1,6 @@
.include "header.inc"

.define DELAY 65
.define DELAY 63
.define RESULT $80
.define SPRITEX 0
.define SPRITEY 0
Expand Down

0 comments on commit 0049bba

Please sign in to comment.