문서 편집 권한이 없습니다. 다음 이유를 확인해주세요: 요청한 명령은 다음 권한을 가진 사용자에게 제한됩니다: 사용자. 문서의 원본을 보거나 복사할 수 있습니다. [[게임보이]]用 [[UTF-8]] 디코딩 函數. 出力은 레지스터 c, d, e에 [[UTF-32]]로 디코딩되어 나온다. 맨밑의 <code>@nextByte</code>는 다음 臺詞 바이트를 가져오는 役割을 하며, 게임마다 따로 具顯하여야 한다. <pre> ; @param b: Bank number to read from ; @param hl: Start address to read from ; @return c: Unicode codepoint, upper 1 byte ; @return de: Unicode codepoint, lower 2 bytes decodeUTF8: ld c, $00 ld d, $00 call @nextByte bit 7, a jr z, @singleByte bit 5, a jr z, @doubleByte bit 4, a jr z, @tripleByte bit 3, a jr z, @quadByte jr @end @singleByte: and a, $7f ld e, a jr @end @doubleByte: push af and a, $1c rrca rrca ld d, a jr @lastByte @tripleByte: and a, $0f rlca rlca rlca rlca ld d, a call @nextByte push af and a, $3c rrca rrca or d ld d, a jr @lastByte @quadByte: and a, $07 rlca rlca ld c, a call @nextByte push af and a, $30 rrca rrca rrca rrca or c ld c, a pop af and a, $0f rlca rlca rlca rlca ld d, a call @nextByte push af and a, $3c rrca rrca or d ld d, a jr @lastByte @lastByte: pop af and a, $03 rrca rrca ld e, a call @nextByte and a, $3f or e ld e, a @end: ret ;; Read next byte from hl, incrementing hl itself @nextByte: ld a, :@nextByte call readByteFromBankAndReturn inc hl ret </pre> UTF-8/게임보이/wla-dx 문서로 돌아갑니다.