home *** CD-ROM | disk | FTP | other *** search
- * Program.: SMALL-.CMD
- * Author..: Luis A. Castro
- * Date....: 01/20/84
- * Notice..: Copyright 1984, Luis A. Castro, All Rights Reserved.
- * Version.: dBASE II, version 2.4
- * Notes...: Front-end program to utilize dWAIT, INKEY,
- * LEADZERO, and LEFTJUST CP/M-80 assembly subroutines.
- * Local...: row, col, string, select, inchar
- *
- SET TALK OFF
- SET BELL OFF
- SET COLON OFF
- SET RAW ON
- ERASE
- @ 2, 0 SAY "DEMONSTRATION of SMALL ASSEMBLY SUBROUTINES"
- @ 2,72 SAY DATE()
- @ 3, 0 SAY "========================================"
- @ 3,40 SAY "========================================"
- STORE "X" TO select
- DO WHILE select <> " "
- @ 10,0
- STORE " " TO select
- @ 5,0 SAY "1. dWAIT = console input or time-out"
- @ 6,0 SAY "2. INKEY() = inkey function"
- @ 7,0 SAY "3. LEADZERO = leading blanks with zeroes"
- @ 8,0 SAY "4. LEFTJUST = left justify a string"
- @ 9,0 GET select PICTURE "!"
- READ
- IF select = " " .OR. .NOT. select $ "1234"
- LOOP
- ENDIF
- @ 9,0 SAY " "
- * ---Execute a routine.
- DO CASE
- CASE select = "1"
- * ---dWAIT. console key or time-out delay.
- * ------------0---1---2---3---4---5---6---7
- POKE 42000, 33, 39,164, 53,194, 26,164, 44
- POKE 42008, 53,200, 14, 6, 30,255,205, 5
- POKE 42016, 0,254, 0,202, 16,164,201, 0
- POKE 42024, 100
- * ------------0---1---2---3---4---5---6---7
- * ---The last value in the above poke sequence, 100,
- * ---is the time-out limit, yielding a delay of 0.035n
- * ---seconds (at 4MHz). The largest value that can be
- * ---used is 255, or about 9 seconds.
- *
- STORE " " TO string
- @ 10,0 SAY "Enter a number [1..3] " GET string
- READ
- IF string < "1" .OR. string > "3"
- @ 12,0 SAY "Number is not [1..3] -- DELAY IN EFFECT"
- * ---Enable dWAIT.
- SET CALL TO 42000
- CALL
- ENDIF
- CASE select = "2"
- * ---INKEY()
- * ------------0---1---2---3---4---5---6---7
- POKE 41984, 42, 6, 0, 34, 57,164, 33, 20,;
- 164, 34, 6, 0,201, 42, 57,164
- POKE 42000, 34, 6, 0,201,245,121,254, 3,;
- 202, 51,164,254, 6,194, 55,164
- POKE 42016, 123,254,255,202, 51,164,254,254,;
- 202, 51,164,254,253,202, 51,164
- POKE 42032, 195, 55,164, 14, 0,241,201,241,;
- 195, 0, 0,229, 14, 6, 30,255
- POKE 42048, 205, 56,164,225, 35,119,201
- * ------------0---1---2---3---4---5---6---7
- * ---Initialize INKEY().
- SET CALL TO 41984
- CALL
- @ 10,0 SAY "Strike any key to STOP"
- * ---Enable INKEY().
- SET CALL TO 42043
- * ---Do something until a character is pressed.
- STORE CHR( 0 ) to inchar
- STORE 11 TO row
- DO WHILE inchar = CHR( 0 ) .AND. row < 14
- STORE 0 TO col
- DO WHILE inchar = CHR( 0 ) .AND. col < 50
- @ row,col SAY "."
- STORE row + 1 TO row
- * ---Read first character from CP/M buffer.
- * ---CHR( 0 ) is returned if none is available.
- CALL inchar
- ENDDO
- STORE col + 1 TO col
- ENDDO
- * ---Restore dBASE II's input routines.
- * ---This closing operation MUST NOT BE FORGOTTEN.
- SET CALL TO 41997
- CALL
- CASE select = "3"
- * ---LEADZERO.
- * ------------0---1---2---3---4---5---6---7
- POKE 42000, 34, 37,164, 70, 35,126,254, 32
- POKE 42008, 194, 33,164, 54, 48, 5,194, 20
- POKE 42016, 164, 42, 37,164,201
- * ------------0---1---2---3---4---5---6---7
- SET CALL TO 42000
- ACCEPT "Enter a string with leading blanks " TO string
- IF TRIM(string) <> " "
- ? "BEFORE: >" + string + "<"
- CALL string
- ? "AFTER: >" + string + "<"
- ENDIF
- CASE select = "4"
- * ---LEFTJUST.
- * ------------0---1---2---3---4---5---6---7
- POKE 42000, 34, 51,164, 78, 84, 93, 19, 35,;
- 126,254, 32,194, 37,164, 13,194
- POKE 42016, 23,164,202, 47,164,126, 54, 32,;
- 18, 19, 35, 13,194, 37,164, 42
- POKE 42032, 51,164,201, 0, 0
- * ------------0---1---2---3---4---5---6---7
- SET CALL TO 42000
- ACCEPT "Enter a string with leading blanks " TO string
- IF TRIM(string) <> " "
- ? "BEFORE: >" + string + "<"
- CALL string
- ? "AFTER: >" + string + "<"
- ENDIF
- ENDCASE
- @ 11,0
- @ 12,0
- @ 13,0
- ENDDO
- SET BELL ON
- SET TALK ON
- SET COLON ON
- SET RAW OFF
- RELEASE row, col, string, select, inchar
- RETURN
- * EOF: SMALL-.CMD