Help us understand the problem. What is going on with this article?

intel 8080 アセンブラ 16bit除算

More than 1 year has passed since last update.

de / hl = hl, de % hl = de

cmpbd:
    mov a, e
    sub c
    mov a, d
    sbb b
    ret    
rdel:
    mov a, e
    ral
    mov e, a
    mov a, d
    ral
    mov d, a
    ora e
    ret    
deneg:
    mov a, d
    cma
    mov d, a
    mov a, e
    cma
    mov e, a
    inx d
    ret
bcneg:
    mov a, b
    cma
    mov b, a
    mov a, c
    cma
    mov c, a
    inx b
    ret    
div16:
    mov b, h
    mov c, l
    mov a, d
    xra b
    push psw
    mov a, d
    ora a
    cm deneg
    mov a, b
    ora a
    cm bcneg
    mvi a, 16
    push psw
    xchg
    lxi d, 0
div1:
    dad h
    call rdel
    jz div2
    call cmpbd
    jm div2
    mov a, l
    ori 1
    mov l, a
    mov a, e
    sub c
    mov e, a
    mov a, d
    sbb b
    mov d, a
div2:
    pop psw
    dcr a
    jz div3
    push psw
    jmp div1
div3:
    pop psw
    rp
    call deneg
    xchg
    call deneg
    xchg
    ret 

補足

バイナリーを十進で表示するのに必要だから最初は除算。
今すぐ実行

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした