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 310

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 269 hellwig
        .byte   0x0D, 0x0A
70
        .byte   "You didn't expect this tiny program to be"
71
        .byte   0x0D, 0x0A
72
        .byte   "a full-fledged operating system, did you?"
73
        .byte   0x0D, 0x0A
74
        .byte   "You can find the real Linux for ECO32 on"
75
        .byte   0x0D, 0x0A
76
        .byte   "GitHub, under the name 'linux-on-eco32'."
77
        .byte   0x0D, 0x0A, 0x0D, 0x0A, 0
78 265 hellwig
hltmsg:
79
        .byte   "bootstrap halted", 0x0D, 0x0A, 0
80
 
81
        ; boot record signature
82
        .locate 512-2
83
        .byte   0x55, 0xAA

powered by: WebSVN 2.1.0

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