Skip to content

Commit

Permalink
https://github.com/saicaca/fuwari/pull/208
Browse files Browse the repository at this point in the history
  • Loading branch information
Scrrrr committed Nov 21, 2024
1 parent b49d7dd commit 2134514
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
22 changes: 21 additions & 1 deletion src/components/misc/Markdown.astro
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const className = Astro.props.class
wrapper.className = "relative code-block";

let copyButton = document.createElement("button");
copyButton.className = "copy-btn btn-regular-dark absolute active:scale-90 h-8 w-8 top-2 right-2 opacity-75 text-sm p-1.5 rounded-lg transition-all ease-in-out";
copyButton.className = "copy-btn btn-regular-dark absolute active:scale-90 h-8 w-8 top-2 right-2 opacity-75 text-sm p-1.5 rounded-lg transition-all ease-in-out hidden";

codeBlock.setAttribute("tabindex", "0");
if (codeBlock.parentNode) {
Expand All @@ -43,8 +43,24 @@ const className = Astro.props.class
copyButton.innerHTML = `<div>${copyIcon} ${successIcon}</div>
`

let dataLang = document.createElement("div");
dataLang.className = "dataLang absolute h-8 w-auto top-0.5 right-2 text-xs text-right p-1.5 rounded-lg transition-all ease-in-out";
dataLang.innerHTML = `
<div>${codeBlock.getAttribute("data-language")}</div>
`;

wrapper.appendChild(codeBlock);
wrapper.appendChild(copyButton);
wrapper.appendChild(dataLang);

wrapper.onmouseover = (event) => {
copyButton.style.display = "block";
dataLang.style.display = "none";
}
wrapper.onmouseout = (event) => {
copyButton.style.display = "none";
dataLang.style.display = "block";
}

let timeout: ReturnType<typeof setTimeout>;
copyButton.addEventListener("click", async () => {
Expand Down Expand Up @@ -148,6 +164,7 @@ const className = Astro.props.class
pre
background: var(--codeblock-bg) !important
border-radius: 0.75rem
padding-top: 1.25rem
padding-left: 1.25rem
padding-right: 1.25rem

Expand All @@ -163,6 +180,9 @@ const className = Astro.props.class
span.br::selection
background: var(--codeblock-selection)

.dataLang
color: var(--primary)

ul
li
&::marker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,18 @@ x64にレジスタは16個ある。一つのレジスタのビット数は64Bit

# ptr演算子
アセンブリではメモリサイズを自分で明記しなくてはい。
```asm
mov [rcx], 5dh ;5dは10進数で93
```
mov [rcx], 5dh
```

そのため、このような記述ではrcxレジスタのどのデータサイズで`5`を格納するのかが分からないためエラーとなる。

```
```asm
mov eax, 5dh
mov [rcx], eax
```
このような記述をする必要がある。
```
```asm
mov dword ptr[rcx], 5dh
```
ptr演算子を使うことでメモリサイズを指定することが出来る。
Expand Down

0 comments on commit 2134514

Please sign in to comment.