OpenCores
URL https://opencores.org/ocsvn/eco32/eco32/trunk

Subversion Repositories eco32

[/] [eco32/] [trunk/] [stdalone/] [wrtmbr/] [mbr/] [mbr.s] - Blame information for rev 78

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 18 hellwig
;
2
; mbr.s -- the master boot record
3
;
4
 
5
        .set    tba,0xF0300000          ; terminal base address
6
        .set    tos,0xC0001000          ; top of stack
7
 
8
start:
9
        add     $29,$0,tos               ; set stackpointer
10
        jal     msgout                  ; output message
11
stop:
12
        j       stop                    ; halt by looping
13
 
14
msgout:
15
        sub     $29,$29,8               ; allocate stack frame
16
        stw     $31,$29,0                ; save return register
17
        stw     $16,$29,4               ; save local variable
18
        add     $16,$0,msg               ; pointer to string
19
loop:
20
        ldbu    $4,$16,0         ; get char
21
        beq     $4,$0,exit               ; null - finished
22
        jal     out                     ; output char
23
        add     $16,$16,1               ; bump pointer
24
        j       loop                    ; next char
25
exit:
26
        ldw     $31,$29,0                ; restore return register
27
        ldw     $16,$29,4               ; restore local variable
28
        add     $29,$29,8               ; release stack frame
29
        jr      $31                     ; return
30
 
31
out:
32
        add     $8,$0,tba                ; set I/O base address
33
out1:
34
        ldw     $9,$8,8                 ; get xmtr status
35
        and     $9,$9,1                 ; xmtr ready?
36
        beq     $9,$0,out1               ; no - wait
37
        stw     $4,$8,12                ; send char
38
        jr      $31                     ; return
39
 
40
msg:
41
        .byte   0x0D, 0x0A
42
        .byte   "Error: This is the default MBR, "
43
        .byte   "which cannot load anything."
44
        .byte   0x0D, 0x0A
45
        .byte   "Please replace the disk, or "
46
        .byte   "write an operating system onto it."
47
        .byte   0x0D, 0x0A
48
        .byte   "Execution halted."
49
        .byte   0x0D, 0x0A
50
        .byte   0x0D, 0x0A, 0
51
 
52
        .locate 512-2
53
sign:
54
        .byte   0x55, 0xAA

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.