kevinboone / cpm-cal

An implementation for CP/M, in Z80 assembly language, of the Unix "cal" utility
10 stars 1 forks source link

Error after rebuilding binary from source #1

Closed mike632t closed 1 year ago

mike632t commented 1 year ago

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)
kevinboone commented 1 year ago

I'd be interested to see the .com file your build produces, and compare it with mine. It's entirely plausible that I'm using L80 wrongly, and it's only worked for me by luck.

mike632t commented 1 year ago

I'd be interested to see the .com file your build produces, and compare it with mine. It's entirely plausible that I'm using L80 wrongly, and it's only worked for me by luck.

I doubt it!!

The original binary from the repository on GitHub.

$ hexdump -v calendar.com 
0000000 0000 0000 0000 0000 0000 0000 0000 0000
0000010 0000 0000 0000 0000 0000 0000 0000 0000
0000020 0000 0000 0000 0000 0000 0000 0000 0000
0000030 0000 0000 0000 0000 0000 0000 0000 0000
0000040 0000 0000 0000 0000 0000 0000 0000 0000
0000050 0000 0000 0000 0000 0000 0000 0000 0000
0000060 0000 0000 0000 0000 0000 0000 0000 0000
0000070 0000 0000 0000 0000 0000 0000 0000 0000
0000080 0000 0000 0000 0000 0000 0000 0000 0000
0000090 0000 0000 0000 0000 0000 0000 0000 0000
00000a0 0000 0000 0000 0000 0000 0000 0000 0000
00000b0 0000 0000 0000 0000 0000 0000 0000 0000
00000c0 0000 0000 0000 0000 0000 0000 0000 0000
00000d0 0000 0000 0000 0000 0000 0000 0000 0000
00000e0 0000 0000 0000 0000 0000 0000 0000 0000
00000f0 0000 0000 0000 0000 0000 0000 0000 0000
0000100 0000 c300 027c 21e5 041a e3cd 2104 03d5
0000110 e3cd e104 e5c9 4521 cd04 04e3 c9e1 cdd5
0000120 05e9 cab7 0373 b77b 73ca fe03 d20d 0373
0000130 b832 d104 d5c9 e9cd b705 97ca 6203 226b
0000140 04b9 c9d1 cde5 0860 e3cd e104 d5c9 f5e5
0000150 5d54 1121 cd04 05c4 e3cd cd04 04c7 e1f1
0000160 c9d1 f5e5 bb3a fe04 2801 2105 03a7 0318
0000170 bc21 cd03 04e3 c7cd f104 c9e1 3bcd 0606
0000180 cd00 067f 3a28 28b7 fe24 2048 cd06 0206
0000190 65c3 fe03 2053 3e07 3201 04bb e318 56fe
00001a0 0820 15cd c302 0365 d718 83c3 7803 00fe
00001b0 0320 1ecd 7802 01fe 0320 35cd 0402 c118
00001c0 fe78 2802 212a 04bc 58cd fe09 2000 3a15
00001d0 04bc 266f 1100 07d0 2219 04b9 bd3a 3204
00001e0 04b8 0b18 9c21 cd04 04e3 c7cd 1804 3a79
00001f0 04b8 44cd cd02 04fa b92a cd04 024d 5d54
0000200 266f cd01 0783 3a67 04bb 01fe 287c fe09
0000210 2800 3d03 0218 063e 62f5 6b55 17cd 4708
0000220 cdf1 0262 000e 0116 28b7 210c 03d1 e3cd
0000230 0c04 283d 1802 21f1 0411 fe7a 300a cd03
0000240 04fa 5ad5 0016 c4cd d105 e3cd cd04 04fa
0000250 790c 07fe 0520 000e c7cd 7a04 28b8 1403
0000260 d518 c7cd cd04 04c2 1a21 cd04 04e3 c7cd
0000270 1804 e5f2 7921 cd04 04e3 cde1 04e3 c7cd
0000280 1804 21e2 0490 e3cd cd04 04c7 1a21 cd04
0000290 04e3 c7cd 1804 e5ce 8521 cd04 04e3 cde1
00002a0 04e3 c7cd 1804 4dbe 206f 7554 5720 2065
00002b0 6854 4620 2072 6153 5320 0075 7553 4d20
00002c0 206f 7554 5720 2065 6854 4620 2072 6153
00002d0 2000 2020 2f00 2068 6873 776f 6820 6c65
00002e0 2070 6574 7478 0a0d 732f 7720 6565 206b
00002f0 7473 7261 7374 7320 6e75 6164 0d79 2f0a
0000300 2076 6873 776f 7620 7265 6973 6e6f 0a0d
0000310 3100 3332 3534 3736 0038 7355 6761 3a65
0000320 6320 6c61 5b20 682f 7673 205d 6d7b 6e6f
0000330 6874 207d 347b 642d 6769 7469 7920 6165
0000340 7d72 0a0d 6300 6c61 3020 312e 2c63 6320
0000350 706f 7279 6769 7468 2820 2963 3032 3332
0000360 4b20 7665 6e69 4220 6f6f 656e 202c 5047
0000370 204c 3376 302e 0a0d 4200 6461 6d20 6e6f
0000380 6874 203a 4200 6461 7920 6165 3a72 0020
0000390 6142 2064 706f 6974 6e6f 002e 6f4e 5220
00003a0 4354 203a 6967 6576 6d20 6e6f 6874 6120
00003b0 646e 7920 6165 0072 0000 0000 0000 0000
00003c0 0000 000e 05cd f500 0d3e d4cd 3e04 cd0a
00003d0 04d4 c9f1 c5e5 d5f5 020e cd5f 0005 f1d1
00003e0 e1c1 f5c9 d5c5 f67e 2800 0e0b 5f02 cde5
00003f0 0005 23e1 f018 c1d1 c9f1 3ef5 cd20 04d4
0000400 c9f1 fef5 380a c607 cd37 04d4 c9f1 30c6
0000410 d4cd f104 f5c9 cbf5 cb2f cb2f cb2f e62f
0000420 cd0f 0502 e6f1 cd0f 0502 c9f1 c5d5 44f5
0000430 3e4d 2110 0000 38cb 19cb 0130 eb19 eb29
0000440 203d f1f3 d1c1 c5c9 44f5 214d 0000 0678
0000450 1708 6aed 52ed 0130 1019 17f6 472f 4879
0000460 0806 ed17 ed6a 3052 1901 f610 2f17 4f41
0000470 54f1 605d c169 e5c9 0011 7e00 28b7 2304
0000480 1813 e1f8 e5c9 7ed5 b712 0428 1323 f718
0000490 e1d1 e5c9 c5d5 7af5 20b3 cd03 0577 b77a
00004a0 0720 fe7b 2001 1802 e516 2b19 cbc1 cb3a
00004b0 d51b 5f0a 027e d173 032b 7a1b 20b3 f1f2
00004c0 d1c1 c9e1 d5c5 44e5 624d 116b 000a 47cd
00004d0 7b05 30c6 0302 003e 7c02 28b5 1802 e1ec
00004e0 0011 cd00 0593 c1d1 e5c9 11c5 0000 b77e
00004f0 1f28 21e5 000a 2ccd 5405 e15d 30d6 0afe
0000500 1430 c5e5 6b62 0006 094f 5d54 e1c1 1823
0000510 3edd c101 c9e1 0011 3e00 1800 c5f6 d5e5
0000520 785f 28b1 7305 230b f718 e1d1 c9c1 b178
0000530 0728 127e 230b 1813 c9f5 213b 0080 0011
0000540 0107 0080 2ecd 2106 0700 237e fd22 3206
0000550 06ff 003e 8132 c907 fd2a 3a06 06ff c8b7
0000560 fe7e 2020 3a15 06ff 323d 06ff 003e 8132
0000570 2a07 06fd 2223 06fd de18 fd22 c906 cd7f
0000580 0658 ff3a b706 3ac8 0781 28b7 2a1d 06fd
0000590 fe7e 2020 3e07 3200 0781 e318 ff3a 3d06
00005a0 ff32 7e06 2223 06fd c9b7 fd2a 7e06 2ffe
00005b0 0628 2dfe 0228 1918 013e 8132 2307 46c5
00005c0 2223 06fd ff3a 3d06 ff32 3e06 b701 c178
00005d0 e5c9 fe7e 2020 360d 2300 fd22 3e06 b701
00005e0 3ee1 c900 ff3a 3d06 ff32 b706 0c20 fd22
00005f0 3606 3e00 b701 3ee1 c900 1823 00d5 0000
0000600 0000 0000 0000 0000 0000 0000 0000 0000
0000610 0000 0000 0000 0000 0000 0000 0000 0000
0000620 0000 0000 0000 0000 0000 0000 0000 0000
0000630 0000 0000 0000 0000 0000 0000 0000 0000
0000640 0000 0000 0000 0000 0000 0000 0000 0000
0000650 0000 0000 0000 0000 0000 0000 0000 0000
0000660 0000 0000 0000 0000 0000 0000 0000 0000
0000670 0000 0000 0000 0000 0000 0000 0000 0000
0000680 0000 e500 c5d5 7de5 03fe 0130 421b d54b
0000690 6b62 0016 041e 47cd 0905 4d44 54e1 d55d
00006a0 0016 641e 47cd e505 6960 edc1 e542 d1c1
00006b0 d5c5 6b62 9011 cd01 0547 c1d1 4409 e14d
00006c0 e52d c5e5 064d 2100 08c4 7e09 e1c1 6960
00006d0 165f 1900 5ad1 0016 1619 1e00 cd07 0547
00006e0 c17b e1d1 e5c9 e5d5 9011 cd01 0547 7ae1
00006f0 28b3 e51a 6411 cd00 0547 7ae1 28b3 e513
0000700 0411 cd00 0547 7ae1 28b3 1802 d105 3ee1
0000710 c901 e1d1 003e cdc9 07e5 28b7 7a09 02fe
0000720 0420 1d3e 3918 fe7a 2801 fe30 2803 fe2c
0000730 2804 fe24 2805 fe24 2806 fe1c 2807 fe1c
0000740 2808 fe18 2809 fe10 280a fe10 280b fe08
0000750 280c 3e08 181c 3e08 181e 3e04 181f c900
0000760 01fe 0420 d021 c908 02fe 0420 d821 c908
0000770 03fe 0420 e121 c908 04fe 0420 e721 c908
0000780 05fe 0420 ed21 c908 06fe 0420 f121 c908
0000790 07fe 0420 f621 c908 08fe 0420 fb21 c908
00007a0 09fe 0420 0221 c909 0afe 0420 0c21 c909
00007b0 0bfe 0420 1421 c909 0cfe 0420 1d21 c909
00007c0 2621 c909 0300 0502 0300 0105 0604 0402
00007d0 614a 756e 7261 0079 6546 7262 6175 7972
00007e0 4d00 7261 6863 4100 7270 6c69 4d00 7961
00007f0 4a00 6e75 0065 754a 796c 4100 6775 7375
0000800 0074 6553 7470 6d65 6562 0072 634f 6f74
0000810 6562 0072 6f4e 6576 626d 7265 4400 6365
0000820 6d65 6562 0072 3f3f 003f 2ae5 fffe fe7e
0000830 2057 230a fe7e 20a8 2304 e17e e1c9 003e
0000840 cdc9 fff0 c5c9 e64f cbf0 473f 3fcb 3fcb
0000850 4780 e679 800f c9c1 ff3e 2acd b709 3428
0000860 d5e5 06c5 cd20 0941 d1c1 e5e1 7ef5 45cd
0000870 7709 7e23 45cd 7709 7e23 45cd 7709 7e23
0000880 45cd 7709 7e23 45cd 7709 7e23 45cd 7709
0000890 f123 c9e1 ff3e 65c9 626d 7265 4400 6365
00008a0 6d65 6562 0072 3f3f 003f 2ae5 fffe fe7e
00008b0 2057 230a fe7e 20a8 2304 e17e e1c9 003e
00008c0 cdc9 fff0 c5c9 e64f cbf0 473f 3fcb 3fcb
00008d0 4780 e679 800f c9c1 ff3e 2acd b709 3428
00008e0 d5e5 06c5 cd20 0941 d1c1 e5e1 7ef5 45cd
00008f0 7709 7e23 45cd 7709 7e23 45cd 7709 7e23
0000900

And the one built on my system using the make file.

$ hexdump -v cal.com
0000000 0000 0000 0000 0000 0000 0000 0000 0000
0000010 0000 0000 0000 0000 0000 0000 0000 0000
0000020 0000 0000 0000 0000 0000 0000 0000 0000
0000030 0000 7676 7676 7676 7676 7676 7676 7676
0000040 7676 7676 7676 7676 7676 7676 7676 7676
0000050 7676 7676 7676 7676 7676 7676 7676 7676
0000060 7676 7676 7676 7676 7676 7676 7676 7676
0000070 7676 7676 7676 7676 7676 7676 7676 7676
0000080 7676 7676 7676 7676 7676 7676 7676 7676
0000090 7676 7676 7676 7676 7676 7676 7676 7676
00000a0 7676 7676 7676 7676 7676 7676 7676 7676
00000b0 7676 7676 7676 7676 7676 7676 7676 7676
00000c0 7676 7676 7676 7676 7676 7676 7676 7676
00000d0 7676 7676 7676 7676 7676 7676 7676 7676
00000e0 7676 7676 7676 7676 7676 7676 7676 7676
00000f0 7676 7676 7676 7676 7676 7676 7676 7676
0000100 7676 c376 027c 21e5 041a e3cd 2104 03d5
0000110 e3cd e104 e5c9 4521 cd04 04e3 c9e1 cdd5
0000120 05e9 cab7 0373 b77b 73ca fe03 d20d 0373
0000130 b832 d104 d5c9 e9cd b705 97ca 6203 226b
0000140 04b9 c9d1 cde5 0860 e3cd e104 d5c9 f5e5
0000150 5d54 1121 cd04 05c4 e3cd cd04 04c7 e1f1
0000160 c9d1 f5e5 bb3a fe04 2801 2105 03a7 0318
0000170 bc21 cd03 04e3 c7cd f104 c9e1 3bcd 0606
0000180 cd00 067f 3a28 28b7 fe24 2048 cd06 0206
0000190 65c3 fe03 2053 3e07 3201 04bb e318 56fe
00001a0 0820 15cd c302 0365 d718 83c3 7803 00fe
00001b0 0320 1ecd 7802 01fe 0320 35cd 0402 c118
00001c0 fe78 2802 212a 04bc 58cd fe09 2000 3a15
00001d0 04bc 266f 1100 07d0 2219 04b9 bd3a 3204
00001e0 04b8 0b18 9c21 cd04 04e3 c7cd 1804 3a79
00001f0 04b8 44cd cd02 04fa b92a cd04 024d 5d54
0000200 266f cd01 0783 3a67 04bb 01fe 287c fe09
0000210 2800 3d03 0218 063e 62f5 6b55 17cd 4708
0000220 cdf1 0262 000e 0116 28b7 210c 03d1 e3cd
0000230 0c04 283d 1802 21f1 0411 fe7a 300a cd03
0000240 04fa 5ad5 0016 c4cd d105 e3cd cd04 04fa
0000250 790c 07fe 0520 000e c7cd 7a04 28b8 1403
0000260 d518 c7cd cd04 04c2 1a21 cd04 04e3 c7cd
0000270 1804 e5f2 7921 cd04 04e3 cde1 04e3 c7cd
0000280 1804 21e2 0490 e3cd cd04 04c7 1a21 cd04
0000290 04e3 c7cd 1804 e5ce 8521 cd04 04e3 cde1
00002a0 04e3 c7cd 1804 4dbe 206f 7554 5720 2065
00002b0 6854 4620 2072 6153 5320 0075 7553 4d20
00002c0 206f 7554 5720 2065 6854 4620 2072 6153
00002d0 2000 2020 2f00 2068 6873 776f 6820 6c65
00002e0 2070 6574 7478 0a0d 732f 7720 6565 206b
00002f0 7473 7261 7374 7320 6e75 6164 0d79 2f0a
0000300 2076 6873 776f 7620 7265 6973 6e6f 0a0d
0000310 3100 3332 3534 3736 0038 7355 6761 3a65
0000320 6320 6c61 5b20 682f 7673 205d 6d7b 6e6f
0000330 6874 207d 347b 642d 6769 7469 7920 6165
0000340 7d72 0a0d 6300 6c61 3020 312e 2c63 6320
0000350 706f 7279 6769 7468 2820 2963 3032 3332
0000360 4b20 7665 6e69 4220 6f6f 656e 202c 5047
0000370 204c 3376 302e 0a0d 4200 6461 6d20 6e6f
0000380 6874 203a 4200 6461 7920 6165 3a72 0020
0000390 6142 2064 706f 6974 6e6f 002e 6f4e 5220
00003a0 4354 203a 6967 6576 6d20 6e6f 6874 6120
00003b0 646e 7920 6165 0072 0000 0000 0000 0000
00003c0 0000 000e 05cd f500 0d3e d4cd 3e04 cd0a
00003d0 04d4 c9f1 c5e5 d5f5 020e cd5f 0005 f1d1
00003e0 e1c1 f5c9 d5c5 f67e 2800 0e0b 5f02 cde5
00003f0 0005 23e1 f018 c1d1 c9f1 3ef5 cd20 04d4
0000400 c9f1 fef5 380a c607 cd37 04d4 c9f1 30c6
0000410 d4cd f104 f5c9 cbf5 cb2f cb2f cb2f e62f
0000420 cd0f 0502 e6f1 cd0f 0502 c9f1 c5d5 44f5
0000430 3e4d 2110 0000 38cb 19cb 0130 eb19 eb29
0000440 203d f1f3 d1c1 c5c9 44f5 214d 0000 0678
0000450 1708 6aed 52ed 0130 1019 17f6 472f 4879
0000460 0806 ed17 ed6a 3052 1901 f610 2f17 4f41
0000470 54f1 605d c169 e5c9 0011 7e00 28b7 2304
0000480 1813 e1f8 e5c9 7ed5 b712 0428 1323 f718
0000490 e1d1 e5c9 c5d5 7af5 20b3 cd03 0577 b77a
00004a0 0720 fe7b 2001 1802 e516 2b19 cbc1 cb3a
00004b0 d51b 5f0a 027e d173 032b 7a1b 20b3 f1f2
00004c0 d1c1 c9e1 d5c5 44e5 624d 116b 000a 47cd
00004d0 7b05 30c6 0302 003e 7c02 28b5 1802 e1ec
00004e0 0011 cd00 0593 c1d1 e5c9 11c5 0000 b77e
00004f0 1f28 21e5 000a 2ccd 5405 e15d 30d6 0afe
0000500 1430 c5e5 6b62 0006 094f 5d54 e1c1 1823
0000510 3edd c101 c9e1 0011 3e00 1800 c5f6 d5e5
0000520 785f 28b1 7305 230b f718 e1d1 c9c1 b178
0000530 0728 127e 230b 1813 c9f5 213b 0080 0011
0000540 0107 0080 2ecd 2106 0700 237e fd22 3206
0000550 06ff 003e 8132 c907 fd2a 3a06 06ff c8b7
0000560 fe7e 2020 3a15 06ff 323d 06ff 003e 8132
0000570 2a07 06fd 2223 06fd de18 fd22 c906 cd7f
0000580 0658 ff3a b706 3ac8 0781 28b7 2a1d 06fd
0000590 fe7e 2020 3e07 3200 0781 e318 ff3a 3d06
00005a0 ff32 7e06 2223 06fd c9b7 fd2a 7e06 2ffe
00005b0 0628 2dfe 0228 1918 013e 8132 2307 46c5
00005c0 2223 06fd ff3a 3d06 ff32 3e06 b701 c178
00005d0 e5c9 fe7e 2020 360d 2300 fd22 3e06 b701
00005e0 3ee1 c900 ff3a 3d06 ff32 b706 0c20 fd22
00005f0 3606 3e00 b701 3ee1 c900 1823 00d5 0000
0000600 7676 7676 7676 7676 7676 7676 7676 7676
0000610 7676 7676 7676 7676 7676 7676 7676 7676
0000620 7676 7676 7676 7676 7676 7676 7676 7676
0000630 7676 7676 7676 7676 7676 7676 7676 7676
0000640 7676 7676 7676 7676 7676 7676 7676 7676
0000650 7676 7676 7676 7676 7676 7676 7676 7676
0000660 7676 7676 7676 7676 7676 7676 7676 7676
0000670 7676 7676 7676 7676 7676 7676 7676 7676
0000680 0076 e500 c5d5 7de5 03fe 0130 421b d54b
0000690 6b62 0016 041e 47cd 0905 4d44 54e1 d55d
00006a0 0016 641e 47cd e505 6960 edc1 e542 d1c1
00006b0 d5c5 6b62 9011 cd01 0547 c1d1 4409 e14d
00006c0 e52d c5e5 064d 2100 08c4 7e09 e1c1 6960
00006d0 165f 1900 5ad1 0016 1619 1e00 cd07 0547
00006e0 c17b e1d1 e5c9 e5d5 9011 cd01 0547 7ae1
00006f0 28b3 e51a 6411 cd00 0547 7ae1 28b3 e513
0000700 0411 cd00 0547 7ae1 28b3 1802 d105 3ee1
0000710 c901 e1d1 003e cdc9 07e5 28b7 7a09 02fe
0000720 0420 1d3e 3918 fe7a 2801 fe30 2803 fe2c
0000730 2804 fe24 2805 fe24 2806 fe1c 2807 fe1c
0000740 2808 fe18 2809 fe10 280a fe10 280b fe08
0000750 280c 3e08 181c 3e08 181e 3e04 181f c900
0000760 01fe 0420 d021 c908 02fe 0420 d821 c908
0000770 03fe 0420 e121 c908 04fe 0420 e721 c908
0000780 05fe 0420 ed21 c908 06fe 0420 f121 c908
0000790 07fe 0420 f621 c908 08fe 0420 fb21 c908
00007a0 09fe 0420 0221 c909 0afe 0420 0c21 c909
00007b0 0bfe 0420 1421 c909 0cfe 0420 1d21 c909
00007c0 2621 c909 0300 0502 0300 0105 0604 0402
00007d0 614a 756e 7261 0079 6546 7262 6175 7972
00007e0 4d00 7261 6863 4100 7270 6c69 4d00 7961
00007f0 4a00 6e75 0065 754a 796c 4100 6775 7375
0000800 0074 6553 7470 6d65 6562 0072 634f 6f74
0000810 6562 0072 6f4e 6576 626d 7265 4400 6365
0000820 6d65 6562 0072 3f3f 003f 2ae5 fffe fe7e
0000830 2057 230a fe7e 20a8 2304 e17e e1c9 003e
0000840 cdc9 fff0 c5c9 e64f cbf0 473f 3fcb 3fcb
0000850 4780 e679 800f c9c1 ff3e 2acd b709 3428
0000860 d5e5 06c5 cd20 0941 d1c1 e5e1 7ef5 45cd
0000870 7709 7e23 45cd 7709 7e23 45cd 7709 7e23
0000880 45cd 7709 7e23 45cd 7709 7e23 45cd 7709
0000890 f123 c9e1 ff3e 65c9 626d 7265 4400 6365
00008a0 6d65 6562 0072 3f3f 003f 2ae5 fffe fe7e
00008b0 2057 230a fe7e 20a8 2304 e17e e1c9 003e
00008c0 cdc9 fff0 c5c9 e64f cbf0 473f 3fcb 3fcb
00008d0 4780 e679 800f c9c1 ff3e 2acd b709 3428
00008e0 d5e5 06c5 cd20 0941 d1c1 e5e1 7ef5 45cd
00008f0 7709 7e23 45cd 7709 7e23 45cd 7709 7e23
0000900

I did a quick check to list the differences....

$ hexdump -v calendar.com > a.txt
$ hexdump -v cal.com > b.txt
$ diff a.txt b.txt
4,17c4,17
< 0000030 0000 0000 0000 0000 0000 0000 0000 0000
< 0000040 0000 0000 0000 0000 0000 0000 0000 0000
< 0000050 0000 0000 0000 0000 0000 0000 0000 0000
< 0000060 0000 0000 0000 0000 0000 0000 0000 0000
< 0000070 0000 0000 0000 0000 0000 0000 0000 0000
< 0000080 0000 0000 0000 0000 0000 0000 0000 0000
< 0000090 0000 0000 0000 0000 0000 0000 0000 0000
< 00000a0 0000 0000 0000 0000 0000 0000 0000 0000
< 00000b0 0000 0000 0000 0000 0000 0000 0000 0000
< 00000c0 0000 0000 0000 0000 0000 0000 0000 0000
< 00000d0 0000 0000 0000 0000 0000 0000 0000 0000
< 00000e0 0000 0000 0000 0000 0000 0000 0000 0000
< 00000f0 0000 0000 0000 0000 0000 0000 0000 0000
< 0000100 0000 c300 027c 21e5 041a e3cd 2104 03d5
---
> 0000030 0000 7676 7676 7676 7676 7676 7676 7676
> 0000040 7676 7676 7676 7676 7676 7676 7676 7676
> 0000050 7676 7676 7676 7676 7676 7676 7676 7676
> 0000060 7676 7676 7676 7676 7676 7676 7676 7676
> 0000070 7676 7676 7676 7676 7676 7676 7676 7676
> 0000080 7676 7676 7676 7676 7676 7676 7676 7676
> 0000090 7676 7676 7676 7676 7676 7676 7676 7676
> 00000a0 7676 7676 7676 7676 7676 7676 7676 7676
> 00000b0 7676 7676 7676 7676 7676 7676 7676 7676
> 00000c0 7676 7676 7676 7676 7676 7676 7676 7676
> 00000d0 7676 7676 7676 7676 7676 7676 7676 7676
> 00000e0 7676 7676 7676 7676 7676 7676 7676 7676
> 00000f0 7676 7676 7676 7676 7676 7676 7676 7676
> 0000100 7676 c376 027c 21e5 041a e3cd 2104 03d5
97,105c97,105
< 0000600 0000 0000 0000 0000 0000 0000 0000 0000
< 0000610 0000 0000 0000 0000 0000 0000 0000 0000
< 0000620 0000 0000 0000 0000 0000 0000 0000 0000
< 0000630 0000 0000 0000 0000 0000 0000 0000 0000
< 0000640 0000 0000 0000 0000 0000 0000 0000 0000
< 0000650 0000 0000 0000 0000 0000 0000 0000 0000
< 0000660 0000 0000 0000 0000 0000 0000 0000 0000
< 0000670 0000 0000 0000 0000 0000 0000 0000 0000
< 0000680 0000 e500 c5d5 7de5 03fe 0130 421b d54b
---
> 0000600 7676 7676 7676 7676 7676 7676 7676 7676
> 0000610 7676 7676 7676 7676 7676 7676 7676 7676
> 0000620 7676 7676 7676 7676 7676 7676 7676 7676
> 0000630 7676 7676 7676 7676 7676 7676 7676 7676
> 0000640 7676 7676 7676 7676 7676 7676 7676 7676
> 0000650 7676 7676 7676 7676 7676 7676 7676 7676
> 0000660 7676 7676 7676 7676 7676 7676 7676 7676
> 0000670 7676 7676 7676 7676 7676 7676 7676 7676
> 0000680 0076 e500 c5d5 7de5 03fe 0130 421b d54b
$

It is probably worth noting that my CPM emulator won't be the same as yours.

kevinboone commented 1 year ago

What happens if you change the start of main.asm:

  ASEG
  ORG    0100H

?

Your version seems to be padded with '76' rather than '00'. 76 is a halt instruction, IIRC. I found that adding the ASEG removes that padding, so perhaps it will remove the opportunity for the linker/platform to pad it with something unhelpful?

mike632t commented 1 year ago

I think the reason the binary is padded with 0x76 is the RAM is not zeroed out but is filled 0x76 by the CPM emulator. Not checked what simh does yet.

mike632t commented 1 year ago

Using ASEG solves the HALT problem

$ cpm cal 2 2023
February 2023
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 
$ 

However

$ cpm cal /s 2 2023
Bad year: 2023v
$

This is probably also a side effect of filling the RAM with 0x76.

kevinboone commented 1 year ago

Yes, but so long as the length of the command line is recorded correctly, my code should be able to cope. I suspect I have a bug that causes the command line parser to read beyond the end of the command line. Let me check that -- I've seen this problem with other programs.

mike632t commented 1 year ago

Yes, but so long as the length of the command line is recorded correctly, my code should be able to cope. I suspect I have a bug that causes the command line parser to read beyond the end of the command line. Let me check that -- I've seen this problem with other programs.

I can confirm that if I fill the RAM with 0x00 everything works as it should.

$ cpm cal /s 2 1963
February 1963
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 
$ 
mike632t commented 1 year ago

Yes, but so long as the length of the command line is recorded correctly, my code should be able to cope. I suspect I have a bug that causes the command line parser to read beyond the end of the command line. Let me check that -- I've seen this problem with other programs.

I'd suggest your counter is off by one (or you assume a null terminated string) as It probably isn't a coincidence that 0x76 is the ASCII code for 'v'.

kevinboone commented 1 year ago

Please feel free to try the latest commit. If it's still broken, I'll have to find a more rigorous way to test the command-line parser.

mike632t commented 1 year ago

Works a treat !!