Compilation implementation of several C ++ statements (H1 command)

Source: Internet
Author: User

; * P = 5
LDC 5;
Push
Ld p; load P's Value
STI; save 5 to Mem [P's value]
LDI; get the value
Dout
LDC '/N'
Aout
; *** Q = 10
LDC 10
Push
Ld q; AC = 17 * q's ADDR
LDI; AC = 18 ** Q's ADDR
LDI; AC = 19 *** Q's ADDR
STI; Save 10 to *** Q, this address is result
; X = *** Q
LDI; LD result, *** Q's Value
St X; X = *** Q;
Ld x;
Dout
LDC '/N'
Aout
; * (P + 1) = 6
LDC 6
Push
LD p + 1; load (p + 1)'s value, shocould be 81
STI; save 6 to * (p + 1)
LDI; * (p + 1). Value, get the value
Dout; check the value if 6
LDC '/N'
Aout
; * P = * p + 1

Ld p; 80
LDI; ADDR 80 value: shocould be 5
Add @ 1
Push
LD P
STI; save * p + 1 to * P
LD P
LDI; ADDR 80 value: shocould be 6
Dout
LDC '/N'
Aout
; R = P
Ld p; AC = P's ADDR
St R
LD R
Dout
Halt
P: DW 80
DW 81
Q: DW * + 1; * q is next address. (* + 1)
DW * + 1; ** Q is next address. (* + 1)
DW * + 1; *** Q is next address. (* + 1 = Result)
Result: DW 0
X: DW 0
R: DW 0
@ 1: DW 1

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.