LoginSignup
0

More than 5 years have passed since last update.

MSX Z80で120倍

Last updated at Posted at 2018-08-05
mul120.asm
; z88dk / WebMSX
; z80asm -b -l mul120.asm
; appmake +msx -b mul120.bin --org=0xd000

        org     $d000
start:
        push    hl
        pop     ix
        ld      a, (ix+2)

        ld      h, a            ; 256倍
        add     a, a
        add     a, a
        add     a, a
        ld      e, a            ; 8倍
        ld      d, 0
        xor     a
        srl     h               ; 256/2=128倍
        rra
        ld      l, a
        sbc     hl, de          ; 128-8=120倍

        ld      (ix+2), l
        ld      (ix+3), h
        ret
mul120.bas
10 clear 100,&hcfff
20 defint a-z
30 def usr=&hd000
40 input "y(0~24)";y
50 print usr(y)
60 goto 40

WMSX Screen (2).png

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
0