VOOZH about

URL: https://qiita.com/Stosstruppe/items/c9647651f3ab0373ceed

⇱ PC-88 z80asmでキー入力 #Z80 - Qiita


👁 Image
1

Go to list of users who liked

0

Share on X(Twitter)

Share on Facebook

Add to Hatena Bookmark

More than 5 years have passed since last update.

@Stosstruppe

PC-88 z80asmでキー入力

1
Posted at
inkey1.asm
; z88dk / PC-88 mon
; z80asm -b -l inkey1.asm

tvram equ $f3c8

 org $b000
start:
 ld a, $0c ; cls
 rst $18 ; OUTIO
.loop
 ; キー入力
 ld a, (dir)
 ld b, a

 in a, ($0a) ; 左キー
 and $04
 jr nz, skip1
 dec b
.skip1
 in a, ($08) ; 右キー
 and $04
 jr nz, skip2
 inc b
.skip2
 ld a, b
 and $3f ; 0~63
 ld (dir), a

 call WaitVBlank

 ; クリア
 ld hl, tvram+120*5
 ld b, 80
 ld a, $20 ; ' '
.cls
 ld (hl), a
 inc hl
 djnz cls

 ; 描画
 ld hl, tvram+120*5
 ld a, (dir)
 ld b, a
 ld a, $8e
.cont
 dec b
 jp m, break
 ld (hl), a
 inc hl
 jr cont
.break
 jr loop

WaitVBlank:
 in a, ($40)
 and $20
 jr nz, WaitVBlank
.wait
 in a, ($40)
 and $20
 jr z, wait
 ret

dir: defb $20

👁 inkey1.png

1

Go to list of users who liked

0
0

Go to list of comments

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

Go to list of users who liked

0