--- Begin Message ---diff -ruNp old/kernel/break.c new/kernel/break.c --- old/kernel/break.c 2004-04-14 17:40:50.000000000 +0000 +++ new/kernel/break.c 2004-04-24 11:55:44.000000000 +0000 @@ -53,13 +53,13 @@ unsigned char ctrl_break_pressed(void) unsigned char check_handle_break(struct dhdr FAR **pdev) { - unsigned char c = CTL_C; - if (!ctrl_break_pressed()) - c = (unsigned char)ndread(&syscon); - if (c != CTL_C && *pdev != syscon) - c = (unsigned char)ndread(pdev); - if (c == CTL_C) + unsigned char c; + if (ctrl_break_pressed() || + (c = (unsigned char)ndread(&syscon)) == CTL_C || + *pdev != syscon && (c = (unsigned char)ndread(pdev)) == CTL_C) + { handle_break(pdev, -1); + } return c; } @@ -90,4 +90,3 @@ void handle_break(struct dhdr FAR **pdev spawn_int23(); /* invoke user INT-23 and never come back */ } - diff -ruNp old/kernel/dsk.c new/kernel/dsk.c --- old/kernel/dsk.c 2004-04-13 12:54:32.000000000 +0000 +++ new/kernel/dsk.c 2004-04-24 06:17:54.000000000 +0000 @@ -363,9 +363,7 @@ STATIC WORD blk_Media(rqptr rp, ddt * pd STATIC WORD getbpb(ddt * pddt) { - ULONG count; bpb *pbpbarray = &pddt->ddt_bpb; - unsigned secs_per_cyl; WORD ret; /* pddt->ddt_descflags |= DF_NOACCESS; @@ -430,19 +428,20 @@ STATIC WORD getbpb(ddt * pddt) printf("BPB_NFSECT = %04x\n", pbpbarray->bpb_nfsect); #endif - count = - pbpbarray->bpb_nsize == 0 ? - pbpbarray->bpb_huge : pbpbarray->bpb_nsize; - secs_per_cyl = pbpbarray->bpb_nheads * pbpbarray->bpb_nsecs; - - if (secs_per_cyl == 0) { - tmark(pddt); - return failure(E_FAILURE); + unsigned secs_per_cyl = pbpbarray->bpb_nheads * pbpbarray->bpb_nsecs; + + if (secs_per_cyl == 0) + { + tmark(pddt); + return failure(E_FAILURE); + } + /* this field is problematic for partitions > 65535 cylinders, + in general > 512 GiB. However: we are not using it ourselves. */ + pddt->ddt_ncyl = (UWORD)(((pbpbarray->bpb_nsize == 0 ? + pbpbarray->bpb_huge : pbpbarray->bpb_nsize) + - 1) / secs_per_cyl) + 1; } - /* this field is problematic for partitions > 65535 cylinders, - in general > 512 GiB. However: we are not using it ourselves. */ - pddt->ddt_ncyl = (UWORD)((count + (secs_per_cyl - 1)) / secs_per_cyl); tmark(pddt); @@ -1065,15 +1064,8 @@ STATIC int LBA_Transfer(ddt * pddt, UWOR LBA_address += count; totaltodo -= count; - buffer = adjust_far((char FAR *)buffer + count * 512); + buffer = adjust_far((char FAR *)buffer + count * 512u); } - return (error_code); + return error_code; } - -/* - * Revision 1.17 2001/05/13 tomehlert - * Added full support for LBA hard drives - * initcode moved (mostly) to initdisk.c - * lower interface partly redesigned - */ diff -ruNp old/kernel/fattab.c new/kernel/fattab.c --- old/kernel/fattab.c 2004-02-07 19:04:48.000000000 +0000 +++ new/kernel/fattab.c 2004-04-24 07:32:48.000000000 +0000 @@ -145,9 +145,9 @@ void write_fsinfo(struct dpb FAR * dpbp) /* */ /* The FAT file system is difficult to trace through FAT table. */ /* There are two kinds of FAT's, 12 bit and 16 bit. The 16 bit */ -/* FAT is the easiest, since it is noting more than a series of */ -/* UWORD's. The 12 bit FAT is difficult, because it packs 3 FAT */ -/* entries into two BYTE's. The are packed as follows: */ +/* FAT is the easiest, since it is nothing more than a series */ +/* of UWORD's. The 12 bit FAT is difficult, because it packs 3 */ +/* FAT entries into two BYTE's. The are packed as follows: */ /* */ /* 0x0003 0x0004 0x0005 0x0006 0x0007 0x0008 0x0009 ... */ /* */ @@ -171,71 +171,65 @@ unsigned link_fat(struct dpb FAR * dpbp, if (ISFAT12(dpbp)) { - unsigned idx; - REG UBYTE FAR *fbp0, FAR * fbp1; - struct buffer FAR * bp1; + struct buffer FAR * bp2; + unsigned b1, b2; - /* form an index so that we can read the block as a */ - /* byte array */ - idx = (unsigned) ((((unsigned)Cluster1 << 1) + (unsigned)Cluster1) >> 1) - % dpbp->dpb_secsize; - - /* Test to see if the cluster straddles the block. If */ - /* it does, get the next block and use both to form the */ - /* the FAT word. Otherwise, just point to the next */ - /* block. */ - fbp0 = &bp->b_buffer[idx]; - fbp1 = fbp0 + 1; + /* form an index so that we can read the block as a byte array. */ + b1 = (((unsigned)Cluster1 >> 1) + (unsigned)Cluster1) + % dpbp->dpb_secsize; + + /* Test to see if the cluster straddles the block. If it does, get */ + /* the next block and use both to form the the FAT word. Otherwise, */ + /* just point to the next block. */ + bp2 = bp; + b2 = b1 + 1; - if (idx >= (unsigned)dpbp->dpb_secsize - 1) + if (b2 >= dpbp->dpb_secsize) { - bp1 = getFATblock((unsigned)Cluster1 + 1, dpbp); - if (bp1 == 0) + bp2 = getFATblock((unsigned)Cluster1 + 1, dpbp); + if (bp2 == 0) return DE_BLKINVLD; - - bp1->b_flag |= BFR_DIRTY | BFR_VALID; - - fbp1 = &bp1->b_buffer[0]; + bp2->b_flag |= BFR_DIRTY | BFR_VALID; + b2 = 0; } /* Now pack the value in */ - if ((unsigned)Cluster1 & 0x01) + if ((UBYTE)Cluster1 & 0x01) { - *fbp0 = (*fbp0 & 0x0f) | (((UBYTE)Cluster2 & 0x0f) << 4); - *fbp1 = (UBYTE)((unsigned)Cluster2 >> 4); + bp->b_buffer[b1] = (UBYTE)(0x0f & bp->b_buffer[b1]) | + (UBYTE)((UBYTE)Cluster2 << 4); + bp2->b_buffer[b2] = (UBYTE)((unsigned)Cluster2 >> 4); } else { - *fbp0 = (UBYTE)Cluster2; - *fbp1 = (*fbp1 & 0xf0) | ((UBYTE)((unsigned)Cluster2 >> 8) & 0x0f); + bp->b_buffer[b1] = (UBYTE)Cluster2; + bp2->b_buffer[b2] = (UBYTE)(0xf0 & bp2->b_buffer[b2]) | + (UBYTE)((unsigned)Cluster2 >> 8); } } else if (ISFAT16(dpbp)) { - /* form an index so that we can read the block as a */ - /* byte array */ - /* Finally, put the word into the buffer and mark the */ - /* buffer as dirty. */ + /* form an index so that we can read the block as a byte array. */ + /* Finally, put the word into the buffer and... */ fputword( - &bp->b_buffer[((unsigned)Cluster1 * SIZEOF_CLST16) % dpbp->dpb_secsize], + bp->b_buffer + ((unsigned)Cluster1 * SIZEOF_CLST16) % dpbp->dpb_secsize, (UWORD)Cluster2); } #ifdef WITHFAT32 else if (ISFAT32(dpbp)) { - /* form an index so that we can read the block as a */ - /* byte array */ - /* Finally, put the word into the buffer and mark the */ - /* buffer as dirty. */ + /* form an index so that we can read the block as a byte array. */ + /* Finally, put the word into the buffer and... */ fputlong( - &bp->b_buffer[(UWORD) ((Cluster1 * SIZEOF_CLST32) % dpbp->dpb_secsize)], + bp->b_buffer + ((unsigned)Cluster1 * SIZEOF_CLST32) % dpbp->dpb_secsize, Cluster2); } #endif else return DE_BLKINVLD; - /* update the free space count */ + /* mark the buffer as dirty. */ + /* update the free space count */ bp->b_flag |= BFR_DIRTY | BFR_VALID; if (Cluster2 == FREE) { @@ -373,4 +367,3 @@ CLUSTER next_cluster(struct dpb FAR * dp #endif return LONG_LAST_CLUSTER; } - diff -ruNp old/kernel/kernel.asm new/kernel/kernel.asm --- old/kernel/kernel.asm 2004-04-13 22:41:14.000000000 +0000 +++ new/kernel/kernel.asm 2004-04-22 12:15:56.000000000 +0000 @@ -123,7 +123,7 @@ kernel_start: mov sp,init_tos int 12h ; move init text+data to higher memory mov cl,6 - shl ax,cl + shl ax,cl ; convert kb to para mov dx,15 + init_end wrt INIT_TEXT mov cl,4 shr dx,cl @@ -136,35 +136,27 @@ kernel_start: sti ; now enable them mov ax,cs mov dx,__InitTextStart wrt HMA_TEXT ; para aligned + shr dx,cl %ifdef WATCOM - mov si,dx - mov cl,4 - shr si,cl - add ax,si + add ax,dx %endif mov ds,ax - mov cx,-2 + init_end wrt INIT_TEXT ; word aligned - mov si,cx - mov di,cx + mov si,-2 + init_end wrt INIT_TEXT ; word aligned + lea cx,[si+2] + mov di,si shr cx,1 - inc cx std ; if there's overlap only std is safe rep movsw ; move HMA_TEXT to higher memory - mov si,dx ; si = __InitTextStart wrt HMA_TEXT - mov cl,4 - shr dx,cl - sub ax,dx mov ds,ax ; ds = HMA_TEXT mov ax,es sub ax,dx mov es,ax ; es = new HMA_TEXT - mov cx,si ; cx = __InitTextStart wrt HMA_TEXT - dec si - dec si + mov si,-2 + __InitTextStart wrt HMA_TEXT + lea cx,[si+2] ; cx = __InitTextStart wrt HMA_TEXT mov di,si shr cx,1 rep movsw diff -ruNp old/kernel/main.c new/kernel/main.c --- old/kernel/main.c 2004-04-14 10:50:34.000000000 +0000 +++ new/kernel/main.c 2004-04-22 20:50:14.000000000 +0000 @@ -363,11 +363,8 @@ STATIC VOID FsConfig(VOID) STATIC VOID signon() { - printf("\r%S", MK_FP(FP_SEG(LoL), FP_OFF(LoL->os_release))); - - printf("Kernel compatibility %d.%d - ", MAJOR_RELEASE, MINOR_RELEASE); - - printf( + printf("\r%S" + "Kernel compatibility %d.%d - " #if defined(__BORLANDC__) "BORLANDC" #elif defined(__TURBOC__) @@ -391,7 +388,10 @@ STATIC VOID signon() #ifdef WITHFAT32 " - FAT32 support" #endif - "\n\n%S", (void FAR *)copyright); + "\n\n%S", + MK_FP(FP_SEG(LoL), FP_OFF(LoL->os_release)), + MAJOR_RELEASE, MINOR_RELEASE, + (void FAR *)copyright); } STATIC void kernel()------------------------------------------------------- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg=12297 _______________________________________________ Freedos-kernel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-kernel
--- End Message ---
