From 1572698a423448b0c544129a510f0b669fab2ca2 Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Wed, 12 May 2021 23:56:05 -0400 Subject: [PATCH] Add some code to filter files to those which match "*.md". This code is untested as yet but it compiles so that is something. I suspect I may have maybe messed up the stack but I will test it when I get closer to something that I can install. --- md2teach.xcodeproj/project.pbxproj | 4 ++ md2teach/babelfish.mk | 5 +- md2teach/babelfish/filter.s | 110 +++++++++++++++++++++++++++++ md2teach/babelfish/init.s | 14 ++++ md2teach/babelfish/markdown.rez | 4 +- 5 files changed, 134 insertions(+), 3 deletions(-) create mode 100644 md2teach/babelfish/filter.s create mode 100644 md2teach/babelfish/init.s diff --git a/md2teach.xcodeproj/project.pbxproj b/md2teach.xcodeproj/project.pbxproj index 1e9c3cc..0cb2c21 100644 --- a/md2teach.xcodeproj/project.pbxproj +++ b/md2teach.xcodeproj/project.pbxproj @@ -45,6 +45,8 @@ 9D406AC4264A2AD400747EE9 /* babelfish_defs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = babelfish_defs.h; sourceTree = ""; }; 9D406ACB264A2B5800747EE9 /* babelfish_rez.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = babelfish_rez.h; sourceTree = ""; }; 9D406ACD264A2BD300747EE9 /* markdown.rez */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.rez; path = markdown.rez; sourceTree = ""; }; + 9D406AD8264C50E400747EE9 /* init.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = init.s; sourceTree = ""; }; + 9D406AD9264C50F700747EE9 /* filter.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = filter.s; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.asm.orcam; }; 9D6532E42626240800105D50 /* md2teach */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = md2teach; sourceTree = BUILT_PRODUCTS_DIR; }; 9D6532EA2626240800105D50 /* doNotBuild */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = doNotBuild; sourceTree = BUILT_PRODUCTS_DIR; }; 9D6532EC2626240800105D50 /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; @@ -107,6 +109,8 @@ 9D406AC4264A2AD400747EE9 /* babelfish_defs.h */, 9D406ACB264A2B5800747EE9 /* babelfish_rez.h */, 9D406ACD264A2BD300747EE9 /* markdown.rez */, + 9D406AD8264C50E400747EE9 /* init.s */, + 9D406AD9264C50F700747EE9 /* filter.s */, ); path = babelfish; sourceTree = ""; diff --git a/md2teach/babelfish.mk b/md2teach/babelfish.mk index 76bca3c..42c1969 100644 --- a/md2teach/babelfish.mk +++ b/md2teach/babelfish.mk @@ -175,7 +175,10 @@ gen: # clean your build. genclean: -target: +$(TARGETDIR)/filter.bin: $(OBJDIR)/babelfish/filter.ROOT + cd $(OBJDIR); $(LINK) $(LDFLAGS) babelfish/filter keep="$(abspath $@)" + +target: $(TARGETDIR)/filter.bin true # Do not change anything else below here... diff --git a/md2teach/babelfish/filter.s b/md2teach/babelfish/filter.s new file mode 100644 index 0000000..409b505 --- /dev/null +++ b/md2teach/babelfish/filter.s @@ -0,0 +1,110 @@ +; +; filter.s +; md2teach +; +; Created by Jeremy Rand on 2021-05-12. +; Based on bfish_asoft by Kelvin Sherlock. +; + + mcopy filter.macros + keep filter + + +offset_fileName gequ 10 + +; SFFilter +; +; in stack: +; +; (3) |rtl +; |---- +; (4) |DirEntryRecPtr +; |---- +; (2) |returnval +; |---- +; |......... + +; out stack: +; +; |returnval +; |---- +; |......... + + +; +; Returns 0 if it's not an markdown file, or 4 if it is. +; + +filter start + +_d equ 1 +ptr equ 5 +_rtlb equ 7 +DirPtr equ 11 +retval equ 15 + + phb ;even up the stack + phd + pha + pha + tsc + tcd + + stz