EUCてきすとをSJISに変換する
//converteuc2sjis | ||
la | t0,euc | |
la | t1,output | |
loop: | ||
lbu | t4,0x0(t0) | #c1 |
lbu | t5,0x1(t0) | #c2 |
beq | t4,zr,NULLowata | |
addiu | t6,t4,0x5F | #euc判定 |
andi | t7,t6,0xFF | |
sltiu | at,t7,0x5E | |
beq | at,zr,半角カナ | |
andi | at,t4,1 | #c1奇数 |
andi | t5,t5,0x7f | |
beql | at,zr,c1処理 | |
addiu | t5,t5,0x7E | #c2=0x7e |
addiu | t5,t5,0x20 | #c2=0x20 |
andi | at,t5,0x80 | |
beql | at,zr,+2 | |
addiu | t5,t5,-1 | #c2+=0x1F |
c1処理: | ||
andi | t4,t4,0x7f | #c1処理 |
addiu | t6,t4,-1 | |
srl | t7,t6,1 | |
addiu | t6,t7,0x91 | |
xori | t4,t6,0x20 | |
sb | t4,0(t1) | |
sb | t5,1(t1) | |
addiu | t0,t0,2 | |
beq | zr,zr,loop | |
addiu | t1,t1,2 | |
半角カナ: | ||
ori | t2,zr,0x8E | #8E,SS1 |
bne | t2,t4,ascii | |
sb | t5,0(t1) | |
addiu | t0,t0,2 | |
beq | zr,zr,loop | |
addiu | t1,t1,1 | |
ascii: | ||
sb | t4,0(t1) | |
addiu | t0,t0,1 | |
beq | zr,zr,loop | |
addiu | t1,t1,1 | |
NULLowata: | ||
jr | ra | |
setpc | 0x1100 | |
sjis: | ||
.string932 | A。ア亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸稲茨芋鰯允印咽員因姻引飲淫胤蔭院陰隠韻吋右宇烏羽迂雨卯鵜窺丑碓 | |
setpc | 0x1200 | |
output: | ||
setpc | 0x1300 | |
euc: | ||
.string51932 | A。ア亜唖娃阿哀愛挨姶逢葵茜穐悪握渥旭葦芦鯵梓圧斡扱宛姐虻飴絢綾鮎或粟袷安庵按暗案闇鞍杏以伊位依偉囲夷委威尉惟意慰易椅為畏異移維緯胃萎衣謂違遺医井亥域育郁磯一壱溢逸稲茨芋鰯允印咽員因姻引飲淫胤蔭院陰隠韻吋右宇烏羽迂雨卯鵜窺丑碓 |