/svarcom/tags/svarcom-2022.4/toys/erlev.c |
---|
0,0 → 1,7 |
#include <stdio.h> |
#include <stdlib.h> |
int main(int argc, char **argv) { |
int d = atoi(argv[1]); |
return(d); |
} |
/svarcom/tags/svarcom-2022.4/toys/fcbdir.asm |
---|
0,0 → 1,77 |
; |
; lists files using first or second FCB provided by COMMAND.COM in PSP |
; Copyright (C) 2022 Mateusz Viste |
; |
; to be assembled with NASM. |
; |
; lists file entries matching first argument of the program using the default |
; unopened FCB entry in PSP as preset by COMMAND.COM. |
; |
; usage: fcbdir file-pattern |
; |
; example: fcbdir c:*.txt |
; |
CPU 8086 |
org 0x100 |
; print whatever drive/filename is set at 0x5C (1st unopened FCB in the PSP) |
mov dx, PARAM |
mov ah, 0x09 |
int 0x21 |
mov bx, 0x5C |
call PRINTDTA |
; FindFirst_FCB applied to PSP:5C (1st unopened FCB) |
mov dx, 0x5C |
mov ah, 0x11 |
int 0x21 |
cmp al, 0 |
jne GAMEOVER |
NEXT: |
; print filename in DTA |
mov bx, 0x80 |
call PRINTDTA |
; FindNext_FCB on PSP until nothing left |
mov ah, 0x12 |
mov dx, 0x5C |
int 0x21 |
cmp al, 0 |
je NEXT |
GAMEOVER: |
int 0x20 |
PARAM: |
db "PARAMETER = $"; |
; ****** print the filename present in the DTA (DTA is at [BX]) ****** |
PRINTDTA: |
; print drive in the DTA |
mov ah, 0x02 |
mov dl, [bx] |
add dl, '@' |
int 0x21 |
mov dl, ':' |
int 0x21 |
; print filename/extension (in FCB format) |
mov ah, 0x40 ; write to file |
mov cx, 11 ; 11 bytes (8+3) |
mov dx, bx ; filename field at the default DTA location |
inc dx |
mov bx, 1 ; output to stdout |
int 0x21 |
; print a trailing CR/LF |
mov ah, 0x02 ; display character in DL |
mov dl, 0x0D ; CR |
int 0x21 |
mov dl, 0x0A ; LF |
int 0x21 |
ret |
/svarcom/tags/svarcom-2022.4/toys/hackz.c |
---|
0,0 → 1,41 |
/* |
* reads stdin and writes to stdout after hacker-like conversion |
*/ |
#include <stdio.h> |
int main(void) { |
int c; |
while ((c = getchar()) != EOF) { |
switch (c) { |
case 'o': |
case 'O': |
c = '0'; |
break; |
case 'i': |
case 'I': |
c = '1'; |
break; |
case 'A': |
c = '4'; |
break; |
case 'a': |
c = '@'; |
break; |
case 'S': |
c = '$'; |
break; |
case 'e': |
case 'E': |
c = '3'; |
break; |
case '0': |
c = 'o'; |
break; |
} |
putchar(c); |
} |
return(0); |
} |
/svarcom/tags/svarcom-2022.4/toys/makefile |
---|
0,0 → 1,16 |
CFLAGS = -0 -mt -wx -lr -we -ox |
all: erlev.com upcase.com hackz.com fcbdir.com |
erlev.com: erlev.c |
*wcl $(CFLAGS) $< |
upcase.com: upcase.c |
*wcl $(CFLAGS) $< |
hackz.com: hackz.c |
*wcl $(CFLAGS) $< |
fcbdir.com: fcbdir.asm |
nasm fcbdir.asm -o fcbdir.com |
/svarcom/tags/svarcom-2022.4/toys/readme.txt |
---|
0,0 → 1,2 |
This directory contains tiny applications that are overall not very useful. |
Their job is only to help me test SvarCOM. |
/svarcom/tags/svarcom-2022.4/toys/upcase.c |
---|
0,0 → 1,16 |
/* |
* reads stdin and writes to stdout after upcasing |
*/ |
#include <stdio.h> |
int main(void) { |
int c; |
while ((c = getchar()) != EOF) { |
if ((c >= 'a') && (c <= 'z')) c -= ('a' - 'A'); |
putchar(c); |
} |
return(0); |
} |