LoginSignup
1
0

More than 5 years have passed since last update.

PC-88 z80asmでVBLANK (2)

Last updated at Posted at 2018-08-08

実機(88MA2)V2モード4/8MHzでの動作を確認。チラつきは感じられなかった。

vblank.asm
; z88dk / PC-88 mon
; z80asm -b -l vblank.asm

tvram   equ     $f3c8
vtvram  equ     $c000

        org     $b000
start:
        call    crtset
        call    vtinit
.loop
        xor     a
        call    vtcls

        in      a, ($00)        ; テンキー 0~7
        cpl
        call    vtcls

        call    vblank
        call    vtblt
        jr      loop

crtset:
        ld      hl, $e6b4
        ld      (hl), $98       ; アトリビュート
        inc     hl
        inc     hl
        inc     hl
        inc     hl
        ld      (hl), $00       ; ファンクション・キー表示スイッチ
        inc     hl
        ld      (hl), $ff       ; カラー/白黒スイッチ
        ld      b, 80
        ld      c, 25
        call    $6f6b           ; CRTSET
        ret

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

vtinit:
        ld      hl, tvram
        ld      de, vtvram
        ld      bc, 120*25
        ldir
        ret

vtcls:
        ld      hl, vtvram
        ld      b, 25
.vtcls1
        push    bc
        ld      (hl), a
        ld      d, h
        ld      e, l
        inc     de
        ld      bc, 80-1
        ldir
        ld      de, 40+1
        add     hl, de
        pop     bc
        djnz    vtcls1
        ret

vtblt:
        ld      hl, vtvram
        ld      de, tvram
        ld      bc, 120*25
        ldir
        ret

vblank.png

1
0
0

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