[4f508e6] | 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 | | ...
|
---|
[8325447] | 22 | | etext end of 'text' area + 1
|
---|
| 23 | | basedat start of 'data' area (will usually be etext)
|
---|
[4f508e6] | 24 | | ...
|
---|
| 25 | | ... -data-
|
---|
| 26 | | ...
|
---|
[8325447] | 27 | | edata end of 'data' area + 1
|
---|
| 28 | | basebss start of 'bss' area (will usually be edata)
|
---|
[4f508e6] | 29 | | ...
|
---|
| 30 | | ... -BSS-
|
---|
| 31 | | ...
|
---|
[8325447] | 32 | | end end of actual 'bss' area + 1
|
---|
[4f508e6] | 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
|
---|
[8325447] | 57 | .xdef Lo_RAM
|
---|
| 58 | .xdef Hi_RAM
|
---|
[4f508e6] | 59 |
|
---|
| 60 | .xdef basebss
|
---|
| 61 | .xdef basedat
|
---|
| 62 | .xdef p_lowtpa
|
---|
| 63 | .xdef p_env
|
---|
| 64 |
|
---|
[8325447] | 65 | .xdef p_tlen
|
---|
| 66 | .xdef p_dlen
|
---|
[4f508e6] | 67 |
|
---|
| 68 | | Globals referred to here:
|
---|
| 69 |
|
---|
| 70 | .xref start_ | entry point in fsmain.s
|
---|
[8325447] | 71 | .xref panic | entry point in fsmain.s
|
---|
[4f508e6] | 72 |
|
---|
[8325447] | 73 | .xref edata | supplied by loader
|
---|
| 74 | .xref etext | supplied by loader
|
---|
[4f508e6] | 75 |
|
---|
| 76 | | ------------------------------------------------------------------------------
|
---|
| 77 | | Memory setup:
|
---|
[8325447] | 78 | | -------------
|
---|
[4f508e6] | 79 | | The equate for HI_RAM must be set to match the memory configuration used.
|
---|
| 80 |
|
---|
[3370595] | 81 | | For a 512K system, Hi_RAM = 0x080000
|
---|
| 82 | | For a 1024K system, Hi_RAM = 0x100000
|
---|
[4f508e6] | 83 |
|
---|
[3370595] | 84 | Hi_RAM = 0x100000 | highest RAM address + 1
|
---|
[4f508e6] | 85 |
|
---|
| 86 | .page
|
---|
| 87 |
|
---|
| 88 | | LOWRAM -- Startup code for Buchla 700 application programs
|
---|
| 89 | | ------ ------------------------------------------------
|
---|
[8325447] | 90 | Lo_RAM:
|
---|
[4f508e6] | 91 | LOWRAM: lea basebss,a0 | setup bss base
|
---|
| 92 | move.l a0,p_bbase | ...
|
---|
[3370595] | 93 | lea Hi_RAM-0x400,a1 | setup faked bss length
|
---|
[4f508e6] | 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 | ...
|
---|
[8325447] | 99 | lea edata,a1 | setup data length
|
---|
[4f508e6] | 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 | ...
|
---|
[8325447] | 105 | lea etext,a1 | setup text length
|
---|
[4f508e6] | 106 | suba.l a0,a1 | ...
|
---|
| 107 | move.l a1,p_tlen | ...
|
---|
| 108 |
|
---|
[3370595] | 109 | lea Hi_RAM,a7 | setup stack pointer
|
---|
[4f508e6] | 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()
|
---|
[8325447] | 120 | jsr panic | ... shouldn't ever return
|
---|
[4f508e6] | 121 | addq.l #4,a7
|
---|
| 122 |
|
---|
| 123 | hstop: 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 |
|
---|
[4cfe69a] | 131 | p_lowtpa: .dc.l 0 | low address of TPA
|
---|
| 132 | p_hitpa: .dc.l 0 | high address + 1 of TPA
|
---|
| 133 | p_tbase: .dc.l 0 | low address of text segment
|
---|
| 134 | p_tlen: .dc.l 0 | length of text segment
|
---|
| 135 | p_dbase: .dc.l 0 | low address of data segment
|
---|
| 136 | p_dlen: .dc.l 0 | length of data segment
|
---|
| 137 | p_bbase: .dc.l 0 | low address of BSS segment
|
---|
| 138 | p_blen: .dc.l 0 | length of BSS segment
|
---|
| 139 | p_dta: .dc.l 0 | pointer to DTA
|
---|
| 140 | p_parent: .dc.l 0 | pointet to parent basepage
|
---|
| 141 | .dc.l 0
|
---|
| 142 | p_env: .dc.l 0 | pointer to environment string
|
---|
| 143 | .ds.l 20
|
---|
| 144 | p_cmdlin: .dc.b 0 | command line tail image
|
---|
| 145 | .ds.b 127
|
---|
[4f508e6] | 146 |
|
---|
| 147 | current:
|
---|
| 148 | BPLEN = current-p_lowtpa | MUST be 0x0100 (or we goofed)
|
---|
| 149 |
|
---|
| 150 | | ------------------------------------------------------------------------------
|
---|
| 151 | .data
|
---|
| 152 | | ------------------------------------------------------------------------------
|
---|
| 153 | .even
|
---|
| 154 |
|
---|
[84920eb] | 155 | basedat: .ascii "***** data *****" | start of data
|
---|
[4f508e6] | 156 |
|
---|
[6dc5ea7] | 157 | pmsg: .asciz "returned from start_()" | panic() message
|
---|
[4f508e6] | 158 |
|
---|
| 159 | | ------------------------------------------------------------------------------
|
---|
| 160 | .bss
|
---|
| 161 | | ------------------------------------------------------------------------------
|
---|
| 162 | .even
|
---|
| 163 |
|
---|
[4cfe69a] | 164 | basebss: .ds.l 1 | start of BSS
|
---|
[4f508e6] | 165 |
|
---|
| 166 | .end
|
---|