You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

425 lines
13KB

  1. VARIANT ?= bsw
  2. DRIVE ?= drv1541
  3. INPUT ?= joydrv
  4. AS = ca65
  5. LD = ld65
  6. C1541 = c1541
  7. PUCRUNCH = pucrunch
  8. EXOMIZER = exomizer
  9. D64_RESULT = geos.d64
  10. DESKTOP_CVT = desktop.cvt
  11. ifeq ($(VARIANT),bsw128)
  12. D64_TEMPLATE = GEOS128.D64
  13. else
  14. D64_TEMPLATE = GEOS64.D64
  15. endif
  16. ASFLAGS = -I inc -I .
  17. # code that is in front bank of all variants
  18. KERNAL_SOURCES= \
  19. kernal/bitmask/bitmask2.s \
  20. kernal/conio/conio1.s \
  21. kernal/conio/conio2.s \
  22. kernal/conio/conio3a.s \
  23. kernal/conio/conio4.s \
  24. kernal/conio/conio6.s \
  25. kernal/dlgbox/dlgbox1a.s \
  26. kernal/dlgbox/dlgbox1b.s \
  27. kernal/dlgbox/dlgbox1c.s \
  28. kernal/dlgbox/dlgbox1d.s \
  29. kernal/dlgbox/dlgbox1e1.s \
  30. kernal/dlgbox/dlgbox1e2.s \
  31. kernal/dlgbox/dlgbox1f.s \
  32. kernal/dlgbox/dlgbox1g.s \
  33. kernal/dlgbox/dlgbox1h.s \
  34. kernal/dlgbox/dlgbox1i.s \
  35. kernal/dlgbox/dlgbox1j.s \
  36. kernal/dlgbox/dlgbox1k.s \
  37. kernal/dlgbox/dlgbox2.s \
  38. kernal/files/files10.s \
  39. kernal/files/files1a2a.s \
  40. kernal/files/files1a2b.s \
  41. kernal/files/files1b.s \
  42. kernal/files/files2.s \
  43. kernal/files/files3.s \
  44. kernal/files/files6a.s \
  45. kernal/files/files6b.s \
  46. kernal/files/files6c.s \
  47. kernal/files/files7.s \
  48. kernal/files/files8.s \
  49. kernal/graph/clrscr.s \
  50. kernal/graph/inlinefunc.s \
  51. kernal/graph/graphicsstring.s \
  52. kernal/graph/graph2l1.s \
  53. kernal/graph/pattern.s \
  54. kernal/graph/inline.s \
  55. kernal/header/header.s \
  56. kernal/hw/hw1a.s \
  57. kernal/hw/hw1b.s \
  58. kernal/hw/hw2.s \
  59. kernal/hw/hw3.s \
  60. kernal/icon/icon1.s \
  61. kernal/icon/icon2.s \
  62. kernal/init/init1.s \
  63. kernal/init/init2.s \
  64. kernal/init/init3.s \
  65. kernal/init/init4.s \
  66. kernal/irq/irq.s \
  67. kernal/jumptab/jumptab.s \
  68. kernal/keyboard/keyboard1.s \
  69. kernal/keyboard/keyboard2.s \
  70. kernal/keyboard/keyboard3.s \
  71. kernal/load/deskacc.s \
  72. kernal/load/load1a.s \
  73. kernal/load/load1b.s \
  74. kernal/load/load1c.s \
  75. kernal/load/load2.s \
  76. kernal/load/load3.s \
  77. kernal/load/load4b.s \
  78. kernal/mainloop/mainloop1.s \
  79. kernal/mainloop/mainloop3.s \
  80. kernal/math/shl.s \
  81. kernal/math/shr.s \
  82. kernal/math/muldiv.s \
  83. kernal/math/neg.s \
  84. kernal/math/dec.s \
  85. kernal/math/random.s \
  86. kernal/math/crc.s \
  87. kernal/memory/memory1a.s \
  88. kernal/memory/memory1b.s \
  89. kernal/memory/memory2.s \
  90. kernal/memory/memory3.s \
  91. kernal/menu/menu1.s \
  92. kernal/menu/menu2.s \
  93. kernal/menu/menu3.s \
  94. kernal/misc/misc.s \
  95. kernal/mouse/mouse1.s \
  96. kernal/mouse/mouse2.s \
  97. kernal/mouse/mouse3.s \
  98. kernal/mouse/mouse4.s \
  99. kernal/mouse/mouseptr.s \
  100. kernal/panic/panic.s \
  101. kernal/patterns/patterns.s \
  102. kernal/process/process1.s \
  103. kernal/process/process2.s \
  104. kernal/process/process3a.s \
  105. kernal/process/process3aa.s \
  106. kernal/process/process3b.s \
  107. kernal/process/process3c.s \
  108. kernal/reu/reu.s \
  109. kernal/serial/serial1.s \
  110. kernal/serial/serial2.s \
  111. kernal/sprites/sprites.s \
  112. kernal/time/time1.s \
  113. kernal/time/time2.s \
  114. kernal/tobasic/tobasic2.s \
  115. kernal/vars/vars.s
  116. # code that is in front bank of C64 only
  117. ifneq ($(VARIANT), bsw128)
  118. KERNAL_SOURCES += \
  119. kernal/start/start64.s \
  120. kernal/bitmask/bitmask1.s \
  121. kernal/bitmask/bitmask3.s \
  122. kernal/bswfont/bswfont.s \
  123. kernal/conio/conio3b.s \
  124. kernal/conio/conio5.s \
  125. kernal/files/files9.s \
  126. kernal/fonts/fonts1.s \
  127. kernal/fonts/fonts2.s \
  128. kernal/fonts/fonts3.s \
  129. kernal/fonts/fonts4.s \
  130. kernal/fonts/fonts4a.s \
  131. kernal/fonts/fonts4b.s \
  132. kernal/graph/bitmapclip.s \
  133. kernal/graph/bitmapup.s \
  134. kernal/graph/line.s \
  135. kernal/graph/point.s \
  136. kernal/graph/rect.s \
  137. kernal/graph/scanline.s \
  138. kernal/mainloop/mainloop2.s \
  139. kernal/ramexp/ramexp1.s \
  140. kernal/ramexp/ramexp2.s \
  141. kernal/rename.s \
  142. kernal/tobasic/tobasic1.s
  143. endif
  144. # code that is in front bank of C128 only
  145. ifeq ($(VARIANT), bsw128)
  146. KERNAL_SOURCES += \
  147. kernal/start/start128.s \
  148. kernal/128k/bank_jmptab_front.s \
  149. kernal/128k/banking.s \
  150. kernal/128k/cbm_jmptab.s \
  151. kernal/c128/iojmptab.s \
  152. kernal/c128/iowrapper.s \
  153. kernal/c128/irq_front.s \
  154. kernal/c128/junk_front.s \
  155. kernal/c128/low_jmptab.s \
  156. kernal/c128/mouseproxy.s \
  157. kernal/c128/vdc_base.s \
  158. kernal/c128/vdc_init.s \
  159. kernal/c128/vectors_front.s \
  160. kernal/files/compat.s \
  161. kernal/graph/normalize.s \
  162. kernal/graph/mode.s \
  163. kernal/memory/memory_128.s
  164. endif
  165. # code that is in C128 back bank
  166. KERNAL2_SOURCES= \
  167. kernal/128k/bank_jmptab_back.s \
  168. kernal/128k/cache.s \
  169. kernal/128k/swapdiskdriver.s \
  170. kernal/640/bswfont80.s \
  171. kernal/bitmask/bitmask1.s \
  172. kernal/bitmask/bitmask2.s \
  173. kernal/bitmask/bitmask3.s \
  174. kernal/bswfont/bswfont.s \
  175. kernal/c128/irq_back.s \
  176. kernal/c128/junk_back.s \
  177. kernal/c128/softsprites.s \
  178. kernal/c128/vdc.s \
  179. kernal/c128/vdc_base.s \
  180. kernal/c128/vectors_back.s \
  181. kernal/conio/conio3b.s \
  182. kernal/conio/conio5.s \
  183. kernal/files/files1a2a.s \
  184. kernal/files/files9.s \
  185. kernal/fonts/fonts1.s \
  186. kernal/fonts/fonts2.s \
  187. kernal/fonts/fonts3.s \
  188. kernal/fonts/fonts4.s \
  189. kernal/fonts/fonts4a.s \
  190. kernal/fonts/fonts4b.s \
  191. kernal/graph/line.s \
  192. kernal/graph/rect.s \
  193. kernal/graph/scanline.s \
  194. kernal/graph/graph2p.s \
  195. kernal/graph/bitmapclip.s \
  196. kernal/graph/bitmapup.s \
  197. kernal/graph/point.s \
  198. kernal/graph/normalize.s \
  199. kernal/math/shl.s \
  200. kernal/math/neg.s \
  201. kernal/memory/backram.s \
  202. kernal/tobasic/tobasic2_128.s
  203. # code that is in Wheels front bank only
  204. ifeq ($(VARIANT), wheels)
  205. KERNAL_SOURCES += \
  206. kernal/wheels/wheels.s \
  207. kernal/wheels/ram.s \
  208. kernal/wheels/devnum.s \
  209. kernal/wheels/format.s \
  210. kernal/wheels/partition.s \
  211. kernal/wheels/directory.s \
  212. kernal/wheels/validate.s \
  213. kernal/wheels/copydisk.s \
  214. kernal/wheels/copyfile.s \
  215. kernal/wheels/loadb.s \
  216. kernal/wheels/tobasicb.s \
  217. kernal/wheels/reux.s
  218. endif
  219. ifeq ($(VARIANT), bsw128)
  220. RELOCATOR_SOURCES = \
  221. kernal/start/relocator128.s
  222. endif
  223. DRIVER_SOURCES= \
  224. drv/drv1541.bin \
  225. drv/drv1571.bin \
  226. drv/drv1581.bin \
  227. input/joydrv.bin \
  228. input/amigamse.bin \
  229. input/lightpen.bin \
  230. input/mse1351.bin \
  231. input/koalapad.bin \
  232. input/pcanalog.bin
  233. DEPS= \
  234. config.inc \
  235. inc/c64.inc \
  236. inc/const.inc \
  237. inc/diskdrv.inc \
  238. inc/geosmac.inc \
  239. inc/geossym.inc \
  240. inc/inputdrv.inc \
  241. inc/jumptab.inc \
  242. inc/kernal.inc \
  243. inc/printdrv.inc
  244. KERNAL_OBJS=$(KERNAL_SOURCES:.s=.o)
  245. KERNAL2_OBJS=$(KERNAL2_SOURCES:.s=.o)
  246. RELOCATOR_OBJS=$(RELOCATOR_SOURCES:.s=.o)
  247. DRIVER_OBJS=$(DRIVER_SOURCES:.s=.o)
  248. ALL_OBJS=$(KERNAL_OBJS) $(DRIVER_OBJS)
  249. BUILD_DIR=build/$(VARIANT)
  250. PREFIXED_KERNAL_OBJS = $(addprefix $(BUILD_DIR)/, $(KERNAL_OBJS))
  251. PREFIXED_KERNAL2_OBJS = $(addprefix $(BUILD_DIR)/, $(KERNAL2_OBJS))
  252. PREFIXED_RELOCATOR_OBJS = $(addprefix $(BUILD_DIR)/, $(RELOCATOR_OBJS))
  253. ALL_BINS= \
  254. $(BUILD_DIR)/kernal/kernal.bin \
  255. $(BUILD_DIR)/drv/drv1541.bin \
  256. $(BUILD_DIR)/drv/drv1571.bin \
  257. $(BUILD_DIR)/drv/drv1581.bin \
  258. $(BUILD_DIR)/input/joydrv.bin \
  259. $(BUILD_DIR)/input/amigamse.bin \
  260. $(BUILD_DIR)/input/lightpen.bin \
  261. $(BUILD_DIR)/input/mse1351.bin \
  262. $(BUILD_DIR)/input/koalapad.bin \
  263. $(BUILD_DIR)/input/pcanalog.bin
  264. ifeq ($(VARIANT), bsw128)
  265. ALL_BINS += \
  266. $(BUILD_DIR)/kernal/kernal2.bin \
  267. $(BUILD_DIR)/kernal/relocator.bin
  268. endif
  269. all: $(BUILD_DIR)/$(D64_RESULT)
  270. regress:
  271. @echo "********** Building variant 'bsw'"
  272. @$(MAKE) VARIANT=bsw all
  273. ./regress.sh bsw
  274. @echo "********** Building variant 'wheels'"
  275. @$(MAKE) VARIANT=wheels all
  276. ./regress.sh wheels
  277. clean:
  278. rm -rf build
  279. ifeq ($(VARIANT),bsw128)
  280. $(BUILD_DIR)/$(D64_RESULT): $(BUILD_DIR)/kernal_compressed.prg
  281. @if [ -e $(D64_TEMPLATE) ]; then \
  282. cp $(D64_TEMPLATE) $@; \
  283. echo delete geos128 geoboot128 | $(C1541) $@ ;\
  284. echo write $< geos128 | $(C1541) $@ ;\
  285. echo \*\*\* Created $@ based on $(D64_TEMPLATE).; \
  286. else \
  287. echo format geos,00 d64 $@ | $(C1541) >/dev/null; \
  288. echo write $< geos128 | $(C1541) $@ >/dev/null; \
  289. if [ -e $(DESKTOP_CVT) ]; then echo geoswrite $(DESKTOP_CVT) | $(C1541) $@; fi >/dev/null; \
  290. echo \*\*\* Created fresh $@.; \
  291. fi;
  292. else
  293. $(BUILD_DIR)/$(D64_RESULT): $(BUILD_DIR)/kernal_compressed.prg
  294. @if [ -e $(D64_TEMPLATE) ]; then \
  295. cp $(D64_TEMPLATE) $@; \
  296. echo delete geos geoboot | $(C1541) $@ ;\
  297. echo write $< geos | $(C1541) $@ ;\
  298. echo \*\*\* Created $@ based on $(D64_TEMPLATE).; \
  299. else \
  300. echo format geos,00 d64 $@ | $(C1541) >/dev/null; \
  301. echo write $< geos | $(C1541) $@ >/dev/null; \
  302. if [ -e $(DESKTOP_CVT) ]; then echo geoswrite $(DESKTOP_CVT) | $(C1541) $@; fi >/dev/null; \
  303. echo \*\*\* Created fresh $@.; \
  304. fi;
  305. endif
  306. $(BUILD_DIR)/kernal_compressed.prg: $(BUILD_DIR)/kernal_combined.prg
  307. @echo Creating $@
  308. ifeq ($(VARIANT), bsw128)
  309. # start address ($4800) is underneath BASIC ROM on the 128; turn off BASIC
  310. # and KERNAL before jumping to unpacked code
  311. $(EXOMIZER) sfx 0x4800 -t128 -Di_ram_exit='$$3e' -o $@ $<
  312. else
  313. $(PUCRUNCH) -f -c64 -x0x5000 $< $@ 2> /dev/null
  314. endif
  315. $(BUILD_DIR)/kernal_combined.prg: $(ALL_BINS)
  316. ifeq ($(VARIANT), bsw128)
  317. @echo Creating $@ from kernal.bin $(DRIVE).bin kernal2.bin relocator.bin $(INPUT).bin
  318. printf "\x00\x48" > $(BUILD_DIR)/tmp.bin
  319. # relocator.bin($4800) @ $4800-$4C00 -> $4800
  320. cat $(BUILD_DIR)/kernal/relocator.bin /dev/zero | dd bs=1 count=1024 >> $(BUILD_DIR)/tmp.bin 2> /dev/null
  321. # kernal.bin($5000) @ $5000-$5400 -> $4C00
  322. cat $(BUILD_DIR)/kernal/kernal.bin /dev/zero | dd bs=1 count=1024 >> $(BUILD_DIR)/tmp.bin 2> /dev/null
  323. # kernal.bin($5000) @ $C000-$FD00 -> $5000
  324. cat $(BUILD_DIR)/kernal/kernal.bin /dev/zero | dd bs=1 count=15616 skip=28672 >> $(BUILD_DIR)/tmp.bin 2> /dev/null
  325. # input*.bin($FD00) @ $FD00-$FE80 -> $8D00
  326. cat $(BUILD_DIR)/input/$(INPUT).bin /dev/zero | dd bs=1 count=384 >> $(BUILD_DIR)/tmp.bin 2> /dev/null
  327. # kernal.bin($5000) @ $FE80-$0000 -> $8E80
  328. cat $(BUILD_DIR)/kernal/kernal.bin /dev/zero | dd bs=1 count=384 skip=44672 >> $(BUILD_DIR)/tmp.bin 2> /dev/null
  329. # drv*.bin($9000) @ $9000-$9D80 -> $9000
  330. cat $(BUILD_DIR)/drv/$(DRIVE).bin /dev/zero | dd bs=1 count=3456 >> $(BUILD_DIR)/tmp.bin 2> /dev/null
  331. # kernal.bin($5000) @ $9D80-$A000 -> $9D80
  332. cat $(BUILD_DIR)/kernal/kernal.bin /dev/zero | dd bs=1 count=640 skip=19840 >> $(BUILD_DIR)/tmp.bin 2> /dev/null
  333. # kernal2.bin($C000) @ $E000-$0000 -> $A000
  334. cat $(BUILD_DIR)/kernal/kernal2.bin /dev/zero | dd bs=1 count=8192 skip=8192 >> $(BUILD_DIR)/tmp.bin 2> /dev/null
  335. # kernal2.bin($C000) @ $C000-$E000 -> $C000
  336. cat $(BUILD_DIR)/kernal/kernal2.bin /dev/zero | dd bs=1 count=8192 >> $(BUILD_DIR)/tmp.bin 2> /dev/null
  337. @mv $(BUILD_DIR)/tmp.bin $(BUILD_DIR)/kernal_combined.prg
  338. else
  339. @echo Creating $@ from kernal.bin $(DRIVE).bin $(INPUT).bin
  340. printf "\x00\x50" > $(BUILD_DIR)/tmp.bin
  341. dd if=$(BUILD_DIR)/kernal/kernal.bin bs=1 count=16384 >> $(BUILD_DIR)/tmp.bin 2> /dev/null
  342. cat $(BUILD_DIR)/drv/$(DRIVE).bin /dev/zero | dd bs=1 count=3456 >> $(BUILD_DIR)/tmp.bin 2> /dev/null
  343. cat $(BUILD_DIR)/kernal/kernal.bin /dev/zero | dd bs=1 count=24832 skip=19840 >> $(BUILD_DIR)/tmp.bin 2> /dev/null
  344. @cat $(BUILD_DIR)/input/$(INPUT).bin >> $(BUILD_DIR)/tmp.bin 2> /dev/null
  345. @mv $(BUILD_DIR)/tmp.bin $(BUILD_DIR)/kernal_combined.prg
  346. endif
  347. ifeq ($(VARIANT),bsw128)
  348. INPUTCFG = input/inputdrv_bsw128.cfg
  349. else
  350. INPUTCFG = input/inputdrv.cfg
  351. endif
  352. $(BUILD_DIR)/drv/drv1541.bin: $(BUILD_DIR)/drv/drv1541.o drv/drv1541.cfg $(DEPS)
  353. $(LD) -C drv/drv1541.cfg $(BUILD_DIR)/drv/drv1541.o -o $@
  354. $(BUILD_DIR)/drv/drv1571.bin: $(BUILD_DIR)/drv/drv1571.o drv/drv1571.cfg $(DEPS)
  355. $(LD) -C drv/drv1571.cfg $(BUILD_DIR)/drv/drv1571.o -o $@
  356. $(BUILD_DIR)/drv/drv1581.bin: $(BUILD_DIR)/drv/drv1581.o drv/drv1581.cfg $(DEPS)
  357. $(LD) -C drv/drv1581.cfg $(BUILD_DIR)/drv/drv1581.o -o $@
  358. $(BUILD_DIR)/input/amigamse.bin: $(BUILD_DIR)/input/amigamse.o $(INPUTCFG) $(DEPS)
  359. $(LD) -C $(INPUTCFG) $(BUILD_DIR)/input/amigamse.o -o $@
  360. $(BUILD_DIR)/input/joydrv.bin: $(BUILD_DIR)/input/joydrv.o $(INPUTCFG) $(DEPS)
  361. $(LD) -C $(INPUTCFG) $(BUILD_DIR)/input/joydrv.o -o $@
  362. $(BUILD_DIR)/input/lightpen.bin: $(BUILD_DIR)/input/lightpen.o $(INPUTCFG) $(DEPS)
  363. $(LD) -C $(INPUTCFG) $(BUILD_DIR)/input/lightpen.o -o $@
  364. $(BUILD_DIR)/input/mse1351.bin: $(BUILD_DIR)/input/mse1351.o $(INPUTCFG) $(DEPS)
  365. $(LD) -C $(INPUTCFG) $(BUILD_DIR)/input/mse1351.o -o $@
  366. $(BUILD_DIR)/input/koalapad.bin: $(BUILD_DIR)/input/koalapad.o $(INPUTCFG) $(DEPS)
  367. $(LD) -C $(INPUTCFG) $(BUILD_DIR)/input/koalapad.o -o $@
  368. $(BUILD_DIR)/input/pcanalog.bin: $(BUILD_DIR)/input/pcanalog.o $(INPUTCFG) $(DEPS)
  369. $(LD) -C $(INPUTCFG) $(BUILD_DIR)/input/pcanalog.o -o $@
  370. $(BUILD_DIR)/%.o: %.s
  371. @mkdir -p `dirname $@`
  372. $(AS) -D $(VARIANT)=1 -D $(DRIVE)=1 -D $(INPUT)=1 $(ASFLAGS) $< -o $@
  373. $(BUILD_DIR)/kernal/kernal.bin: $(PREFIXED_KERNAL_OBJS) kernal/kernal_$(VARIANT).cfg
  374. @mkdir -p $$(dirname $@)
  375. $(LD) -C kernal/kernal_$(VARIANT).cfg $(PREFIXED_KERNAL_OBJS) -o $@ -m $(BUILD_DIR)/kernal/kernal.map -Ln $(BUILD_DIR)/kernal/kernal.lab
  376. $(BUILD_DIR)/kernal/kernal2.bin: $(PREFIXED_KERNAL2_OBJS) kernal/kernal2_$(VARIANT).cfg
  377. @mkdir -p $$(dirname $@)
  378. $(LD) -C kernal/kernal2_$(VARIANT).cfg $(PREFIXED_KERNAL2_OBJS) -o $@ -m $(BUILD_DIR)/kernal/kernal2.map -Ln $(BUILD_DIR)/kernal/kernal2.lab
  379. $(BUILD_DIR)/kernal/relocator.bin: $(PREFIXED_RELOCATOR_OBJS) kernal/relocator_$(VARIANT).cfg
  380. @mkdir -p $$(dirname $@)
  381. $(LD) -C kernal/relocator_$(VARIANT).cfg $(PREFIXED_RELOCATOR_OBJS) -o $@ -m $(BUILD_DIR)/kernal/relocator.map -Ln $(BUILD_DIR)/kernal/relocator.lab
  382. # a must!
  383. love:
  384. @echo "Not war, eh?"