summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkato <kato@FreeBSD.org>2007-04-07 08:37:04 +0000
committerkato <kato@FreeBSD.org>2007-04-07 08:37:04 +0000
commit5b2161e51b74d960f1d95724c0753ecf4a35b483 (patch)
tree56ad186d5b6ea7b9a5d945589be614fb526abf84
parent2e74e1223100a0042690317c9088e8f58c9e9fe8 (diff)
downloadFreeBSD-src-5b2161e51b74d960f1d95724c0753ecf4a35b483.zip
FreeBSD-src-5b2161e51b74d960f1d95724c0753ecf4a35b483.tar.gz
Added the IPLware 3.33 support.
- Added magic numbers to pretend the NEC original program version 2.70. - Added string display routine with Shift-JIS code support. - Added three nop instructions at start1 in start.s since the installaer of the IPLware put 'call $0x09ab' instruction. - Put the near return instruction at 0x9ab in selector.s. Since the Shit-JIS display routine must be located at 0x1243, the linker script file (ldscript) is applied.
-rw-r--r--sys/boot/pc98/boot0.5/Makefile5
-rw-r--r--sys/boot/pc98/boot0.5/boot0.5.s6
-rw-r--r--sys/boot/pc98/boot0.5/ldscript12
-rw-r--r--sys/boot/pc98/boot0.5/putssjis.s137
-rw-r--r--sys/boot/pc98/boot0.5/selector.s7
-rw-r--r--sys/boot/pc98/boot0.5/start.s13
6 files changed, 173 insertions, 7 deletions
diff --git a/sys/boot/pc98/boot0.5/Makefile b/sys/boot/pc98/boot0.5/Makefile
index 6b54dd0..51eebe0 100644
--- a/sys/boot/pc98/boot0.5/Makefile
+++ b/sys/boot/pc98/boot0.5/Makefile
@@ -4,7 +4,8 @@ PROG= ${BOOT}.out
INTERNALPROG=
FILES= ${BOOT}
NO_MAN=
-SRCS= start.s boot.s boot0.5.s disk.s selector.s support.s syscons.s
+SRCS= start.s boot.s boot0.5.s disk.s selector.s support.s syscons.s \
+ putssjis.s
CLEANFILES= ${BOOT} ${BOOT}.bin
BOOT= boot0.5
@@ -13,7 +14,7 @@ BOOT= boot0.5
# unless you are glutton for punishment.
BOOT_BOOT0_ORG?= 0x0000
-LDFLAGS=-N -e start -Ttext ${BOOT_BOOT0_ORG}
+LDFLAGS=-N -e start -Ttext ${BOOT_BOOT0_ORG} -Wl,-T,ldscript
# The size of boot0.5 must be 7168 bytes
${BOOT}: ${BOOT}.bin
diff --git a/sys/boot/pc98/boot0.5/boot0.5.s b/sys/boot/pc98/boot0.5/boot0.5.s
index 8c99ba7..f878006 100644
--- a/sys/boot/pc98/boot0.5/boot0.5.s
+++ b/sys/boot/pc98/boot0.5/boot0.5.s
@@ -1,4 +1,4 @@
-# Copyright (c) KATO Takenori, 1999, 2000.
+# Copyright (c) KATO Takenori, 1999, 2000, 2007.
#
# All rights reserved. Unpublished rights reserved under the copyright
# laws of Japan.
@@ -261,8 +261,8 @@ curdevice: .word 0 # current device
.global ishireso
ishireso: .byte 0
-title: .asciz "PC98 Boot Selector Version 1.1"
-copyright: .ascii "(C)Copyright 1999, 2000 KATO Takenori. "
+title: .asciz "PC98 Boot Selector Version 1.2"
+copyright: .ascii "(C)Copyright 1999-2007 KATO Takenori. "
.asciz "All rights reserved."
msg_device: .asciz "Device"
msg_sasi: .asciz "SASI/IDE unit "
diff --git a/sys/boot/pc98/boot0.5/ldscript b/sys/boot/pc98/boot0.5/ldscript
new file mode 100644
index 0000000..49044ab
--- /dev/null
+++ b/sys/boot/pc98/boot0.5/ldscript
@@ -0,0 +1,12 @@
+/*
+ * $FreeBSD$
+ */
+
+SECTIONS
+{
+ .text : { *(.text) }
+ .data : { *(.data) }
+ . = 0x1243;
+ .putssjis : { *(.putssjis) }
+ .bss : { *(.bss) }
+}
diff --git a/sys/boot/pc98/boot0.5/putssjis.s b/sys/boot/pc98/boot0.5/putssjis.s
new file mode 100644
index 0000000..4a75b97
--- /dev/null
+++ b/sys/boot/pc98/boot0.5/putssjis.s
@@ -0,0 +1,137 @@
+# Copyright (c) KATO Takenori, 2007.
+#
+# All rights reserved. Unpublished rights reserved under the copyright
+# laws of Japan.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer as
+# the first lines of this file unmodified.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+ .code16
+ .section .putssjis, "awx", @progbits
+
+ #
+ # Display string with Shift-JIS support
+ # %si: addres of string, %di: T-VRAM address, %cx: count
+ #
+
+ # Absolute address of putssjis_entry must be 0x1243.
+putssjis_entry:
+ push %es
+ push %ax
+ # Setup the T-VRAM segement address.
+ xorw %ax, %ax
+ movw %ax, %es
+ movw $0xa000, %ax
+ testb $0x08, %es:0x501
+ jz normalmode
+ movw $0xe000, %ax
+normalmode:
+ movw %ax, %es
+
+putssjis_loop:
+ lodsw
+ call check_sjis
+ jc put_2byte_char
+
+ # 1 byte character
+ xorb %ah, %ah
+ testb $0xe0, %al # Check control code.
+ jnz put_1byte_char
+ movb $0x20, %al # Convert control code into the space.
+put_1byte_char:
+ stosw
+ decw %si
+ jmp putssjis_loop_end
+
+put_2byte_char:
+ subb $0x20, %al
+
+ # Check 2byte "hankaku"
+ cmp $0x09, %al
+ je put_2byte_hankaku
+ cmp $0x0a, %al
+ je put_2byte_hankaku
+ cmp $0x0b, %al
+ je put_2byte_hankaku
+ jmp put_2byte_zenkaku
+
+put_2byte_hankaku:
+ stosw
+ jmp putssjis_loop_end
+
+put_2byte_zenkaku:
+ stosw
+ orb $0x80, %ah
+ stosw
+ decw %cx
+
+putssjis_loop_end:
+ loop putssjis_loop
+
+ pop %ax
+ pop %es
+ ret
+
+ # Check 2-byte code.
+check_sjis:
+ cmpb $0x80, %al
+ jbe found_ank_kana
+ cmpb $0xa0, %al
+ jb found_2byte_char
+ cmpb $0xe0, %al
+ jb found_ank_kana
+ cmpb $0xf0, %al
+ jae found_ank_kana
+ jmp found_2byte_char
+found_ank_kana:
+ clc
+ ret
+
+found_2byte_char:
+ # Convert Shift-JIS into JIS.
+ cmpb $0x9f, %al
+ ja sjis_h_2 # Upper > 0x9f
+ subb $0x71, %al # Upper -= 0x71
+ jmp sjis_lower
+sjis_h_2:
+ subb $0xb1, %al # Upper -= 0xb1
+sjis_lower:
+ salb %al # Upper *= 2
+ incb %al # Upper += 1
+
+ cmpb $0x7f, %ah
+ jbe sjis_l_2
+ decb %ah # Lower -= 1 if lower > 0x7f
+sjis_l_2:
+ cmpb $0x9e, %ah
+ jb sjis_l_3
+ subb $0x7d, %ah # Lower -= 0x7d
+ incb %al # Upper += 1
+ jmp check_2byte_end
+sjis_l_3:
+ subb $0x1f, %ah # Lower -= 0x1f
+check_2byte_end:
+ stc
+ ret
diff --git a/sys/boot/pc98/boot0.5/selector.s b/sys/boot/pc98/boot0.5/selector.s
index 18da488..26b5f93 100644
--- a/sys/boot/pc98/boot0.5/selector.s
+++ b/sys/boot/pc98/boot0.5/selector.s
@@ -1,4 +1,4 @@
-# Copyright (c) KATO Takenori, 1999, 2000.
+# Copyright (c) KATO Takenori, 1999, 2000, 2007.
#
# All rights reserved. Unpublished rights reserved under the copyright
# laws of Japan.
@@ -299,6 +299,11 @@ devmode_loop:
jne dev_right
movw $3, mode # N88-BASIC
ret
+
+ # XXX
+ .space 5, 0x90
+ ret # Dummy ret @0x9ab
+
dev_up:
cmpw $0, curdevice
je devmode_loop
diff --git a/sys/boot/pc98/boot0.5/start.s b/sys/boot/pc98/boot0.5/start.s
index 211de14..008ae66 100644
--- a/sys/boot/pc98/boot0.5/start.s
+++ b/sys/boot/pc98/boot0.5/start.s
@@ -1,4 +1,4 @@
-# Copyright (c) KATO Takenori, 1999, 2000.
+# Copyright (c) KATO Takenori, 1999, 2000, 2007.
#
# All rights reserved. Unpublished rights reserved under the copyright
# laws of Japan.
@@ -34,8 +34,19 @@
start:
jmp start1
+ # Magic
+ .org 0x053, 0x20
+ .byte 0x4e, 0x45, 0x43
+
+ .org 0x8f
+ .byte 0x32, 0x2e, 0x37, 0x30
+
.org 0x2d4
start1:
+ # The instruction 'call 0x9ab' can be here. See also selector.s.
+ nop
+ nop
+ nop
cli
movw %cs, %ax
movw %ax, %ds
OpenPOWER on IntegriCloud