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