Formatierungs-Tool

Aus CBMPET.DE

Wechseln zu: Navigation, Suche

CBM_8296_RAMDrive

;---------------------------------------------------------

; qformat for new file-system

;

; [/] 25. oct. 2009
;  M.Sachse
;
;  http://www.cbmhardware.de
;

;---------------------------------------------------------

      strout = $bb24

      chrout = $ffd2  ;  print a char on screen

      get    = $ffe4  ;  to get pressed keys 

 clearscreen = $e015

    nextline = $d534

    space    = $d531

    bsout    = $ffd2

    beep     = $e02a

;---------------------------------------------------

; 

    buffer    = $1000

;---------------------------------------------------

    sector    = $a000

     page     = $a001 

    dataport  = $a400

    mypage    = $0a

    mysector  = $0b

;---------------------------------------------------

!to "qformat.prg",cbm

; Basicstart

*= $0400

!byte $00,$0c,$08,$0a,$00,$9e,$31,$30,$33,$39,$00,$00,$00,$00

; main

*=$040f

               lda #00

               jsr clearscreen
               ldx #80          ; string-len

               lda #<startup    ; low byte

               sta $1F

               lda #>startup    ; high byte

               sta $20

               jsr strout       ; put it on the screen

               jsr nextline

               ldx #80          ; string-len

               lda #<really     ; low byte

               sta $1F

               lda #>really     ; high byte

               sta $20

               jsr strout       ; put it on the screen



keys:          jsr get          ; get keyboard

               cmp #89          ; "y"es 

               beq format       ; 

               cmp #78          ; "n"o : exit program          

               beq ready        ; 

               bne keys    


ready:         jsr nextline

               ldx #25          ; string-len

               lda #<exitmsg    ; low byte

               sta $1F

               lda #>exitmsg    ; high byte

               sta $20

               jsr strout       ; put it on the screen

               jsr beep
               jmp $b3ff                 

 

format:        jsr nextline                

               jsr nextline

               ldx #25          ; string-len

               lda #<rawformat  ; low byte

               sta $1F

               lda #>rawformat  ; high byte

               sta $20

               jsr strout       ; put it on the screen


               
               ldy #$00

               ldx #$00

               stx mypage  
               stx sector
               stx page

j0:            lda #46          ; drop a point on the screen

               jsr bsout


j1:            lda #$00            

               sta dataport,x   ; rewrite

               inx            

               bne j1           ; one sector 

               iny            
               sty sector
               bne j1           ; 256 sectors = 65536 Bytes

               inc mypage
               lda mypage
               sta page
               cmp #$10         ; 16 * 65536 = 1048576 Bytes (4096 Blocks)
               bne j0  

               lda #00          ; set page = 0  
               sta page
               sta sector       ; sector = 0 
               jsr nextline

               ldx #25          ; string-len

               lda #<headerinfo ; low byte

               sta $1F

               lda #>headerinfo ; high byte

               sta $20

               jsr strout       ; put it on the screen


j2:            lda dirheader,x            

               sta dataport,x   ; writing Header (Dir-Header (20), incl. OS-Version(2 l/h), Bytes Free (2 l/h))

               inx
               cpx #20
               bne j2  

               lda #01
               sta sector       ; sector = 1

               jsr nextline

               ldx #25          ; string-len

               lda #<rootinfo   ; low byte

               sta $1F

               lda #>rootinfo   ; high byte

               sta $20

               jsr strout       ; put it on the screen

               ldx #$00

j3:            lda root,x            

               sta dataport,x   ; writing root-dir

               inx
               cpx #32
               bne j3 
               jmp ready
               
;----------------------------------------------------------------------------------------------------------

startup:    !PET "---( CBM RAM-DRIVE 8000 Quick-Format v1.1 )-------------------------------------"

really:     !PET "Do you want to continue (Y/N) ? All Information on your drive will be deleted ! "  

rawformat:  !PET "Doing low level format   "
headerinfo: !PET "Writing Header           " 
rootinfo:   !PET "Writing Root-Directory   " 
exitmsg:    !PET "Have a nice day hacker ! "  
;                                                                             OS-Version   Blocks free (4000)
                     ; T   E   S   T   ( spaces                                 )  ↓  ↓    ↓   ↓

dirheader:  !byte $a0,$d4,$c5,$d3,$d4,$a0,$a0,$a0,$a0,$a0,$a0,$a0,$a0,$a0,$a0,$a0,$00,$01,$0f,$a0


;           bytes 0 = id, 1=status $00:DEL, $01:PRG, 2-17:name,18-31:reserved 

root:       !byte $00,$01,$d2,$cf,$cf,$d4,$a0,$a0,$a0,$a0,$a0,$a0,$a0,$a0,$a0,$a0
            !byte $a0,$a0,$a0,$a0,$a0,$a0,$a0,$a0,$a0, $a0,$a0,$a0,$a0,$a0,$a0,$a0

Persönliche Werkzeuge