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