> For the complete documentation index, see [llms.txt](https://docs.hex-rays.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hex-rays.com/8.5/user-guide/disassembler/disassembly-gallery/h8-500.md).

# H8 500

Assembler code

```
ROM:1082
ROM:1082 ! =============== S U B R O U T I N E =======================================
ROM:1082
ROM:1082
ROM:1082 sub_1082: ! near
ROM:1082                 mov:g.w @(0xC:8,r3), r0
ROM:1085                 mov:g.w @(0xA:8,r3), r2
ROM:1088                 bra     loc_109D:8
ROM:108A ! ---------------------------------------------------------------------------
ROM:108A
ROM:108A loc_108A:                               ! CODE XREF: sub_1082:loc_109D↓j
ROM:108A                 mov:g.w @r0+, r4
ROM:108C                 mov:g.w @r0+, r1
ROM:108E                 shlr.w  r1
ROM:1090                 sub.w   #1:16, r1
ROM:1094
ROM:1094 loc_1094:                               ! CODE XREF: sub_1082+14↓j
ROM:1094                 clr.w   @r4+
ROM:1096                 scb/f   r1, loc_1094:8
ROM:1099                 sub.w   #1:16, r2
ROM:109D
ROM:109D loc_109D:                               ! CODE XREF: sub_1082+6↑j
ROM:109D                 bne     loc_108A:8
ROM:109F                 mov:g.w @(0x10:8,r3), r4
ROM:10A2
ROM:10A2 loc_10A2:                               ! CODE XREF: sub_1082+34↓j
ROM:10A2                 mov:g.w @r4+, r0
ROM:10A4                 beq     loc_10B8:8
ROM:10A6                 mov:g.w @r4+, r1
ROM:10A8
ROM:10A8 loc_10A8:                               ! CODE XREF: sub_1082+2C↓j
ROM:10A8                 mov:g.b @r4+, r2
ROM:10AA                 mov:g.b r2, @r1+
ROM:10AC                 add:q.w #-1, r0
ROM:10AE                 bne     loc_10A8:8
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.hex-rays.com/8.5/user-guide/disassembler/disassembly-gallery/h8-500.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
