DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Euwe has posted 1 posts at DZone. View Full User Profile

Days in a month - embedded system - smaller than table.

01.22.2013
| 2846 views |
  • submit to reddit
(8086 assembly)

//ah = month. 0 = Jan, 7 = Aug..etc. Feb not handled
//ah destroyed.
//al contains number of days in month
mov al,31
xor ah,9
jp thirty_one //parity bit set on 30 day months
dec al
:thirty_one
ret

A small routine returning the number of days in a month for those rolling their own.