home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / 1990 / 04 / praxis / multi.asm < prev    next >
Encoding:
Assembly Source File  |  1990-01-15  |  31.0 KB  |  886 lines

  1. PAGE 72,135
  2. TITLE Multiformatter.V10
  3. ;------------------------  MAKROS  ------------------------
  4. set_Folge MACRO f1, f2, f3, f4, f5, f6, f7, f8, f9 
  5.           push ax                       ;AX sichern
  6.           mov si, offset Struktur       ;Adresse F-Tabelle
  7.           mov al, f1
  8.           mov [si+ 2], al
  9.           mov al, f2
  10.           mov [si+ 6], al
  11.           mov al, f3
  12.           mov [si+10], al
  13.           mov al, f4
  14.           mov [si+14], al
  15.           mov al, f5
  16.           mov [si+18], al
  17.           mov al, f6
  18.           mov [si+22], al
  19.           mov al, f7
  20.           mov [si+26], al
  21.           mov al, f8
  22.           mov [si+30], al
  23.           mov al, f9
  24.           mov [si+34], al
  25.           pop ax
  26. ENDM
  27.  
  28. clrs      MACRO
  29.           mov ah,0Fh
  30.           int 10h                 ;Videomodus lesen -> AL
  31.           mov ah,00h
  32.           int 10h                 ;und schreiben
  33. ENDM
  34.  
  35. set_backg_color MACRO Farbe
  36.           mov ah,11
  37.           mov bh,0
  38.           mov bl,Farbe
  39.           int 10h
  40. ENDM
  41.  
  42. set_LP_Tabelle MACRO
  43.           mov cx,DS                     ;DS sichern
  44.           mov dx,0000h
  45.           mov DS,dx                                 
  46.           mov ax,DS:007Ah               ;Segment holen
  47.           mov DS,ax                     ;und speichern
  48.           mov si,DS:0078h               ;Offset holen
  49.           mov al, 9                     ;9 Sekt./Spur
  50.           mov DS:[si+4], al
  51.           mov DS,cx                     ;DS zurück
  52. ENDM
  53.  
  54. set_Typ   MACRO                         ;Floppy-Typ setzen
  55.           mov ah, 23
  56.           mov al, cs:Floppy
  57.           int 13h
  58. ENDM
  59.  
  60. Ausgabe   MACRO Text,Farbe,Spalten_Nr,Zeilen_Nr,Z_pro_Zeile
  61.           LOCAL Text_Anfang 
  62.           LOCAL Text_Ende
  63.           LOCAL Weiter
  64. ;-------- Text ausgeben -----------------------------------
  65.           mov si,offset Text        ;Textstring Adr.nach si
  66.           mov Spalte, Spalten_Nr
  67.           mov Zeile, Zeilen_Nr
  68.           mov Attribut, Farbe
  69. Text_Anfang:
  70.           mov ah,2
  71.           mov bh,0
  72.           int 10h                     ;Cursor positionieren
  73.           mov al,[si]                 ;Zeichen nach al
  74.           cmp al,36                   ;Ende? ($-Zeichen)
  75.           je Text_Ende
  76.           mov ah,9
  77.           mov bh,0
  78.           mov cx,1                    ;ein Zeichen ausgeben
  79.           int 10h
  80.           inc si                      ;nächstes Zeichen
  81.           cmp Spalte, Z_pro_Zeile     ;Zeile zuende ?
  82.           jne Weiter                  ;wenn nicht, weiter
  83.           mov Spalte, Spalten_Nr
  84.           inc Zeile
  85. Weiter:   inc Spalte                  ;nächste Spalte
  86.           jmp Text_Anfang
  87. Text_Ende: 
  88. ENDM
  89. ;-----------------------------------------------------------
  90. Zeile       equ dh
  91. Spalte      equ dl
  92. Attribut    equ bl
  93. schwarz     equ 4
  94. weiß        equ 112
  95. weiß_bl     equ 240
  96. gruen       equ 2
  97. rot_schwarz equ 64
  98. rot_weiß    equ 79
  99. rot_weiß_bl equ 207
  100. rot_gelb    equ 78
  101. CR          equ 13
  102. LF          equ 10
  103.  
  104. .model small
  105. .stack
  106. .code
  107. ;* Diskstruktur: Spurnummer, Seite, Sek.nr, Bytes pro Sektor
  108. Struktur  DB '#', 'S', 1, 2 
  109.           DB '#', 'S', 2, 2
  110.           DB '#', 'S', 3, 2
  111.           DB '#', 'S', 4, 2
  112.           DB '#', 'S', 5, 2
  113.           DB '#', 'S', 6, 2
  114.           DB '#', 'S', 7, 2
  115.           DB '#', 'S', 8, 2
  116.           DB '#', 'S', 9, 2
  117.  
  118. Folge1   DB' 1-2-3-4-5-6-7-8-9 : normale Sektorenfolge    $'
  119. Folge2   DB' 1-2-3-4-5-6-7-8-8 : Kopierschutz Format      $'
  120. Folge3   DB' 9-8-7-6-5-4-3-2-1 : Schneckenpost            $'
  121. Folge4   DB' 1-6-2-7-3-8-4-9-5 : toter Ritter             $'
  122. Folge5   DB' 1-9-2-8-3-7-4-6-5 : Zauberspiegel            $'
  123. Folge6   DB' 1-2-3-4-9-8-7-6-5 : Hägar der Schreckliche   $'
  124.  
  125. F_Count  DB '?'
  126.  
  127. Folgetxt DB' Über  die Leertaste  lassen  sich verschiedene'
  128.          DB 'Sektorenfolgen für eine Formatierung wählen.  '
  129.          DB 'Nach RETURN kann dann mit diesen Einstellungen'
  130.          DB 'über  den Menüpunkt "Ganze Diskette form." ein'
  131.          DB 'Sonderformat auf die Diskette gebracht werden.'
  132.          DB '$'
  133.  
  134. OK       DB '        ╒═════════════════════════════╕       '
  135.          DB '        │   Fehlerfreie  Ausführung   │       '
  136.          DB '        └─────────────────────────────┘      $'
  137.           
  138. Fehler    DB ' '
  139.           DB'    FEHLER! Diskette schreibgeschütz oder     ' 
  140.           DB'    Sektor defekt bzw. unformatiert !!!!!    $'
  141.  
  142. Fehler2   DB ' '
  143.           DB'    Diskettenstation nicht bereit !!!!!!!!    ' 
  144.           DB'    Floppykabel u. Anschlüsse überprüfen !   $'
  145.  
  146. Bootsek   DB ' '
  147. Bootdat   DB 235,  52, 144,  84,  79,  79,  76,  66
  148.           DB  79,  88,  03,   0,   2,   2,   1,   0
  149.           DB   2, 112,   0, 208,   2, 253,   2,   0
  150.           DB   9,   0,   2,   0,   0,   0,   0,   0
  151.           DB   0,   0,   0,   0,   0,   0,   0,   0
  152.           DB   0,   0,   0,   0,   0,   0,   0,  18
  153.           DB   0,   0,   0,   0,   1,   0, 250,  51
  154.           DB 192, 142, 208, 188,   0, 124,  22,   7
  155.           DB 187, 120,   0,  54, 197,  55,  30,  86
  156.           DB  22,  83, 191,  43, 124, 185,  11,   0
  157.           DB 252, 172,  38, 128,  61,   0, 116,   3
  158.           DB  38, 138,   5, 170, 138, 196, 226, 241
  159.           DB   6,  31, 137,  71,   2, 199,   7,  43
  160.           DB 124, 251, 205,  19, 114, 103, 160,  16
  161.           DB 124, 152, 247,  38,  22, 124,   3,   6
  162.           DB  28, 124,   3,   6,  14, 124, 163,  63
  163.           DB 124, 163,  55, 124, 184,  32,   0, 247
  164.           DB  38,  17, 124, 139,  30,  11, 124,   3
  165.           DB 195,  72, 247, 243,   1,   6,  55, 124
  166.           DB 187,   0,   5, 161,  63, 124, 232, 159
  167.           DB   0, 184,   1,   2, 232, 179,   0, 114
  168.           DB  25, 139, 251, 185,  11,   0, 190, 227
  169.           DB 125, 243, 166, 117,  13, 141, 127,  32
  170.           DB 190, 238, 125, 185,  11,   0, 243, 166
  171.           DB 116,  24, 190, 119, 125, 232, 106,   0
  172.           DB  50, 228, 205,  22,  94,  31, 143,   4
  173.           DB 143,  68,   2, 205,  25, 190, 210, 125
  174.           DB 235, 235, 161,  28,   5,  51, 210, 247
  175.           DB  54,  11, 124, 254, 192, 162,  60, 124
  176.           DB 161,  55, 124, 163,  61, 124, 187,   0
  177.           DB   7, 161,  55, 124, 232,  73,   0, 161
  178.           DB  24, 124,  42,   6,  59, 124,  64,  56
  179.           DB   6,  60, 124, 115,   3, 160,  60, 124
  180.           DB  80, 232,  78,   0,  88, 114, 198,  40
  181.           DB   6,  60, 124, 116,  12,   1,   6,  55
  182.           DB 124, 247,  38,  11, 124,   3, 216, 235
  183.           DB 208, 138,  46,  21, 124, 138,  22, 253
  184.           DB 125, 139,  30,  61, 124, 234,   0,   0
  185.           DB 112,   0, 172,  10, 192, 116,  34, 180
  186.           DB  14, 187,   7,   0, 205,  16, 235, 242
  187.           DB  51, 210, 247,  54,  24, 124, 254, 194
  188.           DB 136,  22,  59, 124,  51, 210, 247,  54
  189.           DB  26, 124, 136,  22,  42, 124, 163,  57
  190.           DB 124, 195, 180,   2, 139,  22,  57, 124
  191.           DB 177,   6, 210, 230,  10,  54,  59, 124
  192.           DB 139, 202, 134, 233, 138,  22, 253, 125
  193.           DB 138,  54,  42, 124, 205,  19, 195,  13
  194.           DB  10,  75, 101, 105, 110, 101,  32,  83
  195.           DB 121, 115, 116, 101, 109, 100, 105, 115
  196.           DB 107, 101, 116, 116, 101,  44,  32, 111
  197.           DB 100, 101, 114,  32,  68, 105, 115, 107
  198.           DB 101, 116, 116, 101, 110, 102, 101, 104
  199.           DB 108, 101, 114,  33,  13,  10,  68, 105
  200.           DB 115, 107, 101, 116, 116, 101,  32, 101
  201.           DB 105, 110, 108, 101, 103, 101, 110,  32
  202.           DB 117, 110, 100,  32, 101, 105, 110, 101
  203.           DB  32,  84,  97, 115, 116, 101,  32, 100
  204.           DB 114, 129,  99, 107, 101, 110,  33,  13
  205.           DB  10,   0,  13,  10,  83, 116,  97, 114
  206.           DB 116, 102, 101, 104, 108, 101, 114,  33
  207.           DB  13,  10,   0,  73,  79,  32,  32,  32
  208.           DB  32,  32,  32,  83,  89,  83,  77,  83
  209.           DB  68,  79,  83,  32,  32,  32,  83,  89
  210.           DB  83,   0,   0,   0,   0,   0,  85, 170
  211.  
  212. Fat       DB 253, 255, 255    ;Seite 0, Sektor 1-2   FAT-1
  213.           DB 1021 DUP (0)
  214.           DB 253, 255, 255    ;Seite 0, Sektor 3-4   FAT-2 
  215.           DB 1021 DUP (0)
  216. Root      DB 2560 DUP (0)     ;Seite 0, Sektor 5-9 (+ 10-11)
  217.  
  218. r_Fat     DB 1024 DUP ('?')   ;Platz zum Lesen der 2-ten FAT
  219.           DB '$'
  220.  
  221. Titel     DB '╔════════════════════════════════════════════'
  222.           DB '══════════════════════════════════╗'  
  223.           DB '║        toolbox Multiformatter  (C) 1990 by '
  224.           DB 'DMV-Verlag  &  U.Schmitz          ║'  
  225.           DB '╠═══════════════════════════╦════════════════'
  226.           DB '══════════════════════════════════╣'  
  227.           DB '║                           ║                '
  228.           DB '                                  ║'
  229.           DB '║                           ║                '
  230.           DB '                                  ║'
  231.           DB '║                           ║                '
  232.           DB '                                  ║'
  233.           DB '║                           ║                '
  234.           DB '                                  ║'
  235.           DB '║                           ║                '
  236.           DB '                                  ║'
  237.           DB '║                           ║                '
  238.           DB '                                  ║'
  239.           DB '║                           ║                '
  240.           DB '                                  ║'
  241.           DB '║                           ║                '
  242.           DB '                                  ║'
  243.           DB '║                           ║                '
  244.           DB '                                  ║'
  245.           DB '║                           ║                '
  246.           DB '                                  ║'
  247.           DB '║                           ║                '
  248.           DB '                                  ║'
  249.           DB '║                           ║                '
  250.           DB '                                  ║'
  251.           DB '║                           ║                '
  252.           DB '                                  ║'
  253.           DB '║                           ║                '
  254.           DB '                                  ║'
  255.           DB '║                           ║                '
  256.           DB '                                  ║'
  257.           DB '║                           ║                '
  258.           DB '                                  ║'
  259.           DB '║                           ║                '
  260.           DB '                                  ║'
  261.           DB '║                           ║                '
  262.           DB '                                  ║'
  263.           DB '╚═══════════════════════════╩════════════════'
  264.           DB '══════════════════════════════════╝$'
  265.  
  266. Text1     DB ' Hilfstext anzeigen    $'
  267. Text2     DB ' Bootsektor schreiben  $'
  268. Text3     DB ' FAT#2->FAT#1 kopieren $'
  269. Text4     DB ' Sektorenfolge ändern  $'
  270. Text5     DB ' Ganze Diskette form.  $'
  271. Text6     DB ' Programm beenden      $'
  272.  
  273. Text1H    DB ' Gibt eine Kurzbeschreibung der Funktionen de'
  274.           DB 's Multiformatters aus       $'
  275. Text2H    DB ' Schreibt einen kompletten Bootsektor für 360'
  276.           DB ' KB-Disketten in Laufwerk A:$'
  277. Text3H    DB ' Restauriert die FAT durch Übertragen der zwe'
  278.           DB 'iten auf die erste FAT      $'
  279. Text4H    DB ' Ermöglicht das Erstellen von Fastloadern ode'
  280.           DB 'r eines Kopierschutzes      $'  
  281. Text5H    DB ' Formatiert eine komplette 360 Kbyte-Diskette'
  282.           DB ' und schreibt Bootsektor    $'
  283. Text6H    DB ' Rückkehr zu DOS                             '
  284.           DB '                            $'
  285.  
  286. Hilfstxt DB' Mit dem  toolbox  Multiformatter  lassen  sich'
  287.           DB'360 KByte Disketten 30% schneller formatieren.'
  288.           DB'Defekte  FATs können  bei intakter zweiter FAT'
  289.           DB'durch diese ersetzt und so restauriert werden.'
  290.           DB'Durch  Änderung der  Sektorenfolge ist es mög-'
  291.           DB'lich, Spezialformate  für  Schnelladedisketten'
  292.           DB'oder Kopierschutzzwecke zu erstellen.         '
  293.           DB'Die  Bedienung  erfolgt über die Cursortasten,'
  294.           DB'wobei man den jeweiligen Menüpunkt mit  RETURN'
  295.           DB'startet.  Ein einmal aktivierter Programmpunkt'
  296.           DB'wird  durch  einen blinkenden Menübalken ange-' 
  297.           DB'zeigt.                                        '
  298.           DB'                                              '
  299.           DB'(C) toolbox & U.S.                            '
  300.           DB'DMV-Verlag                                    '
  301.           DB'Postfach 250                                  '
  302.           DB'3440 Eschwege                                 '
  303.           DB'$                                             '
  304.  
  305. Space     DB'                                              '
  306.           DB' $'
  307.  
  308. Balken1   DB'░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░$'
  309.       
  310. Balken2   DB'░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░$'
  311.           
  312. Form_txt  DB' '
  313.           DB'Formatiere 2 Seiten m. 40 Spuren zu 9 Sektoren'
  314.           DB' ╔══════════════════════════════════════════╗ '
  315.           DB' ║                                          ║ '
  316.           DB' ╟──────────────────────────────────────────╢ '
  317.           DB' ║                                          ║ '
  318.           DB' ╚══════════════════════════════════════════╝ '          
  319.           DB'$'
  320.  
  321. Wahl      DB '?'
  322.  
  323. Zaehler   DB '?'
  324.  
  325. w_Zaehler DB '??'
  326.  
  327. Seite     DB '?'
  328.  
  329. Sektor_n  DB '?'
  330.  
  331. Floppy    DB '?'
  332.  
  333. format_error DB '?'
  334.  
  335.                                                             
  336. hide_cursor proc
  337.           mov ah,1
  338.           mov ch,255                    ;Startzeile Cursor
  339.           mov cl,255                    ;Endzeile Cursor
  340.           int 10h 
  341.           ret
  342. hide_cursor endp
  343.  
  344. show_Cursor proc
  345.           mov ah,1
  346.           mov ch,6                      ;Startzeile Cursor
  347.           mov cl,7                      ;Endzeile Cursor
  348.           int 10h
  349.           ret
  350. show_Cursor endp
  351.  
  352. Titelbild proc
  353.           Ausgabe Titel rot_weiß 0 0 80 
  354.           ret
  355. Titelbild endp          
  356.  
  357. read_Typ  proc
  358.           mov ah, 21
  359.           mov dl, 0
  360.           int 13h
  361.           mov cs:Floppy, ah             ;Floppy-Typ
  362.           ret
  363. read_Typ  endp
  364.  
  365. Menu proc
  366.           Ausgabe Text1 weiß 3  4  80  
  367.           Ausgabe Text2 weiß 3  7  80
  368.           Ausgabe Text3 weiß 3 10  80
  369.           Ausgabe Text4 weiß 3 13  80
  370.           Ausgabe Text5 weiß 3 16  80
  371.           Ausgabe Text6 weiß 3 19  80
  372.           ret
  373. Menu endp          
  374.  
  375. write_Bootsektor proc
  376.           mov ah,03h                    ;Sektor schreiben
  377.           mov dl,0                      ;Laufwerk A         
  378.           mov dh,cs:Seite               ;Seite (0-1)
  379.           mov ch,0                      ;Bootspur (0-39)
  380.           mov cl,1                      ;Startsektor (1-9)
  381.           mov al,CS:Sektor_n            ;Anzahl Sektoren
  382.           mov bx,cs                     ;Segment Puffer           
  383.           mov es,bx                     ;al * 512 Bytes
  384.           mov bx,offset Bootdat         ;Offset Puffer
  385.           int 13h                       ;write Bootsektor 
  386.           ret
  387. write_Bootsektor endp
  388.  
  389. verify_Bootsektor proc
  390.           mov ah,04h                    ;verify Sektor
  391.           mov dl,0                      ;Laufwerk 0
  392.           mov dh,cs:Seite               ;Seite (0-1)
  393.           mov ch,0                      ;Bootspur (0-39)
  394.           mov cl,1                      ;Startsektor (1-9)
  395.           mov al,CS:Sektor_n            ;Anzahl Sektoren
  396.           mov bx,cs                     ;Segment Puffer
  397.           mov es,bx                     
  398.           mov bx,offset Bootdat         ;Offset Puffer
  399.           int 13h                       ;verify Bootsektor
  400.           ret
  401. verify_Bootsektor endp
  402.  
  403. read_FAT2 proc
  404.           mov ah,02h                    ;Sektor lesen
  405.           mov dl,0                      ;Laufwerk A         
  406.           mov dh,0                      ;Seite (0-1)
  407.           mov ch,0                      ;Bootspur (0-39)
  408.           mov cl,4                      ;Startsektor (1-9)
  409.           mov al,2                      ;Anzahl Sektoren
  410.           mov bx,cs                     ;Segment Puffer           
  411.           mov es,bx                     ;al * 512 Bytes
  412.           mov bx,offset r_FAT           ;Offset Puffer
  413.           int 13h                       ;lese FAT 
  414.           ret
  415. read_FAT2 endp
  416.  
  417. write_FAT1 proc
  418.           mov ah,03h                    ;Sektor schreiben
  419.           mov dl,0                      ;Laufwerk A         
  420.           mov dh,0                      ;Seite (0-1)
  421.           mov ch,0                      ;Bootspur (0-39)
  422.           mov cl,2                      ;Startsektor (1-9)
  423.           mov al,2                      ;Anzahl Sektoren
  424.           mov bx,cs                     ;Segment Puffer           
  425.           mov es,bx                     ;al * 512 Bytes
  426.           mov bx,offset r_FAT           ;Offset Puffer
  427.           int 13h                       ;schreibe FAT 
  428.           ret
  429. write_FAT1 endp
  430.  
  431. init_Disk proc
  432.           mov ah,10h                    ;LW bereit ?
  433.           mov dl,80h
  434.           int 13h
  435.           jnc i_weiter
  436.           Ausgabe Fehler2 rot_weiß_bl 30 17 76
  437. i_weiter: mov ah,11h
  438.           mov dl,80h
  439.           int 13h                       ;Rekalibrierung
  440.           jnc ii_weiter
  441.           Ausgabe Fehler2 rot_weiß_bl 30 17 76
  442. ii_weiter:ret
  443. init_Disk endp      
  444.  
  445. write_Root proc
  446.           mov ah,03h                    ;Sektor schreiben
  447.           mov dl,0                      ;Laufwerk A         
  448.           mov dh,cs:Seite               ;Seite (0-1)
  449.           mov ch,0                      ;Bootspur (0-39)
  450.           mov cl,1                      ;Startsektor (1-9)
  451.           mov al,CS:Sektor_n            ;Anzahl Sektoren
  452.           mov bx,cs                     ;Segment Puffer           
  453.           mov es,bx                     ;al * 512 Bytes
  454.           mov bx,offset Root            ;Offset Puffer
  455.           int 13h                       ;write Bootsektor 
  456.           ret
  457. write_Root endp
  458.  
  459. verify_Root proc
  460.           mov ah,04h                    ;verify
  461.           mov dl,0                      ;Laufwerk A         
  462.           mov dh,cs:Seite               ;Seite (0-1)
  463.           mov ch,0                      ;Bootspur (0-39)
  464.           mov cl,1                      ;Startsektor (1-9)
  465.           mov al,CS:Sektor_n            ;Anzahl Sektoren
  466.           mov bx,cs                     ;Segment Puffer           
  467.           mov es,bx                     ;al * 512 Bytes
  468.           mov bx,offset Root            ;Offset Puffer
  469.           int 13h                       ;write Bootsektor 
  470.           ret
  471. verify_Root endp
  472.  
  473. clr_Window proc
  474.           mov cs:w_Zaehler,0003h        ;Zähler init
  475. clr_1:    mov al, cs:w_Zaehler
  476.           inc al
  477.           mov cs:w_Zaehler,al
  478.           Ausgabe Space rot_schwarz  30  al  76
  479.           mov al, cs:w_Zaehler
  480.           cmp al,19                     ;n Zeilen löschen  
  481.           jle clr_1
  482.           ret
  483. clr_Window endp
  484.  
  485. old_Balken1 proc   
  486.            mov si, 0
  487.            mov bx, offset Balken1
  488.            mov al, 176                  ;Zeichen
  489. old_1:     mov [bx], al
  490.            inc bx
  491.            inc si
  492.            cmp si, 40
  493.            jne old_1
  494.            ret
  495. old_Balken1 endp
  496.  
  497. old_Balken2 proc   
  498.            mov si, 0
  499.            mov bx, offset Balken2
  500.            mov al, 176                  ;Zeichen
  501. old_2:     mov [bx], al
  502.            inc bx
  503.            inc si
  504.            cmp si, 40
  505.            jne old_2
  506.            ret
  507. old_Balken2 endp
  508.  
  509. format_Disk proc  
  510.           sub si,si
  511. f_Start:
  512.           set_Typ                       ;setzt Laufwerkstyp
  513.           mov ch, cs:Zaehler
  514.           mov dh, cs:Seite
  515.           mov bx,offset Struktur  
  516.           mov [bx],ch                   ;aktuelle Spur 
  517.           mov [bx+1],dh
  518.           
  519.           mov [bx+4],ch
  520.           mov [bx+5],dh
  521.           
  522.           mov [bx+8],ch
  523.           mov [bx+9],dh
  524.           
  525.           mov [bx+12],ch
  526.           mov [bx+13],dh
  527.           
  528.           mov [bx+16],ch
  529.           mov [bx+17],dh
  530.           
  531.           mov [bx+20],ch
  532.           mov [bx+21],dh
  533.           
  534.           mov [bx+24],ch
  535.           mov [bx+25],dh
  536.           
  537.           mov [bx+28],ch
  538.           mov [bx+29],dh
  539.           
  540.           mov [bx+32],ch
  541.           mov [bx+33],dh
  542.          
  543.           mov ah,5                      ;Sektor formatieren
  544.           mov dl,0                      ;Laufwerk A
  545.           mov al,9                      ;9 Sekt. pro Spur  
  546.           mov bx, cs
  547.           mov es,bx                     ;Segment nach ES
  548.           mov bx, offset Struktur       ;Offset nach bx
  549.           int 13h
  550.           jnc format_OK
  551.           inc si
  552.           cmp si,5                      ;bis zu 5 Fehler
  553.           je format_Fehler
  554.           jmp f_Start                   ;neuer Versuch
  555. format_Fehler:
  556.           stc                           ;Fehler, Carry setzen
  557. format_OK:          
  558.           ret
  559. format_Disk endp
  560.  
  561. ;-------- Hauptprogramm ------------------------------------
  562. start: 
  563.           mov ax,cs
  564.           mov ds,ax
  565.           mov CS:F_Count, 1
  566.           set_LP_Tabelle             ;Laufwerksparameter T.
  567.           call read_Typ              ;Laufwerkstyp ermitteln
  568.           clrs
  569.           set_backg_color 4          ;Hintergrund rot
  570.           call hide_cursor                              
  571.           call Titelbild
  572.           call Menu
  573.           Ausgabe Text1 schwarz   3  4  80
  574.           Ausgabe Text1H gruen 3 23  80
  575. beginn_lesen:
  576.           mov cs:Wahl,1                 
  577. neu_lesen:
  578.           mov ah,08                     ;Zeichen lesen
  579.           int 21h
  580.           cmp al,13                     ;Menüp. start (CR) ? 
  581.           jne weiter_1                  ;Nein !
  582.           jmp Ende_Start                ;Menüpunkt starten !
  583. weiter_1:
  584.           cmp al,0                      ;Cursortaste ???
  585.           jne neu_lesen
  586.           int 21h                       ;2mal fuer code ->AL
  587.           cmp al,72                     ;Cursor up
  588.           jne up_lesen
  589.           mov al,cs:Wahl
  590.           dec al
  591.           mov cs:Wahl,al
  592.           jmp ende_lesen  
  593. up_lesen:  
  594.           cmp al,80                     ;Cursor down          
  595.           jne ende_lesen
  596.           mov al,cs:Wahl
  597.           inc al
  598.           mov cs:Wahl,al
  599. ende_lesen:
  600.           sub ax,ax
  601.           mov al,cs:Wahl 
  602.           cmp ax,7                      ;max. Menüpunkte + 1
  603.           jne Menu_Punkte_1
  604.           mov cs:Wahl,1
  605.           
  606. Menu_Punkte_1:
  607.           cmp ax,0
  608.           jne Menu_Punkte_2
  609.           mov cs:Wahl,6
  610.            
  611. Menu_Punkte_2:          
  612. ;ausgewählten Menüpunkt hell hervorheben
  613.           call Menu
  614.           sub ax,ax
  615.           mov al,cs:Wahl
  616. Punkt_1:
  617.           cmp ax,1
  618.           jne Punkt_2
  619.           Ausgabe Text1 schwarz    3  4  80
  620.           Ausgabe Text1H gruen  3 23  80
  621.           jmp Ende_Start
  622. Punkt_2:
  623.           cmp ax,2
  624.           jne Punkt_3
  625.           Ausgabe Text2 schwarz    3  7  80
  626.           Ausgabe Text2H gruen  3 23  80
  627.           jmp Ende_Start
  628. Punkt_3:
  629.           cmp ax,3
  630.           jne Punkt_4
  631.           Ausgabe Text3 schwarz    3 10  80
  632.           Ausgabe Text3H gruen  3 23  80
  633.           jmp Ende_Start
  634. Punkt_4:
  635.           cmp ax,4
  636.           jne Punkt_5
  637.           Ausgabe Text4 schwarz    3 13  80
  638.           Ausgabe Text4H gruen  3 23  80
  639.           jmp Ende_Start
  640. Punkt_5:          
  641.           cmp ax,5
  642.           jne Punkt_6
  643.           Ausgabe Text5 schwarz    3 16  80
  644.           Ausgabe Text5H gruen  3 23  80
  645.           jmp Ende_Start
  646. Punkt_6:  
  647.           Ausgabe Text6 schwarz    3 19  80
  648.           Ausgabe Text6H gruen  3 23  80
  649.           jmp Ende_Start
  650. Ende_Start:          
  651. ;----- Menüfunktionen ausführen !!!!!!!!!!!!!!!!!!!!!!!!!!!!
  652.           ;EXECUTE PROGRAMM
  653.           cmp al, 13                    ;Programm ausführen?
  654.           je weiter_e                   ;Nein, zurück !!!
  655.           jmp Start_2
  656. weiter_e: sub ax,ax
  657.           mov al, cs:Wahl               ;Programmnummer
  658.           cmp ax,1
  659.           je weiter_f
  660.           jmp Epunkt_2
  661. weiter_f:
  662.  
  663. ;* START PROGRAMMPUNKT-1 -----------------------------------
  664.           Ausgabe Hilfstxt rot_schwarz  30  4  76
  665.  
  666. ;* START PROGRAMMPUNKT-2 -----------------------------------         
  667. Epunkt_2:  
  668.           cmp ax,2
  669.           je weiter_g
  670.           jmp Epunkt_3
  671. weiter_g:          
  672.           Ausgabe Text2 weiß_bl 3 7 80  
  673.           call clr_Window
  674.           call init_Disk                ;Floppy init
  675.           jc BAD_1                      ;bei Fehler Abbruch     
  676.           mov cs:Seite, 0
  677.           mov cs:Sektor_n, 1            ;Nur Bootsektor          
  678.           call write_Bootsektor         
  679.           call write_Bootsektor         ;CF=1 bei Error
  680.           jc BAD_0
  681.           call verify_Bootsektor        ;CF=1 bei Error
  682.           jnc OK_2                      ;kein Fehler ?
  683. BAD_0:    Ausgabe Fehler rot_weiß_bl 30 17 76
  684.           Ausgabe Text2 schwarz 3 7 80  
  685. BAD_1:    jmp Start_2
  686.  
  687. OK_2:     Ausgabe OK rot_weiß 30 15 76
  688.           Ausgabe Text2 schwarz 3 7 80
  689.           
  690. ;* START PROGRAMMPUNKT-3 -----------------------------------         
  691. Epunkt_3:  
  692.           cmp ax,3
  693.           je Fat_Start
  694.           jmp Epunkt_4
  695. Fat_Start:
  696.           Ausgabe Text3 weiß_bl 3 10 80  
  697.           call clr_Window
  698.           call init_Disk
  699.           call read_FAT2
  700.           jnc Fat_weiter                   ;nein
  701.           Ausgabe Fehler rot_weiß_bl 30 17 76
  702.           jmp Start_2
  703. Fat_weiter:
  704.           call write_FAT1
  705.           jc Fat_Fehler                    ;ja
  706.           Ausgabe Text3 schwarz  3 10 80
  707.           Ausgabe OK rot_weiß 30 15 76
  708.           jmp Start_2                      ;nein
  709. Fat_Fehler:
  710.           Ausgabe Fehler rot_weiß_bl 30 17 76
  711.           jmp Start_2                      ;weiter
  712.  
  713. ;* START PROGRAMMPUNKT-4 -----------------------------------         
  714. Epunkt_4:  
  715.           cmp ax,4
  716.           je folge_weiter
  717.           jmp Epunkt_5
  718. folge_weiter:
  719.           Ausgabe Text4 weiß_bl 3 13 80  
  720.           call clr_Window
  721.           call init_Disk
  722.           Ausgabe Folgetxt rot_schwarz  30  4  76
  723. ;-----------------------------------------------------
  724.           mov al, CS:F_Count
  725.           jmp old_f
  726.  lese_Folge:      
  727.           mov ah,08                     ;Zeichen lesen
  728.           int 21h                       ;->al
  729.           
  730.           cmp al, 13                    ;Start ?
  731.           jne Folge_X                   ;Nein
  732. ;-----------------------------------------------------      
  733.           jmp Ende_Folge
  734.  Folge_X:
  735.           cmp al, 32                    
  736.           jne lese_Folge                ;falsche Eingabe
  737.  lese_1:
  738.     ;-- Folge anzeigen      
  739.           mov al,cs:F_Count
  740.           inc al
  741.   old_f:
  742.           mov cs:F_Count, al
  743.           cmp al, 1
  744.           jne F_2 
  745.           Ausgabe Folge1 rot_gelb 32 12 76
  746.           set_Folge 1 2 3 4 5 6 7 8 9  
  747.           jmp lese_Folge
  748.   F_2:
  749.           cmp al, 2
  750.           jne F_3
  751.           Ausgabe Folge2 rot_gelb 32 12 76
  752.           set_Folge 1 2 3 4 5 6 7 8 8  
  753.  
  754.           jmp lese_Folge
  755.   F_3:  
  756.           cmp al, 3
  757.           jne F_4
  758.           Ausgabe Folge3 rot_gelb 32 12 76
  759.           set_Folge 9 8 7 6 5 4 3 2 1  
  760.           jmp lese_Folge
  761.   F_4:
  762.           cmp al, 4
  763.           jne F_5
  764.           Ausgabe Folge4 rot_gelb 32 12 76
  765.           set_Folge 1 6 2 7 3 8 4 9 5  
  766.           jmp lese_Folge
  767.   F_5:
  768.           cmp al, 5
  769.           jne F_6
  770.           Ausgabe Folge5 rot_gelb 32 12 76
  771.           set_Folge 1 9 2 8 3 7 4 6 5  
  772.           jmp lese_Folge
  773.    F_6:
  774.           cmp al, 6
  775.           jne F_7
  776.           Ausgabe Folge6 rot_gelb 32 12 76
  777.           set_Folge 1 2 3 4 9 8 7 6 5  
  778.           jmp lese_Folge
  779.  
  780.    F_7:   mov cs:F_Count, 0
  781.           mov al,1
  782.           jmp lese_1
  783.  
  784. Ende_Folge:
  785.           Ausgabe Text4 schwarz 3 13 80  
  786.           jmp Start_2                   ;ENDE und weiter
  787.  
  788. ;* START PROGRAMMPUNKT-5 -----------------------------------         
  789. Epunkt_5:  
  790.           cmp ax,5
  791.           je weiter_6
  792.           jmp Epunkt_6
  793. weiter_6:
  794.  
  795.           call clr_Window               ;Fenster löschen
  796.           Ausgabe Form_txt rot_schwarz  30  4  76
  797.           Ausgabe Text5 weiß_bl  3  16  80
  798.           Ausgabe Balken1 rot_schwarz 34 6 78
  799.           Ausgabe Balken2 rot_schwarz 34 8 78
  800.  
  801.           mov cs:Zaehler, 0             ;Zähler init  
  802.           mov cs:Seite, 0               ;Seite init                      
  803.           call init_Disk                ;Disk init                    
  804.  Schleife_5:
  805.           jnc form_weiter
  806.           Ausgabe Fehler rot_weiß_bl 30 17 76
  807.           Ausgabe Text5 schwarz  3  16  80
  808.           jmp Start_2                   ;Abbruch, 5 Errors
  809. form_weiter:          
  810.           call format_Disk              ;eine Spur format.
  811.           jc Schleife_5                 ;FEHLER
  812.    ;----- Balken zeichnen ----------------------------------
  813.            mov ch, cs:Zaehler
  814.  
  815.            mov al, cs:Seite
  816.            cmp al, 1
  817.            je BalkenB
  818.            mov ax, offset Balken1
  819.            jmp BalkenA
  820.  BalkenB:  mov ax, offset Balken2
  821.  BalkenA:  add al, ch
  822.            mov si, ax
  823.            mov al, 219          
  824.            mov [si], al
  825.  
  826.            Ausgabe Balken1 rot_schwarz 34 6 78
  827.            Ausgabe Balken2 rot_schwarz 34 8 78
  828.    ;--------------------------------------------------------
  829.           mov ch, cs:Zaehler
  830.           inc ch                        ;nächste Spur
  831.           cmp ch,40                     ;letzter Track ???
  832.           mov cs:Zaehler, ch
  833.           je Ende_5                     ;Ende
  834.           clc
  835.           jmp Schleife_5                ;nächste Spur form.
  836.   Ende_5: mov al, cs:Seite              ;schon 2-te Seite ?
  837.           cmp al, 0                     
  838.           jne w_Boot                    ;beide Seiten fertig
  839.           inc al
  840.           mov cs:Zaehler, 0             ;Zähler für Seite 2  
  841.           mov cs:Seite, al              ;Seite 2
  842.           jmp Schleife_5
  843.            
  844.   w_Boot:
  845.           mov cs:Seite,0
  846.           mov cs:Sektor_n, 9            ;Bootsek.+ FAT          
  847.           call write_Bootsektor
  848.           call verify_Bootsektor
  849.           jnc w_Root                    ;OK und weiter
  850.           call write_Bootsektor         ;2-ter Versuch
  851.           call verify_Bootsektor
  852.           jnc w_Root
  853.           Ausgabe Fehler rot_weiß_bl 30 17 76
  854.           jmp weiter_nix
  855.  
  856.   w_Root: mov cs:Seite,1                ;Seite 2
  857.           mov cs:Sektor_n, 2            ;DIR Seite 2
  858.           call write_Root               ;Root Seite 2 (1)
  859.           call verify_Root              ;verify
  860.           jnc weiter_nix                ;OK und weiter
  861.           Ausgabe Fehler rot_weiß_bl 30 17 76
  862.           call old_Balken1     
  863.           call old_Balken2
  864.           jmp Start_2
  865.  weiter_nix:            
  866.           Ausgabe Text5 schwarz  3  16  80
  867.           Ausgabe OK rot_weiß 30 15 76
  868.           call old_Balken1     
  869.           call old_Balken2
  870.  
  871. ;* START PROGRAMMPUNKT-6 -----------------------------------         
  872. Epunkt_6:
  873.           cmp ax,6
  874.           jne Start_2
  875.           jmp Ende_Programm
  876. Start_2:
  877.           jmp neu_lesen
  878.  
  879. Ende_Programm:          
  880.           clrs
  881.           call show_cursor              ;Cursor restaurieren
  882.           mov al,0                      ;Errorlevel
  883.           mov ah,4Ch                    ;Beende Programm
  884.           int 21h
  885. end start
  886.