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

Subversion Repositories ao486

[/] [ao486/] [trunk/] [sim/] [iverilog/] [soc/] [sw/] [first.c] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 alfik
 
2
static void outb();
3
static void main();
4
 
5
#asm
6
 
7
use16 386
8
 
9
.text
10
 
11
.org 0xfff0
12
 
13
jmp 0xf000:start_code
14
 
15
#endasm
16
 
17
#asm
18
.text
19
 
20
.org 0x0000
21
 
22
start_code:
23
 
24
mov ax, #0xf000
25
mov ds, ax
26
mov es, ax
27
mov fs, ax
28
mov gs, ax
29
mov ss, ax
30
 
31
mov esp, #0xffec
32
 
33
call _main
34
 
35
end_label:
36
jmp end_label
37
 
38
.data
39
.org 0xF000
40
 
41
 
42
#endasm
43
 
44
 
45
typedef unsigned char  Bit8u;
46
typedef unsigned short Bit16u;
47
typedef unsigned short bx_bool;
48
typedef unsigned long  Bit32u;
49
 
50
  void
51
  main()
52
{
53
    char *txt = "Hello world !";
54
    int i = 0;
55
 
56
    while(txt[i] != 0) {
57
        outb(0x8888, txt[i]);
58
        i++;
59
    }
60
}
61
 
62
  void
63
outb(port, val)
64
  Bit16u port;
65
  Bit8u  val;
66
{
67
#asm
68
  push bp
69
  mov  bp, sp
70
 
71
    push ax
72
    push dx
73
    mov  dx, 4[bp]
74
    mov  al, 6[bp]
75
    out  dx, al
76
    pop  dx
77
    pop  ax
78
 
79
  pop  bp
80
#endasm
81
}

powered by: WebSVN 2.1.0

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