summaryrefslogtreecommitdiffstats
path: root/sw/z80/tests/asm/main.s
blob: 8cf4df061902414cfff4c92efce71f776d076585 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
    .module crt0
    .area   _HEADER (ABS)

;; Reset vectors
    .org    0
    jp  init

    .org    0x38 ; the instruction 0xff (not written) resets to this location
    jp init

;; main code
    .org    0x100
    .globl  _main

init:
    ;; Set stack pointer directly above top of memory.
    ld  sp,#0xffff

    ;; Start of the program
    call    _main
    jp      _exit

_exit:
    halt
    ; jp  _exit

;; Ordering of segments for the linker.
    .area   _HOME
    .area   _CODE
_main:
    ret
    .area   _INITIALIZER
    .area   _GSINIT
    .area   _GSFINAL

    .area   _DATA
    .area   _INITIALIZED
    .area   _BSEG
    .area   _BSS
    .area   _HEAP