From b2cf4f8e8d56af9d6895ca5082735e06cc53b299 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Tue, 28 May 2024 20:51:22 +0300 Subject: [PATCH 1/3] Added "#.com", which allows us to have comments As everything in the CP/M CCP is a command we can implement comments by adding a binary named "#". That means this "does nothing": # foo bar What actually happens, of course, is that "#.com" is loaded with "foo bar" passed as arguments to it. But since the binary immediately terminates we get a comment in practice. --- static/A/#.COM | 1 + static/Makefile | 5 ++++- static/comment.z80 | 26 ++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 static/A/#.COM create mode 100644 static/comment.z80 diff --git a/static/A/#.COM b/static/A/#.COM new file mode 100644 index 0000000..6cc8370 --- /dev/null +++ b/static/A/#.COM @@ -0,0 +1 @@ +Ç \ No newline at end of file diff --git a/static/Makefile b/static/Makefile index d0e2870..5f58687 100644 --- a/static/Makefile +++ b/static/Makefile @@ -2,11 +2,14 @@ # # The files we wish to generate. # -all: A/CCP.COM A/CONSOLE.COM A/CTRLC.COM A/QUIET.COM +all: A/\#.COM A/CCP.COM A/CONSOLE.COM A/CTRLC.COM A/QUIET.COM # # How to build them all - repetitive. # +A/\#.COM: + pasmo comment.z80 A/#.COM + A/CCP.COM: pasmo ccp.z80 A/CCP.COM diff --git a/static/comment.z80 b/static/comment.z80 new file mode 100644 index 0000000..1522fb6 --- /dev/null +++ b/static/comment.z80 @@ -0,0 +1,26 @@ +;; comment.z80 - A "do nothing" binary. +;; +;; This binary is useful because it allows SUBMIT-files +;; to contain comments. As everything is a binary in +;; CP/M we can implement comments by just creating a command +;; named "#" then the following will do nothing: +;; +;; # FOO BAR +;; +;; In reality the #.COM binary is loaded and "FOO BAR" are passed +;; to it as arguments. But the end result is "nothing" as this +;; binary immediately terminates. +;; + + + ;; + ;; CP/M programs start at 0x100. + ;; + ORG 100H + + ;; + ;; JP 0x0000, but shorter + ;; + rst 0 + +END \ No newline at end of file From 966aaf81e1c80bf18e60565e1d526d19e69f7f63 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Tue, 28 May 2024 20:54:06 +0300 Subject: [PATCH 2/3] Document comment.z80 --- static/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/static/README.md b/static/README.md index 744f790..e753e97 100644 --- a/static/README.md +++ b/static/README.md @@ -21,6 +21,9 @@ The embedded resources do not have 100% full functionality, you cannot bundle a * [ccp.z80](ccp.z80) * Change the CCP in-use at runtime. +* [comment.z80](comment.z80) + * Source to a program that does nothing, output to "`#.COM`". + * This is used to allow "`# FOO`" to act as a comment inside submit-files. * [console.z80](console.z80) * Toggle between ADM-3A and ANSI console output. * [ctrlc.z80](ctrlc.z80) From f123011d4e7b0f7063b9943237dd4738a7748a44 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Tue, 28 May 2024 21:00:22 +0300 Subject: [PATCH 3/3] Fixed linter warning --- fcb/fcb.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fcb/fcb.go b/fcb/fcb.go index 0ea5eaa..858b6c4 100644 --- a/fcb/fcb.go +++ b/fcb/fcb.go @@ -311,7 +311,7 @@ func (f *FCB) DoesMatch(name string) bool { // Repeat for the suffix. for i, c := range f.Type { - if (tmp.Type[i] != c) && (f.Type[i] != '?') { + if (t[i] != c) && (t[i] != '?') { return false } }