all: bios.rom io.sys


bios.dasm: bios.rom bios.def
	@echo " -ALDIS-  Disassembling '$<'"
	@aldis bios.def

orig.dasm: rev2_fc000_fe000.img orig.def
	@echo " -ALDIS-  Disassembling '$<'"
	@aldis orig.def

check: bios.rom bios.dasm orig.dasm io.sys
	cmp bios.rom rev2_fc000_fe000.img
	cmp io.sys io_orig.sys



bios.rom: bios.obj
	@echo " -WLINK-  Linking '$@'"
	@wlink name bios.rom system dos \
		option quiet \
		option start=_entry \
		output raw offset=0xfe000 \
		option fillchar=0x00 \
		option nodefaultlibs \
		option nofarcalls \
		option statics \
		option map=bios.map \
		order \
		  clname DATA \
		    segment _DATA  segaddr=0x0000 offset=0x0040 \
		  clname CODE \
		    segment _TEXT   segaddr=0xfe00 offset=0x0000 \
		disable 1014 \
		file { $^ }


io.sys: io.obj
	@echo " -WLINK-  Linking '$@'"
	@wlink name io.sys system dos \
		option quiet \
		option start=_entry \
		output raw offset=0x0600 \
		option fillchar=0x00 \
		option nodefaultlibs \
		option nofarcalls \
		option statics \
		option map=io.map \
		order \
		  clname DATA \
		    segment _DATA  segaddr=0x0000 offset=0x0040 \
		  clname CODE \
		    segment _TEXT     segaddr=0x0060 offset=0x0000 \
		    segment _INIT     segaddr=0x05e0 offset=0x0000 \
		disable 1014 \
		file { $^ }

%.obj: %.asm
	@echo " -WASM-   Assembling '$<'"
	@wasm -zq -bt=dos -ms -1 -wx -we -fo=$@ $<

%.dasm: %.def
	@echo " -ALDIS-  Disassembling '$<'"
	@aldis $<

clean:
	rm -rf *~ *.rom *.obj *.map *.dasm io.sys