mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-06-09 06:34:04 +09:00
tvdos kernel to support unicode print, and hangul kernel module to demo the unicode support
This commit is contained in:
@@ -127,10 +127,6 @@ function toLineChar(i,p,f) {
|
||||
/* 1 | 3 */out[1+dbl] = fbuf[0]
|
||||
/* 3 | 5 */out[3+dbl] = fbuf[1]
|
||||
|
||||
// serial.println(`ipf: ${i} ${p} ${f}`)
|
||||
// serial.println(out)
|
||||
|
||||
|
||||
if (out.length > 4) {
|
||||
out[0] = enc.i[out[0]]
|
||||
out[1] = 0x20
|
||||
@@ -151,20 +147,19 @@ function toLineChar(i,p,f) {
|
||||
|
||||
|
||||
function printHangul(char) {
|
||||
let [cy,cx] = con.getyx()
|
||||
|
||||
// serial.println("chars:")
|
||||
// serial.println(char)
|
||||
|
||||
char.forEach((v,i)=>{
|
||||
con.mvaddch(cy+(i%2),cx+(i/2),v)
|
||||
// serial.println(v.toString(16))
|
||||
con.addch(v)
|
||||
if (i % 2 == 0)
|
||||
con.curs_down()
|
||||
else {
|
||||
let c = graphics.getCursorYX();
|
||||
con.move(c[0]-1,c[1]+1);
|
||||
}
|
||||
})
|
||||
con.move(cy+(char.length%2),cx+(char.length/2))
|
||||
}
|
||||
|
||||
|
||||
let text = "동해물과 백두산이 마르고 닳도록 7비트 한글조합"
|
||||
/*let text = "동해물과 백두산이 마르고 닳도록 7비트 한글조합"
|
||||
|
||||
//con.clear()
|
||||
//con.move(1,1)
|
||||
@@ -178,4 +173,24 @@ unicode.utf8toCodepoints(text).forEach(cp=>{
|
||||
else {
|
||||
print(String.fromCharCode(cp))
|
||||
}
|
||||
})
|
||||
})*/
|
||||
|
||||
|
||||
// load unicode module to the TVDOS
|
||||
if (unicode.uniprint) {
|
||||
unicode.uniprint.push([
|
||||
c => 0xAC00 <= c && c <= 0xD7A3,
|
||||
c => {
|
||||
let i = ((c - 0xAC00) / 588)|0
|
||||
let p = ((c - 0xAC00) / 28 % 21)|0
|
||||
let f = (c - 0xAC00) % 28
|
||||
printHangul(toLineChar(i,p,f))
|
||||
}
|
||||
])
|
||||
|
||||
println("조합한글 커널모듈이 로드되었습니다.")
|
||||
}
|
||||
else {
|
||||
println("Failed to load Assembly Hangul kernel module: incompatible DOS version")
|
||||
}
|
||||
|
||||
|
||||
1
assets/disk0/home/hangulprint.js
Normal file
1
assets/disk0/home/hangulprint.js
Normal file
@@ -0,0 +1 @@
|
||||
println("한글 또는 조선글은 현대 한국어 또는 한국어족 언어의 표기에 쓰이는 문자로,남한과 북한,연변 지역에서 사용되는 공용 문자이다. 현대 기준 기본자음 14자와 기본모음 10자로 구성된 음소문자이며, 자음과 자음, 모음과 모음끼리 합쳐서 새로운 자형을 만들 수 있다.\n사용할때는 모아쓰기를 하여 한 글자가 1음절을 나타내는 음절문자적 특성을 지니기도 한다. 현재까지 쓰이는 다른 대부분의 문자와 달리 특정 인물이 인공적으로 만들어낸 글자이며, 따라서 창제 역사와 원리가 설명되어 있는 몇 없는 문자이기도 하다.")
|
||||
Reference in New Issue
Block a user