kevinboone / cpm-cal Goto Github PK
View Code? Open in Web Editor NEWAn implementation for CP/M, in Z80 assembly language, of the Unix "cal" utility
An implementation for CP/M, in Z80 assembly language, of the Unix "cal" utility
I like your style (and I may borrow some of your ideas) but I was wondering if you knew that you can automatically link in relocatable object files using .REQUEST ?
e.g
.REQUEST CONIO
Using this feature of the Microsoft Macro assembler might allow you to simplify the link command making it a little easier to rebuild the binary on CPM itself...
It is probably simpler to simpler to specify the code entry point in main rather than 'mess about' with ASEG and /P directives (there are I suspect perfectly good reasons for using these directives it you want code to burn into a ROM but I've always let the linker just do its' thing).
;------------------------------------------------------------------------
;
; CAL utility
;
; main.asm
;
; Copyright (c)2021 Kevin Boone, GPL v3.0
;
;------------------------------------------------------------------------
.Z80
; ASEG
; ORG 0100H
include CONIO.INC
include CLARGS.INC
include INTMATH.INC
include DATE.INC
include STRING.INC
include ROMWBW.INC
.request conio
.request clargs
.request intmath
.request date
.request string
.request romwbw
.request mem
; JP main
rtcse: ; sec
db 0
end main
$(TARGET): conio.rel main.rel intmath.rel string.rel mem.rel clargs.rel date.rel romwbw.rel
$(CPM) $(LINK80) main,$(NAME)/n/e
The result should be an executable that starts with a jump to the entry point...
0100 C37C01C3 7C01E521 1A03CDE3 0321D502 .|..|..!.....!..
0110 CDE303E1 C9E52145 03CDE303 E1C9D5CD ......!E........
0120 0308B7CA 73027BB7 CA7302FE 0DD27302 ....s.{..s....s.
I'm not sure if the month should be indented but it seems to work..
cpm cal 8 2023 /s
August 2023
Su Mo Tu We Th Fr Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
I can execute the (renamed) prebuilt binary no problem
$ cpm calendar.com
No RTC: give month and year
Usage: cal [/hsv] {month} {4-digit year}
$cpm cal 2 1963
February 1963
Mo Tu We Th Fr Sa Su
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28
$
And, after tweaking the make file slightly I can rebuild the binary from source without any errors
$ make all
cpm ../macro =conio.asm
No Fatal error(s)
cpm ../macro =main.asm
No Fatal error(s)
cpm ../macro =intmath.asm
No Fatal error(s)
cpm ../macro =string.asm
No Fatal error(s)
cpm ../macro =mem.asm
No Fatal error(s)
cpm ../macro =clargs.asm
No Fatal error(s)
cpm ../macro =date.asm
No Fatal error(s)
cpm ../macro =romwbw.asm
No Fatal error(s)
cpm ../link main,conio,intmath,string,mem,clargs,date,romwbw,cal/n/e
Data 0103 0997 < 2196>
51647 Bytes Free
[0000 0997 9]
$
However attempting to execute it doesn't have the expected result...
$ cpm cal
cpm: HALT instruction executed
$
simh (build 0fa5807e) also gives up, but is a little more informative!
A>cal 2 1963
HALT instruction, PC: 00132 (HALT)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.