Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 43 additions & 5 deletions country.asm
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,12 @@
;
; See Matthias Paul's extensive COUNTRY.SYS documentation file: COUNTRY.LST
;
; Country numeric codes closely correspond to international telephone codes
; see https://github.com/google/libphonenumber for current country numbers
; Note: historic ones follow MS-DOS conventions and may no longer exist
;
; Standards used in this file:
; - ISO 3166-1: Country codes
; - ISO 3166-1: Country codes (2-alpha for comments only)
; https://www.iso.org/iso-3166-country-codes.html
; - ISO 639-1: Language codes
; https://www.loc.gov/standards/iso639-2/php/code_list.php
Expand Down Expand Up @@ -363,6 +367,32 @@ YMD equ 2 ; Year-Month-Day (ISO format)
_12 equ 0 ; 12-hour clock
_24 equ 1 ; 24-hour clock

;-------------------------------------------------------------------------------
; INTERNAL HELPER MACRO: _bytes_len
;-------------------------------------------------------------------------------
; given a set of values, returns how many bytes they occupy
;-------------------------------------------------------------------------------
%macro _bytes_len 2-* ; %1 is variable to assign # bytes to, rest are values
%assign %%total 0

%rep %0-1 ; iterate over all args except the first (the result name)
%rotate 1 ; bring next value into %1

; if a string get how many bytes, otherwise assume numeric is db (1 byte)
%ifstr %1
%strlen %%n %1
%assign %%total %%total + %%n
%elifnum %1
%assign %%total %%total + 1
%else
%error bytes_len: argument is neither string nor number
%endif
%endrep

%rotate 1 ; restore original %1 (result_name) into %1
%1 equ %%total ; “return” value as an assembly-time constant
%endmacro

;-------------------------------------------------------------------------------
; INTERNAL MACRO: _cnf_data
;-------------------------------------------------------------------------------
Expand All @@ -380,6 +410,14 @@ _24 equ 1 ; 24-hour clock
dw 0x26 ; Length of data
%endif
dw %1, %2, %3 ; Country ID, Codepage, Date format
; validate currency is an ASCIIZ string of at most 5 total bytes
%if %8 != 0
%warning "Warning: Currency must be ASCIIZ string, use 0 for padding bytes"
%endif
_bytes_len len_currency_ %+ %1 %+ _ %+ %2, %4, %5, %6, %7, %8
%if (len_currency_ %+ %1 %+ _ %+ %2) != 5
%error "Error: Currency exceeds 4 bytes and \0 terminator! Country:" %1 "Codepage:" %2
%endif
db %4, %5, %6, %7, %8 ; Currency symbol (5 bytes)
db %9, 0, %10, 0 ; Thousands sep, Decimal sep
db %11, 0, %12, 0 ; Date sep, Time sep
Expand Down Expand Up @@ -1059,10 +1097,10 @@ COUNTRY SET_ANGLO, 353, 858, en_collate_858, yn_yn, DMY, 0D5h, 0, 0, 0, 0, ",
; ------------------------------------------------------------------------------
; Iceland - Country Code 354
; ------------------------------------------------------------------------------
COUNTRY SET_NORDIC, 354, 850, is_collate_850, yn_jn, DMY, "kr", 0, 0, 0, 0, ".", ",", ".", ":", 3, 0, _24 ; Ja / Nei
COUNTRY SET_NORDIC, 354, 858, is_collate_858, yn_jn, DMY, "kr", 0, 0, 0, 0, ".", ",", ".", ":", 3, 0, _24
COUNTRY SET_NORDIC, 354, 861, is_collate_861, yn_jn, DMY, "kr", 0, 0, 0, 0, ".", ",", ".", ":", 3, 0, _24
COUNTRY SET_NORDIC, 354, 865, is_collate_865, yn_jn, DMY, "kr", 0, 0, 0, 0, ".", ",", ".", ":", 3, 0, _24
COUNTRY SET_NORDIC, 354, 850, is_collate_850, yn_jn, DMY, "k", "r", 0, 0, 0, ".", ",", ".", ":", 3, 0, _24 ; Ja / Nei
COUNTRY SET_NORDIC, 354, 858, is_collate_858, yn_jn, DMY, "k", "r", 0, 0, 0, ".", ",", ".", ":", 3, 0, _24
COUNTRY SET_NORDIC, 354, 861, is_collate_861, yn_jn, DMY, "k", "r", 0, 0, 0, ".", ",", ".", ":", 3, 0, _24
COUNTRY SET_NORDIC, 354, 865, is_collate_865, yn_jn, DMY, "k", "r", 0, 0, 0, ".", ",", ".", ":", 3, 0, _24

; ------------------------------------------------------------------------------
; Albania - Country Code 355
Expand Down