home *** CD-ROM | disk | FTP | other *** search
- ; *** BBLoad written by Gerson Kurz ***
- ;
- ; Size : 644 Bytes !!
- ;
- ; Das ist das Gegenstueck zu BBSave. Hier wird ein File in den Bootblock
- ; Geschrieben....
- ; -----------------------------------------------------------------
- ; Diesmal suchen wir uns auch zuerst einen Task
- ; -----------------------------------------------------------------
- o: cmp.b #1,d0 ; Keine Parameter ?
- bls.l nofile ; Ja, Error !
- movem.l d0-d3/a0-a4,-(sp); Register sichern
- move.l 4,a6 ; Execbase als Basisadr.
- suba.l a1,a1 ; eigener Task
- jsr -294(a6) ; ExecCall FINDTASK
- move.l d0,readreply+$10; Zeiger auf eigenen Task
- lea readreply,a1 ; Task herholen
- jsr -354(a6) ; ExecCall ADDPORT
- movem.l (sp)+,d0-d3/a0-a4; Register zurueckholen
- ; -----------------------------------------------------------------
- ; Aber dann holen wir uns den CLI Eingabestring her...
- ; -----------------------------------------------------------------
- lea $60000,a1 ; String fuer Filename nach a1
- search: move.b (a0)+,d1 ; Char kopieren
- cmp.b #$0a,d1 ; Return erreicht ?
- beq.s found ; Ja > Gefunden !
- move.b d1,(a1)+ ; Sonst Char in String kopieren
- bra.s search ; Weiter nach Return suchen
- found: move.b #$0,(a1)+ ; Nullbyte ans Stringende
- bsr.s init ; Dos.library oeffnen
- ; -----------------------------------------------------------------
- ; File oeffnen und Daten reinlesen
- ; -----------------------------------------------------------------
- move.l #$60000,d1 ; Zeiger auf Filenamen
- move.l #1005,d2 ; Modus : ALT
- jsr -30(a5) ; DosCall OPEN
- cmp.l #0,d0 ; Error ?
- beq.s error ; Ja, also nichts wie raus hier
- move.l d0,a3 ; Filehandle sichern
- moveq #10,d3 ; 10 Zeichen
- move.l #filemsg,d2 ; 'Loading.'-Message
- jsr -60(a5) ; DosCall OUTPUT
- jsr -48(a5) ; DosCall WRITE
- move.l a3,d1 ; Zeiger aufs File
- move.l #$60080,d2 ; Zeiger auf den String
- move.l #1024,d3 ; 1024 Zeichen reinlesen
- jsr -42(a5) ; DosCall READ
- move.l a3,d1 ; Zeiger aufs File
- jsr -36(a5) ; DosCall CLOSE
- ; -----------------------------------------------------------------
- ; Und jetzt schreiben wir das Ganze wieder in den Bootblock. Dazu
- ; oeffnen wir ( wie schon bei BBSave ) das Trackdiskdevice, schauen
- ; nach ob eine Disk vorhanden ist und speichern unsere Daten ab.
- ; -----------------------------------------------------------------
- lea diskio,a1 ; IO-Struktur
- moveq #0,d0 ; df0:
- moveq #0,d1 ; keine Flags
- lea trackdev,a0 ; Trackdisk-Device
- jsr -444(a6) ; ExecCall OPENDEVICE
- tst.l d0 ; Error ?
- bne.L error ; Ja, also nichts wie raus hier !
- lea diskio,a1 ; IO-Struktur
- move.l #readreply,14(A1); Zeiger auf unseren Task
- move #14,28(a1) ; TDComm. CHangestate (Diskette eingelegt?)
- move.l 4,a6 ; Execbase in a6
- jsr -456(a6) ; ExecCall DOIO
- lea diskio,a1 ; IO-Struktur
- move.l #readreply,14(A1); Zeiger auf unseren Task
- move #3,28(a1) ; TDCommand WRITE
- move.l #$60080,40(a1) ; Zeiger auf unseren Buffer
- move.l #1024,36(a1) ; 2 Sektoren einlesen
- move.l #0,44(a1) ; von Sektor 0 Spur 0
- move.l 4,a6 ; Execbase in a6
- jsr -456(a6) ; ExecCall DOIO
- ; -----------------------------------------------------------------
- ; Alles wieder schliessen
- ; -----------------------------------------------------------------
- lea diskio,a1 ; IO-Struktur
- move.l #readreply,14(A1); Zeiger auf unseren Task
- move #9,28(a1) ; TDCommand TD-MOTOR
- move.l #0,36(a1) ; Motor ausschalten
- jsr -456(a6) ; ExecCall DOIO
- lea readreply,a1 ; Task-Struktur
- jsr -360(a6) ; ExecCall REMOVEPORT
- lea diskio,a1 ; IO-Struktur
- jsr -450(a6) ; ExecCall CLOSEDEVICE
- close: move.l a5,a1 ; Dosbase zurueckholen
- jsr -414(a6) ; Und Schliesen..
- error: rts ; Zurueck ins CLI
- ; -----------------------------------------------------------------
- ; Subroutine, die die Dos.library oeffnet und die Basisadresse sichert
- ; -----------------------------------------------------------------
- init: move.l 4,a6 ; Execbase
- lea dosname,a1 ; Dos.library
- jsr -408(a6) ; ExecCall OPENLIBRARY
- move.l d0,a5 ; dosbase retten
- rts ; Zurueck
- ; -----------------------------------------------------------------
- ; Subroutine, wenn keine Parameter eingegeben wurden
- ; -----------------------------------------------------------------
- nofile: bsr.s init ; dos.lib oeffnen
- moveq #10,d3 ; 10 Zeichen
- move.l #nofilemsg,d2 ; 'Bad Args.'-Message
- jsr -60(a5) ; DosCall OUTPUT
- jsr -48(a5) ; DosCall WRITE
- bra.s close ; Raus aus dem Programm
- ; -----------------------------------------------------------------
- ; Labels
- ; -----------------------------------------------------------------
- dosname: dc.b 'dos.library',0
- trackdev: dc.b 'trackdisk.device',0
- nofilemsg: dc.b "Bad Args",$a,0
- filemsg: dc.b "Loading.",$a,0
- even
- diskio: blk.l 20,0
- readreply: blk.l 8,0
-