source: buchla-68k/rom/lowram.s@ 3ac8e1b

Last change on this file since 3ac8e1b was 3370595, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Fix symbol collisions.

  • Property mode set to 100644
File size: 4.8 KB
Line 
1| ------------------------------------------------------------------------------
2| lowram.s -- create a GEMDOS compatible basepage for the Buchla 700
3| Version 10 -- 1988-03-28 -- D.N. Lynx Crowe
4| ------------------------------------------------------------------------------
5| Provides a GEMDOS compatible basepage and calls start_ to
6| get things rolling for applications on the Buchla 700.
7
8| Also sets the stack pointer to the high end of RAM.
9
10| WARNING: This code ONLY works for programs loaded into RAM.
11| ------------------------------------------------------------------------------
12| We expect the following to be the relative layout of memory:
13
14| lowram load address (this chunk of code)
15| ...
16| p_lowtpa start of 'TPA' / basepage address
17| ...
18| start_ first module (starts 'text' area)
19| ...
20| ... -text-
21| ...
22| etext end of 'text' area + 1
23| basedat start of 'data' area (will usually be etext)
24| ...
25| ... -data-
26| ...
27| edata end of 'data' area + 1
28| basebss start of 'bss' area (will usually be edata)
29| ...
30| ... -BSS-
31| ...
32| end end of actual 'bss' area + 1
33| ...
34| ... -heap-
35| ...
36| HI_RAM-0x400 end of pseudo 'bss' area (cleared by fsmain.s)
37| ...
38| ... -stack margin-
39| ...
40| HI_RAM end of RAM + 1, initial stack address
41| ------------------------------------------------------------------------------
42| The startup code in fsmain.s uses the bss length to know how much RAM
43| to clear. We give it HI_RAM-0x400-basebss, and put the stack at HI_RAM.
44| The startup code clears from p_bbase through p_bbase+p_blen-1, inclusive.
45| This keeps fsmain.s from wiping itself out when it zaps the bss area.
46
47| The startup code (start_) in fsmain.s is entered with the address of
48| the basepage passed as a long word parameter on the top of the stack.
49| ------------------------------------------------------------------------------
50 .text
51
52 .page
53
54| Globals defined here:
55
56 .xdef LOWRAM
57 .xdef Lo_RAM
58 .xdef Hi_RAM
59
60 .xdef basebss
61 .xdef basedat
62 .xdef p_lowtpa
63 .xdef p_env
64
65 .xdef p_tlen
66 .xdef p_dlen
67
68| Globals referred to here:
69
70 .xref start_ | entry point in fsmain.s
71 .xref panic | entry point in fsmain.s
72
73 .xref edata | supplied by loader
74 .xref etext | supplied by loader
75
76| ------------------------------------------------------------------------------
77| Memory setup:
78| -------------
79| The equate for HI_RAM must be set to match the memory configuration used.
80
81| For a 512K system, Hi_RAM = 0x080000
82| For a 1024K system, Hi_RAM = 0x100000
83
84Hi_RAM = 0x100000 | highest RAM address + 1
85
86 .page
87
88| LOWRAM -- Startup code for Buchla 700 application programs
89| ------ ------------------------------------------------
90Lo_RAM:
91LOWRAM: lea basebss,a0 | setup bss base
92 move.l a0,p_bbase | ...
93 lea Hi_RAM-0x400,a1 | setup faked bss length
94 suba.l a0,a1 | ...
95 move.l a1,p_blen | ...
96
97 lea basedat,a0 | setup data base
98 move.l a0,p_dbase | ...
99 lea edata,a1 | setup data length
100 suba.l a0,a1 | ...
101 move.l a1,p_dlen | ...
102
103 lea start_,a0 | setup text base
104 move.l a0,p_tbase | ...
105 lea etext,a1 | setup text length
106 suba.l a0,a1 | ...
107 move.l a1,p_tlen | ...
108
109 lea Hi_RAM,a7 | setup stack pointer
110
111 lea p_lowtpa,a0 | setup TPA base
112 move.l a0,p_lowtpa | ...
113 move.l a7,p_hitpa | setup high TPA
114
115 move.l #p_lowtpa,-(a7) | Pass basepage address
116 jsr start_ | Start things going
117 addq.l #4,a7 | Clean up stack
118
119 move.l #pmsg,-(a7) | OOPS: panic()
120 jsr panic | ... shouldn't ever return
121 addq.l #4,a7
122
123hstop: stop #0x2000 | "Die, sucker!"
124 bra hstop
125
126 .page
127
128| The mess below is the basepage. It defines the start of the pseudo 'TPA'.
129| This MUST live in the 'text' segment for things to work.
130
131p_lowtpa: .dc.l 0 | low address of TPA
132p_hitpa: .dc.l 0 | high address + 1 of TPA
133p_tbase: .dc.l 0 | low address of text segment
134p_tlen: .dc.l 0 | length of text segment
135p_dbase: .dc.l 0 | low address of data segment
136p_dlen: .dc.l 0 | length of data segment
137p_bbase: .dc.l 0 | low address of BSS segment
138p_blen: .dc.l 0 | length of BSS segment
139p_dta: .dc.l 0 | pointer to DTA
140p_parent: .dc.l 0 | pointet to parent basepage
141 .dc.l 0
142p_env: .dc.l 0 | pointer to environment string
143 .ds.l 20
144p_cmdlin: .dc.b 0 | command line tail image
145 .ds.b 127
146
147current:
148BPLEN = current-p_lowtpa | MUST be 0x0100 (or we goofed)
149
150| ------------------------------------------------------------------------------
151 .data
152| ------------------------------------------------------------------------------
153 .even
154
155basedat: .ascii "***** data *****" | start of data
156
157pmsg: .asciz "returned from start_()" | panic() message
158
159| ------------------------------------------------------------------------------
160 .bss
161| ------------------------------------------------------------------------------
162 .even
163
164basebss: .ds.l 1 | start of BSS
165
166 .end
Note: See TracBrowser for help on using the repository browser.