Changeset 6dc5ea7 in buchla-68k
- Timestamp:
- 07/02/2017 12:06:10 AM (7 years ago)
- Branches:
- master
- Children:
- f394e7b
- Parents:
- c091ef8
- Files:
-
- 3 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile
rc091ef8 r6dc5ea7 6 6 CROSS_AS := $(CROSS_PRE)-as 7 7 CROSS_AR := $(CROSS_PRE)-ar 8 CROSS_OBJC := $(CROSS_PRE)-objcopy 8 9 9 10 # -mshort sets the size of an int to 16 bits; important for interop with … … 12 13 FLAGS := -Os -m68000 -Wall -Wextra 13 14 14 FLAGS_COM := $(FLAGS) -mshort -std=c99 -f freestanding -nostdinc\15 - fno-strict-aliasing -fno-inline -fno-omit-frame-pointer \15 FLAGS_COM := $(FLAGS) -mshort -std=c99 -fleading-underscore -ffreestanding \ 16 -nostdinc -fno-strict-aliasing -fno-inline -fno-omit-frame-pointer \ 16 17 -Wpedantic -Wcast-align -Wcast-qual -Wconversion -Wsign-conversion \ 17 18 -Wshadow -Wmissing-declarations -Wredundant-decls \ … … 30 31 PROLOG_CO := $(PROLOG_C:.c=.o) 31 32 PROLOG_SO := $(PROLOG_S:.s=.o) 32 33 PROLOG_SRC := $(PROLOG_C:%=prolog/%) $(PROLOG_S:%=prolog/%)34 33 PROLOG_OBJ := $(PROLOG_CO:%=build/%) $(PROLOG_SO:%=build/%) 35 34 36 35 build/%.o: prolog/%.c $(HEADERS) | build 37 36 $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $< 37 $(CROSS_OBJC) --redefine-syms misc/rewrite.txt $@ 38 38 39 39 build/%.o: prolog/%.s $(HEADERS) | build … … 49 49 IOLIB_CO := $(IOLIB_C:.c=.o) 50 50 IOLIB_SO := $(IOLIB_S:.s=.o) 51 52 IOLIB_SRC := $(IOLIB_C:%=iolib/%) $(IOLIB_S:%=iolib/%)53 51 IOLIB_OBJ := $(IOLIB_CO:%=build/%) $(IOLIB_SO:%=build/%) 54 52 55 53 build/%.o: iolib/%.c $(HEADERS) | build 56 54 $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $< 55 $(CROSS_OBJC) --redefine-syms misc/rewrite.txt $@ 57 56 58 57 build/%.o: iolib/%.s $(HEADERS) | build … … 74 73 LIBCIO_CO := $(LIBCIO_C:.c=.o) 75 74 LIBCIO_SO := $(LIBCIO_S:.s=.o) 76 77 LIBCIO_SRC := $(LIBCIO_C:%=libcio/%) $(LIBCIO_S:%=libcio/%)78 75 LIBCIO_OBJ := $(LIBCIO_CO:%=build/%) $(LIBCIO_SO:%=build/%) 79 76 80 77 build/%.o: libcio/%.c $(HEADERS) | build 81 78 $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $< 79 $(CROSS_OBJC) --redefine-syms misc/rewrite.txt $@ 82 80 83 81 build/%.o: libcio/%.s $(HEADERS) | build … … 95 93 96 94 LIBSM_CO := $(LIBSM_C:.c=.o) 97 98 LIBSM_SRC := $(LIBSM_C:%=libsm/%)99 95 LIBSM_OBJ := $(LIBSM_CO:%=build/%) 100 96 101 97 build/%.o: libsm/%.c $(HEADERS) | build 102 98 $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $< 99 $(CROSS_OBJC) --redefine-syms misc/rewrite.txt $@ 103 100 104 101 libsm.a: $(LIBSM_OBJ) … … 113 110 LIB700_CO := $(LIB700_C:.c=.o) 114 111 LIB700_SO := $(LIB700_S:.s=.o) 115 116 LIB700_SRC := $(LIB700_C:%=lib700/%) $(LIB700_S:%=lib700/%)117 112 LIB700_OBJ := $(LIB700_CO:%=build/%) $(LIB700_SO:%=build/%) 118 113 119 114 build/%.o: lib700/%.c $(HEADERS) | build 120 115 $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $< 116 $(CROSS_OBJC) --redefine-syms misc/rewrite.txt $@ 121 117 122 118 build/%.o: lib700/%.s $(HEADERS) | build … … 137 133 VLIB_CO := $(VLIB_C:.c=.o) 138 134 VLIB_SO := $(VLIB_S:.s=.o) 139 140 VLIB_SRC := $(VLIB_C:%=vlib/%) $(VLIB_S:%=vlib/%)141 135 VLIB_OBJ := $(VLIB_CO:%=build/%) $(VLIB_SO:%=build/%) 142 136 143 137 build/%.o: vlib/%.c $(HEADERS) | build 144 138 $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $< 139 $(CROSS_OBJC) --redefine-syms misc/rewrite.txt $@ 145 140 146 141 build/%.o: vlib/%.s $(HEADERS) | build … … 152 147 153 148 ROM_C := booter.c romp.c 154 ROM_S := bios.s lowram.stimeint.s149 ROM_S := bios.s timeint.s 155 150 156 151 ROM_CO := $(ROM_C:.c=.o) 157 152 ROM_SO := $(ROM_S:.s=.o) 158 159 ROM_SRC := $(ROM_C:%=rom/%) $(ROM_S:%=rom/%)160 153 ROM_OBJ := $(ROM_CO:%=build/%) $(ROM_SO:%=build/%) 161 154 155 LOWRAM_S := lowram.s 156 157 LOWRAM_SO := $(LOWRAM_S:.s=.o) 158 LOWRAM_OBJ := $(LOWRAM_SO:%=build/%) 159 162 160 build/%.o: rom/%.c $(HEADERS) | build 163 161 $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $< 162 $(CROSS_OBJC) --redefine-syms misc/rewrite.txt $@ 164 163 165 164 build/%.o: rom/%.s $(HEADERS) | build 166 165 $(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $< 167 166 168 rom.abs: prolog.a iolib.a libcio.a libsm.a lib700.a vlib.a $(ROM_OBJ) 169 $(CROSS_GCC) $(FLAGS_LNK) -o rom.abs $(ROM_OBJ) \ 170 prolog.a libcio.a vlib.a iolib.a libsm.a lib700.a 167 rom.abs: $(ROM_OBJ) \ 168 prolog.a iolib.a libcio.a libsm.a lib700.a vlib.a 169 $(CROSS_GCC) $(FLAGS_LNK) -Wl,--script misc/rom.ld -o rom.abs \ 170 $(ROM_OBJ) \ 171 prolog.a libcio.a vlib.a iolib.a libsm.a lib700.a -lgcc 171 172 172 173 RAM_C := addfpu.c adfield.c adselbx.c asgdsp.c asgvce.c barbadj.c chgsef.c \ … … 194 195 RAM_CO := $(RAM_C:.c=.o) 195 196 RAM_SO := $(RAM_S:.s=.o) 196 197 RAM_SRC := $(RAM_C:%=rom/%) $(RAM_S:%=rom/%)198 197 RAM_OBJ := $(RAM_CO:%=build/%) $(RAM_SO:%=build/%) 199 198 200 199 build/%.o: ram/%.c $(HEADERS) | build 201 200 $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $< 201 $(CROSS_OBJC) --redefine-syms misc/rewrite.txt $@ 202 202 203 203 build/%.o: ram/%.s $(HEADERS) | build 204 204 $(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $< 205 205 206 midas.abs: prolog.a iolib.a libcio.a libsm.a lib700.a vlib.a $(RAM_OBJ) 207 $(CROSS_GCC) $(FLAGS_LNK) -o midas.abs $(RAM_OBJ) \ 208 prolog.a libcio.a vlib.a iolib.a libsm.a lib700.a 206 midas.abs: $(LOWRAM_OBJ) prolog.a $(RAM_OBJ) \ 207 iolib.a libcio.a libsm.a lib700.a vlib.a 208 $(CROSS_GCC) $(FLAGS_LNK) -Wl,--script misc/ram.ld -o midas.abs \ 209 $(LOWRAM_OBJ) prolog.a $(RAM_OBJ) \ 210 libcio.a vlib.a iolib.a libsm.a lib700.a -lgcc 209 211 210 212 build: -
prolog/fsmain.s
rc091ef8 r6dc5ea7 109 109 .data 110 110 111 pmsg1: dc.b " returned from Croot() ",0111 pmsg1: .asciz " returned from Croot() " 112 112 113 113 ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -
ram/etavgr.c
rc091ef8 r6dc5ea7 112 112 113 113 if (tmpval > 0) 114 execins t(vce, (ins2grp[tmpval - 1] & 0x00FF), 1);114 execins(vce, (ins2grp[tmpval - 1] & 0x00FF), 1); 115 115 116 116 modasg(); -
ram/verdate.s
rc091ef8 r6dc5ea7 23 23 .xdef _VerDate 24 24 25 _VerDate: dc.b "19881027.01" | Date and version number 26 dc.b 0 25 _VerDate: .asciz "19881027.01" | Date and version number 27 26 28 27 .end -
rom/bios.s
rc091ef8 r6dc5ea7 437 437 created: dc.l VDATE | Creation date 438 438 439 copyrite: dc.b"{Copyright 1988 by " | Copyright message440 dc.b "D.N. Lynx Crowe}",0439 copyrite: .ascii "{Copyright 1988 by " | Copyright message 440 .asciz "D.N. Lynx Crowe}" 441 441 442 442 dc.l 0 | Some padding -
rom/lowram.s
rc091ef8 r6dc5ea7 156 156 .even 157 157 158 basedat: dc.b"||||| data |||||" | start of data158 basedat: .ascii "||||| data |||||" | start of data 159 159 160 pmsg: dc.b "returned from start_()",0| panic() message160 pmsg: .asciz "returned from start_()" | panic() message 161 161 162 162 | ------------------------------------------------------------------------------ -
rom/timeint.s
-
Property mode
changed from
100644
to120000
rc091ef8 r6dc5ea7 1 | ------------------------------------------------------------------------------ 2 | timeint.s -- timer interrupt handler 3 | Version 9 -- 1988-06-20 -- D.N. Lynx Crowe 4 | ------------------------------------------------------------------------------ 5 6 | This code replaces the interrupt handler in bios.s, which is known to 7 | have a bug in it, and adds support for the VSDD and an array of programable 8 | timers with 1 Ms resolution. 9 10 | WARNING: There are equates to addresses in the bios EPROM which may change 11 | when the bios is reassembled. If the bios is reassembled be sure to update 12 | the equates flagged by "<<<=====". 13 14 | The addresses currently in the equates are for EPROMs dated 1988-04-18 or 15 | 1988-06-20 ONLY. 16 17 | ------------------------------------------------------------------------------ 18 | Hardware timer usage: 19 | --------------------- 20 | Timer 1 PLL divider for score clock -- fixed at 64 21 | Timer 2 PLL divider for score clock -- nominally 3200 22 | Timer 3 1 Ms Real Time Clock 23 24 | ------------------------------------------------------------------------------ 25 26 .text 27 28 .xdef _tsetup | tsetup() -- timer setup function 29 .xdef timeint | timer interrupt handler 30 31 .xdef _timers | timer array -- short timers[NTIMERS] 32 .xdef _vi_clk | VSDD scroll delay timer 33 .xdef _vi_tag | VSDD VI tag 34 .xdef line | Line we entered on 35 36 .xref lclsadr | score object base address 37 .xref lclscrl | score object scroll offset 38 .xref _v_odtab | VSDD object descriptor table 39 .xref _v_regs | VSDD registers 40 41 .page 42 | ============================================================================== 43 44 | Equates to variables in bios.s: 45 | ------------------------------- 46 | These variables are permanently assigned. 47 48 TIMEVEC = 0x00000400 | LONG - System timer trap vector 49 50 FC_SW = 0x00000420 | WORD - Frame clock switch 51 FC_VAL = 0x00000422 | LONG - Frame clock value 52 53 HZ_1K = 0x0000049A | LONG - 1000 Hz clock 54 HZ_200 = 0x0000049E | LONG - 200 Hz clock 55 FRCLOCK = 0x000004A2 | LONG - 50 Hz clock 56 57 T3COUNT = 0x000004AA | WORD - Timer 3 count 58 59 | ------------------------------------------------------------------------------ 60 61 | WARNING: The address of "FLOCK" depends on the version of the bios EPROM. 62 | The address below is for EPROMs dated 1988-04-18 ONLY. 63 64 FLOCK = 0x00000E0C | WORD - Floppy semaphore <<<===== 65 66 | ============================================================================== 67 68 | Equates to routines in bios.s: 69 | ------------------------------ 70 71 | WARNING: The address of "FLOPVBL" depends on the version of the bios EPROM. 72 | The address below is for EPROMs dated 1988-04-18 ONLY. 73 74 FLOPVBL = 0x001015EE | floppy VI handler address <<<===== 75 76 | ============================================================================== 77 78 .page 79 80 | Hardware address equates: 81 | ------------------------- 82 TI_VEC = 0x00000070 | Timer interrupt autovector 83 84 TIMER = 0x003A0001 | Timer base address 85 86 | ------------------------------------------------------------------------------ 87 88 | Timer register equates: 89 | ----------------------- 90 TIME_CRX = TIMER | Control register 1 or 3 91 TIME_CR2 = TIMER+2 | Control register 2 92 TIME_T1H = TIMER+4 | Timer 1 high byte 93 TIME_T1L = TIMER+6 | Timer 1 low byte 94 TIME_T2H = TIMER+8 | Timer 2 high byte 95 TIME_T2L = TIMER+10 | Timer 2 low byte 96 TIME_T3H = TIMER+12 | Timer 3 high byte 97 TIME_T3L = TIMER+14 | Timer 3 low byte 98 99 | VSDD register offsets: 100 | ---------------------- 101 VSDD_R5 = 10 | VSDD bank control register 102 VSDD_R11 = 22 | VSDD access table register 103 104 | ============================================================================== 105 106 | Miscellaneous equates: 107 | ---------------------- 108 IPL7 = 0x0700 | IPL mask for interrupt disable 109 110 FCMAX = 0x00FFFFFF | Maximum frame counter value 111 FCMIN = 0x00000000 | Minimum frame counter value 112 113 NTIMERS = 8 | Number of timers in the timer array 114 115 | ============================================================================== 116 117 .page 118 | ============================================================================== 119 | _tsetup -- tsetup() -- timer setup function 120 | ============================================================================== 121 122 _tsetup: move.w sr,-(a7) | Save old interrupt mask 123 ori.w #IPL7,sr | Disable interrupts 124 125 clr.w FC_SW | Stop the frame clock 126 clr.l FC_VAL | ... and reset it 127 clr.w _vi_tag | Clear VSDD VI tag 128 clr.w _vi_clk | Clear VSDD delay timer 129 clr.w lclsadr | Clear score scroll address 130 clr.w lclscrl | Clear score scroll offset 131 132 lea _timers,a0 | Point at timer array 133 move.w #NTIMERS-1,d0 | Setup to clear timer array 134 135 tclr: clr.w (a0)+ | Clear a timer array entry 136 dbra d0,tclr | Loop until done 137 138 move.l #nullrts,TIMEVEC | Set timer interrupt vector 139 move.l #timeint,TI_VEC | Set timer trap vector 140 141 move.b #0x00,TIME_T1H | Setup timer 1 (PLL) 142 move.b #0x1F,TIME_T1L | ... for divide by 64 143 move.b #0x0C,TIME_T2H | Setup timer 2 (FC) 144 move.b #0x7F,TIME_T2L | ... for divide by 3200 145 move.b #0x03,TIME_T3H | Setup timer 3 (RTC) 146 move.b #0x20,TIME_T3L | ... for 1Ms interval 147 move.b #0x42,TIME_CRX | Setup CR3 148 move.b #0x41,TIME_CR2 | Setup CR2 149 move.b #0x81,TIME_CRX | Setup CR1 150 move.b #0x80,TIME_CRX | Start the timers 151 152 move.w (a7)+,sr | Restore interrupts 153 154 nullrts: rts | Return to caller 155 156 .page 157 | ============================================================================== 158 | timeint -- timer interrupt handler 159 | ============================================================================== 160 161 timeint: movem.l d0-d7/a0-a6,-(a7) | Save registers 162 move.b TIME_CR2,d0 | Get timer interrupt status 163 | ------------------------------------------------------------------------------ 164 | process 1 MS timer 165 | ------------------------------------------------------------------------------ 166 btst.l #2,d0 | Check timer 3 status 167 beq tmi02 | Jump if not active 168 169 move.b TIME_T3H,d1 | Read timer 3 count 170 lsl.w #8,d1 | ... 171 move.b TIME_T3L,d1 | ... 172 move.w d1,T3COUNT | ... and save it 173 174 addq.l #1,HZ_1K | Update 1ms clock (1 KHz) 175 176 move.l d0,-(a7) | Preserve D0 177 | ------------------------------------------------------------------------------ 178 | process VSDD timer 179 | ------------------------------------------------------------------------------ 180 tst.w _vi_tag | Does the VSDD need service ? 181 beq updtime | Jump if not 182 183 move.w _vi_clk,d0 | Get VSDD scroll delay timer 184 subq.w #1,d0 | Decrement timer 185 move.w d0,_vi_clk | Update timer 186 bne updtime | Jump if it's not zero yet 187 188 move.w lclsadr,_v_odtab+12 | Update scroll address 189 move.w lclscrl,_v_odtab+10 | Update scroll offset 190 clr.w _vi_tag | Reset the tag 191 192 .page 193 194 | ------------------------------------------------------------------------------ 195 | process programable timers 196 | ------------------------------------------------------------------------------ 197 198 updtime: move.w #NTIMERS-1,d0 | Setup timer array counter 199 lea _timers,a0 | Point at timer array 200 201 tdcr: move.w (a0),d1 | Get timer array entry 202 beq tdcr1 | Jump if already 0 203 204 subq.w #1,d1 | Decrement timer 205 206 tdcr1: move.w d1,(a0)+ | Store updated timer value 207 dbra d0,tdcr | Loop until done 208 209 | ------------------------------------------------------------------------------ 210 | process timer hook vector 211 | ------------------------------------------------------------------------------ 212 movea.l TIMEVEC,a0 | Get RTC vector 213 move.w #1,-(a7) | Pass 1 msec on stack 214 jsr (a0) | Process RTC vector 215 addq.l #2,a7 | Clean up stack 216 217 move.l (a7)+,d0 | Restore D0 218 219 .page 220 | ------------------------------------------------------------------------------ 221 | process 5 Ms clock 222 | ------------------------------------------------------------------------------ 223 move.w tdiv1,d1 | Update divider 224 addq.w #1,d1 | ... 225 move.w d1,tdiv1 | ... 226 227 cmpi.w #5,d1 | Do we need to update HZ_200 ? 228 blt tmi02 | Jump if not 229 230 addq.l #1,HZ_200 | Update 5ms clock (200 Hz) 231 | ------------------------------------------------------------------------------ 232 | process 20 Ms floppy clock 233 | ------------------------------------------------------------------------------ 234 move.w tdiv2,d1 | Update divider 235 addq.w #1,d1 | ... 236 move.w d1,tdiv2 | ... 237 238 cmpi.w #4,d1 | Do we need to update FRCLOCK ? 239 blt tmi01 | Jump if not 240 241 addq.l #1,FRCLOCK | Update 20 Ms clock (50 Hz) 242 tst.w FLOCK | See if floppy is active 243 bne tmi00 | Don't call FLOPVBL if so 244 245 jsr FLOPVBL | Check on the floppy 246 247 tmi00: move.w #0,tdiv2 | Reset tdiv2 248 249 tmi01: move.w #0,tdiv1 | Reset tdiv1 250 251 .page 252 | ------------------------------------------------------------------------------ 253 | process PLL timers 254 | ------------------------------------------------------------------------------ 255 256 tmi02: btst.l #0,d0 | Check timer 1 int 257 beq tmi03 | Jump if not set 258 259 move.b TIME_T1H,d1 | Read timer 1 to clear int. 260 move.b TIME_T1L,d1 | ... 261 262 tmi03: btst.l #1,d0 | Check for timer 2 int. 263 beq tmi04 | Jump if not set 264 265 move.b TIME_T2H,d1 | Read timer 2 to clear int. 266 move.b TIME_T2L,d1 | ... 267 268 .page 269 | ------------------------------------------------------------------------------ 270 | update score frame counter 271 | ------------------------------------------------------------------------------ 272 tst.w FC_SW | Should we update the frame ? 273 beq tmi04 | Jump if not 274 275 bmi tmi05 | Jump if we count down 276 277 move.l FC_VAL,d0 | Get the frame count 278 cmp.l #FCMAX,d0 | See it we've topped out 279 bge tmi06 | Jump if limit was hit 280 281 addq.l #1,d0 | Count up 1 frame 282 move.l d0,FC_VAL | Store updated frame count 283 bra tmi04 | Done 284 285 tmi07: move.l #FCMIN,FC_VAL | Force hard limit, just in case 286 bra tmi04 | Done 287 288 tmi06: move.l #FCMAX,FC_VAL | Force hard limit, just in case 289 bra tmi04 | Done 290 291 tmi05: move.l FC_VAL,d0 | Get the frame count 292 ble tmi07 | Done if already counted down 293 294 subq.l #1,d0 | Count down 1 frame 295 move.l d0,FC_VAL | Store udpated frame count 296 bra tmi04 | Done 297 298 nop | Filler to force equal paths 299 300 tmi04: movem.l (a7)+,d0-d7/a0-a6 | Restore registers 301 rte | Return to interrupted code 302 303 .page 304 | ============================================================================== 305 .bss 306 | ============================================================================== 307 308 | A note on tdiv1 and tdiv2: 309 | -------------------------- 310 311 | tdiv1 and tdiv2 are actually defined in the bios, but since they could move 312 | we define them here and ignore the ones in the bios. 313 314 tdiv1: ds.w 1 | Timer divider 1 (divides HZ_1K) 315 tdiv2: ds.w 1 | Timer divider 2 (divides HZ_200) 316 317 | ------------------------------------------------------------------------------ 318 319 _timers: ds.w NTIMERS | Timer array -- short timers[16]; 320 321 _vi_clk: ds.w 1 | VSDD scroll delay timer 322 _vi_tag: ds.w 1 | VSDD VI 'needs service' tag 323 324 bank: ds.w 1 | VSDD bank we enterd with 325 line: ds.w 1 | Line we came in on (for analysis) 326 | ============================================================================== 327 328 .end 1 ../ram/timeint.s -
Property mode
changed from
Note:
See TracChangeset
for help on using the changeset viewer.