Discussion:
show current Month's calendar in 256 bytes
(too old to reply)
Kerr-Mudd, John
2022-05-11 10:11:56 UTC
Permalink
DOS prog to display current month - parm of capital 'M' starts week at Monday, defaults to Sunday.
uses int 21 fn 2A for getting current date and fn 09 for display. 254 bytes.

->d 100 l100
1632:0100 BE 82 00 80-3C 4D 75 01-43 BF 24 09-57 B4 2A CD ....<Mu.C.$.W.*.
1632:0110 21 51 28 C2-BD 30 30 BE-D8 01 A5 B9-06 00 B0 20 !Q(..00........
1632:0120 F3 AA 88 F1-49 01 CE 01-CE 01 CE A5-A4 AA 58 50 ....I.........XP
1632:0130 B1 64 52 99-F7 F1 D4 0A-86 E0 09 E8-AB 92 D4 0A .dR.............
1632:0140 86 E0 09 E8-AB 5A BE C8-01 A5 01 DE-01 DE B0 20 .....Z.........
1632:0150 B1 07 38 D9-75 03 BE CA-01 A5 AA E2-F5 BE C8 01 ..8.u...........
1632:0160 A5 F6 DB 00-D3 80 C3 06-88 F0 B2 1C-2C 02 74 10 ............,.t.
1632:0170 79 02 04 0C-91 B8 B5 06-D3 E8 80 D2-02 59 EB 07 y............Y..
1632:0180 59 80 E1 03-75 01 42 88-D8 BE 0A 0D-B9 07 00 D4 Y...u.B.........
1632:0190 07 98 74 0D-28 C1 51 91-B0 20 AA AA-AA E2 FB 58 ..t.(.Q.. .....X
1632:01A0 91 40 38 C2-72 16 50 D4-0A 86 E0 3C-00 75 02 B0 ***@8.r.P....<.u..
1632:01B0 10 31 E8 AB-B0 20 AA 58-E2 E7 B1 07-96 AB 96 73 .1... .X.......s
1632:01C0 E0 5A 89 D0-AA CD 21 C3-0D 0A 53 75-4D 6F 54 75 .Z....!...SuMoTu
1632:01D0 57 65 54 68-46 72 53 61-0D 0A 4A 61-6E 46 65 62 WeThFrSa..JanFeb
1632:01E0 4D 61 72 41-70 72 4D 61-79 4A 75 6E-4A 75 6C 41 MarAprMayJunJulA
1632:01F0 75 67 53 65-70 4F 63 74-4E 6F 76 44-65 63 00 00 ugSepOctNovDec..
--
Bah, and indeed Humbug.
Kerr-Mudd, John
2022-05-13 13:45:01 UTC
Permalink
On Wed, 11 May 2022 11:11:56 +0100
Post by Kerr-Mudd, John
DOS prog to display current month - parm of capital 'M' starts week at Monday, defaults to Sunday.
uses int 21 fn 2A for getting current date and fn 09 for display. 254 bytes.
->d 100 l100
1632:0100 BE 82 00 80-3C 4D 75 01-43 BF 24 09-57 B4 2A CD ....<Mu.C.$.W.*.
1632:0110 21 51 28 C2-BD 30 30 BE-D8 01 A5 B9-06 00 B0 20 !Q(..00........
1632:0120 F3 AA 88 F1-49 01 CE 01-CE 01 CE A5-A4 AA 58 50 ....I.........XP
1632:0130 B1 64 52 99-F7 F1 D4 0A-86 E0 09 E8-AB 92 D4 0A .dR.............
1632:0140 86 E0 09 E8-AB 5A BE C8-01 A5 01 DE-01 DE B0 20 .....Z.........
1632:0150 B1 07 38 D9-75 03 BE CA-01 A5 AA E2-F5 BE C8 01 ..8.u...........
1632:0160 A5 F6 DB 00-D3 80 C3 06-88 F0 B2 1C-2C 02 74 10 ............,.t.
1632:0170 79 02 04 0C-91 B8 B5 06-D3 E8 80 D2-02 59 EB 07 y............Y..
1632:0180 59 80 E1 03-75 01 42 88-D8 BE 0A 0D-B9 07 00 D4 Y...u.B.........
1632:0190 07 98 74 0D-28 C1 51 91-B0 20 AA AA-AA E2 FB 58 ..t.(.Q.. .....X
1632:01B0 10 31 E8 AB-B0 20 AA 58-E2 E7 B1 07-96 AB 96 73 .1... .X.......s
1632:01C0 E0 5A 89 D0-AA CD 21 C3-0D 0A 53 75-4D 6F 54 75 .Z....!...SuMoTu
1632:01D0 57 65 54 68-46 72 53 61-0D 0A 4A 61-6E 46 65 62 WeThFrSa..JanFeb
1632:01E0 4D 61 72 41-70 72 4D 61-79 4A 75 6E-4A 75 6C 41 MarAprMayJunJulA
1632:01F0 75 67 53 65-70 4F 63 74-4E 6F 76 44-65 63 00 00 ugSepOctNovDec..
N.B. Warranty expires 31st Jan 2100.
--
Bah, and indeed Humbug.
Frank Kotler
2022-05-14 03:57:38 UTC
Permalink
Post by Kerr-Mudd, John
On Wed, 11 May 2022 11:11:56 +0100
...
Post by Kerr-Mudd, John
N.B. Warranty expires 31st Jan 2100.
Wolfgang tried to reply to this and had a problem.

I just had a problem, too!

Lemme try just CLAX...

It is an imperfect world. I try to do my part. :)

Best,
Frank

.
Frank Kotler
2022-05-14 04:51:39 UTC
Permalink
Post by Frank Kotler
Post by Kerr-Mudd, John
On Wed, 11 May 2022 11:11:56 +0100
...
Post by Kerr-Mudd, John
N.B. Warranty expires 31st Jan 2100.
Wolfgang tried to reply to this and had a problem.
I just had a problem, too!
Lemme try just CLAX...
It is an imperfect world. I try to do my part. :)
Best,
Frank
Unknown problem.

Sleep first. Think later.

Best
Frank
Kerr-Mudd, John
2022-05-14 08:25:20 UTC
Permalink
On Fri, 13 May 2022 14:45:01 +0100
Post by Kerr-Mudd, John
On Wed, 11 May 2022 11:11:56 +0100
Post by Kerr-Mudd, John
DOS prog to display current month - parm of capital 'M' starts week at Monday, defaults to Sunday.
uses int 21 fn 2A for getting current date and fn 09 for display. 254 bytes.
[]
Post by Kerr-Mudd, John
N.B. Warranty expires 31st Jan 2100.
-> d 100 l100
16AB:0100 BE 82 00 80-3C 4D 75 01-43 BF 24 09-57 B4 2A CD ....<Mu.C.$.W.*.
16AB:0110 21 51 28 C2-28 DA 80 C2-06 BD 30 30-BE DA 01 A5 !Q(.(.....00....
16AB:0120 B9 06 00 B0-20 F3 AA 88-F1 49 01 CE-01 CE 01 CE .... ....I......
16AB:0130 A5 A4 AA 58-B1 64 52 99-F7 F1 52 08-D2 75 02 88 ...X.dR...R..u..
16AB:0140 C2 D4 0A 86-E0 09 E8 AB-58 D4 0A 86-E0 09 E8 AB ........X.......
16AB:0150 BE CA 01 A5-01 DE 01 DE-B0 20 B1 07-38 D9 75 03 ......... ..8.u.
16AB:0160 BE CC 01 A5-AA E2 F5 BE-CA 01 A5 5B-88 F8 B7 1C ...........[....
16AB:0170 2C 02 74 0F-79 02 04 0C-91 B8 B5 06-D3 E8 80 D7 ,.t.y...........
16AB:0180 02 EB 07 80-E2 03 75 02-FE C7 92 BE-0A 0D B9 07 ......u.........
16AB:0190 00 D4 07 98-74 0D 28 C1-51 91 B0 20-AA AA AA E2 ....t.(.Q.. ....
16AB:01A0 FB 58 91 40-38 C7 72 16-50 D4 0A 86-E0 3C 00 75 ***@8.r.P....<.u
16AB:01B0 02 B0 10 31-E8 AB B0 20-AA 58 E2 E7-B1 07 96 AB ...1... .X......
16AB:01C0 96 73 E0 5A-89 D0 AA CD-21 C3 0D 0A-53 75 4D 6F .s.Z....!...SuMo
16AB:01D0 54 75 57 65-54 68 46 72-53 61 0D 0A-4A 61 6E 46 TuWeThFrSa..JanF
16AB:01E0 65 62 4D 61-72 41 70 72-4D 61 79 4A-75 6E 4A 75 ebMarAprMayJunJu
16AB:01F0 6C 41 75 67-53 65 70 4F-63 74 4E 6F-76 44 65 63 lAugSepOctNovDec

New! Improved! 256 bytes. Warranty expires Dec 31st 9999. (code is OK to y32k, but it won't display 5 digit year)

Thanks for taking a peek Wolfgang, don't get hung up on the DOS interrupt, focus on the leap year test and month length array...
--
Bah, and indeed Humbug.
Frank Kotler
2022-05-15 00:10:38 UTC
Permalink
Post by Kerr-Mudd, John
On Fri, 13 May 2022 14:45:01 +0100
New! Improved! 256 bytes. Warranty expires Dec 31st 9999. (code is OK to y32k, but it won't display 5 digit year)
Thanks for taking a peek Wolfgang, don't get hung up on the DOS interrupt, focus on the leap year test and month length array...
Tempurary problem? I hope!
Try again Wolfgang. You too, Steve.
Frank Kotler
2022-05-15 00:19:32 UTC
Permalink
Post by Kerr-Mudd, John
On Fri, 13 May 2022 14:45:01 +0100
...
Post by Kerr-Mudd, John
Thanks for taking a peek Wolfgang, don't get hung up on the DOS interrupt, focus on the leap year test and month length array...
Temporary problem? I hope!

Try again Wolfgang and Steve.

Best,
Frank
Kerr-Mudd, John
2022-05-16 16:15:53 UTC
Permalink
On Sat, 14 May 2022 09:25:20 +0100
Post by Kerr-Mudd, John
On Fri, 13 May 2022 14:45:01 +0100
Post by Kerr-Mudd, John
On Wed, 11 May 2022 11:11:56 +0100
Post by Kerr-Mudd, John
DOS prog to display current month - parm of capital 'M' starts week at Monday, defaults to Sunday.
uses int 21 fn 2A for getting current date and fn 09 for display.
[]
Post by Kerr-Mudd, John
New! Improved! 256 bytes. Warranty expires Dec 31st 9999. (code is OK to y32k, but it won't display 5 digit year)
Thanks for taking a peek Wolfgang, don't get hung up on the DOS interrupt, focus on the leap year test and month length array...
244 bytes:

->d 100 l100
1636:0100 A0 82 00 3C-4D 75 01 43-BF 24 09 57-B4 2A CD 21 ...<Mu.C.$.W.*.!
1636:0110 51 28 C2 28-DA 80 C2 06-BE CE 01 A5-B9 06 00 B0 Q(.(............
1636:0120 20 F3 AA 88-F1 49 01 CE-01 CE 01 CE-A5 A4 AA 58 ....I.........X
1636:0130 B1 64 52 99-F7 F1 52 08-D2 75 02 88-C2 83 E2 03 .dR...R..u......
1636:0140 4A F6 D6 FE-CE B1 0A F6-F1 0D 30 30-AB 58 F6 F1 J.........00.X..
1636:0150 0D 30 30 AB-BE BE 01 56-A5 01 DE 01-DE B0 20 B1 .00....V...... .
1636:0160 07 38 D9 75-03 BE C0 01-A5 AA E2 F5-5E A5 5B 80 .8.u........^.[.
1636:0170 FF 02 74 01-99 88 F9 BD-B5 06 D3 ED-80 D6 1E 93 ..t.............
1636:0180 BE 0A 0D B1-07 D4 07 74-0D 28 C1 51-88 C1 93 AA .......t.(.Q....
1636:0190 AA AA E2 FB-91 59 40 38-C6 72 17 50-D4 0A 86 E0 ***@8.r.P....
1636:01A0 3C 00 75 02-B0 10 35 30-30 AB B0 20-AA 58 E2 E6 <.u...500.. .X..
1636:01B0 B1 07 96 AB-96 73 DF 5A-89 D0 AA CD-21 C3 0D 0A .....s.Z....!...
1636:01C0 53 75 4D 6F-54 75 57 65-54 68 46 72-53 61 0D 0A SuMoTuWeThFrSa..
1636:01D0 4A 61 6E 46-65 62 4D 61-72 41 70 72-4D 61 79 4A JanFebMarAprMayJ
1636:01E0 75 6E 4A 75-6C 41 75 67-53 65 70 4F-63 74 4E 6F unJulAugSepOctNo
1636:01F0 76 44 65 63-20 20 20 20-20 20 20 20-20 20 20 20 vDec


y2k code slimmed down; still a bit clunky I feel:
actual code for those not keen to convert hex dumps:

;PrtYear: I: ax=year ; O: dh=Febadj
mov cl,100d ; ch 0 still
push dx ; hi=mth lo=StrtDayOff
; xor dx,dx
cwd ; prog no good after y32k! but [-1]
div cx ; ax=CC, dx=YY ; bad disp after 10k
push dx
;; lpyrcalc I: dl=YY, al=CC; O: dh=Febadj [14]
or dl,dl ; YY=0? [2]
jnz notcent
mov dl,al ; so check CC

notcent: ; lpyr notlpyr
and dx,3 ; 0 nz [3]
dec dx ; dh=FFFF dh=0
not dh ; 0 -1 [2]
dec dh ; -1, -2 [2]

mov cl,10 ; lth prt [13]
putnumal ; CC (6)
pop ax
putnumal ; YY
;;ah nz

[omitted header print]


pop bx ; hi=mth lo=StrtDayOff

;; calc mthlth I: bh=mth, dl=Febadj; O: dl=mthlth [17+10=27], dl lost
;; uses cl, bp. al untouched

;; lpyr check earlier

cmp bh,2 ; [3]
je IsFeb ; retain dh Febadj
cwd ; dh=0 for non Feb mths any year
IsFeb:
mov cl,bh ; DNOSAJJMAMFJ
mov bp,0x06B5 ; 101011010101; default feb to 30
shr bp,cl
adc dh,30 ; this mth lth [16]


[omitted rtn to print day numbers offset to correct column, stop at dh]
--
Bah, and indeed Humbug.
Kerr-Mudd, John
2022-05-17 07:03:34 UTC
Permalink
On Mon, 16 May 2022 17:15:53 +0100
Post by Kerr-Mudd, John
On Sat, 14 May 2022 09:25:20 +0100
Post by Kerr-Mudd, John
On Fri, 13 May 2022 14:45:01 +0100
Post by Kerr-Mudd, John
On Wed, 11 May 2022 11:11:56 +0100
Post by Kerr-Mudd, John
DOS prog to display current month - parm of capital 'M' starts week at Monday, defaults to Sunday.
uses int 21 fn 2A for getting current date and fn 09 for display.
[]
Post by Kerr-Mudd, John
New! Improved! 256 bytes. Warranty expires Dec 31st 9999. (code is OK to y32k, but it won't display 5 digit year)
Thanks for taking a peek Wolfgang, don't get hung up on the DOS interrupt, focus on the leap year test and month length array...
[]
Post by Kerr-Mudd, John
;PrtYear: I: ax=year ; O: dh=Febadj
mov cl,100d ; ch 0 still
push dx ; hi=mth lo=StrtDayOff
; xor dx,dx
cwd ; prog no good after y32k! but [-1]
div cx ; ax=CC, dx=YY ; bad disp after 10k
push dx
;; lpyrcalc I: dl=YY, al=CC; O: dh=Febadj [14]
or dl,dl ; YY=0? [2]
jnz notcent
mov dl,al ; so check CC
notcent: ; lpyr notlpyr
and dx,3 ; 0 nz [3]
dec dx ; dh=FFFF dh=0
; not dh ; 0 -1 [2]
; dec dh ; -1, -2 [2]

Better: (but only by 1)
or dh,-2 ; -1, -2 [3]
Post by Kerr-Mudd, John
mov cl,10 ; lth prt [13]
putnumal ; CC (6)
pop ax
putnumal ; YY
;;ah nz
[omitted header print]
pop bx ; hi=mth lo=StrtDayOff
;; calc mthlth I: bh=mth, dl=Febadj; O: dl=mthlth [17+10=27], dl lost
;; uses cl, bp. al untouched
;; lpyr check earlier
cmp bh,2 ; [3]
je IsFeb ; retain dh Febadj
cwd ; dh=0 for non Feb mths any year
mov cl,bh ; DNOSAJJMAMFJ
mov bp,0x06B5 ; 101011010101; default feb to 30
shr bp,cl
adc dh,30 ; this mth lth [16]
[omitted rtn to print day numbers offset to correct column, stop at dh]
--
Bah, and indeed Humbug.
Loading...