source: buchla-68k/orig/ROM/LOWRAM.S@ 6f49665

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

Imported original source code.

  • Property mode set to 100755
File size: 5.1 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-$400 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-$400-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 = $080000
82* For a 1024K system, _Hi_RAM = $100000
83*
84_Hi_RAM .equ $100000 * highest RAM address + 1
85*
86 .page
87*
88* LOWRAM -- Startup code for Buchla 700 application programs
89* ------ ------------------------------------------------
90_Lo_RAM:
91LOWRAM: lea basebss,a0 * setup bss base
92 move.l a0,p_bbase * ...
93 lea _Hi_RAM-$400,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 #$2000 * "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*
147BPLEN .equ *-p_lowtpa * MUST be $0100 (or we goofed)
148*
149_p_tlen .equ p_tlen * text length for MIDAS-VII
150_p_dlen .equ p_dlen * data length for MIDAS-VII
151*
152* ------------------------------------------------------------------------------
153 .data
154* ------------------------------------------------------------------------------
155 .even
156*
157basedat: dc.b '***** data *****' * start of data
158*
159pmsg: dc.b 'returned from start_()',0 * panic() message
160*
161* ------------------------------------------------------------------------------
162 .bss
163* ------------------------------------------------------------------------------
164 .even
165*
166basebss: ds.l 1 * start of BSS
167*
168 .end
Note: See TracBrowser for help on using the repository browser.