home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 December
/
simtel1292_SIMTEL_1292_Walnut_Creek.iso
/
msdos
/
basic
/
buffdemo.arc
/
BUFFLOAD.SUB
< prev
next >
Wrap
Text File
|
1986-05-12
|
2KB
|
35 lines
1000 'LISTING 1 - by Jim Pottkotter
1010 '
1020 'BUFFLOAD.SUB clears and optionally loads the keyboard buffer
1030 '
1040 '=====> Load Keyboard Buffer
1050 '
1060 '---- If BUFF.1$ and BUFF.2$ both contain a string,
1070 '---- BUFF.1$ overrides BUFF.2$.
1080 '
1090 POKE 1050, PEEK(1052) 'Clear the buffer
1100 DEF SEG = 0 'Set segment to 0
1110 WHILE BUFF.1$ <> "" 'Case 1 - normal codes
1120 POKE 1050, 30 'Address of 1st byte in buffer
1130 BUFF.LEN% = LEN(LEFT$(BUFF.1$,15)) 'Get truncated string size
1140 POKE 1052, 30 + 2 * BUFF.LEN% 'Addr of 1st byte after buffer
1150 FOR BUFF.LOOP% = 1 TO BUFF.LEN% 'Loop BUFF.LEN% times
1160 POKE 1052 + 2 * BUFF.LOOP%, ASC(MID$(BUFF.1$,BUFF.LOOP%,1)) 'ASCII
1170 NEXT 'End loop
1180 BUFF.2$ = "" 'Prevent case 2
1190 BUFF.1$ = "" 'Set exit condition
1200 WEND 'End case 1
1210 '
1220 WHILE BUFF.2$ <> "" 'Case 2 - extended codes
1230 POKE 1050, 30 'Address of 1st byte in buffer
1240 BUFF.LEN% = LEN(LEFT$(BUFF.2$,30)) 'Limit is 30 characters
1250 BUFF.LEN% = (BUFF.LEN% \ 2) * 2 'Force even # of bytes
1260 POKE 1052, 30 + BUFF.LEN% 'Addr of 1st byte after buffer
1270 FOR BUFF.LOOP% = 1 TO BUFF.LEN% 'Loop BUFF.LEN% times
1280 POKE 1053 + BUFF.LOOP%, ASC(MID$(BUFF.2$,BUFF.LOOP%,1)) 'ASCII
1290 NEXT 'End loop
1300 BUFF.2$ = "" 'Set exit condition
1310 WEND 'End case 2
1320 '
1330 RETURN