home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
database
/
trl14db.zip
/
TRLPRG.EXE
/
COUNTRY2.PRG
< prev
next >
Wrap
Text File
|
1990-10-22
|
5KB
|
177 lines
*********
* COUNTRY.PRG
*
* by Ralph Davis
* modified by Tom Rettig and Leonard Zerman
*
* Placed in the Public Domain by Tom Rettig Associates, 10/22/1990.
*
* Demonstrates use of level-1 syntax and DOSFUNC procedure.
*********
SET TALK OFF
SET ESCAPE OFF
CLEAR
x = 1000
CALL trpass WITH x
CALL trexe WITH "ALLOCATE"
IF [] = tr_retc
? "Not enough memory to allocate."
ELSE
m_buffer = tr_retc && save long address for deallocation
CALL trpass WITH m_buffer
CALL trexe WITH "SEPARATE"
segment = tr_retc
offset = tr_retn
ENDIF
STORE 0 TO i, m_flags
DO WHILE i <= 254
@ 0, 0 SAY i
CALL trpass WITH i
CALL trexe WITH "HEX"
m_ax = '38' + SUBSTR(tr_retc,3,2)
m_bx = '0000'
m_cx = '0000'
m_dx = SUBSTR( m_buffer, 5, 4 )
m_si = '0000'
m_di = '0000'
m_ds = segment
m_es = '0000'
m_regs = m_ax + m_bx + m_cx + m_dx + m_si + m_di + m_ds + m_es
CALL trpass WITH m_regs
CALL trpass WITH m_flags
CALL trexe WITH "DOSFUNC"
IF MOD(m_flags,2) # 0
i = i + 1
LOOP
ELSE
?
? "COUNTRY NO: " + LTRIM(STR(i))
CALL trpass WITH segment
CALL trpass WITH offset
CALL trexe WITH "PEEKINT"
DO CASE
CASE tr_retn = 0
? "Date format: USA (mm/dd/yy)"
CASE tr_retn = 1
? "Date format: European (dd/mm/yy)"
CASE tr_retn = 2
? "Date format: Japanese (yy/mm/dd)"
ENDCASE
offset = offset + 2
CALL trpass WITH segment
CALL trpass WITH offset
CALL trexe WITH "PEEKSTR"
? "Currency symbol: " + tr_retc
offset = offset + 5
CALL trpass WITH segment
CALL trpass WITH offset
CALL trexe WITH "PEEKSTR"
? "Thousands separator: " + tr_retc
offset = offset + 2
CALL trpass WITH segment
CALL trpass WITH offset
CALL trexe WITH "PEEKSTR"
? "Decimal separator: " + tr_retc
offset = offset + 2
CALL trpass WITH segment
CALL trpass WITH offset
CALL trexe WITH "PEEKSTR"
? "Date separator: " + tr_retc
offset = offset + 2
CALL trpass WITH segment
CALL trpass WITH offset
CALL trexe WITH "PEEKSTR"
? "Time separator: " + tr_retc
offset = offset + 2
CALL trpass WITH segment
CALL trpass WITH offset
CALL trexe WITH "PEEKSTR"
IF MOD(tr_retn,2) = 0
? "Currency symbol precedes the value"
ELSE
? "Currency symbol follows the value"
ENDIF
m_spaces = MOD( INT((tr_retn/2)), 2 )
? "There are " + LTRIM(STR(m_spaces,1,0)) + " spaces " +;
"between the value and the symbol"
offset = offset + 1
CALL trpass WITH segment
CALL trpass WITH offset
CALL trexe WITH "PEEKSTR"
? "Significant decimal digits in currency: " + LTRIM(STR(tr_retn))
offset = offset + 1
CALL trpass WITH segment
CALL trpass WITH offset
CALL trexe WITH "PEEKSTR"
IF MOD(tr_retn,2) = 0
? "Twelve hour clock in use"
ELSE
? "Twenty-four hour clock in use"
ENDIF
offset = offset + 1
CALL trpass WITH segment
CALL trpass WITH offset
CALL trexe WITH "PEEKINT"
CALL trpass WITH tr_retn
CALL trexe WITH "HEX"
m_caseoff = tr_retc && HEX( PEEKINT(segment, offset+18) )
offset = offset + 2
CALL trpass WITH segment
CALL trpass WITH offset
CALL trexe WITH "PEEKINT"
CALL trpass WITH tr_retn
CALL trexe WITH "HEX"
m_caseseg = tr_retc && HEX( PEEKINT(segment, offset+20) )
? "Case map call address: " + m_caseseg + ":" + m_caseoff
offset = offset + 2
CALL trpass WITH segment
CALL trpass WITH offset
CALL trexe WITH "PEEKSTR"
? "Data list separator: " + tr_retc
?
?
? "Press any key to continue, <Esc> to abort..."
holdkey = 0
DO WHILE holdkey = 0
holdkey = INKEY()
IF holdkey = 27 && Escape key aborts
SET TALK ON
SET ESCAPE ON
RETURN
ENDIF
ENDDO
offset = ( offset - 22 )
CLEAR
ENDIF
i = i + 1
m_flags = 0
ENDDO
CALL trpass WITH m_buffer
CALL trexe WITH "DEALLOC"
IF .NOT. tr_retl
?? CHR(7)
? 'Error freeing memory'
ENDIF
SET TALK ON
SET ESCAPE ON
RETURN
* eof: country.prg