1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

BIOSの`GTSTCK`から得たスティックの状態に応じてXY座標を更新する

Last updated at Posted at 2018-10-31

BIOSのGTSTCKから得たスティックの状態に応じてXY座標を更新する

# HレジスタをX座標
# LレジスタをY座標として
# Aレジスタのスティックの値に応じてXY座標(HL)を更新
# 破壊されるレジスタ: BC

UPDATE_PLAYER_XY:
    SLA A
    SLA A
  LD C,A
    LD B,0
    PUSH HL // 追記
    LD  HL,TABLE_XY
    ADD HL,BC
    LD (JUMP + 01H),HL
    POP HL // 追記
JUMP:
    JP 0000H 

TABLE_XY:
# 0:
    NOP
    NOP
    NOP
    RET
# 1:
    NOP
    DEC L
    NOP
    RET
# 2:
    INC H
    DEC L
    NOP
    RET
# 3:
    INC H
    NOP
    NOP
    RET
# 4:
    INC H
    INC L
    NOP
    RET
# 5:
    NOP
    INC L
    NOP
    RET
# 6:
    DEC H
    INC L
    NOP
    RET
# 7: 
    DEC H
    NOP
    NOP
    RET
# 8:
    DEC H
    DEC L
    RET
1
0
5

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?