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.
This commit is contained in:
KATO Takenori 2007-04-07 08:37:04 +00:00
parent 999b7fd4b5
commit f2a081cfe4
6 changed files with 173 additions and 7 deletions

View File

@ -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

View File

@ -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 "

View File

@ -0,0 +1,12 @@
/*
* $FreeBSD$
*/
SECTIONS
{
.text : { *(.text) }
.data : { *(.data) }
. = 0x1243;
.putssjis : { *(.putssjis) }
.bss : { *(.bss) }
}

View File

@ -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

View File

@ -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

View File

@ -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