]> git.sur5r.net Git - cc65/blob - testcode/grc/vlir0.s
Removed (pretty inconsistently used) tab chars from source code base.
[cc65] / testcode / grc / vlir0.s
1 ; Maciej 'YTM/Elysium' Witkowiak
2 ; 06.06.2002
3
4 ; This is the source for the main VLIR-structured program part
5
6     ; include some GEOS defines
7
8             .include "../../libsrc/geos/inc/const.inc"
9             .include "../../libsrc/geos/inc/jumptab.inc"
10             .include "../../libsrc/geos/inc/geossym.inc"
11             .include "../../libsrc/geos/inc/geosmac.inc"
12
13     ; import load addresses for all VLIR chains
14     ; these labels are defined upon linking with ld65
15
16             .import __OVERLAYADDR__
17             .import __OVERLAYSIZE__
18
19     ; import names of functions defined (and exported) in each VLIR part
20     ; of your application
21     ; here I used an OVERLAYx_ prefix to prevent name clashes
22
23             .import OVERLAY1_Function1
24             .import OVERLAY2_Function1
25
26     ; segments "STARTUP", "CODE", "DATA", "RODATA" and "BSS" all go to VLIR0 chain
27
28             .segment "STARTUP"
29             ; code segment for VLIR 0 chain
30 ProgExec:
31                 LoadW r0, paramString           ; show something
32                 jsr DoDlgBox
33
34                 MoveW dirEntryBuf+OFF_DE_TR_SC, r1
35                 LoadW r4, fileHeader
36                 jsr GetBlock                    ; load back VLIR t&s table
37                 bnex error
38
39                 lda #1
40                 jsr PointRecord                 ; we want next module (#1)
41                 LoadW r2, __OVERLAYSIZE__       ; length - as many bytes as we have room for
42                 LoadW r7, __OVERLAYADDR__       ; all VLIR segments have the same load address
43                 jsr ReadRecord                  ; load it
44                 bnex error
45                 jsr OVERLAY1_Function1          ; execute something
46
47                 lda #2
48                 jsr PointRecord                 ; next module
49                 LoadW r2, __OVERLAYSIZE__
50                 LoadW r7, __OVERLAYADDR__
51                 jsr ReadRecord                  ; load it
52                 bnex error
53                 jsr OVERLAY2_Function1          ; execute something
54
55 error:          jmp EnterDeskTop                ; end of application
56
57             .segment "RODATA"
58             ; read-only data segment
59 paramString:
60             .byte DEF_DB_POS | 1
61             .byte DBTXTSTR, TXT_LN_X, TXT_LN_2_Y
62             .word line1
63             .byte DBTXTSTR, TXT_LN_X, TXT_LN_3_Y
64             .word line2
65             .byte OK, DBI_X_0, DBI_Y_2
66             .byte NULL
67
68 line1:      .byte BOLDON, "Hello World!",0
69 line2:      .byte OUTLINEON,"Hello",PLAINTEXT," world!",0
70
71             .segment "DATA"
72             ; read/write initialized data segment
73 counter:    .word 0
74
75             .segment "BSS"
76             ; read/write uninitialized data segment
77             ; this space doesn't go into output file, only its size and
78             ; position is remembered