#module
#deffunc peek16 val, val, int
mref v1, 24 : mref v2, 25 : mref index, 2
tmp = 0
peek tmp, v2, index
str tmp, 16
v1 = tmp
return
#deffunc wpeek16 val, val, int
mref v1, 24 : mref v2, 25 : mref index, 2
tmp = 0
wpeek tmp, v2, index
str tmp, 16
v1 = tmp
return
#deffunc poke16 val, str, int
mref v, 24 : mref string, 33 : mref index, 2
tmp = "$" + string
int tmp
poke v, index, tmp
return
#deffunc wpoke16 val, str, int
mref v, 24 : mref string, 33 : mref index, 2
tmp = "$" + string
int tmp
wpoke v, index, tmp
return
#global
sdim tmp, 4
data = "16進数で処理するTest"
pos 10, 10 : mes "◎対象ワード[" + data + "]"
font "MS 明朝", 13
pos 10, 40 : mes "16進数"
pos 100, 40 : mes "10進数"
pos 200, 40 : mes "データ"
strlen len , data
repeat len
peek16 hex, data, cnt
peek dec, data, cnt
pos 10, cnt * 20 + 70 : mes "$" + hex
pos 100, cnt * 20 + 70 : mes dec
// 前回全角文字ならデータを表示しない
peek chk, tmp, 1
if chk = 0 {
if (dec > 128 & (dec < 160)) | (dec > 223) {
wpeek16 tmp2, data, cnt
wpoke16 tmp, tmp2
pos 200, cnt * 20 + 70 : mes tmp
} else {
poke16 tmp, hex
pos 200, cnt * 20 + 70 : mes tmp
}
} else {
memset tmp, , 4
}
loop
stop
|