--- doscmd/Makefile 2009-12-10 08:10:45.000000000 -0800 +++ doscmd/Makefile 2011-08-26 10:00:24.000000000 -0700 @@ -6,11 +6,10 @@ # PORTNAME= doscmd -PORTVERSION= 20040330 -PORTREVISION= 3 +PORTVERSION= 20110826 CATEGORIES= emulators -MASTER_SITES= ${MASTER_SITE_LOCAL} -MASTER_SITE_SUBDIR= des +MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} +MASTER_SITE_SUBDIR= doscmd MAINTAINER= shurd@sasktel.net COMMENT= DOS emulator @@ -27,4 +26,12 @@ MAN1= doscmd.1 MANCOMPRESSED= yes +post-install: + @${ECHO_MSG} NOTE: + @${ECHO_MSG} ===== + @${ECHO_MSG} For security reasons, FreeBSD no longer allows mmap\(\) at zero. + @${ECHO_MSG} To remove this security protection and allow doscmd to work, you will need + @${ECHO_MSG} to set sysctl security.bsd.map_at_zero=1 either before running doscmd or + @${ECHO_MSG} in /etc/sysctl.conf. + .include --- doscmd/distinfo 2006-01-22 01:47:18.000000000 -0800 +++ doscmd/distinfo 2011-08-26 09:57:50.000000000 -0700 @@ -1,3 +1,2 @@ -MD5 (doscmd-20040330.tar.gz) = 41945d5b433c6dda3aec719ecb7bae13 -SHA256 (doscmd-20040330.tar.gz) = 8903166dda822457cf561f1b0f0cd27bec32e9a3dd422340be5dddfa66ec684a -SIZE (doscmd-20040330.tar.gz) = 183364 +SHA256 (doscmd-20110826.tar.gz) = bc9187427b381bf0c8aa2e07362db36ebe3582a855a7f1e08bb159d9707feaba +SIZE (doscmd-20110826.tar.gz) = 189004 --- doscmd/files/patch-8.x 2009-12-08 05:46:40.000000000 -0800 +++ doscmd/files/patch-8.x 1969-12-31 16:00:00.000000000 -0800 @@ -1,629 +0,0 @@ -diff -rc ../../work.old/doscmd-20040330/dos.h ./dos.h -*** ../../work.old/doscmd-20040330/dos.h Mon Mar 29 14:00:00 2004 ---- ./dos.h Tue Sep 15 16:22:30 2009 -*************** -*** 118,165 **** - * use the first 21 bytes. - */ - typedef struct { -! u_char drive __attribute__ ((packed)); -! u_char pattern[11] __attribute__ ((packed)); -! u_char flag __attribute__ ((packed)); -! u_char reserved1[4] __attribute__ ((packed)); -! search_t *searchptr __attribute__ ((packed)); -! u_char attr __attribute__ ((packed)); -! u_short time __attribute__ ((packed)); -! u_short date __attribute__ ((packed)); -! u_long size __attribute__ ((packed)); -! u_char name[13] __attribute__ ((packed)); -! }/* __attribute__((__packed__))*/ find_block_t; - - /* - * DOS directory entry structure - */ - typedef struct { -! u_char name[8] __attribute__ ((packed)); -! u_char ext[3] __attribute__ ((packed)); -! u_char attr __attribute__ ((packed)); -! u_char reserved[10] __attribute__ ((packed)); -! u_short time __attribute__ ((packed)); -! u_short date __attribute__ ((packed)); -! u_short start __attribute__ ((packed)); -! u_long size __attribute__ ((packed)); -! } dosdir_t; - - /* - * The Current Drive Structure - */ - typedef struct { -! u_char path[0x43] __attribute__ ((packed)); -! u_short flag __attribute__ ((packed)); -! u_short dpb_off __attribute__ ((packed)); -! u_short dpb_seg __attribute__ ((packed)); -! u_short redirector_off __attribute__ ((packed)); -! u_short redirector_seg __attribute__ ((packed)); -! u_char paramter_int21[2] __attribute__ ((packed)); -! u_short offset __attribute__ ((packed)); -! u_char dummy __attribute__ ((packed)); -! u_char ifs_driver[4] __attribute__ ((packed)); -! u_char dummy2[2] __attribute__ ((packed)); -! }/* __attribute__((__packed__))*/ CDS; - - #define CDS_remote 0x8000 - #define CDS_ready 0x4000 ---- 118,165 ---- - * use the first 21 bytes. - */ - typedef struct { -! u_char drive; -! u_char pattern[11]; -! u_char flag; -! u_char reserved1[4]; -! search_t *searchptr; -! u_char attr; -! u_short time; -! u_short date; -! u_long size; -! u_char name[13]; -! } __attribute__((packed)) find_block_t; - - /* - * DOS directory entry structure - */ - typedef struct { -! u_char name[8]; -! u_char ext[3]; -! u_char attr; -! u_char reserved[10]; -! u_short time; -! u_short date; -! u_short start; -! u_long size; -! } __attribute__((packed)) dosdir_t; - - /* - * The Current Drive Structure - */ - typedef struct { -! u_char path[0x43]; -! u_short flag; -! u_short dpb_off; -! u_short dpb_seg; -! u_short redirector_off; -! u_short redirector_seg; -! u_char paramter_int21[2]; -! u_short offset; -! u_char dummy; -! u_char ifs_driver[4]; -! u_char dummy2[2]; -! } __attribute__((packed)) CDS; - - #define CDS_remote 0x8000 - #define CDS_ready 0x4000 -*************** -*** 172,333 **** - * The List of Lists (used to get the CDS and a few other numbers) - */ - typedef struct { -! u_char dummy1[0x16] __attribute__ ((packed)); -! u_short cds_offset __attribute__ ((packed)); -! u_short cds_seg __attribute__ ((packed)); -! u_char dummy2[6] __attribute__ ((packed)); -! u_char numberbdev __attribute__ ((packed)); -! u_char lastdrive __attribute__ ((packed)); -! } LOL; - - /* - * The System File Table - */ - typedef struct { -! /*00*/ u_short nfiles __attribute__ ((packed)); /* Number file handles referring to this file */ -! /*02*/ u_short open_mode __attribute__ ((packed)); /* Open mode (bit 15 -> by FCB) */ -! /*04*/ u_char attribute __attribute__ ((packed)); -! /*05*/ u_short info __attribute__ ((packed)); /* 15 -> remote, 14 -> dont set date */ -! /*07*/ u_char ddr_dpb[4] __attribute__ ((packed)); /* Device Driver Header/Drive Paramter Block */ -! /*0b*/ u_short fd __attribute__ ((packed)); -! /*0d*/ u_short time __attribute__ ((packed)); -! /*0f*/ u_short date __attribute__ ((packed)); -! /*11*/ u_long size __attribute__ ((packed)); -! /*15*/ u_long offset __attribute__ ((packed)); -! /*19*/ u_short rel_cluster __attribute__ ((packed)); -! /*1b*/ u_short abs_cluster __attribute__ ((packed)); -! /*1d*/ u_char dir_sector[2] __attribute__ ((packed)); -! /*1f*/ u_char dir_entry __attribute__ ((packed)); -! /*20*/ u_char name[8] __attribute__ ((packed)); -! /*28*/ u_char ext[3] __attribute__ ((packed)); -! /*2b*/ u_char sharesft[4] __attribute__ ((packed)); -! /*2f*/ u_char sharenet[2] __attribute__ ((packed)); -! /*31*/ u_short psp __attribute__ ((packed)); -! /*33*/ u_char share_off[2] __attribute__ ((packed)); -! /*35*/ u_char local_end[2] __attribute__ ((packed)); -! /*37*/ u_char ifd_driver[4] __attribute__ ((packed)); -! } /*__attribute__((__packed__))*/ SFT; - - /* - * Format of PCDOS 4.01 swappable data area - * (Sorry, but you need a wide screen to make this look nice) - */ - typedef struct { -! u_char err_crit __attribute__ ((packed)); /* 00h BYTE critical error flag */ -! u_char InDOS __attribute__ ((packed)); /* 01h BYTE InDOS flag (count of active INT 21 calls) */ -! u_char err_drive __attribute__ ((packed)); /* 02h BYTE ??? drive number or FFh */ -! u_char err_locus __attribute__ ((packed)); /* 03h BYTE locus of last error */ -! u_short err_code __attribute__ ((packed)); /* 04h WORD extended error code of last error */ -! u_char err_suggest __attribute__ ((packed)); /* 06h BYTE suggested action for last error */ -! u_char err_class __attribute__ ((packed)); /* 07h BYTE class of last error */ -! u_short err_di __attribute__ ((packed)); -! u_short err_es __attribute__ ((packed)); /* 08h DWORD ES:DI pointer for last error */ -! u_short dta_off __attribute__ ((packed)); -! u_short dta_seg __attribute__ ((packed)); /* 0Ch DWORD current DTA */ -! u_short psp __attribute__ ((packed)); /* 10h WORD current PSP */ -! u_short int_23_sp __attribute__ ((packed)); /* 12h WORD stores SP across an INT 23 */ -! u_short wait_status __attribute__ ((packed)); /* 14h WORD return code from last process termination (set to 0 after reading with AH=4Dh) */ -! u_char current_drive __attribute__ ((packed)); /* 16h BYTE current drive */ -! u_char break_flag __attribute__ ((packed)); /* 17h BYTE extended break flag */ -! u_char unknown1[2] __attribute__ ((packed)); /* 18h 2 BYTEs ??? */ -! u_short int_21_ax __attribute__ ((packed)); /* 1Ah WORD value of AX on call to INT 21 */ -! u_short net_psp __attribute__ ((packed)); /* 1Ch WORD PSP segment for sharing/network */ -! u_short net_number __attribute__ ((packed)); /* 1Eh WORD network machine number for sharing/network (0000h = us) */ -! u_short first_mem __attribute__ ((packed)); /* 20h WORD first usable memory block found when allocating memory */ -! u_short best_mem __attribute__ ((packed)); /* 22h WORD best usable memory block found when allocating memory */ -! u_short last_mem __attribute__ ((packed)); /* 24h WORD last usable memory block found when allocating memory */ -! u_char unknown[10] __attribute__ ((packed)); /* 26h 2 BYTEs ??? (don't seem to be referenced) */ -! u_char monthday __attribute__ ((packed)); /* 30h BYTE day of month */ -! u_char month __attribute__ ((packed)); /* 31h BYTE month */ -! u_short year __attribute__ ((packed)); /* 32h WORD year - 1980 */ -! u_short days __attribute__ ((packed)); /* 34h WORD number of days since 1-1-1980 */ -! u_char weekday __attribute__ ((packed)); /* 36h BYTE day of week (0 = Sunday) */ -! u_char unknown2[3] __attribute__ ((packed)); /* 37h BYTE ??? */ -! u_char ddr_head[30] __attribute__ ((packed)); /* 38h 30 BYTEs device driver request header */ -! u_short ddre_ip __attribute__ ((packed)); -! u_short ddre_cs __attribute__ ((packed)); /* 58h DWORD pointer to device driver entry point (used in calling driver) */ -! u_char ddr_head2[22] __attribute__ ((packed)); /* 5Ch 22 BYTEs device driver request header */ -! u_char ddr_head3[30] __attribute__ ((packed)); /* 72h 30 BYTEs device driver request header */ -! u_char unknown3[6] __attribute__ ((packed)); /* 90h 6 BYTEs ??? */ -! u_char clock_xfer[6] __attribute__ ((packed)); /* 96h 6 BYTEs CLOCK$ transfer record (see AH=52h) */ -! u_char unknown4[2] __attribute__ ((packed)); /* 9Ch 2 BYTEs ??? */ -! u_char filename1[128] __attribute__ ((packed)); /* 9Eh 128 BYTEs buffer for filename */ -! u_char filename2[128] __attribute__ ((packed)); /* 11Eh 128 BYTEs buffer for filename */ -! u_char findfirst[21] __attribute__ ((packed)); /* 19Eh 21 BYTEs findfirst/findnext search data block (see AH=4Eh) */ -! u_char foundentry[32] __attribute__ ((packed)); /* 1B3h 32 BYTEs directory entry for found file */ -! u_char cds[88] __attribute__ ((packed)); /* 1D3h 88 BYTEs copy of current directory structure for drive being accessed */ -! u_char fcbname[11] __attribute__ ((packed)); /* 22Bh 11 BYTEs ??? FCB-format filename */ -! u_char unknown5 __attribute__ ((packed)); /* 236h BYTE ??? */ -! u_char wildcard[11] __attribute__ ((packed)); /* 237h 11 BYTEs wildcard destination specification for rename (FCB format) */ -! u_char unknown6[11] __attribute__ ((packed)); /* 242h 2 BYTEs ??? */ -! u_char attrmask __attribute__ ((packed)); /* 24Dh BYTE attribute mask for directory search??? */ -! u_char open_mode __attribute__ ((packed)); /* 24Eh BYTE open mode */ -! u_char unknown7[3] __attribute__ ((packed)); /* 24fh BYTE ??? */ -! u_char virtual_dos __attribute__ ((packed)); /* 252h BYTE flag indicating how DOS function was invoked (00h = direct INT 20/INT 21, FFh = server call AX=5D00h) */ -! u_char unknown8[9] __attribute__ ((packed)); /* 253h BYTE ??? */ -! u_char term_type __attribute__ ((packed)); /* 25Ch BYTE type of process termination (00h-03h) */ -! u_char unknown9[3] __attribute__ ((packed)); /* 25Dh BYTE ??? */ -! u_short dpb_off __attribute__ ((packed)); -! u_short dpb_seg __attribute__ ((packed)); /* 260h DWORD pointer to Drive Parameter Block for critical error invocation */ -! u_short int21_sf_off __attribute__ ((packed)); -! u_short int21_sf_seg __attribute__ ((packed)); /* 264h DWORD pointer to stack frame containing user registers on INT 21 */ -! u_short store_sp __attribute__ ((packed)); /* 268h WORD stores SP??? */ -! u_short dosdpb_off __attribute__ ((packed)); -! u_short dosdpb_seg __attribute__ ((packed)); /* 26Ah DWORD pointer to DOS Drive Parameter Block for ??? */ -! u_short disk_buf_seg __attribute__ ((packed)); /* 26Eh WORD segment of disk buffer */ -! u_short unknown10[4] __attribute__ ((packed)); /* 270h WORD ??? */ -! u_char media_id __attribute__ ((packed)); /* 278h BYTE Media ID byte returned by AH=1Bh,1Ch */ -! u_char unknown11 __attribute__ ((packed)); /* 279h BYTE ??? (doesn't seem to be referenced) */ -! u_short unknown12[2] __attribute__ ((packed)); /* 27Ah DWORD pointer to ??? */ -! u_short sft_off __attribute__ ((packed)); -! u_short sft_seg __attribute__ ((packed)); /* 27Eh DWORD pointer to current SFT */ -! u_short cds_off __attribute__ ((packed)); -! u_short cds_seg __attribute__ ((packed)); /* 282h DWORD pointer to current directory structure for drive being accessed */ -! u_short fcb_off __attribute__ ((packed)); -! u_short fcb_seg __attribute__ ((packed)); /* 286h DWORD pointer to caller's FCB */ -! u_short unknown13[2] __attribute__ ((packed)); /* 28Ah WORD ??? */ -! u_short jft_off __attribute__ ((packed)); -! u_short jft_seg __attribute__ ((packed)); /* 28Eh DWORD pointer to a JFT entry in process handle table (see AH=26h) */ -! u_short filename1_off __attribute__ ((packed)); /* 292h WORD offset in DOS CS of first filename argument */ -! u_short filename2_off __attribute__ ((packed)); /* 294h WORD offset in DOS CS of second filename argument */ -! u_short unknown14[12] __attribute__ ((packed)); /* 296h WORD ??? */ -! u_short file_offset_lo __attribute__ ((packed)); -! u_short file_offset_hi __attribute__ ((packed)); /* 2AEh DWORD offset in file??? */ -! u_short unknown15 __attribute__ ((packed)); /* 2B2h WORD ??? */ -! u_short partial_bytes __attribute__ ((packed)); /* 2B4h WORD bytes in partial sector */ -! u_short number_sectors __attribute__ ((packed)); /* 2B6h WORD number of sectors */ -! u_short unknown16[3] __attribute__ ((packed)); /* 2B8h WORD ??? */ -! u_short nbytes_lo __attribute__ ((packed)); -! u_short nbytes_hi __attribute__ ((packed)); /* 2BEh DWORD number of bytes appended to file */ -! u_short qpdb_off __attribute__ ((packed)); -! u_short qpdb_seg __attribute__ ((packed)); /* 2C2h DWORD pointer to ??? disk buffer */ -! u_short asft_off __attribute__ ((packed)); -! u_short asft_seg __attribute__ ((packed)); /* 2C6h DWORD pointer to ??? SFT */ -! u_short int21_bx __attribute__ ((packed)); /* 2CAh WORD used by INT 21 dispatcher to store caller's BX */ -! u_short int21_ds __attribute__ ((packed)); /* 2CCh WORD used by INT 21 dispatcher to store caller's DS */ -! u_short temporary __attribute__ ((packed)); /* 2CEh WORD temporary storage while saving/restoring caller's registers */ -! u_short prevcall_off __attribute__ ((packed)); -! u_short prevcall_seg __attribute__ ((packed)); /* 2D0h DWORD pointer to prev call frame (offset 264h) if INT 21 reentered also switched to for duration of INT 24 */ -! u_char unknown17[9] __attribute__ ((packed)); /* 2D4h WORD ??? */ -! u_short ext_action __attribute__ ((packed)); /* 2DDh WORD multipurpose open action */ -! u_short ext_attr __attribute__ ((packed)); /* 2DFh WORD multipurpose attribute */ -! u_short ext_mode __attribute__ ((packed)); /* 2E1h WORD multipurpose mode */ -! u_char unknown17a[9] __attribute__ ((packed)); -! u_short lol_ds __attribute__ ((packed)); /* 2ECh WORD stores DS during call to [List-of-Lists + 37h] */ -! u_char unknown18[5] __attribute__ ((packed)); /* 2EEh WORD ??? */ -! u_char usernameptr[4] __attribute__ ((packed)); /* 2F3h DWORD pointer to user-supplied filename */ -! u_char unknown19[4] __attribute__ ((packed)); /* 2F7h DWORD pointer to ??? */ -! u_char lol_ss[2] __attribute__ ((packed)); /* 2FBh WORD stores SS during call to [List-of-Lists + 37h] */ -! u_char lol_sp[2] __attribute__ ((packed)); /* 2FDh WORD stores SP during call to [List-of-Lists + 37h] */ -! u_char lol_flag __attribute__ ((packed)); /* 2FFh BYTE flag, nonzero if stack switched in calling [List-of-Lists+37h] */ -! u_char searchdata[21] __attribute__ ((packed)); /* 300h 21 BYTEs FindFirst search data for source file(s) of a rename operation (see AH=4Eh) */ -! u_char renameentry[32] __attribute__ ((packed)); /* 315h 32 BYTEs directory entry for file being renamed */ -! u_char errstack[331] __attribute__ ((packed)); /* 335h 331 BYTEs critical error stack */ -! u_char diskstack[384] __attribute__ ((packed)); /* 480h 384 BYTEs disk stack (functions greater than 0Ch, INT 25, INT 26) */ -! u_char iostack[384] __attribute__ ((packed)); /* 600h 384 BYTEs character I/O stack (functions 01h through 0Ch) */ -! u_char int_21_08_flag __attribute__ ((packed)); /* 780h BYTE flag affecting AH=08h (see AH=64h) */ -! u_char unknown20[11] __attribute__ ((packed)); /* 781h BYTE ??? looks like a drive number */ -! } /*__attribute__((__packed__))*/ SDA; - - struct exehdr { - u_short magic; ---- 172,333 ---- - * The List of Lists (used to get the CDS and a few other numbers) - */ - typedef struct { -! u_char dummy1[0x16]; -! u_short cds_offset; -! u_short cds_seg; -! u_char dummy2[6]; -! u_char numberbdev; -! u_char lastdrive; -! } __attribute__((packed)) LOL; - - /* - * The System File Table - */ - typedef struct { -! /*00*/ u_short nfiles; /* Number file handles referring to this file */ -! /*02*/ u_short open_mode; /* Open mode (bit 15 -> by FCB) */ -! /*04*/ u_char attribute; -! /*05*/ u_short info; /* 15 -> remote, 14 -> dont set date */ -! /*07*/ u_char ddr_dpb[4]; /* Device Driver Header/Drive Paramter Block */ -! /*0b*/ u_short fd; -! /*0d*/ u_short time; -! /*0f*/ u_short date; -! /*11*/ u_long size; -! /*15*/ u_long offset; -! /*19*/ u_short rel_cluster; -! /*1b*/ u_short abs_cluster; -! /*1d*/ u_char dir_sector[2]; -! /*1f*/ u_char dir_entry; -! /*20*/ u_char name[8]; -! /*28*/ u_char ext[3]; -! /*2b*/ u_char sharesft[4]; -! /*2f*/ u_char sharenet[2]; -! /*31*/ u_short psp; -! /*33*/ u_char share_off[2]; -! /*35*/ u_char local_end[2]; -! /*37*/ u_char ifd_driver[4]; -! } __attribute__((packed)) SFT; - - /* - * Format of PCDOS 4.01 swappable data area - * (Sorry, but you need a wide screen to make this look nice) - */ - typedef struct { -! u_char err_crit; /* 00h BYTE critical error flag */ -! u_char InDOS; /* 01h BYTE InDOS flag (count of active INT 21 calls) */ -! u_char err_drive; /* 02h BYTE ??? drive number or FFh */ -! u_char err_locus; /* 03h BYTE locus of last error */ -! u_short err_code; /* 04h WORD extended error code of last error */ -! u_char err_suggest; /* 06h BYTE suggested action for last error */ -! u_char err_class; /* 07h BYTE class of last error */ -! u_short err_di; -! u_short err_es; /* 08h DWORD ES:DI pointer for last error */ -! u_short dta_off; -! u_short dta_seg; /* 0Ch DWORD current DTA */ -! u_short psp; /* 10h WORD current PSP */ -! u_short int_23_sp; /* 12h WORD stores SP across an INT 23 */ -! u_short wait_status; /* 14h WORD return code from last process termination (set to 0 after reading with AH=4Dh) */ -! u_char current_drive; /* 16h BYTE current drive */ -! u_char break_flag; /* 17h BYTE extended break flag */ -! u_char unknown1[2]; /* 18h 2 BYTEs ??? */ -! u_short int_21_ax; /* 1Ah WORD value of AX on call to INT 21 */ -! u_short net_psp; /* 1Ch WORD PSP segment for sharing/network */ -! u_short net_number; /* 1Eh WORD network machine number for sharing/network (0000h = us) */ -! u_short first_mem; /* 20h WORD first usable memory block found when allocating memory */ -! u_short best_mem; /* 22h WORD best usable memory block found when allocating memory */ -! u_short last_mem; /* 24h WORD last usable memory block found when allocating memory */ -! u_char unknown[10]; /* 26h 2 BYTEs ??? (don't seem to be referenced) */ -! u_char monthday; /* 30h BYTE day of month */ -! u_char month; /* 31h BYTE month */ -! u_short year; /* 32h WORD year - 1980 */ -! u_short days; /* 34h WORD number of days since 1-1-1980 */ -! u_char weekday; /* 36h BYTE day of week (0 = Sunday) */ -! u_char unknown2[3]; /* 37h BYTE ??? */ -! u_char ddr_head[30]; /* 38h 30 BYTEs device driver request header */ -! u_short ddre_ip; -! u_short ddre_cs; /* 58h DWORD pointer to device driver entry point (used in calling driver) */ -! u_char ddr_head2[22]; /* 5Ch 22 BYTEs device driver request header */ -! u_char ddr_head3[30]; /* 72h 30 BYTEs device driver request header */ -! u_char unknown3[6]; /* 90h 6 BYTEs ??? */ -! u_char clock_xfer[6]; /* 96h 6 BYTEs CLOCK$ transfer record (see AH=52h) */ -! u_char unknown4[2]; /* 9Ch 2 BYTEs ??? */ -! u_char filename1[128]; /* 9Eh 128 BYTEs buffer for filename */ -! u_char filename2[128]; /* 11Eh 128 BYTEs buffer for filename */ -! u_char findfirst[21]; /* 19Eh 21 BYTEs findfirst/findnext search data block (see AH=4Eh) */ -! u_char foundentry[32]; /* 1B3h 32 BYTEs directory entry for found file */ -! u_char cds[88]; /* 1D3h 88 BYTEs copy of current directory structure for drive being accessed */ -! u_char fcbname[11]; /* 22Bh 11 BYTEs ??? FCB-format filename */ -! u_char unknown5; /* 236h BYTE ??? */ -! u_char wildcard[11]; /* 237h 11 BYTEs wildcard destination specification for rename (FCB format) */ -! u_char unknown6[11]; /* 242h 2 BYTEs ??? */ -! u_char attrmask; /* 24Dh BYTE attribute mask for directory search??? */ -! u_char open_mode; /* 24Eh BYTE open mode */ -! u_char unknown7[3]; /* 24fh BYTE ??? */ -! u_char virtual_dos; /* 252h BYTE flag indicating how DOS function was invoked (00h = direct INT 20/INT 21, FFh = server call AX=5D00h) */ -! u_char unknown8[9]; /* 253h BYTE ??? */ -! u_char term_type; /* 25Ch BYTE type of process termination (00h-03h) */ -! u_char unknown9[3]; /* 25Dh BYTE ??? */ -! u_short dpb_off; -! u_short dpb_seg; /* 260h DWORD pointer to Drive Parameter Block for critical error invocation */ -! u_short int21_sf_off; -! u_short int21_sf_seg; /* 264h DWORD pointer to stack frame containing user registers on INT 21 */ -! u_short store_sp; /* 268h WORD stores SP??? */ -! u_short dosdpb_off; -! u_short dosdpb_seg; /* 26Ah DWORD pointer to DOS Drive Parameter Block for ??? */ -! u_short disk_buf_seg; /* 26Eh WORD segment of disk buffer */ -! u_short unknown10[4]; /* 270h WORD ??? */ -! u_char media_id; /* 278h BYTE Media ID byte returned by AH=1Bh,1Ch */ -! u_char unknown11; /* 279h BYTE ??? (doesn't seem to be referenced) */ -! u_short unknown12[2]; /* 27Ah DWORD pointer to ??? */ -! u_short sft_off; -! u_short sft_seg; /* 27Eh DWORD pointer to current SFT */ -! u_short cds_off; -! u_short cds_seg; /* 282h DWORD pointer to current directory structure for drive being accessed */ -! u_short fcb_off; -! u_short fcb_seg; /* 286h DWORD pointer to caller's FCB */ -! u_short unknown13[2]; /* 28Ah WORD ??? */ -! u_short jft_off; -! u_short jft_seg; /* 28Eh DWORD pointer to a JFT entry in process handle table (see AH=26h) */ -! u_short filename1_off; /* 292h WORD offset in DOS CS of first filename argument */ -! u_short filename2_off; /* 294h WORD offset in DOS CS of second filename argument */ -! u_short unknown14[12]; /* 296h WORD ??? */ -! u_short file_offset_lo; -! u_short file_offset_hi; /* 2AEh DWORD offset in file??? */ -! u_short unknown15; /* 2B2h WORD ??? */ -! u_short partial_bytes; /* 2B4h WORD bytes in partial sector */ -! u_short number_sectors; /* 2B6h WORD number of sectors */ -! u_short unknown16[3]; /* 2B8h WORD ??? */ -! u_short nbytes_lo; -! u_short nbytes_hi; /* 2BEh DWORD number of bytes appended to file */ -! u_short qpdb_off; -! u_short qpdb_seg; /* 2C2h DWORD pointer to ??? disk buffer */ -! u_short asft_off; -! u_short asft_seg; /* 2C6h DWORD pointer to ??? SFT */ -! u_short int21_bx; /* 2CAh WORD used by INT 21 dispatcher to store caller's BX */ -! u_short int21_ds; /* 2CCh WORD used by INT 21 dispatcher to store caller's DS */ -! u_short temporary; /* 2CEh WORD temporary storage while saving/restoring caller's registers */ -! u_short prevcall_off; -! u_short prevcall_seg; /* 2D0h DWORD pointer to prev call frame (offset 264h) if INT 21 reentered also switched to for duration of INT 24 */ -! u_char unknown17[9]; /* 2D4h WORD ??? */ -! u_short ext_action; /* 2DDh WORD multipurpose open action */ -! u_short ext_attr; /* 2DFh WORD multipurpose attribute */ -! u_short ext_mode; /* 2E1h WORD multipurpose mode */ -! u_char unknown17a[9]; -! u_short lol_ds; /* 2ECh WORD stores DS during call to [List-of-Lists + 37h] */ -! u_char unknown18[5]; /* 2EEh WORD ??? */ -! u_char usernameptr[4]; /* 2F3h DWORD pointer to user-supplied filename */ -! u_char unknown19[4]; /* 2F7h DWORD pointer to ??? */ -! u_char lol_ss[2]; /* 2FBh WORD stores SS during call to [List-of-Lists + 37h] */ -! u_char lol_sp[2]; /* 2FDh WORD stores SP during call to [List-of-Lists + 37h] */ -! u_char lol_flag; /* 2FFh BYTE flag, nonzero if stack switched in calling [List-of-Lists+37h] */ -! u_char searchdata[21]; /* 300h 21 BYTEs FindFirst search data for source file(s) of a rename operation (see AH=4Eh) */ -! u_char renameentry[32]; /* 315h 32 BYTEs directory entry for file being renamed */ -! u_char errstack[331]; /* 335h 331 BYTEs critical error stack */ -! u_char diskstack[384]; /* 480h 384 BYTEs disk stack (functions greater than 0Ch, INT 25, INT 26) */ -! u_char iostack[384]; /* 600h 384 BYTEs character I/O stack (functions 01h through 0Ch) */ -! u_char int_21_08_flag; /* 780h BYTE flag affecting AH=08h (see AH=64h) */ -! u_char unknown20[11]; /* 781h BYTE ??? looks like a drive number */ -! } __attribute__((packed)) SDA; - - struct exehdr { - u_short magic; -Only in .: dos.h.orig -diff -rc ../../work.old/doscmd-20040330/ems.h ./ems.h -*** ../../work.old/doscmd-20040330/ems.h Mon Mar 29 14:00:00 2004 ---- ./ems.h Tue Sep 15 16:24:00 2009 -*************** -*** 242,250 **** - */ - - typedef struct { -! u_short handle __attribute__ ((packed)); /* handle */ -! u_short npages __attribute__ ((packed)); /* pages allocated */ -! } EMShandlepage; - - /* - * EMS map/unmap multiple, only used to pass information to and from ---- 242,250 ---- - */ - - typedef struct { -! u_short handle; /* handle */ -! u_short npages; /* pages allocated */ -! } __attribute__((packed)) EMShandlepage; - - /* - * EMS map/unmap multiple, only used to pass information to and from -*************** -*** 252,261 **** - */ - - typedef struct { -! u_short log __attribute__ ((packed)); /* logical page number */ -! u_short phys __attribute__ ((packed)); /* physical page (position) or - segment address inside frame */ -! } EMSmapunmap; - - /* - * EMS handle directory, only used to pass information to and from ---- 252,261 ---- - */ - - typedef struct { -! u_short log; /* logical page number */ -! u_short phys; /* physical page (position) or - segment address inside frame */ -! } __attribute__ ((packed)) EMSmapunmap; - - /* - * EMS handle directory, only used to pass information to and from -*************** -*** 263,272 **** - */ - - typedef struct { -! u_short log __attribute__ ((packed)); /* logical page number */ -! Hname name __attribute__ ((packed)); /* Handle name */ - -! } EMShandledir; - - /* - * Structure for get/set page map: This structure is used to save and ---- 263,272 ---- - */ - - typedef struct { -! u_short log; /* logical page number */ -! Hname name; /* Handle name */ - -! } __attribute__ ((packed)) EMShandledir; - - /* - * Structure for get/set page map: This structure is used to save and -*************** -*** 287,295 **** - */ - - typedef struct { -! u_short segm __attribute__ ((packed)); /* segment address inside frame */ -! u_short phys __attribute__ ((packed)); /* physical page (position) */ -! } EMSaddrarray; - - /* - * EMS move memory call structure, only used to pass information to and from ---- 287,295 ---- - */ - - typedef struct { -! u_short segm; /* segment address inside frame */ -! u_short phys; /* physical page (position) */ -! } __attribute__ ((packed)) EMSaddrarray; - - /* - * EMS move memory call structure, only used to pass information to and from -*************** -*** 297,313 **** - */ - - typedef struct { -! u_long length __attribute__ ((packed)); /* length of region */ - #define EMS_MOVE_CONV 0 - #define EMS_MOVE_EMS 1 -! u_char src_type __attribute__ ((packed)); /* source type (0,1) */ -! u_short src_handle __attribute__ ((packed)); /* source handle */ -! u_short src_offset __attribute__ ((packed)); /* source offset */ -! u_short src_seg __attribute__ ((packed)); /* source type */ -! u_char dst_type __attribute__ ((packed)); /* destination type (0,1) */ -! u_short dst_handle __attribute__ ((packed)); /* destination handle */ -! u_short dst_offset __attribute__ ((packed)); /* destination offset */ -! u_short dst_seg __attribute__ ((packed)); /* destination type */ -! } EMSmovemem; - - #endif /* EMS_H */ ---- 297,313 ---- - */ - - typedef struct { -! u_long length; /* length of region */ - #define EMS_MOVE_CONV 0 - #define EMS_MOVE_EMS 1 -! u_char src_type; /* source type (0,1) */ -! u_short src_handle; /* source handle */ -! u_short src_offset; /* source offset */ -! u_short src_seg; /* source type */ -! u_char dst_type; /* destination type (0,1) */ -! u_short dst_handle; /* destination handle */ -! u_short dst_offset; /* destination offset */ -! u_short dst_seg; /* destination type */ -! } __attribute__ ((packed)) EMSmovemem; - - #endif /* EMS_H */ -diff -rc ../../work.old/doscmd-20040330/int14.c ./int14.c -*** ../../work.old/doscmd-20040330/int14.c Tue Sep 15 16:26:36 2009 ---- ./int14.c Tue Sep 15 16:25:04 2009 -*************** -*** 636,642 **** - "com_set_line: going with cflag 0x%X iflag 0x%X speed %d.\n", - cdsp->tty.c_cflag, cdsp->tty.c_iflag, speed); - div_lo = (115200 / spd) & 0x00ff; -! div_hi = (115200 / spd) & 0xff00; - cdsp->div_latch[DIV_LATCH_LOW] = div_lo; - cdsp->div_latch[DIV_LATCH_HIGH] = div_hi; - errno = 0; ---- 636,642 ---- - "com_set_line: going with cflag 0x%X iflag 0x%X speed %d.\n", - cdsp->tty.c_cflag, cdsp->tty.c_iflag, speed); - div_lo = (115200 / spd) & 0x00ff; -! div_hi = ((115200 / spd) & 0xff00) >> 8; - cdsp->div_latch[DIV_LATCH_LOW] = div_lo; - cdsp->div_latch[DIV_LATCH_HIGH] = div_hi; - errno = 0; -diff -rc ../../work.old/doscmd-20040330/xms.h ./xms.h -*** ../../work.old/doscmd-20040330/xms.h Mon Mar 29 14:00:00 2004 ---- ./xms.h Tue Sep 15 16:26:02 2009 -*************** -*** 99,109 **** - - struct EMM { - u_long nbytes; -! u_short src_handle __attribute__ ((packed)); -! u_long src_offset __attribute__ ((packed)); -! u_short dst_handle __attribute__ ((packed)); -! u_long dst_offset __attribute__ ((packed)); -! } ; - - /* - * XMS info structure, only used to pass information to and from ---- 99,109 ---- - - struct EMM { - u_long nbytes; -! u_short src_handle; -! u_long src_offset; -! u_short dst_handle; -! u_long dst_offset; -! } __attribute__ ((packed)); - - /* - * XMS info structure, only used to pass information to and from -*************** -*** 112,121 **** - - struct XMSinfo { - u_char handle; /* the handle */ -! u_char num_locks __attribute__ ((packed)); /* number of locks */ -! u_long size __attribute__ ((packed)); /* size of memory */ -! u_long phys_addr __attribute__ ((packed)); /* "physical" address */ -! }; - - /* - * Handle management inside the emulator for extended memory pages, ---- 112,121 ---- - - struct XMSinfo { - u_char handle; /* the handle */ -! u_char num_locks; /* number of locks */ -! u_long size; /* size of memory */ -! u_long phys_addr; /* "physical" address */ -! } __attribute__ ((packed)); - - /* - * Handle management inside the emulator for extended memory pages, --- doscmd/files/patch-bioscursor 2007-09-23 05:48:46.000000000 -0700 +++ doscmd/files/patch-bioscursor 1969-12-31 16:00:00.000000000 -0800 @@ -1,114 +0,0 @@ ---- /usr/ports/emulators/doscmd/work/doscmd-20040330/tty.c Mon May 1 18:38:07 2006 -+++ tty.c Mon May 1 18:38:51 2006 -@@ -125,6 +125,7 @@ - #define row (CursRow0) - #define col (CursCol0) - -+ - /* Local functions */ - static void _kbd_event(int, int, void *, regcontext_t *); - static void Failure(void *); -@@ -1427,7 +1428,9 @@ - tty_move(int r, int c) - { - row = r; -+ BIOS_CursRow0 = r; - col = c; -+ BIOS_CursCol0 = c; - SetVREGCur(); - } - -@@ -1459,6 +1462,7 @@ - vmem[(height - 1) * width + i] = vattr | ' '; - } - } -+ BIOS_CursRow0 = row; /* Sync back with row */ - SetVREGCur(); - } - -@@ -1489,21 +1493,27 @@ - case 0x08: - if (row > (height - 1) || col > width) - break; -- if (col > 0) -+ if (col > 0) { - --col; -+ BIOS_CursCol0 = col; -+ } - vmem[row * width + col] &= 0xff00; - break; - case '\t': -- if (row > (height - 1)) -+ if (row > (height - 1)) { - row = 0; -+ BIOS_CursRow0 = 0; -+ } - col = (col + 8) & ~0x07; - if (col > width) { - col = 0; - tty_index(1); - } -+ BIOS_CursCol0 = col; - break; - case '\r': - col = 0; -+ BIOS_CursCol0 = col; - break; - case '\n': - tty_index(1); -@@ -1511,10 +1521,13 @@ - default: - if (col >= width) { - col = 0; -+ BIOS_CursCol0 = 0; - tty_index(1); - } -- if (row > (height - 1)) -+ if (row > (height - 1)) { - row = 0; -+ BIOS_CursRow0 = 0; -+ } - if (attr >= 0) - vmem[row * width + col] = attr & 0xff00; - else -@@ -1554,7 +1567,9 @@ - vmem[row * width + col++] |= c; - } - row = srow; -+ BIOS_CursRow0 = srow; - col = scol; -+ BIOS_CursCol0 = scol; - SetVREGCur(); - } - -@@ -1582,7 +1597,9 @@ - col++; - } - row = srow; -+ BIOS_CursRow0 = srow; - col = scol; -+ BIOS_CursCol0 = scol; - SetVREGCur(); - - return; ---- /home/admin/doscmd-20040330/video.c Mon May 1 17:41:16 2006 -+++ video.c Mon May 1 18:08:12 2006 -@@ -167,14 +167,18 @@ - cp &= 0xff; - cp |= value << 8; - row = cp / DpyCols; -+ BIOS_CursRow0 = row; - col = cp % DpyCols; -+ BIOS_CursCol0 = col; - break; - case CRTC_CurLocLo: /* Update cursor position in BIOS */ - cp = row * DpyCols + col; - cp &= 0xff00; - cp |= value; - row = cp / DpyCols; -+ BIOS_CursRow0 = row; - col = cp % DpyCols; -+ BIOS_CursCol0 = col; - break; - default: - debug(D_VIDEO, "VGA: outb 0x%04x, 0x%02x at index 0x%02x\n", --- doscmd/files/patch-desqview-timeslice 2007-09-28 01:13:10.000000000 -0700 +++ doscmd/files/patch-desqview-timeslice 1969-12-31 16:00:00.000000000 -0800 @@ -1,36 +0,0 @@ ---- /usr/ports/emulators/doscmd/work/doscmd-20040330/bios.c Mon Mar 29 16:00:00 2004 -+++ bios.c Mon May 1 18:39:31 2006 -@@ -31,6 +31,7 @@ - */ - - #include -+#include - __FBSDID("$FreeBSD: projects/doscmd/bios.c,v 1.9 2002/03/07 12:52:26 obrien Exp $"); - - #include "doscmd.h" -@@ -110,6 +111,7 @@ - static void - int15(regcontext_t *REGS) - { -+ const struct timespec rqtp={0,1}; - R_FLAGS &= ~PSL_C; - - switch (R_AH) { -@@ -119,6 +121,17 @@ - break; - case 0x04: /* Set ABIOS table */ - R_FLAGS |= PSL_C; /* We don't support it */ -+ break; -+ case 0x10: /* DesqView */ -+ switch (R_AL) { -+ case 0x00: /* Give up CPU time */ -+ nanosleep(&rqtp, NULL); -+ break; -+ case 0x22: /* Get version */ -+ R_BH = 0x0a; /* Use v2.0 for timeslice support */ -+ R_BL = 0x01; -+ break; -+ } - break; - case 0x4f: /* Keyboard intercept */ - debug(D_TRAPS | 0x15, "BIOS: Keyboard intercept\n"); --- doscmd/files/patch-doscmd.1 2007-09-23 05:48:46.000000000 -0700 +++ doscmd/files/patch-doscmd.1 1969-12-31 16:00:00.000000000 -0800 @@ -1,41 +0,0 @@ ---- doscmd.1.orig Tue Mar 30 08:00:00 2004 -+++ doscmd.1 Sun Sep 23 22:46:19 2007 -@@ -38,7 +38,7 @@ - .Nd run a subset of real-mode DOS programs - .Sh SYNOPSIS - .Nm --.Fl 23AbDEfGHIMOPRrtVvXxYz -+.Fl 23AbDEFfGHIMOPQRrtVvXxYz - .Fl c Ar file - .Fl d Ar file - .Fl i Ar port Ns Xo -@@ -139,6 +139,9 @@ - .\" - .\" - .\" -+.It Fl F -+Enables support for FOSSIL IO using stdio. -+.\" - .It Fl G - Enable debugging of the video (graphics) routines. - .\" -@@ -212,6 +215,10 @@ - .Li outb , - etc). - .\" -+.It Fl Q -+Suppresses all video IO. Helps optimize the input behavior especially -+when polling for input. -+.\" - .\" - .\" - .It Fl R -@@ -754,7 +761,7 @@ - and then typing - .Ic make install - in the source directory (normally --.Pa /usr/src/usr.bin/doscmd ) . -+.Pa /usr/ports/emulators/doscmd ) . - For this to work, the X programmer's kit must have been installed. - .Sh AUTHORS - .An Pace Willisson , --- doscmd/files/patch-fossil-support 2007-09-23 05:48:46.000000000 -0700 +++ doscmd/files/patch-fossil-support 1969-12-31 16:00:00.000000000 -0800 @@ -1,409 +0,0 @@ -diff -u /root/doscmd-20040330/bios.c ./bios.c ---- /root/doscmd-20040330/bios.c Fri May 5 19:34:31 2006 -+++ ./bios.c Fri May 5 19:39:27 2006 -@@ -297,7 +297,10 @@ - ivec[0x12] = vec; - register_callback(vec, int12, "int 12"); - -- vec = insert_softint_trampoline(); -+ if(fossil) -+ vec = insert_fossil_softint_trampoline(); -+ else -+ vec = insert_softint_trampoline(); - ivec[0x14] = vec; - register_callback(vec, int14, "int 14"); - -diff -u /root/doscmd-20040330/callback.c ./callback.c ---- /root/doscmd-20040330/callback.c Fri May 5 19:34:31 2006 -+++ ./callback.c Fri May 5 19:39:27 2006 -@@ -76,6 +76,25 @@ - 2, - 0, - }; -+/* -+ * From the FOSSIL spec: -+ * The driver has a "signature" that can be used to determine whether it is -+ * present in memory. At offset 6 in the INT 14h service routine is a word, -+ * 1954h, followed by a byte that specifies the maximum function number -+ * supported by the driver. This is to make it possible to determine when a -+ * driver is present and what level of functionality it provides. -+ */ -+u_char fossil_softint_trampoline[] = { -+ 0xf4, /* HLT */ -+ 0xfb, /* STI */ -+ 0xca, /* RETF 2 */ -+ 2, -+ 0, -+ 0, -+ 0x54, -+ 0x19, -+ 0x1b, /* Max. Supported FOSSIL AH */ -+}; - u_char hardint_trampoline[] = { - 0xf4, /* HLT */ - 0xcf, /* IRET */ -@@ -102,6 +121,13 @@ - { - return (insert_generic_trampoline( - sizeof(softint_trampoline), softint_trampoline)); -+} -+ -+u_long -+insert_fossil_softint_trampoline(void) -+{ -+ return (insert_generic_trampoline( -+ sizeof(fossil_softint_trampoline), fossil_softint_trampoline)); - } - - u_long -diff -u /root/doscmd-20040330/callback.h ./callback.h ---- /root/doscmd-20040330/callback.h Fri May 5 19:34:31 2006 -+++ ./callback.h Fri May 5 19:39:27 2006 -@@ -9,5 +9,6 @@ - callback_t find_callback(u_long); - u_long insert_generic_trampoline(size_t, u_char *); - u_long insert_softint_trampoline(void); -+u_long insert_fossil_softint_trampoline(void); - u_long insert_hardint_trampoline(void); - u_long insert_null_trampoline(void); -diff -u /root/doscmd-20040330/doscmd.c ./doscmd.c ---- /root/doscmd-20040330/doscmd.c Fri May 5 19:34:31 2006 -+++ ./doscmd.c Fri May 5 19:39:27 2006 -@@ -511,7 +511,7 @@ - FILE *fp; - char *col; - -- while ((c = getopt(argc, argv, "234AbCc:Dd:EGHIi:kLMOo:Pp:RrS:TtU:vVxXYz")) != -1) { -+ while ((c = getopt(argc, argv, "234AbCc:Dd:EFGHIi:kLMOo:Pp:RrS:TtU:vVxXYz")) != -1) { - switch (c) { - case '2': - debug_flags |= D_TRAPS2; -@@ -551,6 +551,9 @@ - break; - case 'E': - debug_flags |= D_EXEC; -+ break; -+ case 'F': -+ fossil = 1; - break; - case 'G': - debug_flags |= D_VIDEO; -diff -u /root/doscmd-20040330/doscmd.h ./doscmd.h ---- /root/doscmd-20040330/doscmd.h Fri May 5 19:34:31 2006 -+++ ./doscmd.h Fri May 5 19:39:27 2006 -@@ -224,6 +224,9 @@ - extern int search_floppy(int i); - extern void disk_bios_init(void); - -+/* int14.c */ -+extern int fossil; -+ - /* int16.c */ - void int16(regcontext_t *); - -diff -u /root/doscmd-20040330/int14.c ./int14.c ---- /root/doscmd-20040330/int14.c Fri May 5 19:34:31 2006 -+++ ./int14.c Fri May 5 20:23:09 2006 -@@ -46,6 +46,9 @@ - #include "AsyncIO.h" - #include "com.h" - -+/* exports */ -+int fossil = 0; -+ - #define N_BYTES 1024 - - struct com_data_struct { -@@ -58,7 +61,9 @@ - int ids; /* input data size */ - int ods; /* output data size */ - int emptyint; -+ int fossil_mode; /* FOSSIL has been enabled */ - struct termios tty; -+ unsigned char param; /* Copy of init params */ - unsigned char div_latch[2]; /* mirror of 16550 R0':R1' - read/write */ - unsigned char int_enable; /* mirror of 16550 R1 read/write */ -@@ -257,7 +262,7 @@ - struct com_data_struct *cdsp; - int i; - -- debug(D_PORT, "int14: dl = 0x%02X, al = 0x%02X.\n", R_DL, R_AL); -+ debug(D_PORT, "int14: ah = 0x%02X, dl = 0x%02X, al = 0x%02X.\n", R_AH, R_DL, R_AL); - if (R_DL >= N_COMS_MAX) { - if (vflag) - dump_regs(REGS); -@@ -269,16 +274,31 @@ - case 0x00: /* Initialize Serial Port */ - com_set_line(cdsp, R_DL + 1, R_AL); - R_AH = get_status(cdsp); -- R_AL = 0; -+ if (cdsp->fossil_mode) { -+ R_AL = 0x08; -+ R_AL |= 0x80; -+ } -+ else -+ R_AL = 0; - break; - - case 0x01: /* Write Character */ - if (write_char(cdsp, R_AL)) { -- R_AH = get_status(cdsp); -+ R_AH = get_status(cdsp); -+ if (cdsp->fossil_mode) { -+ R_AL = 0x08; -+ R_AL |= 0x80; -+ } -+ else - R_AL = 0; - } else { -- debug(D_PORT, "int14: lost output character 0x%02x\n", R_AL); -- R_AH = LS_SW_TIME_OUT; -+ debug(D_PORT, "int14: lost output character 0x%02x\n", R_AL); -+ R_AH = LS_SW_TIME_OUT; -+ if (cdsp->fossil_mode) { -+ R_AL = 0x08; -+ R_AL |= 0x80; -+ } -+ else - R_AL = 0; - } - break; -@@ -296,28 +316,193 @@ - - case 0x03: /* Status Request */ - R_AH = get_status(cdsp); -- R_AL = 0; -+ if (cdsp->fossil_mode) { -+ R_AL = 0x08; -+ R_AL |= 0x80; -+ } -+ else -+ R_AL = 0; - break; - - case 0x04: /* Extended Initialization */ -- R_AX = (LS_SW_TIME_OUT) << 8; -+ if (fossil) { -+ cdsp->fossil_mode = 1; -+ R_AX = 0x1954; -+ R_BL = 0x1b; /* Max supported FOSSIL AH */ -+ R_BH = 5; -+ } -+ else -+ R_AX = (LS_SW_TIME_OUT) << 8; - break; - -- case 0x05: /* Modem Control Register operations */ -- switch (R_AH) { -- case 0x00: /* Read Modem Control Register */ -+ case 0x05: /* Modem Control Register operations/FOSSIL deinit */ -+ if (fossil && cdsp->fossil_mode) -+ cdsp->fossil_mode = 0; -+ else { -+ switch (R_AH) { -+ case 0x00: /* Read Modem Control Register */ - R_AX = (LS_SW_TIME_OUT) << 8; - break; - -- case 0x01: /* Write Modem Control Register */ -+ case 0x01: /* Write Modem Control Register */ - R_AX = (LS_SW_TIME_OUT) << 8; - break; - -- default: -+ default: - unknown_int3(0x14, 0x05, R_AL, REGS); - break; -+ } - } - break; -+ -+ case 0x06: /* FOSSIL raise/lower DTR */ -+ if(cdsp->fossil_mode) { -+ switch (R_AL) { -+ case 0: -+ ioctl(cdsp->fd, TIOCCDTR); -+ break; -+ case 1: -+ ioctl(cdsp->fd, TIOCSDTR); -+ break; -+ } -+ break; -+ } -+ -+ case 0x08: /* FOSSIL Flush output buffer */ -+ if(cdsp->fossil_mode) { -+ flush_out(cdsp); -+ break; -+ } -+ -+ case 0x09: /* FOSSIL Purge output buffer */ -+ if(cdsp->fossil_mode) { -+ cdsp->ods = 0; -+ break; -+ } -+ -+ case 0x0a: /* FOSSIL Purge input buffer */ -+ if(cdsp->fossil_mode) { -+ cdsp->ids = 0; -+ break; -+ } -+ -+ case 0x0b: /* FOSSIL Transmit no wait */ -+ if(cdsp->fossil_mode) { -+ if (cdsp->ods < N_BYTES) { -+ if (write_char(cdsp, R_AL)) -+ R_AX = 1; -+ else -+ R_AX = 0; -+ } -+ else -+ R_AX = 0; -+ break; -+ } -+ -+ case 0x0c: /* FOSSIL Non-destructive read-ahead */ -+ if(cdsp->fossil_mode) { -+ if(cdsp->ods) { -+ R_AH = 0; -+ R_AL = cdsp->inbuf[0]; -+ } else -+ R_AX = 0xffff; -+ break; -+ } -+ -+ case 0x0f: /* FOSSIL Set flow control */ -+ if(cdsp->fossil_mode) { -+ if(R_AL & 0x01) /* Enable output Xon/Xoff */ -+ cdsp->tty.c_iflag |= IXON; -+ else -+ cdsp->tty.c_iflag &= ~(IXON); -+ -+ if(R_AL & 0x02) /* Enable CTR/RTS */ -+ cdsp->tty.c_cflag |= CCTS_OFLOW|CRTS_IFLOW; -+ else -+ cdsp->tty.c_iflag &= ~(CCTS_OFLOW|CRTS_IFLOW); -+ -+ if(R_AL & 0x08) /* Enable input Xon/Xoff */ -+ cdsp->tty.c_iflag |= IXOFF; -+ else -+ cdsp->tty.c_iflag &= ~(IXOFF); -+ -+ tcsetattr(cdsp->fd, 0, &cdsp->tty); -+ break; -+ } -+ -+ case 0x18: /* FOSSIL Read block */ -+ if(cdsp->fossil_mode) { -+ int rd = R_CX; -+ -+ input(cdsp, 0); -+ if(rd > cdsp->ids) -+ rd=cdsp->ids; -+ if(rd) { -+ memmove((char *)MAKEPTR(R_ES, R_DI), cdsp->inbuf, rd); -+ if(rd < cdsp->ids) -+ memmove(cdsp->inbuf, cdsp->inbuf + rd, N_BYTES - rd); -+ cdsp->ids -= rd; -+ R_AX = rd; -+ } else -+ R_AX = 0; -+ break; -+ } -+ -+ case 0x19: /* FOSSIL Write block */ -+ if(cdsp->fossil_mode) { -+ int wr = R_CX; -+ if(wr > N_BYTES - cdsp->ods) -+ wr=N_BYTES - cdsp->ods; -+ if(wr) { -+ memcpy(cdsp->outbuf + cdsp->ods, (char *)MAKEPTR(R_ES, R_DI), wr); -+ cdsp->ods += wr; -+ output(cdsp); -+ R_AX = wr; -+ } else -+ R_AX = 0; -+ break; -+ } -+ -+ case 0x1a: /* FOSSIL Break begin/end */ -+ if(cdsp->fossil_mode) { -+ switch(R_AL) { -+ case 0: -+ ioctl(cdsp->fd, TIOCCBRK); -+ break; -+ case 1: -+ ioctl(cdsp->fd, TIOCSBRK); -+ break; -+ } -+ break; -+ } -+ -+ case 0x1b: /* FOSSIL Driver information */ -+ if(cdsp->fossil_mode) { -+ unsigned char *p; -+ int bufpos=0; -+ int info_size=19; -+ const char *id_string="doscmd FOSSIL"; -+ p = (unsigned char *)MAKEPTR(R_ES, R_DI); -+ p[bufpos++]=info_size&0xff; -+ p[bufpos++]=(info_size>>8)&0xff; -+ p[bufpos++]=5; -+ p[bufpos++]=0; -+ PUTVEC(*(u_short *)p, *(ushort *)(p + sizeof(u_short)), (u_long)id_string); -+ bufpos+=sizeof(u_short)*2; -+ p[bufpos++]=N_BYTES & 0xff; -+ p[bufpos++]=(N_BYTES>>8) & 0xff; -+ p[bufpos++]=(N_BYTES - cdsp->ids) & 0xff; -+ p[bufpos++]=((N_BYTES - cdsp->ids) >> 8) & 0xff; -+ p[bufpos++]=N_BYTES & 0xff; -+ p[bufpos++]=(N_BYTES>>8) & 0xff; -+ p[bufpos++]=(N_BYTES - cdsp->ods) & 0xff; -+ p[bufpos++]=((N_BYTES - cdsp->ods) >> 8) & 0xff; -+ p[bufpos++]=80; -+ p[bufpos++]=25; -+ p[bufpos++]=cdsp->param & BITRATE_9600; -+ break; -+ } -+ - default: - unknown_int2(0x14, R_AH, REGS); - break; -@@ -353,6 +538,7 @@ - port, cdsp->path); - return; - } -+ cdsp->param = param; - - cdsp->ids = cdsp->ods = cdsp->emptyint = 0; - cdsp->int_enable = 0; -@@ -402,12 +588,24 @@ - } - switch (param & BITRATE_9600) { - case BITRATE_110: -- speed = B110; -- spd = 110; -+ if (fossil) { -+ speed = B19200; -+ spd = 19200; -+ } -+ else { -+ speed = B110; -+ spd = 110; -+ } - break; - case BITRATE_150: -- speed = B150; -- spd = 150; -+ if (fossil) { -+ speed = B38400; -+ spd = 38400; -+ } -+ else { -+ speed = B150; -+ spd = 150; -+ } - break; - case BITRATE_300: - speed = B300; --- doscmd/files/patch-quietmode 2007-09-28 01:13:10.000000000 -0700 +++ doscmd/files/patch-quietmode 1969-12-31 16:00:00.000000000 -0800 @@ -1,317 +0,0 @@ -diff -u ./debug.c /home/admin/doscmd.working/doscmd-20040330/debug.c ---- ./debug.c Mon Mar 29 16:00:00 2004 -+++ /home/admin/doscmd.working/doscmd-20040330/debug.c Wed May 3 13:58:35 2006 -@@ -106,7 +106,7 @@ - - dead = 1; - -- if (xmode) { -+ if (xmode && !quietmode) { - char buf[1024]; - const char *m; - -diff -u ./dos.c /home/admin/doscmd.working/doscmd-20040330/dos.c ---- ./dos.c Mon Mar 29 16:00:00 2004 -+++ /home/admin/doscmd.working/doscmd-20040330/dos.c Wed May 3 13:58:35 2006 -@@ -625,9 +625,12 @@ - { - int n; - -- /* XXX this is pretty bogus, actually */ -- if (!xmode) { -- R_AL = 0xff; /* no X mode, always claim data available */ -+ if (quietmode && !xmode) { -+ const struct timespec rqtp={0,1}; -+ -+ /* In case of camping */ -+ nanosleep(&rqtp, NULL); -+ R_AL = 0; - return(0); - } - /* XXX tty_peek is broken */ -diff -u ./doscmd.c /home/admin/doscmd.working/doscmd-20040330/doscmd.c ---- ./doscmd.c Wed May 3 14:06:55 2006 -+++ /home/admin/doscmd.working/doscmd-20040330/doscmd.c Wed May 3 13:58:35 2006 -@@ -64,6 +64,7 @@ - int capture_fd = -1; - int dead = 0; - int xmode = 0; -+int quietmode = 0; - int booting = 0; - int raw_kbd = 0; - int timer_disable = 0; -@@ -226,7 +227,7 @@ - kbd_init(); - kbd_bios_init(); - video_init(); -- if (xmode) -+ if (xmode || quietmode) - mouse_init(); - video_bios_init(); - disk_bios_init(); -@@ -511,7 +512,7 @@ - FILE *fp; - char *col; - -- while ((c = getopt(argc, argv, "234AbCc:Dd:EFGHIi:kLMOo:Pp:RrS:TtU:vVxXYz")) != -1) { -+ while ((c = getopt(argc, argv, "234AbCc:Dd:EFGHIi:kLMOo:PpQ:RrS:TtU:vVxXYz")) != -1) { - switch (c) { - case '2': - debug_flags |= D_TRAPS2; -@@ -620,6 +621,9 @@ - define_output_port_handler(p++, outb_port); - } - break; -+ case 'Q': -+ quietmode = 1; -+ break; - case 'R': - debug_flags |= D_REDIR; - break; -@@ -826,7 +830,7 @@ - done(regcontext_t *REGS, int val) - { - if (curpsp < 2) { -- if (xmode) { -+ if (xmode && !quietmode) { - const char *m; - - tty_move(24, 0); -@@ -861,7 +865,7 @@ - coq = coq->next; - c->func(c->arg); - } -- if (!xmode) /* XXX not for bootmode */ -+ if (!(xmode || quietmode)) /* XXX not for bootmode */ - puts("\n"); - exit(status); - } -diff -u ./doscmd.h /home/admin/doscmd.working/doscmd-20040330/doscmd.h ---- ./doscmd.h Wed May 3 14:06:55 2006 -+++ /home/admin/doscmd.working/doscmd-20040330/doscmd.h Wed May 3 13:58:35 2006 -@@ -175,6 +175,7 @@ - extern int capture_fd; - extern int dead; - extern int xmode; -+extern int quietmode; - extern int booting; - extern int raw_kbd; - extern int timer_disable; -diff -u ./int10.c /home/admin/doscmd.working/doscmd-20040330/int10.c ---- ./int10.c Mon Mar 29 16:00:00 2004 -+++ /home/admin/doscmd.working/doscmd-20040330/int10.c Wed May 3 13:58:35 2006 -@@ -57,7 +57,7 @@ - - switch (R_AH) { - case 0x00: /* Set display mode */ -- if (!xmode) -+ if (!(xmode || quietmode)) - goto unsupported; - init_mode(R_AL); - break; -@@ -94,12 +94,12 @@ - break; - } - case 0x02: /* Position cursor */ -- if (!xmode) -+ if (!(xmode || quietmode)) - goto unsupported; - tty_move(R_DH, R_DL); - break; - case 0x03: /* Read cursor position */ -- if (!xmode) -+ if (!(xmode || quietmode)) - goto unsupported; - tty_report(&i, &j); - R_DH = i; -@@ -111,7 +111,7 @@ - debug(D_VIDEO, "Select current display page %d\n", R_AL); - break; - case 0x06: /* initialize window/scroll text upward */ -- if (!xmode) -+ if (!(xmode || quietmode)) - goto unsupported; - if (R_AL == 0) /* clear screen */ - R_AL = DpyRows + 1; -@@ -120,7 +120,7 @@ - R_AL, R_BH << 8); - break; - case 0x07: /* initialize window/scroll text downward */ -- if (!xmode) -+ if (!(xmode || quietmode)) - goto unsupported; - if (R_AL == 0) /* clear screen */ - R_AL = DpyRows + 1; -@@ -129,24 +129,24 @@ - R_AL, R_BH << 8); - break; - case 0x08: /* read character/attribute */ -- if (!xmode) -+ if (!(xmode || quietmode)) - goto unsupported; - i = tty_char(-1, -1); - R_AX = i; - break; - case 0x09: /* write character/attribute */ -- if (!xmode) -+ if (!(xmode || quietmode)) - goto unsupported; - tty_rwrite(R_CX, R_AL, R_BL << 8); - break; - case 0x0a: /* write character */ -- if (!xmode) -+ if (!(xmode || quietmode)) - goto unsupported; - debug(D_HALF, "Int 10:0a: Write char: %02x\n", R_AL); - tty_rwrite(R_CX, R_AL, -1); - break; - case 0x0b: /* set border color */ -- if (!xmode) -+ if (!(xmode || quietmode)) - goto unsupported; - video_setborder(R_BL); - break; -@@ -165,7 +165,7 @@ - R_BH = 0;/*ActivePage *//* display page */ - break; - case 0x10: -- if (!xmode) -+ if (!(xmode || quietmode)) - goto unsupported; - switch (R_AL) { - case 0x00: /* Set single palette register */ -@@ -350,7 +350,7 @@ - } - break; - case 0x12: /* Alternate function select */ -- if (!xmode) -+ if (!(xmode || quietmode)) - goto unsupported; - switch (R_BL) { - case 0x10: /* Read EGA/VGA config */ -@@ -372,7 +372,7 @@ - } - break; - case 0x13: /* write character string */ -- if (!xmode) -+ if (!(xmode || quietmode)) - goto unsupported; - addr = (char *)MAKEPTR(R_ES, R_BP); - switch (R_AL & 0x03) { -@@ -407,7 +407,7 @@ - } - break; - case 0x1a: -- if (!xmode) -+ if (!(xmode || quietmode)) - goto unsupported; - R_AL = 0x1a; /* I am VGA */ - R_BL = 8; /* Color VGA */ -diff -u ./int16.c /home/admin/doscmd.working/doscmd-20040330/int16.c ---- ./int16.c Mon Mar 29 16:00:00 2004 -+++ /home/admin/doscmd.working/doscmd-20040330/int16.c Wed May 3 13:58:35 2006 -@@ -78,7 +78,7 @@ - void - int16(regcontext_t *REGS) - { -- if (!xmode && !raw_kbd) { -+ if (!(xmode || raw_kbd || quietmode)) { - if (vflag) dump_regs(REGS); - fatal ("int16 func 0x%x only supported in X mode\n", R_AH); - } -diff -u ./tty.c /home/admin/doscmd.working/doscmd-20040330/tty.c ---- ./tty.c Wed May 3 14:06:55 2006 -+++ /home/admin/doscmd.working/doscmd-20040330/tty.c Wed May 3 13:58:35 2006 -@@ -34,6 +34,7 @@ - __FBSDID("$FreeBSD: projects/doscmd/tty.c,v 1.25 2002/04/12 21:18:05 charnier Exp $"); - - #include -+#include - #include - #include - #include -@@ -1471,7 +1472,8 @@ - { - if (attr == TTYF_REDIRECT) { - if (redirect1) { -- write(1, &c, 1); -+ if(!quietmode) -+ write(1, &c, 1); - return; - } - attr = -1; -@@ -1487,8 +1489,10 @@ - #ifndef NO_X - XBell(dpy, 0); - #endif -- } else -+ } else { -+ if(!quietmode) - write(1, "\007", 1); -+ } - break; - case 0x08: - if (row > (height - 1) || col > width) -@@ -1658,20 +1662,14 @@ - { - int r; - -+ if(quietmode && !xmode) -+ return(0); -+ - if ((r = nextchar) != 0) { - nextchar = 0; - return(r & 0xff); - } - -- if ((flag & TTYF_REDIRECT) && redirect0) { -- char c; -- if (read(STDIN_FILENO, &c, 1) != 1) -- return(-1); -- if (c == '\n') -- c = '\r'; -- return(c); -- } -- - if (KbdEmpty()) { - if (flag & TTYF_BLOCK) { - while (KbdEmpty()) -@@ -1858,6 +1856,22 @@ - int - KbdEmpty() - { -+ if(!xmode) { -+ fd_set rd; -+ struct timeval tv; -+ -+ FD_ZERO(&rd); -+ FD_SET(STDIN_FILENO, &rd); -+ tv.tv_sec=0; -+ tv.tv_usec=0; -+ if(select(STDIN_FILENO+1, &rd, NULL, NULL, &tv)==1) { -+ char ch=0; -+ read(STDIN_FILENO, &ch, 1); -+ if(ch == '\n') -+ ch = '\r'; -+ KbdWrite(ch); -+ } -+ } - return(K_NEXT == K_FREE); - } - -diff -u ./video.c /home/admin/doscmd.working/doscmd-20040330/video.c ---- ./video.c Wed May 3 14:06:55 2006 -+++ /home/admin/doscmd.working/doscmd-20040330/video.c Wed May 3 13:58:35 2006 -@@ -276,9 +276,9 @@ - define_output_port_handler(GDC_DataPort, video_outb); - } - -- redirect0 = isatty(0) == 0 || !xmode ; -- redirect1 = isatty(1) == 0 || !xmode ; -- redirect2 = isatty(2) == 0 || !xmode ; -+ redirect0 = isatty(0) == 0 || !(xmode || quietmode); -+ redirect1 = isatty(1) == 0 || !(xmode || quietmode); -+ redirect2 = isatty(2) == 0 || !(xmode || quietmode); - - return; - } --- doscmd/pkg-message 1969-12-31 16:00:00.000000000 -0800 +++ doscmd/pkg-message 2011-08-26 09:54:58.000000000 -0700 @@ -0,0 +1,6 @@ +NOTE: +===== +For security reasons, FreeBSD no longer allows mmap() at zero. +To remove this security protection and allow doscmd to work, you will need +to set sysctl security.bsd.map_at_zero=1 either before running doscmd or +in /etc/sysctl.conf.