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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [disk/] [tools/] [fs-Linux/] [mkpboot/] [pbr.s] - Blame information for rev 267

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

Line No. Rev Author Line
1 265 hellwig
;
2
; pbr.s -- the partition boot record
3
;
4
 
5
; Runtime environment:
6
;
7
; This code must be loaded and started at 0xC0010000.
8
; It allocates a stack from 0xC0011000 downwards. So
9
; it must run within 4K (code + data + stack).
10
;
11
; This code expects the disk number of the boot disk
12
; in $16, the start sector of the disk or partition
13
; to be booted in $17 and its size in $18.
14
;
15
; NOTE: THIS IS A FAKE PARTITION BOOT RECORD!
16
;       It doesn't load anything, but displays a message
17
;       where the real thing can be downloaded from.
18
 
19
        .set    stacktop,0xC0011000     ; top of stack
20
 
21
        .set    cout,0xC0000020         ; the monitor's console output
22
 
23
        ; display a message and halt
24
start:
25
        add     $29,$0,stacktop          ; setup stack
26
        add     $4,$0,strtmsg            ; say what is going on
27
        jal     msgout
28
        j       halt
29
 
30
        ; output message
31
        ;   $4 pointer to string
32
msgout:
33
        sub     $29,$29,8
34
        stw     $31,$29,4
35
        stw     $16,$29,0
36
        add     $16,$4,0         ; $16: pointer to string
37
msgout1:
38
        ldbu    $4,$16,0         ; get character
39
        beq     $4,$0,msgout2            ; done?
40
        jal     chrout                  ; output character
41
        add     $16,$16,1               ; bump pointer
42
        j       msgout1                 ; continue
43
msgout2:
44
        ldw     $16,$29,0
45
        ldw     $31,$29,4
46
        add     $29,$29,8
47
        jr      $31
48
 
49
        ; output character
50
        ;   $4 character
51
chrout:
52
        sub     $29,$29,4
53
        stw     $31,$29,0
54
        add     $8,$0,cout
55
        jalr    $8
56
        ldw     $31,$29,0
57
        add     $29,$29,4
58
        jr      $31
59
 
60
        ; halt execution by looping
61
halt:
62
        add     $4,$0,hltmsg
63
        jal     msgout
64
halt1:
65
        j       halt1
66
 
67
        ; messages
68
strtmsg:
69 267 hellwig
        .byte   "You didn't expect this tiny program to be "
70
        .byte   "a full-fledged operating system, did you? ;-) "
71
        .byte   "The real Linux for ECO32 is a project all by "
72
        .byte   "itself. You can find it on GitHub, under the "
73
        .byte   "name 'linux-on-eco32'.", 0x0D, 0x0A, 0
74 265 hellwig
hltmsg:
75
        .byte   "bootstrap halted", 0x0D, 0x0A, 0
76
 
77
        ; boot record signature
78
        .locate 512-2
79
        .byte   0x55, 0xAA

powered by: WebSVN 2.1.0

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