OSDN Git Service

(none)
authorryuz <ryuz>
Tue, 6 May 2008 11:03:07 +0000 (11:03 +0000)
committerryuz <ryuz>
Tue, 6 May 2008 11:03:07 +0000 (11:03 +0000)
sample/ia32/pcat/gcc/gmake.mak
sample/ia32/pcat/gcc/ipl.S
sample/ia32/pcat/sample.c

index b3f25d3..ee59909 100755 (executable)
@@ -56,7 +56,7 @@ SRC_DIRS += . ..
 # %jp{オプションフラグ}%en{option flags}
 AFLAGS  = -march=i386
 CFLAGS  = -march=i386
-LNFLAGS = -nostdlib -nostartfiles -lc -lgcc -Wl,-Map,$(TARGET).map,-T$(LINK_SCRIPT)
+LNFLAGS = -nostartfiles -Wl,-Map,$(TARGET).map,-T$(LINK_SCRIPT)
 # LNFLAGS = -nostdlib -fno-exceptions -ffreestanding -fno-builtin -nostartfiles -Wl,-Map,$(TARGET).map,-T$(LINK_SCRIPT)
 
 
index f90b0b7..de83171 100755 (executable)
@@ -14,7 +14,7 @@ LOAD_SEG  = 0x0800                    /* 本体をロードするセグメントアドレス */
 IPL_ADDR  = (IPL_SEG << 4)
 LOAD_ADDR = (LOAD_SEG << 4)
 
-LOAD_SEC_NUM = 32
+LOAD_SEC_NUM = 128
 
 
                                .code16
@@ -44,21 +44,6 @@ init_start:
                                call    bios_puts
                                
                                /* 本体のロード */
-       //                      movw    $LOAD_SEG, %ax
-       //                      movw    %ax, %es
-       //                      xorw    %bx, %bx                        /* 読込先アドレス */
-       //                      movb    $0x02, %ah
-       //                      movb    $LOAD_SEC_NUM, %al      /* セクタ数 */
-       //                      movw    $0x0002, %cx            /* シリンダ・セクタ番号 */
-       //                      movb    $0x00, %dh                      /* ヘッド番号 */
-       //                      movb    $0x00, %dl                      /* ドライブ番号 */
-       //                      int             $0x13
-       //                      jc              disk_error
-       //                      cmp             $LOAD_SEC_NUM, %al
-       //                      jnz             disk_error
-                               
-                               
-                               
                                movw    $LOAD_SEG, %ax
                                movw    %ax, %es
                                xorw    %bx, %bx                        /* 読込先アドレス */
@@ -77,9 +62,11 @@ read_loop:
                                cmp             $LOAD_SEC_NUM, %ax
                                jnz             read_loop
                                
-                               
+                               /* ネイティブモードへ移行 */
                                jmp             switch_32bit
                                
+                               
+                               /* エラー */
 disk_error:            
                                movw    $error_message, %si
                                call    bios_puts
@@ -102,10 +89,8 @@ read_sector:
                                movb    %al, %dh                        /* ヘッド番号 */
                                andb    $0x01, %dh
                                
-                               andb    $0xfe, %al
-                               movb    $0, %ah
-                               shlw    $5, %ax
-                               orw             %ax, %cx                        /* シリンダ番号 */
+                               shrb    $1, %al
+                               mov             %al, %ch                        /* シリンダ番号 */
                                
                                movb    $0x00, %dl                      /* ドライブ番号 */
                                
index 8cf60a5..650a89b 100755 (executable)
@@ -60,16 +60,26 @@ void Sample_Initialize(VP_INT exinf)
 }
 
 
+/* とりあえず線形合同法 */
+int my_rand(void)
+{
+       static long x=1;
+       
+       x = x * 1103515245 + 12345;
+       return (x & 2147483647);
+}
+
+
 /** %jp{適当な時間待つ} */
 void rand_wait(void)
 {
        int r;
        
        wai_sem(SEMID_RAND);
-       r = 100;        // rand();
+       r = my_rand();
        sig_sem(SEMID_RAND);
        
-       dly_tsk((r % 1000) + 10);
+       dly_tsk((r % 100) + 10);
 }