home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 13 / CDA13.ISO / cdactual / demobin / share / program / Asm / ASM.ZIP / FREECOPY.ASM < prev    next >
Encoding:
Assembly Source File  |  1987-06-26  |  82.6 KB  |  2,577 lines

  1.  
  2. Page    55,132
  3. Title    FREECOPY Version 1.0 (C)Copyright 1984
  4. ;***********************  F R E E C O P Y  ******************************
  5. ;*                                    *
  6. ;*    Program: FREECOPY                        *
  7. ;*                                    *
  8. ;*    Author: Donald L. Buresh, C.D.P.                *
  9. ;*        Squire Buresh Associates, Inc.                *
  10. ;*        Post Office Box 112                    *
  11. ;*        Millbury, MA  01527                    *
  12. ;*        (617) 865-3435                        *
  13. ;*                                    *
  14. ;*    !!!!!!!!!!!!!!!!!!!!!!   N O T I C E   !!!!!!!!!!!!!!!!!!!!!!     *
  15. ;*                                    *
  16. ;*    A limited license is granted to all users of this program to    *
  17. ;*    make copies of this source code and to distribute them to    *
  18. ;*    other users under the following conditions:            *
  19. ;*                                    *
  20. ;*    1. The notice contained in the variable MES00_Copy_Notice    *
  21. ;*       is not to be altered, bypassed or removed.            *
  22. ;*                                    *
  23. ;*    2. The program is not to be distributed to others in        *
  24. ;*       modified form.                        *
  25. ;*                                    *
  26. ;*    3. If you think that this program has helped you, we request    *
  27. ;*       a $25.00 contribution.                    *
  28. ;*                                    *
  29. ;*    4. No other fee is to be charged or any consideration received    *
  30. ;*       for copying or distributing the program without the        *
  31. ;*       expressed written permission of Squire Buresh Assoc, Inc.    *
  32. ;*                                    *
  33. ;*                                    *
  34. ;*  (C) Copyright  1984        Squire Buresh Associates, Inc.        *
  35. ;*                                    *
  36. ;************************************************************************
  37. Page
  38. ;************************************************************************
  39. ;*                                    *
  40. ;*    EQUATES                                *
  41. ;*                                    *
  42. ;*    The constants defined below are used to to specify:        *
  43. ;*                                    *
  44. ;*            o Disk commands,                *
  45. ;*                                    *
  46. ;*            o Keyboard commands,                *
  47. ;*                                    *
  48. ;*            o Video commands                *
  49. ;*                                    *
  50. ;*            o Miscellaneous parameters,            *
  51. ;*                                    *
  52. ;*            o Various ASCII characters.            *
  53. ;*                                    *
  54. ;************************************************************************
  55. ;
  56. Disk_Parameter_Addr    Equ    001EH*4    ; Address of Disk Parameter Table
  57. ;
  58. Reset_Command        Equ    0000D    ; Diskette reset command
  59. Status_Command        Equ    0001D    ; Diskette status command
  60. Read_Command        Equ    0002D    ; Diskette read command
  61. Write_Command        Equ    0003D    ; Diskette write command
  62. Verify_Command        Equ    0004D    ; Diskette verify command
  63. Format_Command         Equ    0005D    ; Diskette format command
  64. ;
  65. Time_Out_Error        Equ    0080H    ; Diskette error codes
  66. Seek_Error        Equ    0040H    ; .
  67. Controller_Error    Equ    0020H    ; .
  68. CRC_Error        Equ    0010H    ; .
  69. DMA_Boundary_Error    Equ    0009H    ; .
  70. DMA_Error        Equ    0008H    ; .
  71. Sector_Error        Equ    0004H    ; .
  72. Write_Protect_Error    Equ    0003H    ; .
  73. Address_Mark_Error    Equ    0002H    ; .
  74. Command_Error        Equ    0001H    ; ..End
  75. ;
  76. Video_Address        Equ    0A000H    ; Starting segment addr of Video RAM
  77. ;
  78. Set_Mode_Command    Equ    0000D    ; Set the video mode
  79. Set_CType_Command    Equ    0001D    ; Set the cursor type
  80. Set_CPos_Command    Equ    0002D    ; Set the cursor position
  81. Read_Cursor_Command    Equ    0003D    ; Get cursor position and attributes
  82. Read_LPen_Command    Equ    0004D    ; Get the light pen position
  83. Set_ADPage_Command    Equ    0005D    ; Set the active display page
  84. Scroll_Up_Command    Equ    0006D    ; Scrool up or blank a portion of
  85.                     ; . the video display
  86. ;
  87. Page
  88. ;************************************************************************
  89. ;*                                    *
  90. ;*    EQUATES        Page 2                        *
  91. ;*                                    *
  92. ;************************************************************************
  93. ;
  94. Scroll_Down_Command    Equ    0007D    ; Scroll down or blank a portion
  95.                     ; . of the video display
  96. Read_AChar_Command    Equ    0008D    ; Read the attribute and character
  97. Write_AChar_command    Equ    0009D    ; Write the attribute and character
  98. Write_Char_Command    Equ    0010D    ; Write the character only
  99. Set_Color_Command    Equ    0011D    ; Set the color pallette
  100. Write_Dot_Command    Equ    0012D    ; Write a pixel to a graphics screen
  101. Read_Dot_Command    Equ    0013D    ; Read a pixel from a graphics screen
  102. Write_TTY_Command    Equ    0014D    ; Write a character with automatic
  103.                     ; . processing for LF, CR, Bell & BS
  104. Video_State_Command    Equ    0015D    ; Get the current video state
  105. ;
  106. Read_Keyboard_Command    Equ    0007D    ; Reads character from the keyboard
  107. ;
  108. Default_Drive_Command    Equ    0025D    ; Get PC DOS default drive number
  109. ;
  110. Video_Interrupt        Equ    0010H    ; Interrupt 10H for video calls
  111. Equipment_Interrupt    Equ    0011H    ; Interrupt 11H for equipment
  112. Disk_Interrupt        Equ    0013H    ; Interrupt 13H for disk calls
  113. PC_DOS_Interrupt    Equ    0021H    ; Interrupt 21H for PC DOS calls
  114. ;
  115. Parallel_Ports_Mask    Equ    0C000H    ; Equipment masks
  116. Game_Adapters_Mask    Equ    00100H    ; .
  117. RS232_Ports_Mask    Equ    00E00H    ; .
  118. Disk_Drives_Mask    Equ    000C0H    ; .
  119. Init_Video_Mask        Equ    00030H    ; .
  120. Planar_RAM_Mask        Equ    0000CH    ; .
  121. IPL_Diskette_Mask    Equ    00001H    ; ..End
  122. ;
  123. Page
  124. ;************************************************************************
  125. ;*                                    *
  126. ;*    EQUATES        Page 3                        *
  127. ;*                                    *
  128. ;************************************************************************
  129. ;
  130. Command_Com_Size    Equ    1125D    ; Size of various tables and programs
  131. CHRN_Table_Size        Equ    0180D    ; in 16 byte paragraphs
  132.                     ; .
  133.                     ; .
  134. ESBX_Table_Size        Equ    0020D    ; .
  135.                     ; .
  136.                     ; .
  137. FAT_Sector_Size        Equ    0032D    ; ..End
  138. ;
  139. DMA_Boundary_Mask    Equ    0FFFH    ; Mask to isolate the high nibble of
  140.                     ; . the ES segment address
  141. ;
  142. Invalid_Drive        Equ    0255D    ; Invalid drive parameter
  143. Maximum_Drives        Equ    0003D    ; Maximum number of floppy drives 
  144. Minimum_Drives        Equ    0000D    ; Minimum number of floppy drives
  145. ;
  146. Sector_Size        Equ    0512D    ; Number of bytes per sector
  147. Paragraph_Size        Equ    0016D    ; Number of bytes per paragraph
  148. Number_of_Retries    Equ    0005D    ; Number of attempts to copy 
  149.                     ; . a track before admitting failure
  150. Final_Track        Equ    0039D    ; The last track on a PC DOS diskette
  151. ;
  152. One_Side_Eight_Sectors    Equ    00FEH    ; First entry in the File Allocation
  153. Two_Sides_Eight_Sectors    Equ    00FFH    ; Table (FAT)
  154. One_Side_Nine_Sectors    Equ    00FCH    ; .
  155. Two_Sides_Nine_Sectors    Equ    00FDH    ; .
  156. Fixed_Disk        Equ    00F8H    ; ..End
  157. ;
  158. Keyboard_Buffer_Size    Equ    0080D    ; Maximum number of characters in
  159.                     ; . the keyboard buffer
  160. ;
  161. Minimum_Memory_Size    Equ    0288D    ; Minimum memory size in 16 byte
  162.                     ; . paragraphs to hold a nine
  163.                     ; . sectored track
  164. ;
  165. Blank_Cursor        Equ    0F0FH    ; Blank cursor value
  166. Underline_Cursor    Equ    0D0DH    ; Underline cursor value
  167. ;
  168. True            Equ    0001D    ; Correct processing occured
  169. False            Equ    0000D    ; Incorrect processing occured
  170. ;
  171. Page
  172. ;************************************************************************
  173. ;*                                    *
  174. ;*    EQUATES        Page 4                        *
  175. ;*                                    *
  176. ;************************************************************************
  177. ;
  178. NUL            Equ    0000D    ; Null character
  179. SOH            Equ    0001D    ; SOH character
  180. STX            Equ    0002D    ; STX character
  181. ETX            Equ    0003D    ; Control Break character
  182. Bell            Equ    0007D    ; Bell character
  183. BS            Equ    0008D    ; Backspace character
  184. LF            Equ    0010D    ; Line feed character
  185. CR            Equ    0013D    ; Carriage return character
  186. Space            Equ    0032D    ; Space or blank character
  187. Slash            Equ    0047D    ; Slash character
  188. Zero_Digit        Equ    0048D    ; Digit Zero
  189. One_Digit        Equ    0049D    ; Digit One
  190. Capital_Letter_A    Equ    0065D    ; Capital letter A
  191. Capital_Letter_N    Equ    0078D    ; Capital letter N
  192. Capital_Letter_Y    Equ    0089D    ; Capital letter Y
  193. Small_Letter_n        Equ    0110D    ; Small letter n
  194. Small_Letter_y        Equ    0121D    ; Small letter y
  195. EOT            Equ    0255D    ; End of text character
  196. ;
  197. Minus_One        Equ      -1D    ; Numbers used in FREECOPY
  198. Zero            Equ    0000D    ; .
  199. One            Equ    0001D    ; .
  200. Two            Equ    0002D    ; .
  201. Three            Equ    0003D    ; .
  202. Four            Equ    0004D    ; .
  203. Six            Equ    0006D    ; .
  204. Eight            Equ    0008D    ; .
  205. Nine            Equ    0009D    ; .
  206. Ten            Equ    0010D    ; .
  207. Eleven            Equ    0011D    ; .
  208. Twelve            Equ    0012D    ; .
  209. Fourteen        Equ    0014D    ;.
  210. Fifteen            Equ    0015D    ; .
  211. Twenty_Four        Equ    0024D    ; .
  212. Twenty_Five        Equ    0025D    ; .
  213. Thirty_Four        Equ    0034D    ; .
  214. Thirty_Six        Equ    0036D    ; .
  215. Thirty_Nine        Equ    0039D    ; .
  216. Seventy_Nine        Equ    0079D    ; ..End
  217. ;
  218. Page
  219. ;************************************************************************
  220. ;*                                    *
  221. ;*    CSEG Segment                            *
  222. ;*                                    *
  223. ;*    This segment contains all of the code of the program.  It is    *
  224. ;*    named CSEG because this name conforms with ASM-86.        *
  225. ;*                                    *
  226. ;************************************************************************
  227. ;
  228. CSEG    Segment Para Public 'CSEG'
  229.     Assume CS:CSEG,DS:CSEG,ES:CSEG,SS:Nothing
  230. ;
  231. Page
  232. ;************************************************************************
  233. ;*                                    *
  234. ;*    PROGRAM SEGMENT PREFIX                        *
  235. ;*                                    *
  236. ;*    The first 256 bytes of every program executed under PC DOS    *
  237. ;*    contains a Program Segment Prefix control block.  The data    *
  238. ;*    stored in this block of memory is used by FREECOPY to process    *
  239. ;*    the parameters when invoking the program.            *
  240. ;*                                    *
  241. ;************************************************************************
  242. ;
  243.     Org    05CH
  244. Source_Drive        Label Byte    ; Source diskette drive number
  245.     Org    05DH
  246. Source_Filename        Label Byte    ; Source diskette filename
  247.     Org    068H
  248. Source_Filler_Area    Label Byte
  249.     Org    06CH
  250. Target_Drive        Label Byte    ; Target diskette drive number
  251.     Org    06DH
  252. Target_Filename        Label Byte    ; Target diskette filename
  253.     Org    078H
  254. Target_Filler_Area    Label Byte
  255.     Org    080H
  256. Parameter_Count        Label Byte    ; Number of parameters
  257.     Org    081H
  258. Parameter_String    Label Byte    ; String entered by the user
  259. ;
  260. Page
  261. ;************************************************************************
  262. ;*                                    *
  263. ;*    A1000_MAIN_MODULE                        *
  264. ;*                                    *
  265. ;*    This is the top level of FREECOPY and it controls the flow of    *
  266. ;*    the program.  The first sequence of commands in the routine    *
  267. ;*    preserve the state of the machine.  Next, there is a set of    *
  268. ;*    three (3) calls to sub-modules that control the initial        *
  269. ;*    processing, detail processing and final processing.  Finally,    *
  270. ;*    FREECOPY restores the state of the machine an returns to     *
  271. ;*    PC DOS via INT 20H.                        *
  272. ;*                                    *
  273. ;************************************************************************
  274. ;
  275.     Org    0100H
  276. ;
  277. Public    A1000_Main_Module
  278. ;
  279. A1000_Main_Module Proc Far
  280. ;
  281. A1001:
  282.     Cli                ; Set up the top of the stack
  283.     Mov    SP,Offset MEM04_Top_of_the_Stack
  284.     Sti                ; ..End
  285.     Push    BP            ; Save the state of the machine
  286.     Push    DS            ; .
  287.     Push    ES            ; .
  288.     Push    SS            ; .
  289.     Push    AX            ; .
  290.     Push    BX            ; .
  291.     Push    CX            ; .
  292.     Push    DX            ; .
  293.     Push    SI            ; .
  294.     Push    DI            ; .
  295.     Pushf                ; ..End
  296. ;
  297.     Cli                ; Save the current stack pointer
  298.     Mov    Word Ptr SYS15_Stack_Pointer,SP
  299.     Sti                ; ..End
  300. ;
  301.     Call    B1000_Initial_Process    ; Main flow of control
  302.     Cmp    Byte Ptr FLG01_Good_Command,False
  303.     Je    A1002            ; .
  304.     Cmp    Byte Ptr FLG03_Default_Drive,False
  305.     Je    A1002            ; .
  306.     Call    B1100_Detail_Process    ; .
  307. A1002:                    ; .
  308.     Call    B1200_Final_Process    ; ..End
  309. A1090:
  310.     Popf                ; Restore the state of the machine
  311.     Pop    DI            ; .
  312.     Pop    SI            ; .
  313.     Pop    DX            ; .
  314.     Pop    CX            ; .
  315.     Pop    BX            ; .
  316.     Pop    AX            ; .
  317.     Pop    SS            ; .
  318.     Pop    ES            ; .
  319.     Pop    DS            ; .
  320.     Pop    BP            ; ..End
  321. A1099:
  322.     Int    20H            ; Return to PC DOS
  323. ;
  324. A1000_Main_Module Endp
  325. ;
  326. Page
  327. ;************************************************************************
  328. ;*                                    *
  329. ;*    B1000_INITIAL_PROCESS                        *
  330. ;*                                    *
  331. ;*    This module performs the following functions after control    *
  332. ;*    passess to FREECOPY:                        *
  333. ;*                                    *
  334. ;*     1. Sets up the Disk Parameter Table.                *
  335. ;*                                    *
  336. ;*     2. Initializes various parameters.                *
  337. ;*                                    *
  338. ;*     3. Gets and sets the video mode.                *
  339. ;*                                    *
  340. ;*     4. Displays the intiial message.                *
  341. ;*                                    *
  342. ;*     5. Parses the command line entered by a user.            *
  343. ;*                                    *
  344. ;*     6. Determines the amount of equipment on the machine.        *
  345. ;*                                    *
  346. ;*     7. Validates the number of disk drives on the system.        *
  347. ;*                                    *
  348. ;*     8. Displays the appropriate disk copying message.        *
  349. ;*                                    *
  350. ;*     9. Gets the amount of available memory.            *
  351. ;*                                    *
  352. ;*    10. Calculates the number and position of the entries in the    *
  353. ;*        ES:BX buffer address table.                    *
  354. ;*                                    *
  355. ;************************************************************************
  356. ;
  357. Page
  358. ;
  359. Public    B1000_Initial_Process
  360. ;
  361. B1000_Initial_Process Proc Near
  362. ;
  363. B1001:
  364.     Call    S1000_Setup_Disk_Param_Table
  365. ;
  366.     Mov    Byte Ptr FLG01_Good_Command,True
  367.     Mov    Byte Ptr FLG02_Double_Side,True
  368.     Mov    Byte Ptr FLG03_Default_Drive,True
  369.     Mov    Byte Ptr FLG04_Single_Drive,True
  370.     Mov    Byte Ptr FLG07_First_Time,True
  371. B1002:
  372.     Call    C1000_Get_And_Set_Video    ; Get and set current video state
  373.     Call    C1100_Display_Intro    ; Display the intial screen
  374.     Call    C1200_Parse_Commands    ; Parse the command line entered
  375.                     ; . by the user
  376.     Cmp    Byte Ptr FLG01_Good_Command,False
  377.     Je    B1099            ; If false, go to end of the module
  378.     Call    C1300_Get_Equipment    ; Find out the equipment on the PC
  379.     Call    C1400_Validate_Drives    ; Validate the drive numbers
  380.     Cmp    Byte Ptr FLG03_Default_Drive,False
  381.     Je    B1099            ; If false, go to end of the module
  382.     Call    C1500_Diskette_Messages    ; Display the appropriate messages
  383.     Call    C1600_Get_Free_Memory    ; Get the available memory in 16
  384.                     ; . byte paragraphs
  385.     Cmp    Byte Ptr FLG01_Good_Command,False
  386.     Je    B1099            ; If false, go to end of the module
  387.     Call    C1700_Create_ESBX_Table    ; Create the ES:BX table for the disk
  388.                     ; reads and writes
  389. B1099:
  390.     Ret
  391. ;
  392. B1000_Initial_Process Endp
  393. ;
  394. Page
  395. ;************************************************************************
  396. ;*                                    *
  397. ;*    B1100_DETAIL_PROCESS                        *
  398. ;*                                    *
  399. ;*    This module performs the following functions when copying one    *
  400. ;*    or more diskettes:                        *
  401. ;*                                    *
  402. ;*    1. Initializes various parameters.                *
  403. ;*                                    *
  404. ;*    2. Validates the contents of the source diskette.        *
  405. ;*                                    *
  406. ;*    3. Creates all of the entries of the CHRN table used in        *
  407. ;*       formatting the target diskette.                *
  408. ;*                                    *
  409. ;*    4. Reads the tracks of the source diskette.            *
  410. ;*                                    *
  411. ;*    5. If the diskette is being copied on only one drive, the    *
  412. ;*       routines asks the user to enter the target diskette.        *
  413. ;*                                    *
  414. ;*    6. Writes the tracks on the target diskette.            *
  415. ;*                                    *
  416. ;*    7. If FREECOPY is finished copying the source diskette, the    *
  417. ;*       program asks whether wants to copy another one.  If not,    *
  418. ;*       the module returns to A1000_Main_Module.  If so, control    *
  419. ;*       transfers to 1.                        *
  420. ;*                                    *
  421. ;*    8. If FREECOPY is not completed copying the source diskette,    *
  422. ;*       control transfers to 4.                    *
  423. ;*                                    *
  424. ;************************************************************************
  425. ;
  426. Page
  427. ;
  428. Public    B1100_Detail_Process
  429. ;
  430. B1100_Detail_Process Proc Near
  431. ;
  432. B1101:
  433.     Mov    Byte Ptr WRK20_Current_Source_Head,Zero
  434.     Mov    Byte Ptr WRK21_Current_Source_Track,Zero
  435.     Mov    Byte Ptr WRK22_Current_Target_Head,Zero
  436.     Mov    Byte Ptr WRK23_Current_Target_Track,Zero
  437.     Mov    Word Ptr WRK33_CHRN_Table_Address,Offset MEM02_CHRN_Table
  438.     Mov    Byte Ptr FLG13_First_Read_Write,True
  439.     Mov    Byte Ptr FLG14_Copy_Complete,False
  440.     Mov    Byte Ptr FLG15_IO_Error,Three
  441. B1102:
  442.     Call    C1800_Validate_Source_Disk
  443.     Cmp    Byte Ptr FLG08_Good_Read,True
  444.     Je    B1103            ; If it is a valid source, continue
  445.     Mov    SI,Offset MES07_Correct_And_Press_Key
  446.     Call    U1000_Display_Message    ; Display the message on the screen
  447.     Mov    Byte Ptr FLG05_Store_Buffer,False
  448.     Call    U1100_Get_Response    ; Get the user's response
  449.     Jmp    B1101            ; Go back and try again
  450. B1103:
  451.     Call    C1900_Create_CHRN_Table
  452. B1104:
  453.     Call    C2000_Read_Source_Disk
  454.     Cmp    Byte Ptr FLG08_Good_Read,True
  455.     Je    B1105            ; If read disk correctly, continue
  456.     Mov    SI,Offset MES07_Correct_And_Press_Key
  457.     Call    U1000_Display_Message    ; Display the message on the screen
  458.     Mov    Byte Ptr FLG05_Store_Buffer,False
  459.     Call    U1100_Get_Response    ; Get the user's response
  460.     Jmp    B1101            ; Go back and try again
  461. B1105:
  462.     Cmp    Byte Ptr FLG04_Single_Drive,False
  463.     Je    B1106            ; If a single drive copy, continue
  464.     Mov    SI,Offset MES10_Insert_Target
  465.     Mov    AL,Byte Ptr WRK02_Target_Drive
  466.     Add    AL,Capital_Letter_A    ; Put drive letter into AL
  467.     Mov    [SI+Thirty_Four],AL    ; Put the drive letter into the
  468.                     ; . correct position in the message
  469.     Call    U1000_Display_Message    ; Display the message on the screen
  470.     Mov    SI,Offset MES16_Press_Any_Key
  471.     Call    U1000_Display_Message    ; Display the message on the screen
  472.     Mov    Byte Ptr FLG05_Store_Buffer,False
  473.     Call    U1100_Get_Response    ; Get the user's response
  474. B1106:
  475.     Call    C2100_Write_Format_Target_Disk
  476.     Cmp    Byte Ptr FLG09_Good_Write,False
  477.     Je    B1110            ; If bad write, go to bottom of loop
  478.     Cmp    Byte Ptr FLG11_Good_Format,False
  479.     Je    B1110            ; If bad format, go to bottom of loop
  480. B1107:
  481.     Cmp    Byte Ptr FLG14_Copy_Complete,True
  482.     Je    B1109            ; If copy done, go to bottom of loop
  483.     Cmp    Byte Ptr FLG04_Single_Drive,False
  484.     Je    B1108            ; If double drive copy, continue
  485.     Mov    SI,Offset MES09_Insert_Source
  486.     Mov    AL,Byte Ptr WRK01_Source_Drive
  487.     Add    AL,Capital_Letter_A    ; Put the drive letter into AL
  488.     Mov    [SI+Thirty_Four],AL    ; Put the drive letter into the
  489.                     ; . correct position in the message
  490.     Call    U1000_Display_Message    ; Display the message on the screen
  491.     Mov    SI,Offset MES16_Press_Any_Key
  492.     Call    U1000_Display_Message    ; Display the message on the screen
  493.     Mov    Byte Ptr FLG05_Store_Buffer,False
  494.     Call    U1100_Get_Response    ; Get the user's response
  495. B1108:
  496.     Call    C2200_Check_File_Alloc_Table
  497.     Cmp    Byte Ptr FLG12_Good_FAT,False
  498.     Je    B1110            ; If bad FAT, go to bottom of loop
  499.     Mov    Byte Ptr FLG13_First_Read_Write,False
  500.     Jmp    B1104            ; Go back and read some more
  501. B1109:
  502.     Mov    Byte Ptr FLG07_First_Time,False
  503.     Mov    SI,Offset MES02_Copy_Complete
  504.     Call    U1000_Display_Message
  505. B1110:
  506.     Mov    SI,Offset MES01_Copy_Another
  507.     Call    U1000_Display_Message
  508.     Call    U1200_Get_Yes_or_No
  509.     Cmp    Byte Ptr FLG06_Yes_or_No,False
  510.     Je    B1199            ; Go to the end of the module
  511.     Call    C1500_Diskette_Messages    ; Print out the messages on screen
  512.     Jmp    B1101            ; Start copying a diskette again
  513. B1199:
  514.     Ret
  515. ;
  516. B1100_Detail_Process Endp
  517. ;
  518. Page
  519. ;************************************************************************
  520. ;*                                    *
  521. ;*    B1200_FINAL_PROCESS                        *
  522. ;*                                    *
  523. ;*    This module performs the following functions before returning     *
  524. ;*    control to PC DOS:                        *
  525. ;*                                    *
  526. ;*    1. Restores the value of the stack pointer.            *
  527. ;*                                    *
  528. ;*    2. Displays the final message of the program.            *
  529. ;*                                    *
  530. ;*    3. Restores the underline cursor.                *
  531. ;*                                    *
  532. ;*    4. Restores the settings in the Disk Parameter Table.        *
  533. ;*                                    *
  534. ;*    5. Returns control to A1000_Main_Module.            *
  535. ;*                                    *
  536. ;************************************************************************
  537. ;
  538. Page
  539. ;
  540. Public    B1200_Final_Process
  541. ;
  542. B1200_Final_Process Proc Near
  543. ;
  544. B1201:
  545.     Cli                ; Establish the stack pointer
  546.     Mov    SP,Word Ptr SYS15_Stack_Pointer
  547.     Sti                ; ..End
  548. ;
  549.     Mov    SI,Offset MES99_Freecopy_Finished
  550.     Call    U1000_Display_Message    ; Display the message on the screen
  551. ;
  552.     Mov    AH,Set_CType_Command    ; Restore the underline cursor
  553.     Mov    CX,Underline_Cursor    ; .
  554.     Int    Video_Interrupt        ; ..End
  555. ;
  556.     Call    S1100_Restore_Disk_Param_Table
  557. ;
  558.     Mov    AX,Offset A1090        ; Setup to return to the main module
  559.     Push    CS            ; .
  560.     Push    AX            ; ..End
  561. B1299:
  562.     Ret
  563. ;
  564. B1200_Final_Process Endp
  565. ;
  566. Page
  567. ;************************************************************************
  568. ;*                                    *
  569. ;*    C1000_GET_AND_SET_VIDEO                        *
  570. ;*                                    *
  571. ;*    This module gets the current video state and saves this        *
  572. ;*    information in the various SYStem variables.            *
  573. ;*                                    *
  574. ;************************************************************************
  575. ;
  576. Public    C1000_Get_And_Set_Video
  577. ;
  578. C1000_Get_And_Set_Video Proc Near
  579. ;
  580. C1001:
  581.     Push    AX            ; Save the registers
  582.     Push    BX            ; .
  583.     Push    CX            ; ..End
  584. C1002:
  585.     Mov    AH,Video_State_Command    ; Get the current video state
  586.     Int    Video_Interrupt        ; ..End
  587.     Mov    Byte Ptr SYS01_Number_Columns,AH
  588.     Mov    Byte Ptr SYS02_Current_Mode,AL
  589.     Mov    Byte Ptr SYS03_Active_Page,BH
  590. C1003:
  591.     Mov    AH,Set_CType_Command    ; Set the cursor to blanks
  592.     Mov    CX,Blank_Cursor        ; .
  593.     Int    Video_Interrupt        ; ..End
  594. C1090:
  595.     Pop    CX            ; Restore the registers
  596.     Pop    BX            ; .
  597.     Pop    AX            ; ..End
  598. C1099:
  599.     Ret
  600. ;
  601. C1000_Get_And_Set_Video Endp
  602. ;
  603. Page
  604. ;************************************************************************
  605. ;*                                    *
  606. ;*    C1100_DISPLAY_INTRO                        *
  607. ;*                                    *
  608. ;*    This module displays the introductory message to FREECOPY.    *
  609. ;*    Please do not disable this message, since it states the        *
  610. ;*    conditions under which a person may copy this program.        *
  611. ;*                                    *
  612. ;************************************************************************
  613. ;
  614. Public    C1100_Display_Intro
  615. ;
  616. C1100_Display_Intro Proc Near
  617. ;
  618. C1101:
  619.     Mov    SI,Offset MES00_Copy_Notice    ; Display the copy notice
  620.     Call    U1000_Display_Message        ; ..End
  621. C1199:
  622.     Ret
  623. C1100_Display_Intro Endp
  624. ;
  625. Page
  626. ;************************************************************************
  627. ;*                                    *
  628. ;*    C1200_PARSE_COMMANDS                        *
  629. ;*                                    *
  630. ;*    This module parses the command line entered by the user        *
  631. ;*    by checking the following conditions:                *
  632. ;*                                    *
  633. ;*    1. The source and/or the target drives do not exist.        *
  634. ;*                                    *
  635. ;*    2. The command line contains any characters other than two    *
  636. ;*       drive letters (e.g., a filename).                *
  637. ;*                                    *
  638. ;*    3. The /1 (single side) parameter is on the command line.    *
  639. ;*                                    *
  640. ;************************************************************************
  641. ;
  642. Public    C1200_Parse_Commands
  643. ;
  644. C1200_Parse_Commands Proc Near
  645. ;
  646. C1201:
  647.     Cmp    AH,Invalid_Drive    ; Compare for invalid drive parms
  648.     Jne    C1202            ; .
  649.     Mov    Byte Ptr FLG01_Good_Command,False
  650.     Mov    SI,Offset MES14_Invalid_Drive
  651.     Call    U1000_Display_Message
  652.     Jmp    C1299            ; .
  653. C1202:                    ; .
  654.     Cmp    AL,Invalid_Drive    ; .
  655.     Jne    C1203            ; .
  656.     Mov    Byte Ptr FLG01_Good_Command,False
  657.     Mov    SI,Offset MES14_Invalid_Drive
  658.     Call    U1000_Display_Message
  659.     Jmp    C1299            ; ..End
  660. C1203:
  661.     Mov    AL,Byte Ptr Source_Drive
  662.     Mov    Byte Ptr WRK01_Source_Drive,AL
  663.     Mov    AL,Byte Ptr Target_Drive
  664.     Mov    Byte Ptr WRK02_Target_Drive,AL
  665. C1204:
  666.     Mov    SI,Offset Source_Filename
  667.     Mov    DI,Offset WRK03_Valid_Filename
  668.     Mov    CX,Eleven        ; Set CX to compare 11 characters 
  669. C1205:
  670.     Mov    AL,[SI]            ; Compare for valid source diskette
  671.     Mov    AH,[DI]            ; filename in the FCB at 05DH
  672.     Cmp    AH,AL            ; .
  673.     Je    C1206            ; .
  674.     Mov    Byte Ptr FLG01_Good_Command,False
  675.     Mov    SI,Offset MES12_Invalid_Parameter
  676.     Call    U1000_Display_Message
  677.     Jmp    C1299            ; .
  678. C1206:                    ; .
  679.     Inc    SI            ; .
  680.     Inc    DI            ; .
  681.     Loop    C1205            ; ..End
  682. C1207:
  683.     Mov    SI,Offset Target_Filename
  684.     Mov    DI,Offset WRK03_Valid_Filename
  685.     Mov    CX,Eleven        ; Set CX to comapre 11 characters
  686. C1208:
  687.     Mov    AL,[SI]            ; Compare for valid target diskette
  688.     Mov    AH,[DI]            ; . filename in the FCB at 06DH
  689.     Cmp    AH,AL            ; .
  690.     Je    C1209            ; .
  691.     Mov    Byte Ptr FLG01_Good_Command,False
  692.     Mov    SI,Offset MES12_Invalid_Parameter
  693.     Call    U1000_Display_Message
  694.     Jmp    C1299            ; .
  695. C1209:                    ; .
  696.     Inc    SI            ; .
  697.     Inc    DI            ; .
  698.     Loop    C1208            ; ..End
  699. C1210:
  700.     Mov    AL,Byte Ptr Parameter_Count
  701.     Mov    Byte Ptr WRK04_Parameter_Count,AL
  702.     Mov    SI,Offset Parameter_String
  703.     Inc    Byte Ptr WRK04_Parameter_Count
  704. C1211:
  705.     Dec    Byte Ptr WRK04_Parameter_Count
  706.     Jz    C1299            ; Go to the end of the module
  707.     Mov    AL,[SI]            ; Put the character into AL
  708.     Cmp    AL,Slash        ; Compare character with a slash
  709.     Je    C1212            ; If so, then continue processing
  710.     Inc    SI            ; Increment the command string addr
  711.     Jmp    C1211            ; Go back and try again
  712. C1212:
  713.     Inc    SI            ; Increment the command string addr
  714.     Mov    AL,[SI]            ; Get the next char after the slash
  715.     Cmp    AL,One_Digit        ; Compare with the char 1
  716.     Je    C1214            ; Set double side flag to false
  717. C1213:
  718.     Mov    Byte Ptr FLG01_Good_Command,False
  719.     Mov    SI,Offset MES12_Invalid_Parameter
  720.     Call    U1000_Display_Message
  721.     Jmp    C1299            ; Go to the end of the module
  722. C1214:
  723.     Mov    Byte Ptr FLG02_Double_Side,False
  724.     Dec    Byte Ptr WRK04_Parameter_Count
  725.     Jz    C1299            ; Go to the end of the module
  726. C1215:
  727.     Dec    Byte Ptr WRK04_Parameter_Count
  728.     Jz    C1299            ; Go to the end of the module
  729.     Inc    SI            ; Increment the command string addr
  730.     Mov    AL,[SI]            ; Get the next char in command line
  731.     Cmp    AL,Space        ; Check for spaces
  732.     Je    C1215            ; If equal to a space, continue
  733. C1216:
  734.     Mov    Byte Ptr FLG01_Good_Command,False
  735.     Mov    SI,Offset MES12_Invalid_Parameter
  736.     Call    U1000_Display_Message
  737. C1299:
  738.     Ret
  739. ;
  740. C1200_Parse_Commands Endp
  741. ;
  742. Page
  743. ;************************************************************************
  744. ;*                                    *
  745. ;*    C1300_GET_EQUIPMENT                        *
  746. ;*                                    *
  747. ;*    This module determines the peripheral devices on the machine.    *
  748. ;*    It invokes the equipment status interrupt and places the    *
  749. ;*    information into the appropriate SYStem parameters.        *
  750. ;*                                    *
  751. ;************************************************************************
  752. ;
  753. Public    C1300_Get_Equipment
  754.  
  755.  
  756. C1300_Get_Equipment Proc Near
  757. ;
  758. C1301:
  759.     Int    Equipment_Interrupt    ; Get the equipment on machine
  760.     Mov    BX,AX            ; Save the result for future use
  761. ;
  762.     And    AX,Parallel_Ports_Mask    ; Get the number of parallel ports
  763.     Mov    CL,Fourteen        ; .
  764.     Shr    AX,CL            ; .
  765.     Mov    Byte Ptr SYS07_No_Parallel_Ports,AL
  766. ;
  767.     Mov    AX,BX            ; Get the game adapter attachments
  768.     And    AX,Game_Adapters_Mask    ; .
  769.     Mov    CL,Twelve        ; .
  770.     Shr    AX,CL            ; .
  771.     Mov    Byte Ptr SYS08_Game_Adapters,AL
  772. ;
  773.     Mov    AX,BX            ; Get the number of RS-232 ports
  774.     And    AX,RS232_Ports_Mask    ; .
  775.     Mov    CL,Nine            ; .
  776.     Shr    AX,CL            ; .
  777.     Mov    Byte Ptr SYS09_No_RS232_Ports,AL
  778. ;
  779.     Mov    AX,BX            ; Get the number of diskette drives
  780.     And    AX,Disk_Drives_Mask    ; .
  781.     Mov    CL,Six            ; .
  782.     Shr    AX,CL            ; .
  783.     Mov    Byte Ptr SYS10_No_Disk_Drives,AL
  784. ;
  785.     Mov    AX,BX            ; Get the initial video mode
  786.     And    AX,Init_Video_Mask    ; .
  787.     Mov    CL,Four            ; .
  788.     Shr    AX,CL            ; .
  789.     Mov    Byte Ptr SYS11_Init_Video_Mode,AL
  790. ;
  791.     Mov    AX,BX            ; Get planar RAM size
  792.     And    AX,Planar_RAM_Mask    ; .
  793.     Mov    CL,Two            ; .
  794.     Shr    AX,CL            ; .
  795.     Mov    Byte Ptr SYS12_Planar_RAM_Size,AL
  796. ;
  797.     Mov    AX,BX            ; Get IPL from diskette flag
  798.     And    AX,IPL_Diskette_Mask    ; .
  799.     Mov    Byte Ptr SYS13_IPL_From_Diskette,AL
  800. ;
  801. C1399:
  802.     Ret
  803. ;
  804. C1300_Get_Equipment Endp
  805. Page
  806. ;************************************************************************
  807. ;*                                    *
  808. ;*    C1400_VALIDATE_DRIVES                        *
  809. ;*                                    *
  810. ;*    This module determines if the drives specified in the        *
  811. ;*    command line are floppy disk drives or RAM disk drives.        *
  812. ;*    It also checks if copying the source diskette takes place    *
  813. ;*    on a single drive.                        *
  814. ;*                                    *
  815. ;************************************************************************
  816. ;
  817. Public    C1400_Validate_Drives
  818. ;
  819. C1400_Validate_Drives Proc Near
  820. ;
  821. C1401:
  822.     Mov    AH,Default_Drive_Command; Get the PC DOS default drive
  823.     Int    PC_DOS_Interrupt    ; .
  824.     Mov    Byte Ptr SYS14_Default_Drive,AL
  825. C1402:
  826.     Cmp    Byte Ptr SYS10_No_Disk_Drives,Minimum_Drives
  827.     Ja    C1403            ; If not single drive copy, set
  828.                     ; . FLG04 to false
  829.     Mov    Byte Ptr SYS14_Default_Drive,Minimum_Drives
  830.     Mov    Byte Ptr WRK01_Source_Drive,Minimum_Drives
  831.     Mov    Byte Ptr WRK02_Target_Drive,Minimum_Drives
  832.     Jmp    C1499            ; Go to the end of the module
  833. C1403:
  834.     Mov    Byte Ptr FLG04_Single_Drive,False
  835. C1404:
  836.     Cmp    Byte Ptr SYS14_Default_Drive,Maximum_Drives
  837.     Jbe    C1405            ; If below maximum, continue
  838.     Mov    Byte Ptr FLG03_Default_Drive,False
  839.     Mov    SI,Offset MES13_Invalid_Default
  840.     Call    U1000_Display_Message
  841.     Jmp    C1499            ; Go to the end of the module
  842. C1405:
  843.     Dec    Byte Ptr WRK01_Source_Drive
  844.     Cmp    Byte Ptr WRK01_Source_Drive,Minus_One
  845.     Jne    C1406
  846.     Mov    AL,Byte Ptr SYS14_Default_Drive
  847.     Mov    Byte Ptr WRK01_Source_Drive,AL
  848. C1406:
  849.     Dec    Byte Ptr WRK02_Target_Drive
  850.     Cmp    Byte Ptr WRK02_Target_Drive,Minus_One
  851.     Jne    C1407
  852.     Mov    AL,Byte Ptr SYS14_Default_Drive
  853.     Mov    Byte Ptr WRK02_Target_Drive,AL
  854. C1407:
  855.     Mov    AL,Byte Ptr WRK01_Source_Drive
  856.     Mov    AH,Byte Ptr WRK02_Target_Drive
  857.     Cmp    AH,AL            ; Check source drive = target drive
  858.     Jne    C1499            ; If so, then continue
  859.     Mov    Byte Ptr FLG04_Single_Drive,True
  860. C1499:
  861.     Ret
  862. ;
  863. C1400_Validate_Drives Endp
  864. ;
  865. Page
  866. ;************************************************************************
  867. ;*                                    *
  868. ;*    C1500_DISKETTE_MESSAGES                        *
  869. ;*                                    *
  870. ;*    This module displays the appropriate source and target        *
  871. ;*    insertion diskette messages on the screen.            *
  872. ;*                                    *
  873. ;************************************************************************
  874. ;
  875. Public    C1500_Diskette_Messages
  876. ;
  877. C1500_Diskette_Messages Proc Near
  878. ;
  879. C1501:
  880.     Cmp    Byte Ptr FLG07_First_Time,False
  881.     Je    C1502            ; If not first time, continue
  882.     Cmp    Byte Ptr FLG04_Single_Drive,False
  883.     Je    C1502            ; If false, then continue
  884.     Mov    SI,Offset MES15_Single_Drive_Copy
  885.     Call    U1000_Display_Message
  886. C1502:
  887.     Mov    SI,Offset MES09_Insert_Source
  888.     Mov    AL,Byte Ptr WRK01_Source_Drive
  889.     Add    AL,Capital_Letter_A    ; Put the drive letter into AL
  890.     Mov    [SI+Thirty_Four],AL    ; Put the drive letter into the
  891.                     ; . correct position in the message
  892.     Call    U1000_Display_Message    ; Display the message on the screen
  893. C1503:
  894.     Cmp    Byte Ptr FLG04_Single_Drive,True
  895.     Je    C1505            ; If true, go to the message to press
  896.                     ; . any key to continue
  897. C1504:
  898.     Mov    SI,Offset MES10_Insert_Target
  899.     Mov    AL,Byte Ptr WRK02_Target_Drive
  900.     Add    AL,Capital_Letter_A    ; Put the drive letter into AL
  901.     Mov    [SI+Thirty_Four],AL    ; Put the drive letter into the
  902.                     ; . correct position in the message
  903.     Call    U1000_Display_Message    ; Display the message on the screen
  904. C1505:
  905.     Mov    SI,Offset MES16_Press_Any_Key
  906.     Call    U1000_Display_Message
  907.     Mov    Byte Ptr FLG05_Store_Buffer,False
  908.     Call    U1100_Get_Response
  909. C1599:
  910.     Ret
  911. ;
  912. C1500_Diskette_Messages Endp
  913. ;
  914. Page
  915. ;************************************************************************
  916. ;*                                    *
  917. ;*    C1600_GET_FREE_MEMORY                        *
  918. ;*                                    *
  919. ;*    This module calculates the amount of free 16 byte paragraphs    *
  920. ;*    available on the machine. The segment address of the beginning    *
  921. ;*    of free memory is obtained by setting DX to:            *
  922. ;*                                    *
  923. ;*        1. The contents of the stack segment SS plus        *
  924. ;*                                    *
  925. ;*        2. 256 bytes for the Program Segment Prefix plus    *
  926. ;*                                    *
  927. ;*        3. 128 bytes for the stack.                *
  928. ;*                                    *
  929. ;*    After saving the ES segment register on the stack and        *
  930. ;*    initializing both the offset register BX and the 16 byte    *
  931. ;*    counter register CX to zero, the routine begins the looping    *
  932. ;*    through memory 16 bytes at a time (incrementing the segment    *
  933. ;*    register ES by one) until either the module encounters one    *
  934. ;*    of the two (2) conditions:                    *
  935. ;*                                    *
  936. ;*        1. The beginning of Video RAM at the segment address    *
  937. ;*           specified in Video_Address.                *
  938. ;*                                    *
  939. ;*        2. The memory pattern defined by the machine that    *
  940. ;*           indicates no more memory.                *
  941. ;*                                    *
  942. ;*    When either of these two (2) conditions occur, CX contains    *
  943. ;*    the  number of 16 bytes paragraphs of free memory.        *
  944. ;*                                    *
  945. ;*    Since we do not know the size of the transient portion of    *
  946. ;*    COMMAND.COM, FREECOPY makes the worst case assumption that    *
  947. ;*    all of the bytes in COMMAND.COM reside in high memory.        *
  948. ;*                                    *
  949. ;*    This module also allocates space for the ES:BX table, the    *
  950. ;*    CHRN table, the File Allocation Table (FAT) of the source    *
  951. ;*    diskette and at least one track (4608 bytes).            *
  952. ;*                                    *
  953. ;************************************************************************
  954. ;
  955. Page
  956. ;
  957. Public    C1600_Get_Free_Memory
  958. ;
  959. C1600_Get_Free_Memory Proc Near
  960. ;
  961. C1601:
  962.     Mov    DX,SS            ; Calculate the segment address for
  963.                     ; . the beginning of free memory
  964.     Add    DX,Offset MEM04_Top_of_the_Stack
  965. ;
  966.     Push    ES            ; Save ES on the stack for a moment
  967.     Mov    BX,NUL            ; Initialize BX and CX registers
  968.     Mov    CX,NUL            ; ..End
  969. C1602:
  970.     Mov    ES,DX            ; Set ES to the appropriate value
  971.     Cli                ; Turn off interrupts for a moment
  972.     Mov    AX,ES:[BX]        ; Read a word from memory into AX
  973.     Mov    Word Ptr ES:[BX],SOH    ; Put the test pattern into memory
  974.     Cmp    Word Ptr ES:[BX],SOH    ; Compare memory with test pattern
  975.     Mov    ES:[BX],AX        ; Restore the contents of memory
  976.     Sti                ; Turn on the interrupts
  977.     Jne    C1603            ; If not equal, stop looping
  978.     Inc    DX            ; Increment DX segment register
  979.     Cmp    DX,Video_Address    ; Compare for start of Video RAM
  980.     Jae    C1603            ; If so, stop looping
  981.     Inc    CX            ; Increment 16 byte counter CX
  982.     Jmp    C1602            ; Go back and try again
  983. C1603:
  984.     Pop    ES            ; Restore the ES register
  985.     Cmp    CX,Command_Com_Size    ; Compare the paragraph size of
  986.                     ; . free memory with the paragraph
  987.                     ; . size of COMMAND.COM.
  988.     Ja    C1604            ; If greater, continue
  989. ;
  990.     Mov    Byte Ptr FLG01_Good_Command,False
  991.     Mov    SI,Offset MES11_Insufficient_Memory
  992.     Call    U1000_Display_Message    ; Display the message on the screen
  993.     Jmp    C1699            ; Go to the end of the module
  994. C1604:
  995.     Sub    CX,Command_Com_Size    ; Subtract the size of COMMAND.COM
  996.     Cmp    CX,ESBX_Table_Size    ; Compare the paragraph size of the
  997.                     ; . free memory with the paragraph
  998.                     ; . size of the ES:BX table
  999.     Ja    C1605            ; If greater, continue
  1000.     Mov    Byte Ptr FLG01_Good_Command,False
  1001.     Mov    SI,Offset MES11_Insufficient_Memory
  1002.     Call    U1000_Display_Message    ; Display the message on the screen
  1003.     Jmp    C1699            ; Go to the end of the module
  1004. C1605:
  1005.     Sub    CX,ESBX_Table_Size    ; Subtract the size of ES:BX table
  1006.     Cmp    CX,CHRN_Table_Size    ; Compare the paragraph size of the
  1007.                     ; . free memory with the paragraph
  1008.                     ; . size of the CHRN table
  1009.     Ja    C1606            ; If greater, continue
  1010. ;
  1011.     Mov    Byte Ptr FLG01_Good_Command,False
  1012.     Mov    SI,Offset MES11_Insufficient_Memory
  1013.     Call    U1000_Display_Message    ; Display the message on the screen
  1014.     Jmp    C1699            ; Go to the end of the module
  1015. C1606:
  1016.     Sub    CX,CHRN_Table_Size    ; Subtract the size of CHRN Table
  1017.     Cmp    CX,FAT_Sector_Size    ; Determine if there is enough memory
  1018.     Jae    C1607            ; to read the File Allocation Table
  1019.     Mov    Byte Ptr FLG01_Good_Command,False
  1020.     Mov    SI,Offset MES11_Insufficient_Memory
  1021.     Call    U1000_Display_Message    ; Display the message on the screen
  1022.     Jmp    C1699            ; Go to the end of the module
  1023. C1607:
  1024.     Sub    CX,FAT_Sector_Size    ; Subtract the size of the source FAT
  1025.     Cmp    CX,Minimum_Memory_Size    ; Determine if the amount of memory
  1026.     Jae    C1608            ; can hold a nine sectored track
  1027. ;
  1028.     Mov    Byte Ptr FLG01_Good_Command,False
  1029.     Mov    SI,Offset MES11_Insufficient_Memory
  1030.     Call    U1000_Display_Message    ; Display the message on the screen
  1031.     Jmp    C1699            ; Go to the end of the module
  1032. C1608:
  1033.     Mov    Word Ptr SYS05_Para_RAM_Size,CX
  1034. C1699:
  1035.     Ret
  1036. ;
  1037. C1600_Get_Free_Memory Endp
  1038. ;
  1039. Page
  1040. ;************************************************************************
  1041. ;*                                    *
  1042. ;*    C1700_CREATE_ESBX_TABLE                        *
  1043. ;*                                    *
  1044. ;*    This module creates the correct ES:BX addresses that are    *
  1045. ;*    used when storing tracks read from the source diskette.        *
  1046. ;*    The routine allocates at most 80 entries in the table for    *
  1047. ;*    double sided diskettes.                        *
  1048. ;*                                    *
  1049. ;************************************************************************
  1050. ;
  1051. Public    C1700_Create_ESBX_Table
  1052. ;
  1053. C1700_Create_ESBX_Table Proc Near
  1054. ;
  1055. C1701:
  1056.     Mov    Word Ptr WRK18_Counter_ESBX_Entries,Zero
  1057.     Mov    AX,Nine            ; Calculate DI = the number of bytes
  1058.     Mov    BX,Sector_Size        ; per track and BX = the number of
  1059.     Mul    BX            ; paragraphs per track
  1060.     Mov    DI,AX            ; .
  1061.     Mov    BX,Paragraph_Size    ; .
  1062.     Div    BX            ; .
  1063.     Mov    BX,AX            ; ..End
  1064. ;
  1065.     Mov    AX,CS            ; Calculate the address of the 1st
  1066.     Mov    CL,Four            ; that will be copied into memory
  1067.     Shl    AX,CL            ; .
  1068.     Add    AX,Offset MEM00_Bottom_Free_Memory
  1069.     Shr    AX,CL            ; .
  1070.     Inc    AX            ; ..End
  1071. ;
  1072.     Mov    SI,Offset MEM03_ESBX_Table
  1073.     Mov    Word Ptr [SI],Zero    ; Put the 1st entry into the table
  1074.     Mov    Word Ptr [SI+Two],AX    ; ..End
  1075. C1702:
  1076.     Cmp    Word Ptr WRK18_Counter_ESBX_Entries,Seventy_Nine
  1077.     Jae    C1705            ; Calculate the ES:BX valid entries
  1078.     Add    SI,Four            ; Get the next ES:BX table address
  1079. ;
  1080.     Mov    AX,[SI-Two]        ; Check for DMA overflow error
  1081.     And    AX,DMA_Boundary_Mask    ; .
  1082.     Shl    AX,CL            ; .
  1083.     Add    AX,DI            ; .
  1084.     Jnc    C1703            ; ..End
  1085. ;
  1086.     Mov    AX,[SI-Two]        ; Correction for DMA overflow
  1087.     Add    AX,BX            ; .
  1088.     Mov    [SI-Two],AX        ; ..End
  1089. C1703:
  1090.     Mov    AX,[SI-Two]        ; Increment the ES segment address
  1091.     Add    AX,BX            ; ..End
  1092. C1704:
  1093.     Mov    Word Ptr [SI],Zero    ; Put the address into the table
  1094.     Mov    Word Ptr [SI+Two],AX    ; ..End
  1095.     Inc    Word Ptr WRK18_Counter_ESBX_Entries
  1096.     Jmp    C1702            ; Go back and find another entry
  1097. C1705:
  1098.     Mov    AX,Word Ptr SYS05_Para_RAM_Size
  1099.     Div    BX            ; Divide by the paragraphs per track
  1100.     Mov    Word Ptr WRK19_Number_ESBX_Entries,AX
  1101.     Cmp    Word Ptr WRK19_Number_ESBX_Entries,Seventy_Nine
  1102.     Jbe    C1799            ; If less than 79, continue
  1103.     Mov    Word Ptr WRK19_Number_ESBX_Entries,Seventy_Nine
  1104. C1799:
  1105.     Ret
  1106. ;
  1107. C1700_Create_ESBX_Table Endp
  1108. ;
  1109. Page
  1110. ;************************************************************************
  1111. ;*                                    *
  1112. ;*    C1800_VALIDATE_SOURCE_DISK                    *
  1113. ;*                                    *
  1114. ;*    This module determines if the source diskette is readable    *
  1115. ;*    and whether it was formatted under PC DOS 1.0, 1.1, 2.0 or    *
  1116. ;*    2.1.  The routine also reads the first copy of the File        *
  1117. ;*    Allocation Table (FAT) storing it for future comparisons    *
  1118. ;*    as well as analyzing it first entry.                *
  1119. ;*                                    *
  1120. ;*    A series of comparisons for the number of sectors per track    *
  1121. ;*    is done for the following reasons.  All diskettes formatted    *
  1122. ;*    under PC DOS 2.0 and 2.1 really have nine sectors.  In order    *
  1123. ;*    to obtain an eight sectored diskette, the operating system    *
  1124. ;*    sets the first byte of the File Allocation Table (FAT)        *
  1125. ;*    accordingly.  In contrast, PC DOS 1.0 and 1.1 formats a track    *
  1126. ;*    to have exactly eight sectors.                    *
  1127. ;*                                    *
  1128. ;************************************************************************
  1129. ;
  1130. Public    C1800_Validate_Source_Disk
  1131. ;
  1132. C1800_Validate_Source_Disk Proc Near
  1133. ;
  1134. C1801:
  1135.     Mov    Byte Ptr FLG08_Good_Read,True
  1136. ;
  1137.     Mov    AL,Byte Ptr WRK01_Source_Drive
  1138.     Mov    Byte Ptr WRK06_Drive_Number,AL
  1139.     Mov    Byte Ptr WRK07_Head_Number,Zero
  1140.     Mov    Byte Ptr WRK08_Track_Number,Zero
  1141.     Mov    Byte Ptr WRK09_Sector_Number,Nine
  1142.     Mov    Byte Ptr WRK10_Number_of_Sectors,One
  1143.     Push    CS            ; Establish the address ES:BX
  1144.     Pop    ES            ; ..End
  1145.     Mov    BX,Offset MEM01_File_Allocation_Table
  1146. ;
  1147.     Call    D1000_Read_Diskette
  1148. ;
  1149.     Cli                ; Set the number of sectors to nine
  1150.     Mov    Byte Ptr SYS18_Disk_Parameter_Table[Four],Nine
  1151.     Sti                ; .
  1152.     Mov    Byte Ptr WRK17_Maximum_Sectors,Nine
  1153. ;                
  1154.     Cmp    Byte Ptr FLG08_Good_Read,True
  1155.     Je    C1803            ; Check for good read of sector nine
  1156.     Cmp    Byte Ptr WRK14_Status_Operation,Sector_Error
  1157.     Je    C1802            ; If so, continue
  1158.     Mov    Byte Ptr FLG15_IO_Error,One
  1159.     Call    D1200_Disk_IO_Error    ; Process the error
  1160.     Jmp    C1899            ; ..End
  1161. C1802:
  1162.     Cli                ; Set the number of sectors to eight
  1163.     Mov    Byte Ptr SYS18_Disk_Parameter_Table[Four],Eight
  1164.     Sti                ; .
  1165.     Mov    Byte Ptr WRK17_Maximum_Sectors,Eight
  1166. C1803:                    ; .
  1167.     Mov    Byte Ptr FLG08_Good_Read,True
  1168. ;
  1169.     Mov    AL,Byte Ptr WRK01_Source_Drive
  1170.     Mov    Byte Ptr WRK06_Drive_Number,AL
  1171.     Mov    Byte Ptr WRK07_Head_Number,Zero
  1172.     Mov    Byte Ptr WRK08_Track_Number,Zero
  1173.     Mov    Byte Ptr WRK09_Sector_Number,Two
  1174.     Mov    Byte Ptr WRK10_Number_of_Sectors,One
  1175.     Push    CS            ; Establish the address ES:BX
  1176.     Pop    ES            ; ..End
  1177.     Mov    BX,Offset MEM01_File_Allocation_Table
  1178. ;
  1179.     Call    D1000_Read_Diskette
  1180. ;
  1181.     Cmp    Byte Ptr FLG08_Good_Read,True
  1182.     Je    C1804            ; If the read operation was
  1183.                     ; . successful, continue
  1184.     Mov    Byte Ptr FLG15_IO_Error,One
  1185.     Call    D1200_Disk_IO_Error    ; Display appropriate error message
  1186.     Jmp    C1899            ; Go to the end of the module
  1187. C1804:
  1188.     Mov    AL,Byte Ptr MEM01_File_Allocation_Table[Zero]
  1189. ;
  1190.     Cmp    AL,One_Side_Eight_Sectors
  1191.     Jne    C1805            ; If not, continue
  1192.     Mov    Byte Ptr WRK15_Maximum_Heads,Zero
  1193.     Mov    Byte Ptr WRK16_Maximum_Tracks,Thirty_Nine
  1194.     Mov    SI,Offset MES03_Copy81_Sectors
  1195.     Jmp    C1809            ; Continue the processing
  1196. C1805:
  1197.     Cmp    AL,Two_Sides_Eight_Sectors
  1198.     Jne    C1806            ; If not, continue
  1199.     Mov    Byte Ptr WRK15_Maximum_Heads,One
  1200.     Mov    Byte Ptr WRK16_Maximum_Tracks,Seventy_Nine
  1201.     Mov    SI,Offset MES04_Copy82_Sectors
  1202.     Jmp    C1809            ; Continue the processing
  1203. C1806:
  1204.     Cmp    AL,One_Side_Nine_Sectors
  1205.     Jne    C1807            ; If not, continue
  1206.     Mov    Byte Ptr WRK15_Maximum_Heads,Zero
  1207.     Mov    Byte Ptr WRK16_Maximum_Tracks,Thirty_Nine
  1208.     Mov    SI,Offset MES05_Copy91_Sectors
  1209.     Jmp    C1809            ; Continue the processing
  1210. C1807:
  1211.     Cmp    AL,Two_Sides_Nine_Sectors
  1212.     Jne    C1808            ; If not, continue
  1213.     Mov    Byte Ptr WRK15_Maximum_Heads,One
  1214.     Mov    Byte Ptr WRK16_Maximum_Tracks,Seventy_Nine
  1215.     Mov    SI,Offset MES06_Copy92_Sectors
  1216.     Jmp    C1809            ; Continue the processing
  1217. C1808:
  1218.     Mov    Byte Ptr FLG08_Good_Read,False
  1219.     Mov    SI,Offset MES19_Unrecoverable_Read
  1220.     Call    U1000_Display_Message    ; Display the message on the screen
  1221.     Mov    SI,Offset MES90_Unknown_FAT_Error
  1222.     Call    U1000_Display_Message    ; Display the message on the screen
  1223.     Jmp    C1899            ; Go to display the message
  1224. C1809:
  1225.     Cmp    Byte Ptr WRK15_Maximum_Heads,Zero
  1226.     Je    C1810            ; If the diskette is single sided,
  1227.                     ; . display the diskette message
  1228.     Cmp    Byte Ptr FLG02_Double_Side,True
  1229.     Je    C1810            ; If the flag indicates to copy 
  1230.                     ; . both sides of the diskette,
  1231.                     ; . then continue
  1232.     Mov    Byte Ptr WRK15_Maximum_Heads,Zero
  1233.     Mov    Byte Ptr WRK16_Maximum_Tracks,Thirty_Nine
  1234. C1810:
  1235.     Mov    AL,Byte Ptr WRK01_Source_Drive
  1236.     Mov    Byte Ptr WRK06_Drive_Number,AL
  1237.     Mov    Byte Ptr WRK07_Head_Number,One
  1238.     Mov    Byte Ptr WRK08_Track_Number,Zero
  1239.     Mov    Byte Ptr WRK09_Sector_Number,One
  1240.     Mov    Byte Ptr WRK10_Number_of_Sectors,One
  1241.     Push    CS            ; Establish the ES segment register
  1242.     Pop    ES            ; ..End
  1243.     Mov    BX,Offset MEM00_Bottom_Free_Memory
  1244. ;
  1245.     Call    D1000_Read_Diskette
  1246. ;
  1247.     Cmp    Byte Ptr FLG08_Good_Read,True
  1248.     Je    C1812            ; Go to display the message
  1249.     Cmp    Byte Ptr WRK15_Maximum_Heads,One
  1250.     Je    C1811            ; If double sided diskette, error!!!
  1251.     Mov    Byte Ptr FLG08_Good_Read,True
  1252.     Mov    Byte Ptr FLG02_Double_Side,False
  1253.     Jmp    C1812            ; Display the appropriate message
  1254. C1811:
  1255.     Mov    SI,Offset MES19_Unrecoverable_Read
  1256.     Call    U1000_Display_Message    ; Display the message on the screen
  1257.     Mov    SI,Offset MES91_Single_Side_Error
  1258.     Call    U1000_Display_Message    ; Display the message on the screen
  1259.     Jmp    C1899            ; Go to the end of the module
  1260. C1812:
  1261.     Call    U1000_Display_Message    ; Display the message on the screen
  1262. C1899:
  1263.     Ret
  1264. ;
  1265. C1800_Validate_Source_Disk Endp
  1266. ;
  1267. Page
  1268. ;************************************************************************
  1269. ;*                                    *
  1270. ;*    C1900_CREATE_CHRN_TABLE                        *
  1271. ;*                                    *
  1272. ;*    This module creates the CHRN table to be used in case the    *
  1273. ;*    target diskette needs to be formatted.    The abbreviation    *
  1274. ;*    stands for C = track number, H = head number, R = sector    *
  1275. ;*    number and N = a code for the number of bytes per sector.    *
  1276. ;*                                    *
  1277. ;************************************************************************
  1278. ;
  1279. Public    C1900_Create_CHRN_Table
  1280. ;
  1281. C1900_Create_CHRN_Table Proc Near
  1282. ;
  1283. C1901:
  1284.     Mov    BH,Byte Ptr WRK15_Maximum_Heads
  1285.     Mov    BL,Byte Ptr WRK16_Maximum_Tracks
  1286.     Mov    AL,Nine
  1287. ;
  1288.     Mov    CL,BH            ; Establish correct track number
  1289.     Shr    BL,CL            ; ..End
  1290. ;
  1291.     Mov    DL,Two            ; . DL = number of sectors
  1292.     Mov    DH,Zero            ; . DH = head number
  1293.     Mov    CH,Zero            ; . CH = track number
  1294.     Mov    CL,One            ; . CL = sector number
  1295.     Mov    SI,Offset MEM02_CHRN_Table; Set up initial registers
  1296. C1902:
  1297.     Mov    [SI],CH            ; Establish an entry in the CHRN
  1298.     Mov    [SI+One],DH        ; . table
  1299.     Mov    [SI+Two],CL        ; .
  1300.     Mov    [SI+Three],DL        ; ..End
  1301. ;
  1302.     Add    SI,Four            ; Get the addr of next CHRN entry
  1303.     Inc    CL            ; Increment the sector number
  1304.     Cmp    CL,AL            ; Compare for maximum sectors
  1305.     Jbe    C1902            ; If not, go back and try again
  1306. ;
  1307.     Mov    CL,One            ; Initialize sector number
  1308.     Inc    DH            ; Increment the head number
  1309.     Cmp    DH,BH            ; Compare for maximum heads
  1310.     Jbe    C1902            ; If not, go back and try again
  1311. ;
  1312.     Mov    CL,One            ; Initialize sector number
  1313.     Mov    DH,Zero            ; Initialize head number
  1314.     Inc    CH            ; Increment the track number
  1315.     Cmp    CH,BL            ; Compare for maximum tracks
  1316.     Jbe    C1902            ; If not, go back and try again
  1317. C1999:
  1318.     Ret
  1319. ;
  1320. C1900_Create_CHRN_Table Endp
  1321. ;
  1322. Page
  1323. ;************************************************************************
  1324. ;*                                    *
  1325. ;*    C2000_READ_SOURCE_DISK                        *
  1326. ;*                                    *
  1327. ;*    This module reads a diskette track by track until it fills    *
  1328. ;*    all of available memory specified by the ES:BX table.  The    *
  1329. ;*    processing sequence is:                        *
  1330. ;*                                    *
  1331. ;*    1. Initializes the SI resgister to point to the correct entry    *
  1332. ;*       in the ES:BX table.                        *
  1333. ;*                                    *
  1334. ;*    2. Prints the initial read message on the screen.        *
  1335. ;*                                    *
  1336. ;*    3. Compares for the end of the ES:BX table and/or the number    *
  1337. ;*       of tracks on the diskette.  If not, continue.  If so,    *
  1338. ;*       return to B1100_Detail_Processing.                *
  1339. ;*                                    *
  1340. ;*    4. Reads a track from the source diskette.            *
  1341. ;*                                    *
  1342. ;*    5. Displays the track and head numbers on the screen.        *
  1343. ;*                                    *
  1344. ;*    6. Transfers control to 3.                    *
  1345. ;*                                    *
  1346. ;************************************************************************
  1347. ;
  1348. Page
  1349. ;
  1350. Public    C2000_Read_Source_Disk
  1351. ;
  1352. C2000_Read_Source_Disk Proc Near
  1353. ;
  1354. C2001:
  1355.     Mov    Byte Ptr FLG08_Good_Read,True
  1356. ;
  1357.     Mov    SI,Offset MEM03_ESBX_Table
  1358.     Mov    Word Ptr WRK18_Counter_ESBX_Entries,Zero
  1359. ;
  1360.     Cmp    Byte Ptr FLG13_First_Read_Write,False
  1361.     Je    C2002            ; If not first time, continue
  1362.     Mov    Byte Ptr WRK31_Track_Read_Counter,Zero
  1363.     Jmp    C2003            ; Go to display the message
  1364. C2002:
  1365.     Cmp    Byte Ptr FLG04_Single_Drive,False
  1366.     Je    C2004            ; If double drive copy, continue
  1367. C2003:
  1368.     Push    SI            ; Save SI = Addr of ES:BX table
  1369.     Mov    SI,Offset MES97_Return_Linefeed
  1370.     Call    U1000_Display_Message    ; Display a return and linefeed
  1371.     Mov    SI,Offset MES17_Reading_Track
  1372.     Mov    AL,Byte Ptr WRK21_Current_Source_Track
  1373.     Call    U1300_Convert_Binary_to_ASCII
  1374.     Mov    [SI+Fifteen],AX        ; Put the track number into message
  1375.     Mov    AL,Byte Ptr WRK20_Current_Source_Head
  1376.     Call    U1300_Convert_Binary_to_ASCII
  1377.     Mov    [SI+Twenty_Five],AL    ; Put the head number into message
  1378.     Call    U1000_Display_Message    ; Display the message on the screeen
  1379. ;
  1380.     Mov    AH,Read_Cursor_Command    ; Get the current cursor position
  1381.     Mov    BH,Byte Ptr SYS03_Active_Page
  1382.     Int    Video_Interrupt        ; ..End
  1383. ;
  1384.     Dec    DH            ; Save the row of the read track and
  1385.     Mov    Byte Ptr WRK24_Read_Message_Row,DH; . head message
  1386. ;
  1387.     Pop    SI            ; Restore SI = Addr of ES:BX table
  1388. C2004:
  1389.     Mov    AX,Word Ptr WRK18_Counter_ESBX_Entries
  1390.     Cmp    AX,Word Ptr WRK19_Number_ESBX_Entries
  1391.     Jbe    C2005            ; If more memory exists, continue
  1392.     Jmp    C2099            ; Go to the end of the module
  1393. C2005:
  1394.     Mov    AL,Byte Ptr WRK31_Track_Read_Counter
  1395.     Cmp    AL,Byte Ptr WRK16_Maximum_Tracks
  1396.     Jbe    C2006            ; If more tracks, then continue
  1397.     Jmp    C2099            ; Go to the end of the module
  1398. C2006:
  1399. ;                    ; Display the current track and head
  1400.     Mov    AL,Byte Ptr WRK24_Read_Message_Row
  1401.     Mov    Byte Ptr WRK28_Current_Message_Row,AL
  1402.     Mov    AL,Byte Ptr WRK20_Current_Source_Head
  1403.     Mov    Byte Ptr WRK29_Current_Head,AL
  1404.     Mov    AL,Byte Ptr WRK21_Current_Source_Track
  1405.     Mov    Byte Ptr WRK30_Current_Track,AL
  1406. ;
  1407.     Call    U1400_Display_Head_and_Track
  1408. ;
  1409.                     ; Establish the disk parameters
  1410.     Mov    AL,Byte Ptr WRK01_Source_Drive
  1411.     Mov    Byte Ptr WRK06_Drive_Number,AL
  1412.     Mov    AL,Byte Ptr WRK20_Current_Source_Head
  1413.     Mov    Byte Ptr WRK07_Head_Number,AL
  1414.     Mov    AL,Byte Ptr WRK21_Current_Source_Track
  1415.     Mov    Byte Ptr WRK08_Track_Number,AL
  1416.     Mov    Byte Ptr WRK09_Sector_Number,One
  1417.     Mov    AL,Byte Ptr WRK17_Maximum_Sectors
  1418.     Mov    Byte Ptr WRK10_Number_of_Sectors,AL
  1419.     Mov    AX,DS:[SI]        ; .
  1420.     Mov    BX,AX            ; .
  1421.     Mov    AX,DS:[SI+Two]        ; .
  1422.     Mov    ES,AX            ; ..End
  1423. ;
  1424.     Call    D1000_Read_Diskette    ; Read the source diskette
  1425. C2007:
  1426.     Cmp    Byte Ptr FLG08_Good_Read,True
  1427.     Je    C2008            ; If the read operation was 
  1428.                     ; . successful, then continue
  1429.     Mov    Byte Ptr FLG15_IO_Error,One
  1430.     Call    D1200_Disk_IO_Error    ; Display appropriate error message
  1431.     Jmp    C2099            ; Go to the end of the module
  1432. C2008:
  1433.     Inc    Byte Ptr WRK31_Track_Read_Counter
  1434.     Inc    Word Ptr WRK18_Counter_ESBX_Entries
  1435.     Add    SI,Four            ; Increment addr of the ES:BX table
  1436.     Cmp    Byte Ptr FLG02_Double_Side,False
  1437.     Je    C2009            ; If single sided, then continue
  1438.     Inc    Byte Ptr WRK20_Current_Source_Head
  1439.     Cmp    Byte Ptr WRK20_Current_Source_Head,One
  1440.     Jbe    C2010            ; If the head number is less than or
  1441.                     ; . equal to one, then continue
  1442.     Mov    Byte Ptr WRK20_Current_Source_Head,Zero
  1443. C2009:
  1444.     Inc    Byte Ptr WRK21_Current_Source_Track
  1445. C2010:
  1446.     Jmp    C2004            ; Go back and read another track
  1447. C2099:
  1448.     Ret
  1449. ;
  1450. C2000_Read_Source_Disk Endp
  1451. ;
  1452. Page
  1453. ;************************************************************************
  1454. ;*                                    *
  1455. ;*    C2100_WRITE_FORMAT_TARGET_DISK                    *
  1456. ;*                                    *
  1457. ;*    This module formats and writes  a diskette track by track    *
  1458. ;*    until it fills all of available memory specified by the        *
  1459. ;*    ES:BX table.  The processing sequence is:            *
  1460. ;*                                    *
  1461. ;*    1. Initializes the SI resgister to point to the correct entry    *
  1462. ;*       in the ES:BX table.                        *
  1463. ;*                                    *
  1464. ;*    2. Prints the initial write message on the screen.        *
  1465. ;*                                    *
  1466. ;*    3. Compares for the end of the ES:BX table and/or the number    *
  1467. ;*       of tracks on the diskette.  If not, continue.  If so,    *
  1468. ;*       return to B1100_Detail_Processing.                *
  1469. ;*                                    *
  1470. ;*    4. Writes a track from the source diskette.            *
  1471. ;*                                    *
  1472. ;*    5. Displays the track and head numbers on the screen.        *
  1473. ;*                                    *
  1474. ;*    6. Transfers control to 3.                    *
  1475. ;*                                    *
  1476. ;************************************************************************
  1477. ;
  1478. Public    C2100_Write_Format_Target_Disk
  1479. ;
  1480. C2100_Write_Format_Target_Disk Proc Near
  1481. ;
  1482. C2101:
  1483.     Mov    Byte Ptr FLG09_Good_Write,True
  1484.     Mov    Byte Ptr FLG11_Good_Format,True
  1485. ;
  1486.     Mov    Byte Ptr WRK13_Retry_Counter,Number_of_Retries
  1487. ;
  1488.     Mov    SI,Offset MEM03_ESBX_Table
  1489.     Mov    Word Ptr WRK18_Counter_ESBX_Entries,Zero
  1490. ;
  1491.     Cmp    Byte Ptr FLG13_First_Read_Write,False
  1492.     Je    C2102            ; If not first time, continue
  1493.     Mov    Byte Ptr WRK32_Track_Write_Counter,Zero
  1494.     Jmp    C2103            ; Go to display the message
  1495. C2102:
  1496.     Cmp    Byte Ptr FLG04_Single_Drive,False
  1497.     Je    C2104            ; If double drive copy, continue
  1498. C2103:
  1499.     Push    SI            ; Save SI = Addr of ES:BX table
  1500. ;
  1501.     Mov    SI,Offset MES97_Return_Linefeed
  1502.     Call    U1000_Display_Message    ; Display return and line feed
  1503.     Mov    SI,Offset MES23_Writing_Track
  1504.     Call    U1000_Display_Message    ; Display write track message
  1505. ;
  1506.     Mov    AH,Read_Cursor_Command    ; Get the current cursor position
  1507.     Mov    BH,Byte Ptr SYS03_Active_Page
  1508.     Int    Video_Interrupt        ; ..End
  1509. ;
  1510.     Dec    DH            ; Save the row of the I/O track and
  1511.     Mov    Byte Ptr WRK27_Write_Message_Row,DH; . head information
  1512.     Sub    DH,Two            ; .
  1513.     Mov    Byte Ptr WRK24_Read_Message_Row,DH
  1514. ;
  1515.     Pop    SI            ; Restore SI = Addr of ES:BX table
  1516. C2104:
  1517.     Mov    AX,Word Ptr WRK18_Counter_ESBX_Entries
  1518.     Cmp    AX,Word Ptr WRK19_Number_ESBX_Entries
  1519.     Jbe    C2105            ; If more memory exists, continue
  1520.     Jmp    C2199            ; Go to the end of the module
  1521. C2105:
  1522.     Mov    AL,Byte Ptr WRK32_Track_Write_Counter
  1523.     Cmp    AL,Byte Ptr WRK16_Maximum_Tracks
  1524.     Jbe    C2106            ; If more tracks, then continue
  1525.     Mov    Byte Ptr FLG14_Copy_Complete,True
  1526.     Jmp    C2199            ; Go to the end of the module
  1527. C2106:
  1528. ;                    ; Establish the disk parameters
  1529.     Mov    AL,Byte Ptr WRK02_Target_Drive
  1530.     Mov    Byte Ptr WRK06_Drive_Number,AL
  1531.     Mov    AL,Byte Ptr WRK22_Current_Target_Head
  1532.     Mov    Byte Ptr WRK07_Head_Number,AL
  1533.     Mov    AL,Byte Ptr WRK23_Current_Target_Track
  1534.     Mov    Byte Ptr WRK08_Track_Number,AL
  1535.     Mov    Byte Ptr WRK09_Sector_Number,One
  1536.     Mov    AL,Byte Ptr WRK17_Maximum_Sectors
  1537.     Mov    Byte Ptr WRK10_Number_of_Sectors,AL
  1538.     Mov    AX,DS:[SI+Two]        ; .
  1539.     Mov    Word Ptr WRK11_Segment_Address,AX
  1540.     Mov    AX,DS:[SI]        ; .
  1541.     Mov    Word Ptr WRK12_Offset_Address,AX
  1542. ;
  1543.     Call    D1100_Write_Format_Diskette
  1544. ;
  1545.     Cmp    Byte Ptr FLG11_Good_Format,True
  1546.     Je    C2107            ; If a good format, continue
  1547.     Cmp    Byte Ptr FLG09_Good_Write,True
  1548.     Je    C2107            ; If a good write, continue
  1549.     Call    D1200_Disk_IO_Error    ; Display appropriate error message
  1550.     Jmp    C2199            ; Go to the end of the module
  1551. C2107:
  1552.     Inc    Byte Ptr WRK32_Track_Write_Counter
  1553.     Inc    Word Ptr WRK18_Counter_ESBX_Entries
  1554.     Add    SI,Four            ; Increment addr of the ES:BX table
  1555.     Cmp    Byte Ptr FLG02_Double_Side,False
  1556.     Je    C2108            ; If single sided, then continue
  1557.     Inc    Byte Ptr WRK22_Current_Target_Head
  1558.     Cmp    Byte Ptr WRK22_Current_Target_Head,One
  1559.     Jbe    C2109            ; If the head number is less than or
  1560.                     ; . equal to one, then continue
  1561.     Mov    Byte Ptr WRK22_Current_Target_Head,Zero
  1562. C2108:
  1563.     Inc    Byte Ptr WRK23_Current_Target_Track
  1564. C2109:
  1565.     Jmp    C2104            ; Go back and write another track
  1566. C2199:
  1567.     Ret
  1568. ;
  1569. C2100_Write_Format_Target_Disk Endp
  1570. ;
  1571. Page
  1572. ;************************************************************************
  1573. ;*                                    *
  1574. ;*    C2200_CHECK_FILE_ALLOC_TABLE                    *
  1575. ;*                                    *
  1576. ;*    This module checks the File Allocation Table (FAT) of the    *
  1577. ;*    diskette in the source drive and compares it with the File    *
  1578. ;*    Allocation Table (FAT) of the original source diskette.  If    *
  1579. ;*    there are any differences, the program sets the flag        *
  1580. ;*    FLG12_Good_FAT to False; otherwise, the flag is True.        *
  1581. ;*                                    *
  1582. ;************************************************************************
  1583. ;
  1584. Public    C2200_Check_File_Alloc_Table
  1585. ;
  1586. C2200_Check_File_Alloc_Table Proc Near
  1587. ;
  1588. C2201:
  1589.     Mov    Byte Ptr FLG12_Good_FAT,True
  1590. ;
  1591.     Mov    AL,Byte Ptr WRK01_Source_Drive
  1592.     Mov    Byte Ptr WRK06_Drive_Number,AL
  1593.     Mov    Byte Ptr WRK07_Head_Number,Zero
  1594.     Mov    Byte Ptr WRK08_Track_Number,Zero
  1595.     Mov    Byte Ptr WRK09_Sector_Number,Two
  1596.     Mov    Byte Ptr WRK10_Number_of_Sectors,One
  1597.     Push    CS            ; Establish the ES segment register
  1598.     Pop    ES            ; ..End
  1599.     Mov    BX,Offset MEM00_Bottom_Free_Memory
  1600. ;
  1601.     Call    D1000_Read_Diskette    ; Read the File Allocation Table
  1602. ;
  1603.     Cmp    Byte Ptr FLG08_Good_Read,True
  1604.     Je    C2202            ; If the read operation was
  1605.                     ; . successful, continue
  1606.     Mov    Byte Ptr FLG15_IO_Error,One
  1607.     Call    D1200_Disk_IO_Error    ; Display appropriate error message
  1608.     Jmp    C2299            ; Go to the end of the module
  1609. C2202:
  1610.     Mov    SI,Offset MEM01_File_Allocation_Table
  1611.     Mov    DI,Offset MEM00_Bottom_Free_Memory
  1612.     Mov    CX,Sector_Size        ; Set counter CX to compare the
  1613.                     ; . sector size in words
  1614.     Shr    CX,1            ; ..End
  1615.     Cld                ; Clear the direction flag
  1616.     Rep    Cmpsw            ; Compare all of the 512 bytes
  1617.     Jne    C2203            ; If there is a discrepancy, go to
  1618.                     ; . the error message routine
  1619.     Jmp    C2299            ; Go to the end of the module
  1620. C2203:
  1621.     Mov    Byte Ptr FLG12_Good_FAT,False
  1622.     Mov    SI,Offset MES19_Unrecoverable_Read
  1623.     Call    U1000_Display_Message    ; Display the message on the screen
  1624.     Mov    SI,Offset MES90_Unknown_FAT_Error
  1625.     Call    U1000_Display_Message    ; Display the message on the screen
  1626. C2299:
  1627.     Ret
  1628. ;
  1629. C2200_Check_File_Alloc_Table Endp
  1630. ;
  1631. Page
  1632. ;************************************************************************
  1633. ;*                                    *
  1634. ;*    D1000_READ_DISKETTE                        *
  1635. ;*                                    *
  1636. ;*    This module reads a track at a time from a diskette. If it    *
  1637. ;*    fails to read the diskette it tries Number_of_Retries = 5    *
  1638. ;*    times.                                *
  1639. ;*                                    *
  1640. ;************************************************************************
  1641. ;
  1642. Public    D1000_Read_Diskette
  1643. ;
  1644. D1000_Read_Diskette Proc Near
  1645. ;
  1646. D1001:
  1647.     Mov    Byte Ptr WRK13_Retry_Counter,Number_of_Retries
  1648. D1002:
  1649.     Clc                ; Clear the carry flag
  1650.     Mov    AH,Read_Command        ; Read the data on the diskette
  1651.     Mov    DL,Byte Ptr WRK06_Drive_Number
  1652.     Mov    DH,Byte Ptr WRK07_Head_Number
  1653.     Mov    CH,Byte Ptr WRK08_Track_Number
  1654.     Mov    CL,Byte Ptr WRK09_Sector_Number
  1655.     Mov    AL,Byte Ptr WRK10_Number_of_Sectors
  1656.     Int    Disk_Interrupt        ; ..End
  1657. ;
  1658.     Mov    Byte Ptr WRK14_Status_Operation,AH
  1659.     Jnc    D1099            ; Go to the end of the module
  1660. D1003:
  1661.     Dec    Byte Ptr WRK13_Retry_Counter
  1662.     Jz    D1004            ; Could not read the diskette
  1663.     Clc                ; Clear the carry flag
  1664.     Mov    AH,Reset_Command    ; Initialize the disk controller
  1665.     Int    Disk_Interrupt        ; .
  1666.     Mov    Byte Ptr WRK14_Status_Operation,AH
  1667.     Jnc    D1002            ; .
  1668.     Jmp    D1003            ; ..End
  1669. D1004:
  1670.     Mov    Byte Ptr FLG08_Good_Read,False
  1671. D1099:
  1672.     Ret
  1673. ;
  1674. D1000_Read_Diskette Endp
  1675. ;
  1676. Page
  1677. ;************************************************************************
  1678. ;*                                    *
  1679. ;*    D1100_WRITE_FORMAT_DISKETTE                    *
  1680. ;*                                    *
  1681. ;*    This module formats and writes a track at a time to a         *
  1682. ;*    diskette.  If it fails to format or a write a track, it tries    *
  1683. ;*    Number_of_Retries = 5 times.                    *
  1684. ;*                                    *
  1685. ;************************************************************************
  1686. ;
  1687. Public    D1100_Write_Format_Diskette
  1688. ;
  1689. D1100_Write_Format_Diskette Proc Near
  1690. ;
  1691. D1101:
  1692.     Mov    Byte Ptr WRK13_Retry_Counter,Number_of_Retries
  1693. D1102:
  1694.     Clc                ; Clear the carry flag
  1695.     Mov    AH,Format_Command    ; Format the diskette
  1696.     Mov    DL,Byte Ptr WRK06_Drive_Number
  1697.     Mov    DH,Byte Ptr WRK07_Head_Number
  1698.     Mov    CH,Byte Ptr WRK08_Track_Number
  1699.     Mov    CL,Byte Ptr WRK09_Sector_Number
  1700.     Mov    AL,Byte Ptr WRK10_Number_of_Sectors
  1701.     Push    CS            ; .
  1702.     Pop    ES            ; .
  1703.     Mov    BX,Word Ptr WRK33_CHRN_Table_Address
  1704.     Int    Disk_Interrupt        ; ..End
  1705.     Mov    Byte Ptr WRK14_Status_Operation,AH
  1706.     Jnc    D1105            ; Formatted the diskette
  1707. D1103:
  1708.     Dec    Byte Ptr WRK13_Retry_Counter
  1709.     Jz    D1104            ; Go to format error processing
  1710.     Clc                ; Clear the carry flag
  1711.     Mov    AH,Reset_Command    ; Initialize the disk controller
  1712.     Int    Disk_Interrupt        ; .
  1713.     Mov    Byte Ptr WRK14_Status_Operation,AH
  1714.     Jnc    D1102            ; Try to format the disk again
  1715.     Jmp    D1103            ; Try to initialize the disk again
  1716. D1104:
  1717.     Mov    Byte Ptr FLG15_IO_Error,Zero
  1718.     Mov    Byte Ptr FLG11_Good_Format,False
  1719.     Jmp    D1199            ; Go to the end of the module
  1720. D1105:
  1721.     Mov    Byte Ptr WRK13_Retry_Counter,Number_of_Retries
  1722. D1106:
  1723.     Clc                ; Clear the carry flag
  1724.     Mov    AH,Write_Command    ; Write the diskette
  1725.     Mov    ES,Word Ptr WRK11_Segment_Address
  1726.     Mov    BX,Word Ptr WRK12_Offset_Address
  1727.     Mov    AL,Byte Ptr WRK10_Number_of_Sectors
  1728.     Int    Disk_Interrupt        ; .
  1729.     Mov    Byte Ptr WRK14_Status_Operation,AH
  1730.     Jnc    D1109            ; ..End
  1731. D1107:
  1732.     Dec    Byte Ptr WRK13_Retry_Counter
  1733.     Jz    D1108            ; Go to write error processing
  1734.     Clc                ; Clear the carry flag
  1735.     Mov    AH,Reset_Command    ; Initialize the disk controller
  1736.     Int    Disk_Interrupt        ; .
  1737.     Mov    Byte Ptr WRK14_Status_Operation,AH
  1738.     Jnc    D1106            ; .
  1739.     Jmp    D1107            ; ..End
  1740. D1108:
  1741.     Mov    Byte Ptr FLG15_IO_Error,Two
  1742.     Mov    Byte Ptr FLG09_Good_Write,False
  1743.     Jmp    D1199            ; Go to the end of the module
  1744. D1109:
  1745.     Add    Word Ptr WRK33_CHRN_Table_Address,Thirty_Six
  1746. ;
  1747.     Mov    AL,Byte Ptr WRK27_Write_Message_Row
  1748.     Mov    Byte Ptr WRK28_Current_Message_Row,AL
  1749.     Mov    AL,Byte Ptr WRK22_Current_Target_Head
  1750.     Mov    Byte Ptr WRK29_Current_Head,AL
  1751.     Mov    AL,Byte Ptr WRK23_Current_Target_Track
  1752.     Mov    Byte Ptr WRK30_Current_Track,AL
  1753.     Call    U1400_Display_Head_and_Track
  1754. D1199:
  1755.     Ret
  1756. ;
  1757. D1100_Write_Format_Diskette Endp
  1758. ;
  1759. Page
  1760. ;************************************************************************
  1761. ;*                                    *
  1762. ;*    D1200_DISK_IO_ERROR                        *
  1763. ;*                                    *
  1764. ;*    This module fans out a disk error.  It tells a user if it    *
  1765. ;*    occured on a read, format or write operation.  If it cannot    *
  1766. ;*    determine the nature of the error, the routine displays an    *
  1767. ;*    unknown disk error message.                    *
  1768. ;*                                    *
  1769. ;************************************************************************
  1770. ;
  1771. Public    D1200_Disk_IO_Error
  1772. ;
  1773. D1200_Disk_IO_Error Proc Near
  1774. ;
  1775. D1201:
  1776.     Cmp    Byte Ptr WRK14_Status_Operation,Time_Out_Error
  1777.     Jne    D1202            ; If not time out error, continue
  1778.     Mov    SI,Offset MES08_Drive_Not_Ready
  1779.     Mov    AL,Byte Ptr WRK06_Drive_Number
  1780.     Add    AL,Capital_Letter_A    ; Convert drive number to a letter
  1781.     Mov    [SI+Twenty_Four],AL    ; Put the drive letter into position
  1782.     Call    U1000_Display_Message
  1783.     Jmp    D1299            ; Go to the end of the module
  1784. D1202:
  1785.     Cmp    Byte Ptr FLG15_IO_Error,Zero
  1786.     Jne    D1203            ; If not a format error, continue
  1787.     Mov    SI,Offset MES18_Unrecoverable_Format
  1788.     Jmp    D1206            ; Continue processing
  1789. D1203:
  1790.     Cmp    Byte Ptr FLG15_IO_Error,One
  1791.     Jne    D1204            ; If not a read error, continue
  1792.     Mov    SI,Offset MES19_Unrecoverable_Read
  1793.     Jmp    D1206            ; Continue processing
  1794. D1204:
  1795.     Cmp    Byte Ptr FLG15_IO_Error,Two
  1796.     Jne    D1205            ; If not a write error, continue
  1797.     Mov    SI,Offset MES21_Unrecoverable_Write
  1798.     Jmp    D1206            ; Continue processing
  1799. D1205:
  1800.     Mov    SI,Offset MES22_Unrecoverable_IO
  1801. D1206:
  1802.     Call    U1000_Display_Message    ; Display the message on the screen
  1803. D1207:
  1804.     Cmp    Byte Ptr WRK14_Status_Operation,Seek_Error
  1805.     Jne    D1208            ; If not a seek error, continue
  1806.     Mov    SI,Offset MES80_Seek_Error
  1807.     Jmp    D1217            ; Continue processing
  1808. D1208:
  1809.     Cmp    Byte Ptr WRK14_Status_Operation,Controller_Error
  1810.     Jne    D1209            ; If not a controller error, continue
  1811.     Mov    SI,Offset MES81_Controller_Error
  1812.     Jmp    D1217            ; Continue processing
  1813. D1209:
  1814.     Cmp    Byte Ptr WRK14_Status_Operation,CRC_Error
  1815.     Jne    D1210            ; If not a CRC error, continue
  1816.     Mov    SI,Offset MES82_CRC_Error
  1817.     Jmp    D1217            ; Continue processing
  1818. D1210:
  1819.     Cmp    Byte Ptr WRK14_Status_Operation,DMA_Boundary_Error
  1820.     Jne    D1211            ; If not DMA boundary error, continue
  1821.     Mov    SI,Offset MES83_DMA_Boundary_Error
  1822.     Jmp    D1217            ; Continue processing
  1823. D1211:
  1824.     Cmp    Byte Ptr WRK14_Status_Operation,DMA_Error
  1825.     Jne    D1212            ; If not a DMA error, continue
  1826.     Mov    SI,Offset MES84_DMA_Error
  1827.     Jmp    D1217            ; Continue processing
  1828. D1212:
  1829.     Cmp    Byte Ptr WRK14_Status_Operation,Sector_Error
  1830.     Jne    D1213            ; If not a sector error, continue
  1831.     Mov    SI,Offset MES85_Sector_Error
  1832.     Jmp    D1217            ; Continue processing
  1833. D1213:
  1834.     Cmp    Byte Ptr WRK14_Status_Operation,Write_Protect_Error
  1835.     Jne    D1214            ; If not write protected, continue
  1836.     Mov    SI,Offset MES86_Write_Protect_Error
  1837.     Jmp    D1217            ; Continue processing
  1838. D1214:
  1839.     Cmp    Byte Ptr WRK14_Status_Operation,Address_Mark_Error
  1840.     Jne    D1215            ; If not addr mark error, continue
  1841.     Mov    SI,Offset MES87_Address_Mark_Error
  1842.     Jmp    D1217            ; Continue processing
  1843. D1215:
  1844.     Cmp    Byte Ptr WRK14_Status_Operation,Command_Error
  1845.     Jne    D1216            ; If not a command error, continue
  1846.     Mov    SI,Offset MES88_Command_Error
  1847.     Jmp    D1217            ; Continue processing
  1848. D1216:
  1849.     Mov    SI,Offset MES89_Unknown_Error
  1850. D1217:
  1851.     Call    U1000_Display_Message    ; Display the message on the screen
  1852. D1299:
  1853.     Ret
  1854. ;
  1855. D1200_Disk_IO_Error Endp
  1856. ;
  1857. Page
  1858. ;************************************************************************
  1859. ;*                                    *
  1860. ;*    S1000_SETUP_DISK_PARAM_TABLE                    *
  1861. ;*                                    *
  1862. ;*    This module sets up the Disk Parameter Table (Int 1EH) so that    *
  1863. ;*    it points to the disk parameters for PC DOS 2.1 contained in    *
  1864. ;*    this program.                            *
  1865. ;*                                    *
  1866. ;************************************************************************
  1867. ;
  1868. Public    S1000_Setup_Disk_Param_Table
  1869. ;
  1870. S1000_Setup_Disk_Param_Table Proc Near
  1871. ;
  1872. S1001:
  1873.     Cli                ; Turn off the interrupts
  1874. ;
  1875.     Push    AX            ; Save the registers
  1876.     Push    BX            ; .
  1877.     Push    DS            ; ..End
  1878. ;
  1879.     Sub    AX,AX            ; Initialize DS to Absolute Zero
  1880.     Mov    DS,AX            ; ..End
  1881. ;
  1882.     Mov    BX,Disk_Parameter_Addr    ; Save and redirect the address
  1883.     Mov    AX,[BX]            ; .
  1884.     Mov    Word Ptr CS:SYS16_Save_DPT_Offset,AX
  1885.     Mov    AX,[BX+Two]        ; .
  1886.     Mov    Word Ptr CS:SYS17_Save_DPT_Segment,AX
  1887.                     ; .
  1888.     Mov    AX,Offset SYS18_Disk_Parameter_Table
  1889.     Mov    [BX],AX            ; .
  1890.     Mov    AX,CS            ; .
  1891.     Mov    [BX+Two],AX        ; ..End
  1892. ;
  1893.     Pop    DS            ; Restore the registers
  1894.     Pop    BX            ; .
  1895.     Pop    AX            ; ..End
  1896. ;
  1897.     Sti                ; Turn on the interrupts
  1898. S1099:
  1899.     Ret
  1900. ;
  1901. S1000_Setup_Disk_Param_Table Endp
  1902. ;
  1903. Page
  1904. ;************************************************************************
  1905. ;*                                    *
  1906. ;*    S1100_RESTORE_DISK_PARAM_TABLE                    *
  1907. ;*                                    *
  1908. ;*    This module restores the Disk Parameter Table to its original    *
  1909. ;*    address in PC DOS.                        *
  1910. ;*                                    *
  1911. ;************************************************************************
  1912. ;
  1913. Public    S1100_Restore_Disk_Param_Table
  1914. ;
  1915. S1100_Restore_Disk_Param_Table Proc Near
  1916. ;
  1917. S1101:
  1918.     Cli                ; Turn off the interrupts
  1919. ;
  1920.     Push    AX            ; Save the registers
  1921.     Push    BX            ; .
  1922.     Push    DS            ; ..End
  1923. ;
  1924.     Sub    AX,AX            ; Initialize DS to Absolute Zero
  1925.     Mov    DS,AX            ; ..End
  1926. ;
  1927.     Mov    BX,Disk_Parameter_Addr    ; Restore Disk Parameter Address
  1928.     Mov    AX,Word Ptr CS:SYS16_Save_DPT_Offset
  1929.     Mov    [BX],AX            ; .
  1930.     Mov    AX,Word Ptr CS:SYS17_Save_DPT_Segment
  1931.     Mov    [BX+Two],AX        ; ..End
  1932. ;
  1933.     Pop    DS            ; Restore the registers
  1934.     Pop    BX            ; .
  1935.     Pop    AX            ; ..End
  1936. ;
  1937.     Sti                ; Turn on the interrupts
  1938. S1199:
  1939.     Ret
  1940. ;
  1941. S1100_Restore_Disk_Param_Table Endp
  1942. ;
  1943. Page
  1944. ;************************************************************************
  1945. ;*                                    *
  1946. ;*    U1000_DISPLAY_MESSAGE                        *
  1947. ;*                                    *
  1948. ;*    This module displays a message on the screen. Before calling    *
  1949. ;*    this module, the offset of the message should be in SI         *
  1950. ;*    relative to the DS register.  This routine preserves the    *
  1951. ;*    registers and the flags.                    *
  1952. ;*                                    *
  1953. ;************************************************************************
  1954. ;
  1955. Public    U1000_Display_Message
  1956. ;
  1957. U1000_Display_Message Proc Near
  1958. ;
  1959. U1001:
  1960.     Push    AX            ; Save the registers and flags
  1961.     Push    BX            ; .
  1962.     Push    SI            ; .
  1963.     Pushf                ; ..End
  1964. U1002:
  1965.     Mov    AL,[SI]            ; Put the character into AL
  1966.     Cmp    AL,EOT            ; Compare for the end of the string
  1967.     Je    U1090            ; If so, go to end of the module
  1968.     Mov    AH,Write_TTY_Command    ; Write the Character
  1969.     Mov    BH,Byte Ptr SYS03_Active_Page
  1970.     Mov    BL,Byte Ptr SYS04_Foreground_Color
  1971.     Int    Video_Interrupt        ; ..End
  1972.     Inc    SI            ; Increment the SI counter
  1973.     Jmp    U1002            ; Go back and try again
  1974. U1090:
  1975.     Popf                ; Restore the registers and flags
  1976.     Pop    SI            ; .
  1977.     Pop    BX            ; .
  1978.     Pop    AX            ; ..End
  1979. U1099:
  1980.     Ret
  1981. ;
  1982. U1000_Display_Message Endp
  1983. ;
  1984. Page
  1985. ;************************************************************************
  1986. ;*                                    *
  1987. ;*    U1100_GET_RESPONSE                        *
  1988. ;*                                    *
  1989. ;*    This module gets the response from the keyboard and displays    *
  1990. ;*    the information on the video display unit.  The keyboard    *
  1991. ;*    buffer is WRK05_Keyboard_Buffer.  The first byte of this    *
  1992. ;*    buffer contains the length of the buffer and must be less    *
  1993. ;*    than or equal to 80 characters.  The next 80 characters are    *
  1994. ;*    the acutal buffer. The character EOT denotes the end of the    *
  1995. ;*    buffer and can occur in any one of the 80 characters.        *
  1996. ;*                                    *
  1997. ;************************************************************************
  1998. ;
  1999. Public    U1100_Get_Response
  2000. ;
  2001. U1100_Get_Response Proc Near
  2002. ;
  2003. U1101:
  2004.     Push    AX            ; Save the registers and flags
  2005.     Push    BX            ; .
  2006.     Push    CX            ; .
  2007.     Push    SI            ; .
  2008.     Pushf                ; ..End
  2009. U1102:
  2010.     Mov    SI,Offset WRK05_Keyboard_Buffer+1
  2011.     Mov    CX,NUL            ; Initialize the CX counter register
  2012. U1103:
  2013.     Mov    AH,Read_Keyboard_Command; Read the character from keyboard
  2014.     Int    PC_DOS_Interrupt    ; ..End
  2015.     Cmp    AL,ETX            ; Compare for a control break
  2016.     Jne    U1104            ; If not, then continue
  2017.     Mov    SI,Offset MES98_Control_Break
  2018.     Call    U1000_Display_Message    ; Display the message on the screen
  2019.     Jmp    B1201            ; Go to B1200_Final_Process
  2020. U1104:
  2021.     Cmp    Byte Ptr FLG05_Store_Buffer,True
  2022.     Je    U1105            ; If store keyboard entries, continue
  2023.     Jmp    U1190            ; If not, go to end of the module
  2024. U1105:
  2025.     Cmp    AL,BS            ; Is AL a backspace character???
  2026.     Jne    U1106            ; If not, continue processing AL
  2027.     Cmp    CX,NUL            ; Is the cursor at column zero????
  2028.     Je    U1103            ; Yes, so get another character
  2029.     Dec    CX            ; Decrement CX to point to the
  2030.                     ; . previous cursor location
  2031.     Dec    SI            ; Decrement SI to go back to the
  2032.                     ; . previos buffer location
  2033. ;
  2034.     Mov    AH,Write_TTY_Command    ; Write a backspace to the screen
  2035.     Mov    AL,BS            ; .
  2036.     Mov    BH,Byte Ptr SYS03_Active_Page
  2037.     Mov    BL,Byte Ptr SYS04_Foreground_Color
  2038.     Int    Video_Interrupt        ; ..End
  2039. ;
  2040.     Mov    AH,Write_TTY_Command    ; Write a space to the screen
  2041.     Mov    AL,Space        ; .
  2042.     Mov    BH,Byte Ptr SYS03_Active_Page
  2043.     Mov    BL,Byte Ptr SYS04_Foreground_Color
  2044.     Int    Video_Interrupt        ; ..End
  2045. ;
  2046.     Mov    AH,Write_TTY_Command    ; Write a backspace to the screen
  2047.     Mov    AL,BS            ; .
  2048.     Mov    BH,Byte Ptr SYS03_Active_Page
  2049.     Mov    BL,Byte Ptr SYS04_Foreground_Color
  2050.     Int    Video_Interrupt        ; ..End
  2051. ;
  2052.     Jmp    U1103            ; Go back and get another character
  2053. U1106:
  2054.     Cmp    AL,CR            ; Compare char for a carriage return
  2055.     Je    U1108            ; If so, insert an EOT into buffer
  2056.     Cmp    CX,Keyboard_Buffer_Size    ; Check for keyboard buffer full
  2057.     Jae    U1107            ; If so, sound bell and get new char
  2058.     Mov    [SI],AL            ; Put the character into the buffer
  2059.     Inc    SI            ; Increment the keyboard address
  2060.     Inc    CX            ; Increment the CX character counter
  2061.     Jmp    U1103            ; Go back and get another character
  2062. U1107:
  2063.     Mov    AH,Write_TTY_Command    ; Sound the beep from the screen
  2064.     Mov    AL,Bell            ; .
  2065.     Mov    BH,Byte Ptr SYS03_Active_Page
  2066.     Mov    BL,Byte Ptr SYS04_Foreground_Color
  2067.     Int    Video_Interrupt        ; ..End
  2068.     Jmp    U1103            ; Go back and get another character
  2069. U1108:
  2070.     Mov    AL,EOT            ; Put an EOT into the buffer
  2071.     Mov    [SI],AL            ; ..End
  2072. ;
  2073.     Mov    AH,Write_TTY_Command    ; Write a carriage return to the
  2074.     Mov    AL,CR            ; . screen
  2075.     Mov    BH,Byte Ptr SYS03_Active_Page
  2076.     Mov    BL,Byte Ptr SYS04_Foreground_Color
  2077.     Int    Video_Interrupt        ; ..End
  2078. ;
  2079.     Mov    AH,Write_TTY_Command    ; Write a line feed to the screen
  2080.     Mov    AL,LF            ; .
  2081.     Mov    BH,Byte Ptr SYS03_Active_Page
  2082.     Mov    BL,Byte Ptr SYS04_Foreground_Color
  2083.     Int    Video_Interrupt        ; ..End
  2084. ;
  2085.     Mov    WRK05_Keyboard_Buffer[0],CL; Set the length accrodingly
  2086. U1190:
  2087.     Popf                ; Restore the registers and flags
  2088.     Pop    SI            ; .
  2089.     Pop    CX            ; .
  2090.     Pop    BX            ; .
  2091.     Pop    AX            ; ..End
  2092. U1199:
  2093.     Ret
  2094. U1100_Get_Response Endp
  2095. ;
  2096. Page
  2097. ;************************************************************************
  2098. ;*                                    *
  2099. ;*    U1200_GET_YES_OR_NO                        *
  2100. ;*                                    *
  2101. ;*    This module asks for a [Yy]es or [Nn]o answer from a user.  The    *
  2102. ;*    routine accepts only a [Yy] or [Nn] and exists with the flag    *
  2103. ;*    FLG06_Yes_or_No set to True for YES and False for NO.        *
  2104. ;*                                    *
  2105. ;************************************************************************
  2106. ;
  2107. Public    U1200_Get_Yes_or_No
  2108. ;
  2109. U1200_Get_Yes_or_No Proc Near
  2110. ;
  2111. U1201:
  2112.     Push    AX            ; Save the registers and flags
  2113.     Push    SI            ; .
  2114.     Pushf                ; ..End
  2115. U1202:
  2116.     Mov    AH,Read_Keyboard_Command; Get a character from keyboard
  2117.     Int    PC_DOS_Interrupt    ; ..End
  2118.     Cmp    AL,ETX            ; Compare for control break
  2119.     Jne    U1203            ; If not, then continue
  2120.     Mov    SI,Offset MES98_Control_Break
  2121.     Call    U1000_Display_Message    ; Display the message on the screen
  2122.     Jmp    B1201            ; Go to B1200_Final_Process
  2123. U1203:
  2124.     Cmp    AL,Capital_Letter_Y    ; Check for capital letter Y
  2125.     Jne    U1204            ; ..End
  2126.     Mov    Byte Ptr FLG06_Yes_or_No,True
  2127.     Mov    SI,Offset MES24_Yes    ; Display YES on the screen
  2128.     Call    U1000_Display_Message    ; ..End
  2129.     Jmp    U1290            ; Go to the end of the module
  2130. U1204:
  2131.     Cmp    AL,Small_Letter_y    ; Check for small letter y
  2132.     Jne    U1205            ; ..End
  2133.     Mov    Byte Ptr FLG06_Yes_or_No,True
  2134.     Mov    SI,Offset MES24_Yes    ; Display YES on the screen
  2135.     Call    U1000_Display_Message    ; ..End
  2136.     Jmp    U1290            ; Go to the end of the module
  2137. U1205:
  2138.     Cmp    AL,Capital_Letter_N    ; Check for capital letter N
  2139.     Jne    U1206            ; ..End
  2140.     Mov    Byte Ptr FLG06_Yes_or_No,False
  2141.     Mov    SI,Offset MES25_No    ; Display NO on the screen
  2142.     Call    U1000_Display_Message    ; ..End
  2143.     Jmp    U1290            ; Go to the end of the module
  2144. U1206:
  2145.     Cmp    AL,Small_Letter_n    ; Check for small letter n
  2146.     Jne    U1207            ; ..End
  2147.     Mov    Byte Ptr FLG06_Yes_or_No,False
  2148.     Mov    SI,Offset MES25_No    ; Display NO on the screen
  2149.     Call    U1000_Display_Message    ; ..End
  2150.     Jmp    U1290            ; Go to the end of the module
  2151. U1207:
  2152.     Jmp    U1202            ; Go back and get another character
  2153. U1290:
  2154.     Popf                ; Restore the registers and flags
  2155.     Pop    SI            ; .
  2156.     Pop    AX            ; ..End
  2157. U1299:
  2158.     Ret
  2159. ;
  2160. U1200_Get_Yes_or_No Endp
  2161. ;
  2162. Page
  2163. ;************************************************************************
  2164. ;*                                    *
  2165. ;*    U1300_CONVERT_BINARY_TO_ASCII                    *
  2166. ;*                                    *
  2167. ;*    This module BCD contained in the AL register into an ASCII    *
  2168. ;*    character.  The output is returned in the AX register.        *
  2169. ;*                                    *
  2170. ;************************************************************************
  2171. ;
  2172. Public    U1300_Convert_Binary_to_ASCII
  2173. ;
  2174. U1300_Convert_Binary_to_ASCII Proc Near
  2175. ;
  2176. U1301:
  2177.     Push    DX            ; Save the registers
  2178.     Pushf                ; ..End
  2179. ;
  2180.     Cbw                ; Perform sign extension for division
  2181.     Mov    DL,Ten            ; Set DL disvisor to 10D
  2182.     Div    DL            ; Divide AL by 10D remainder in AH
  2183.     Add    AL,Zero_Digit        ; Setup the characters in AL & AH
  2184.     Add    AH,Zero_Digit        ; ..End
  2185. ;
  2186.     Popf                ; Restore the registers
  2187.     Pop    DX            ; ..End
  2188. U1399:
  2189.     Ret
  2190. ;
  2191. U1300_Convert_Binary_to_ASCII Endp
  2192. ;
  2193. Page
  2194. ;************************************************************************
  2195. ;*                                    *
  2196. ;*    U1400_DISPLAY_HEAD_AND_TRACK                    *
  2197. ;*                                    *
  2198. ;*    This module displays the current track and head number that    *
  2199. ;*    is being read from the source diskette or written to the     *
  2200. ;*    target diskette.                        *
  2201. ;*                                    *
  2202. ;************************************************************************
  2203. ;
  2204. Public    U1400_Display_Head_and_Track
  2205. ;
  2206. U1400_Display_Head_and_Track Proc Near
  2207. ;
  2208. U1401:
  2209.     Push    AX            ; Save the registers
  2210.     Push    BX            ; .
  2211.     Push    DX            ; .
  2212.     Pushf                ; ..End
  2213. ;
  2214.     Mov    AH,Set_CPos_Command    ; Set cursor to track position
  2215.     Mov    BH,Byte Ptr SYS03_Active_Page
  2216.     Mov    DH,Byte Ptr WRK28_Current_Message_Row
  2217.     Mov    DL,Fifteen        ; .
  2218.     Int    Video_Interrupt        ; ..End
  2219. ;
  2220.                     ; Write the current track number
  2221.     Mov    AL,Byte Ptr WRK30_Current_Track
  2222.     Call    U1300_Convert_Binary_to_ASCII
  2223.     Push    AX            ; .
  2224.     Mov    AH,Write_TTY_Command    ; .
  2225.     Mov    BH,Byte Ptr SYS03_Active_Page
  2226.     Mov    BL,Byte Ptr SYS04_Foreground_Color
  2227.     Int    Video_Interrupt        ; .
  2228.     Pop    AX            ; .
  2229.     Mov    AL,AH            ; .
  2230.     Mov    AH,Write_TTY_Command    ; .
  2231.     Mov    BH,Byte Ptr SYS03_Active_Page
  2232.     Mov    BL,Byte Ptr SYS04_Foreground_Color
  2233.     Int    Video_Interrupt        ; ..End
  2234. ;
  2235.     Mov    AH,Set_CPos_Command    ; Set cursor to head position
  2236.     Mov    BH,Byte Ptr SYS03_Active_Page
  2237.     Mov    DH,Byte Ptr WRK28_Current_Message_Row
  2238.     Mov    DL,Twenty_Five        ; .
  2239.     Int    Video_Interrupt        ; ..End
  2240. ;                    ; Write the current head number
  2241.     Mov    AL,Byte Ptr WRK29_Current_Head
  2242.     Call    U1300_Convert_Binary_to_ASCII
  2243.     Mov    AL,AH            ;.
  2244.     Mov    AH,Write_TTY_Command    ;.
  2245.     Mov    BH,Byte Ptr SYS03_Active_Page
  2246.     Mov    BL,Byte Ptr SYS04_Foreground_Color
  2247.     Int    Video_Interrupt        ; ..End
  2248. ;
  2249.     Mov    AH,Set_CPos_Command    ; Set cursor to the next line
  2250.     Mov    BH,Byte Ptr SYS03_Active_Page
  2251.     Mov    DH,Byte Ptr WRK28_Current_Message_Row
  2252.     Inc    DH            ; .
  2253.     Mov    DL,Zero            ; .
  2254.     Int    Video_Interrupt        ; ..End
  2255. U1490:
  2256.     Popf                ; Restore the registers
  2257.     Pop    DX            ; 
  2258.     Pop    BX            ; .
  2259.     Pop    AX            ; ..End
  2260. U1499:
  2261.     Ret
  2262. ;
  2263. U1400_Display_Head_and_Track Endp
  2264. ;
  2265. Page
  2266. ;************************************************************************
  2267. ;*                                    *
  2268. ;*    FLAGS                                *
  2269. ;*                                    *
  2270. ;*    This portion of FREECOPY contains the definitions of all of    *
  2271. ;*    flags defined in the program.                    *
  2272. ;*                                    *
  2273. ;************************************************************************
  2274. ;
  2275. FLG01_Good_Command    DB (?)        ; Establishes any errors in the
  2276.                     ; . command line entered by a user
  2277. FLG02_Double_Side    DB (?)        ; Points out whether the user wants
  2278.                     ; . to copy only the top side of a
  2279.                     ; . floppy diskette
  2280. FLG03_Default_Drive    DB (?)        ; Shows if the default drive is a
  2281.                     ; . valid floppy disk drive
  2282. FLG04_Single_Drive    DB (?)        ; Determines if the machine is a
  2283.                     ; . single drive system
  2284. FLG05_Store_Buffer    DB (?)        ; Establishes whether to put the
  2285.                     ; . characters entered from the
  2286.                     ; . keyboard into the buffer
  2287. FLG06_Yes_or_No        DB (?)        ; Points out the user's response
  2288.                     ; . NO = False   YES = True
  2289. FLG07_First_Time    DB (?)        ; Shows the number of times the user
  2290.                     ; . copies a diskette
  2291.                     ; . ONCE = True  MORE = False
  2292. FLG08_Good_Read        DB (?)        ; Flags establish whether the
  2293. FLG09_Good_Write    DB (?)        ; . operation was performed correctly
  2294. FLG10_Good_Verify      DB (?)        ; . YES = True    NO = False
  2295. FLG11_Good_Format    DB (?)        ; ..End
  2296. FLG12_Good_FAT        DB (?)        ; Establishes a good FAT when reading
  2297.                     ; . source diskette more than once
  2298. FLG13_First_Read_Write    DB (?)        ; Shows if a diskette is being read
  2299.                     ; . or written for the first time
  2300.                     ; . YES = True    NO  = False
  2301. FLG14_Copy_Complete    DB (?)        ; Points out if a diskette has been
  2302.                     ; . copied completely
  2303.                     ; . YES = True    NO = False
  2304. FLG15_IO_Error        DB (?)        ; Establishes the type of IO error
  2305.                     ; . Zero = Format error
  2306.                     ; . One  = Read error
  2307.                     ; . Two  = Write error
  2308.                     ; ..End
  2309. ;
  2310. Page
  2311. ;************************************************************************
  2312. ;*                                    *
  2313. ;*    MESSAGES                            *
  2314. ;*                                    *
  2315. ;*    This portion of FREECOPY contains the definitions of all of    *
  2316. ;*    messages defined in the program.                *
  2317. ;*                                    *
  2318. ;************************************************************************
  2319. ;
  2320. MES00_Copy_Notice        Label Byte
  2321.     DB    CR,LF
  2322.     DB    'FREECOPY Disk Utility',CR,LF
  2323.     DB    'IBM Personal Computer/Jr.',CR,LF
  2324.     DB    'Version 1.0 (C)Copyright 1984',CR,LF
  2325.     DB    CR,LF
  2326.     DB    'Squire Buresh Assoc., Inc.',CR,LF
  2327.     DB    'Post Office Box 112',CR,LF
  2328.     DB    'Millbury, MA 01527',CR,LF
  2329.     DB    CR,LF
  2330.     DB    '$25.00 requested contribution.',CR,LF,EOT
  2331. MES01_Copy_Another        Label Byte
  2332.     DB    CR,LF
  2333.     DB    'Copy another diskette (Y/N)? ',EOT
  2334. MES02_Copy_Complete        Label Byte
  2335.     DB    CR,LF
  2336.     DB    'Copy complete.',CR,LF,EOT
  2337. MES03_Copy81_Sectors        Label Byte
  2338.     DB    CR,LF
  2339.     DB    'Copying 8 sectors per track, 1 side.',CR,LF,EOT
  2340. MES04_Copy82_Sectors        Label Byte
  2341.     DB    CR,LF
  2342.     DB    'Copying 8 sectors per track, 2 sides.',CR,LF,EOT
  2343. MES05_Copy91_Sectors        Label Byte
  2344.     DB    CR,LF
  2345.     DB    'Copying 9 sectors per track, 1 side.',CR,LF,EOT
  2346. MES06_Copy92_Sectors        Label Byte
  2347.     DB    CR,LF
  2348.     DB    'Copying 9 sectors per track, 2 sides.',CR,LF,EOT
  2349. MES07_Correct_And_Press_Key    Label Byte
  2350.     DB    CR,LF
  2351.     DB    'Correct, and press any key to continue',CR,LF,EOT
  2352. MES08_Drive_Not_Ready        Label Byte
  2353.     DB    CR,LF
  2354.     DB    'Diskette not in drive  :.',CR,LF,EOT
  2355. MES09_Insert_Source        Label Byte
  2356.     DB    CR,LF
  2357.     DB    'Insert source diskette in drive  :.',CR,LF,EOT
  2358. MES10_Insert_Target        Label Byte
  2359.     DB    CR,LF
  2360.     DB    'Insert target diskette in drive  :.',CR,LF,EOT
  2361. MES11_Insufficient_Memory    Label Byte
  2362.     DB    CR,LF
  2363.     DB    'Insufficient memory.',Bell,CR,LF,EOT
  2364. MES12_Invalid_Parameter        Label Byte
  2365.     DB    CR,LF
  2366.     DB    'Invalid parameter(s) specified.',CR,LF,EOT
  2367. MES13_Invalid_Default        Label Byte
  2368.     DB    CR,LF
  2369.     DB    'Invalid default floppy disk drive',CR,LF,EOT
  2370. MES14_Invalid_Drive        Label Byte
  2371.     DB    CR,LF
  2372.     DB    'Invalid drive specification.',CR,LF,EOT
  2373. MES15_Single_Drive_Copy        Label Byte
  2374.     DB    CR,LF
  2375.     DB    'NOTE: Copying diskette on single drive.',Bell,CR,LF,EOT
  2376. MES16_Press_Any_Key        Label Byte
  2377.     DB    CR,LF
  2378.     DB    'Press any key when ready.',CR,LF,EOT
  2379. MES17_Reading_Track        Label Byte
  2380.     DB    'Reading track (  ) head ( ).',CR,LF,EOT
  2381. MES18_Unrecoverable_Format    Label Byte
  2382.     DB    CR,LF
  2383.     DB    'Unrecoverable format error on target.',CR,LF,EOT
  2384. MES19_Unrecoverable_Read    Label Byte
  2385.     DB    CR,LF
  2386.     DB    'Unrecoverable read error on source.',CR,LF,EOT
  2387. MES20_Unrecoverable_Verify    Label Byte
  2388.     DB    CR,LF
  2389.     DB    'Unrecoverable verify error on target.',CR,LF,EOT
  2390. MES21_Unrecoverable_Write    Label Byte
  2391.     DB    CR,LF
  2392.     DB    'Unrecoverable write error on target.',CR,LF,EOT
  2393. MES22_Unrecoverable_IO        Label Byte
  2394.     DB    CR,LF
  2395.     DB    'Unrecoverable IO error.',CR,LF,EOT
  2396. MES23_Writing_Track        Label Byte
  2397.     DB    'Writing track (  ) head ( ).',CR,LF,EOT
  2398. MES24_Yes            Label Byte
  2399.     DB    'YES',CR,LF,EOT
  2400. MES25_No            Label Byte
  2401.     DB    'NO',CR,LF,EOT
  2402. MES80_Seek_Error        Label Byte
  2403.     DB    'Seek operation has failed.',CR,LF,EOT
  2404. MES81_Controller_Error        Label Byte
  2405.     DB    'Disk controller has failed.',CR,LF,EOT
  2406. MES82_CRC_Error            Label Byte
  2407.     DB    'Cyclic redundancy check (CRC) error.',CR,LF,EOT
  2408. MES83_DMA_Boundary_Error    Label Byte
  2409.     DB    'Attempted to DMA across a 64K boundary.',CR,LF,EOT
  2410. MES84_DMA_Error            Label Byte
  2411.     DB    'DMA overrun on I/O operation.',CR,LF,EOT
  2412. MES85_Sector_Error        Label Byte
  2413.     DB    'Requested sector not found.',CR,LF,EOT
  2414. MES86_Write_Protect_Error    Label Byte
  2415.     DB    'Output diskette is write protected.',CR,LF,EOT
  2416. MES87_Address_Mark_Error    Label Byte
  2417.     DB    'Address mark was not found.',CR,LF,EOT
  2418. MES88_Command_Error        Label Byte
  2419.     DB    'Bad command passed to the disk interrupt 13H.',CR,LF,EOT
  2420. MES89_Unknown_Error        Label Byte
  2421.     DB    'Unknown diskette error encountered.',CR,LF,EOT
  2422. MES90_Unknown_FAT_Error        Label Byte
  2423.     DB    'First byte of the FAT does not',CR,LF
  2424.     DB    'match any known diskette type.',CR,LF,EOT
  2425. MES91_Single_Side_Error        Label byte
  2426.     DB    'Double sided diskette in a',CR,LF
  2427.     DB    'single sided disk drive.',CR,LF,EOT
  2428. MES97_Return_Linefeed        Label Byte
  2429.     DB    CR,LF,EOT
  2430. MES98_Control_Break        Label Byte
  2431.     DB    '^C',CR,LF,EOT
  2432. MES99_Freecopy_Finished        Label Byte
  2433.     DB    CR,LF
  2434.     DB    'Returning to PC DOS.',CR,LF,EOT
  2435. ;
  2436. Page
  2437. ;************************************************************************
  2438. ;*                                    *
  2439. ;*    WORK VARIABLES                            *
  2440. ;*                                    *
  2441. ;*    This portion of FREECOPY contains the definitions of the work    *
  2442. ;*    variables that are used by the program.                *
  2443. ;*                                    *
  2444. ;************************************************************************
  2445. ;
  2446. WRK01_Source_Drive        DB (?)    ; Source diskette drive number
  2447. WRK02_Target_Drive        DB (?)    ; Target diskette drive number
  2448. WRK03_Valid_Filename        DB 11 Dup (32D); Valid diskette file name
  2449. WRK04_Parameter_Count        DB (?)    ; Valid diskette filler area
  2450. ;
  2451. WRK05_Keyboard_Buffer        Label Byte
  2452.                 DB 80D    ; Length of the keyboard buffer
  2453.                 DB 80 Dup (?); Actual keyboard buffer
  2454.                 DB EOT    ; Last char denotes the end of text
  2455. ;
  2456. WRK06_Drive_Number        DB (?)    ; Drive number of a disk drive
  2457. WRK07_Head_Number        DB (?)    ; Head number of a disk drive
  2458. WRK08_Track_Number        DB (?)    ; Track number of a diskette
  2459. WRK09_Sector_Number        DB (?)    ; Sector number of a diskette
  2460. WRK10_Number_of_Sectors        DB (?)    ; Number of sectors on a track
  2461. WRK11_Segment_Address        DW (?)    ; ES segment address
  2462. WRK12_Offset_Address        DW (?)    ; BX offset address
  2463. WRK13_Retry_Counter        DB (?)    ; Number of retrys to make
  2464. WRK14_Status_Operation        DB (?)    ; Result of the operation
  2465. ;
  2466. WRK15_Maximum_Heads        DB (?)    ; Maximum heads, tracks and sectors
  2467. WRK16_Maximum_Tracks        DB (?)    ; .
  2468. WRK17_Maximum_Sectors        DB (?)    ; ..End
  2469. ;
  2470. WRK18_Counter_ESBX_Entries    DW (?)    ; Counter to calculate ES:BX entries
  2471. WRK19_Number_ESBX_Entries    DW (?)    ; Maximum ES:BX table entires
  2472. ;
  2473. Page
  2474. ;************************************************************************
  2475. ;*                                    *
  2476. ;*    WORK VARIABLES    Page 2                        *
  2477. ;*                                    *
  2478. ;************************************************************************
  2479. ;
  2480. WRK20_Current_Source_Head    DB (?)    ; Current source head & track number
  2481. WRK21_Current_Source_Track    DB (?)    ; ..End
  2482. WRK22_Current_Target_Head    DB (?)    ; Current target head & track number
  2483. WRK23_Current_Target_Track    DB (?)    ; . End
  2484. ;
  2485. WRK24_Read_Message_Row        DB (?)    ; Cursor row of read, verify, format
  2486. WRK25_Verify_Message_Row    DB (?)    ; and write message
  2487. WRK26_Format_Message_Row    DB (?)    ; .
  2488. WRK27_Write_Message_Row        DB (?)    ; .
  2489. WRK28_Current_Message_Row    DB (?)    ; ..End
  2490. ;
  2491. WRK29_Current_Head        DB (?)    ; Current head and track to display
  2492. WRK30_Current_Track        DB (?)    ; . on the screen
  2493. ;
  2494. WRK31_Track_Read_Counter        DB (?)    ; Counter of tracks processed
  2495. WRK32_Track_Write_Counter       DB (?)  ; ..End
  2496. ;
  2497. WRK33_CHRN_Table_Address    DW (?)    ; Current address of the CHRN table
  2498. ;
  2499. Page
  2500. ;************************************************************************
  2501. ;*                                    *
  2502. ;*    SYSTEM VARIABLES                        *
  2503. ;*                                    *
  2504. ;*    This portion of FREECOPY contains the definitions of all of    *
  2505. ;*    the system variables used by the program.            *
  2506. ;*                                    *
  2507. ;************************************************************************
  2508. ;
  2509. SYS01_Number_Columns    DB (?)        ; Number of columns in current mode
  2510. SYS02_Current_Mode    DB (?)        ; Current video mode
  2511. SYS03_Active_Page    DB (?)        ; Active display page
  2512. SYS04_Foreground_Color    DB (?)        ; Foreground color number
  2513. SYS05_Para_RAM_Size    DW (?)        ; Number of free 16 byte paragraphs
  2514. SYS06_Monitor_Flag    DB (?)        ; 0 = monochrome  1 = graphics
  2515. SYS07_No_Parallel_Ports    DB (?)        ; Number of parallel ports
  2516. SYS08_Game_Adapters    DB (?)        ; Number of RS-232 ports
  2517. SYS09_No_RS232_Ports    DB (?)        ; 0 = no adapter  1 = has adapter
  2518. SYS10_No_Disk_Drives    DB (?)        ; Number of floppy disk drives
  2519. SYS11_Init_Video_Mode    DB (?)        ; Initial video mode when powering
  2520.                     ; up the machine
  2521. SYS12_Planar_RAM_Size    DB (?)        ; Planar RAM size
  2522. SYS13_IPL_From_Diskette    DB (?)        ; Location of initial program load
  2523. SYS14_Default_Drive    DB (?)        ; Default disk drive
  2524. ;
  2525. SYS15_Stack_Pointer    DW (?)        ; Stack pointer value when entering
  2526.                     ; . FREECOPY from PC DOS
  2527. SYS16_Save_DPT_Offset    DW (?)        ; Address of Disk Parameter Table
  2528. SYS17_Save_DPT_Segment    DW (?)        ; ..End
  2529. ;
  2530. SYS18_Disk_Parameter_Table    Label Byte
  2531.             DB 11011111B    ; SRT = 0D & Head Unload = 0FH
  2532.             DB 002H        ; Head Load = 1 Mode = DMA
  2533.             DB 025H        ; Wait to turn the motor off
  2534.             DB 002H        ; 512 bytes per sector
  2535.             DB 009H        ; 9 sectors per track
  2536.             DB 02AH        ; PC DOS gap length for I/O
  2537.             DB 0FFH        ; Data length parameter
  2538.             DB 050H        ; PC DOS gap length for format
  2539.             DB 0F6H        ; Fille byte for format
  2540.             DB 00FH        ; Head Settle time in milliseconds
  2541.             DB 002H        ; Motor start-up time (1/8 sec.)
  2542. ;
  2543. Page
  2544. ;************************************************************************
  2545. ;*                                    *
  2546. ;*    SETUP STACK POINTER AND MEMORY                    *
  2547. ;*                                    *
  2548. ;*    This portion of FREECOPY is contains the stack and the label    *
  2549. ;*    that indicates the beginning of available memory.        *
  2550. ;*                                    *
  2551. ;************************************************************************
  2552. ;
  2553. MEM05_Bottom_of_the_Stack    Label Word
  2554.             DW 64 Dup (?)
  2555. MEM04_Top_of_the_Stack        Label Word
  2556. ;
  2557. MEM03_ESBX_Table        Equ MEM04_Top_of_the_Stack+2
  2558. ;
  2559. MEM02_CHRN_Table        Equ MEM03_ESBX_Table+320
  2560. ;
  2561. MEM01_File_Allocation_Table    Equ MEM02_CHRN_Table+2880
  2562. ;
  2563. MEM00_Bottom_Free_Memory    Equ MEM01_File_Allocation_Table+512
  2564. ;
  2565. Page
  2566. ;************************************************************************
  2567. ;*                                    *
  2568. ;*    END OF THE PROGRAM                        *
  2569. ;*                                    *
  2570. ;************************************************************************
  2571. ;
  2572. CSEG    Ends
  2573.     End   A1000_Main_Module
  2574.  
  2575.  
  2576.