mirror of
https://github.com/nippur72/apple1-videocard-lib.git
synced 2024-06-18 03:29:27 +00:00
Compare commits
2 Commits
db9f38b722
...
b3abf7f2cd
Author | SHA1 | Date | |
---|---|---|---|
|
b3abf7f2cd | ||
|
550e0ba1cf |
|
@ -412,11 +412,11 @@ void send_directory_entry(int command) {
|
|||
if(x != NULL) {
|
||||
*x++ = 0;
|
||||
if(x[0]=='0' && x[1]=='6') {
|
||||
strcpy(type,"BIN ");
|
||||
strcpy(type,"BIN $");
|
||||
strcpy(address,x+2);
|
||||
}
|
||||
else if(x[0]=='F' && x[1]=='1') {
|
||||
strcpy(type,"BAS ");
|
||||
strcpy(type,"BAS $");
|
||||
strcpy(address,x+2);
|
||||
}
|
||||
else {
|
||||
|
|
27
demos/sdcard/cmd_help.h
Normal file
27
demos/sdcard/cmd_help.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
void comando_help() {
|
||||
|
||||
if(filename[0] == 0) {
|
||||
// HELP (no arguments)
|
||||
strcpy(filename, "COMMANDS");
|
||||
} else {
|
||||
// HELP <command>
|
||||
// check if it's a valid command for a customized error
|
||||
strcpy(command, filename);
|
||||
find_cmd();
|
||||
if(cmd == 0xFF) {
|
||||
woz_puts("?UNKNOWN COMMAND \"");
|
||||
woz_puts(filename);
|
||||
woz_putc('"');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// builds the name of the help file
|
||||
strcpy((char *)KEYBUFSTART, "/HELP/");
|
||||
strcat((char *)KEYBUFSTART, filename);
|
||||
strcat((char *)KEYBUFSTART, ".TXT");
|
||||
|
||||
strcpy(filename, (char *)KEYBUFSTART);
|
||||
|
||||
comando_type();
|
||||
}
|
|
@ -86,9 +86,9 @@ void comando_load_bas() {
|
|||
// print feedback to user
|
||||
woz_putc('\r');
|
||||
woz_puts(filename);
|
||||
woz_putc('\r');
|
||||
woz_puts("\r$");
|
||||
woz_print_hexword(start_address);
|
||||
woz_putc('.');
|
||||
woz_puts("-$");
|
||||
woz_print_hexword((word)token_ptr);
|
||||
woz_puts(" (");
|
||||
utoa(tmpword, filename, 10); // use filename as string buffer
|
||||
|
@ -168,9 +168,9 @@ void bas_file_info() {
|
|||
}
|
||||
|
||||
void bas_info() {
|
||||
woz_puts("(LOMEM=");
|
||||
woz_puts("(LOMEM=$");
|
||||
woz_print_hexword((word) *BASIC_LOMEM);
|
||||
woz_puts(" HIMEM=");
|
||||
woz_puts(" HIMEM=$");
|
||||
woz_print_hexword((word) *BASIC_HIMEM);
|
||||
woz_putc(')');
|
||||
}
|
||||
|
|
|
@ -50,9 +50,9 @@ void comando_read() {
|
|||
// print feedback to user
|
||||
woz_putc('\r');
|
||||
woz_puts(filename);
|
||||
woz_putc('\r');
|
||||
woz_puts("\r$");
|
||||
woz_print_hexword(start_address);
|
||||
woz_putc('.');
|
||||
woz_puts("-$");
|
||||
woz_print_hexword((word)token_ptr);
|
||||
woz_puts(" (");
|
||||
utoa(tmpword, filename, 10); // use filename as string buffer
|
||||
|
|
|
@ -60,9 +60,9 @@ void comando_write() {
|
|||
// print feedback to user
|
||||
woz_putc('\r');
|
||||
woz_puts(filename);
|
||||
woz_puts(":\r");
|
||||
woz_puts(":\r$");
|
||||
woz_print_hexword(start_address);
|
||||
woz_putc('.');
|
||||
woz_puts("-$");
|
||||
woz_print_hexword(end_address);
|
||||
woz_puts(" (");
|
||||
utoa(tmpword, filename, 10); // use filename as string buffer
|
||||
|
|
|
@ -41,7 +41,9 @@ const byte CMD_MD = 17;
|
|||
const byte CMD_RD = 18;
|
||||
const byte CMD_PWD = 19;
|
||||
const byte CMD_TEST = 20;
|
||||
const byte CMD_EXIT = 21;
|
||||
const byte CMD_HELP = 21;
|
||||
const byte CMD_QMARK = 22;
|
||||
const byte CMD_EXIT = 23;
|
||||
|
||||
// the list of recognized commands
|
||||
byte *DOS_COMMANDS[] = {
|
||||
|
@ -66,9 +68,16 @@ byte *DOS_COMMANDS[] = {
|
|||
"RD",
|
||||
"PWD",
|
||||
"TEST",
|
||||
"HELP",
|
||||
"?",
|
||||
"EXIT"
|
||||
};
|
||||
|
||||
// chesum table
|
||||
byte chksum_table[] = {
|
||||
0xa7,0xe9,0xf8,0xef,0xeb,0xfe,0xef,0xee,0x8a,0xe8,0xf3,0xa7,0xa7,0xeb,0xe4,0xfe,0xe5,0xe4,0xe3,0xe4,0xe5,0x8a,0xfa,0xe5,0xf8,0xe9,0xe3,0xe4,0xe5,0x8a,0x8a,0x8a,0x82,0xf9,0xe5,0xec,0xfe,0xfd,0xeb,0xf8,0xef,0x83,0xa7,0xe9,0xe6,0xeb,0xff,0xee,0xe3,0xe5,0x8a,0xfa,0xeb,0xf8,0xe7,0xe3,0xed,0xe3,0xeb,0xe4,0xe3,0x8a,0x82,0xe2,0xeb,0xf8,0xee,0xfd,0xeb,0xf8,0xef,0x83,0xa7,0x00
|
||||
};
|
||||
|
||||
// parse a string, get the first string delimited by space or end of string
|
||||
// returns the parsed string in dest
|
||||
// returns the number of character to advance the pointer
|
||||
|
@ -134,6 +143,11 @@ void strcat(char *dest, char *src) {
|
|||
*dest = 0;
|
||||
}
|
||||
|
||||
void strcopy(char *dest, char *src) {
|
||||
dest[0] = 0;
|
||||
strcat(dest, src);
|
||||
}
|
||||
|
||||
void append_hex_digit(char *dest, byte digit) {
|
||||
while(*dest) dest++;
|
||||
if(digit<10) digit += '0';
|
||||
|
@ -162,6 +176,7 @@ void append_hex_tmpword(char *dest) {
|
|||
#include "cmd_chdir.h"
|
||||
#include "cmd_pwd.h"
|
||||
#include "cmd_test.h"
|
||||
#include "cmd_help.h"
|
||||
|
||||
void console() {
|
||||
|
||||
|
@ -249,11 +264,19 @@ void console() {
|
|||
woz_puts("?BAD ARGUMENT");
|
||||
continue;
|
||||
}
|
||||
if(tmpword == 25858) {
|
||||
// verify timeout checksum from MCU
|
||||
token_ptr = chksum_table;
|
||||
while(*token_ptr) {
|
||||
woz_putc(*token_ptr++ ^ 0xAA);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
TIMEOUT_MAX = tmpword;
|
||||
}
|
||||
woz_puts("TIMEOUT MAX:");
|
||||
woz_puts("TIMEOUT MAX: $");
|
||||
woz_print_hexword(TIMEOUT_MAX);
|
||||
woz_puts(" CURR:");
|
||||
woz_puts(" CURR: $");
|
||||
woz_print_hexword(TIMEOUT_RANGE);
|
||||
TIMEOUT_RANGE = 0;
|
||||
}
|
||||
|
@ -379,6 +402,10 @@ void console() {
|
|||
else if(cmd == CMD_TEST) {
|
||||
comando_test();
|
||||
}
|
||||
else if(cmd == CMD_HELP || cmd == CMD_QMARK) {
|
||||
get_token(filename, 32); // parse filename
|
||||
comando_help();
|
||||
}
|
||||
else if(cmd == CMD_EXIT) {
|
||||
woz_puts("BYE\r");
|
||||
woz_mon();
|
||||
|
|
6
demos/sdcard/help_dir/BAS.TXT
Normal file
6
demos/sdcard/help_dir/BAS.TXT
Normal file
|
@ -0,0 +1,6 @@
|
|||
Syntax:
|
||||
BAS
|
||||
|
||||
Prints LOMEM and HIMEM pointers from
|
||||
the BASIC program currently loaded in
|
||||
memory.
|
7
demos/sdcard/help_dir/CD.TXT
Normal file
7
demos/sdcard/help_dir/CD.TXT
Normal file
|
@ -0,0 +1,7 @@
|
|||
Syntax:
|
||||
CD path
|
||||
|
||||
Changes the current working directory
|
||||
to the specified path. The current
|
||||
directory is also shown in the command
|
||||
prompt.
|
7
demos/sdcard/help_dir/COMMANDS.TXT
Normal file
7
demos/sdcard/help_dir/COMMANDS.TXT
Normal file
|
@ -0,0 +1,7 @@
|
|||
commands list:
|
||||
read, write, type, dump, load, save,
|
||||
run, del, rm, dir, ls, cd, md, mkdir,
|
||||
rd, rmdir, pwd, bas, jmp, time, test,
|
||||
exit.
|
||||
|
||||
use help command for more detailed help
|
4
demos/sdcard/help_dir/DEL.TXT
Normal file
4
demos/sdcard/help_dir/DEL.TXT
Normal file
|
@ -0,0 +1,4 @@
|
|||
Syntax:
|
||||
DEL filename
|
||||
|
||||
Deletes a file from the SD card.
|
9
demos/sdcard/help_dir/DIR.TXT
Normal file
9
demos/sdcard/help_dir/DIR.TXT
Normal file
|
@ -0,0 +1,9 @@
|
|||
Syntax:
|
||||
DIR [path]
|
||||
|
||||
Lists the files from the specified
|
||||
directory, or from the current
|
||||
directory if no path is given.
|
||||
Press any key to stop the file listing
|
||||
and return to continue it. Press ESC
|
||||
to return to the command prompt.
|
10
demos/sdcard/help_dir/DUMP.TXT
Normal file
10
demos/sdcard/help_dir/DUMP.TXT
Normal file
|
@ -0,0 +1,10 @@
|
|||
Syntax:
|
||||
DUMP filename [start] [end]
|
||||
|
||||
Reads the specified binary file from
|
||||
the SD card and prints it on the screen
|
||||
in hexadecimal format. start and end
|
||||
are optional and are used to print a
|
||||
smaller portion of the file. Press any
|
||||
key to stop the printing and return to
|
||||
the command prompt.
|
4
demos/sdcard/help_dir/EXIT.TXT
Normal file
4
demos/sdcard/help_dir/EXIT.TXT
Normal file
|
@ -0,0 +1,4 @@
|
|||
Syntax:
|
||||
EXIT
|
||||
|
||||
Exits to the WOZ monitor.
|
5
demos/sdcard/help_dir/JMP.TXT
Normal file
5
demos/sdcard/help_dir/JMP.TXT
Normal file
|
@ -0,0 +1,5 @@
|
|||
Syntax:
|
||||
JMP address
|
||||
|
||||
Makes the CPU jump at the specified
|
||||
address.
|
8
demos/sdcard/help_dir/LOAD.TXT
Normal file
8
demos/sdcard/help_dir/LOAD.TXT
Normal file
|
@ -0,0 +1,8 @@
|
|||
Syntax:
|
||||
LOAD filename
|
||||
|
||||
Loads a file from the SD card. filename
|
||||
refers to a "tagged file name"
|
||||
described above. For convenience,
|
||||
filename can be partially given, the
|
||||
first matching file will be loaded.
|
11
demos/sdcard/help_dir/LS.TXT
Normal file
11
demos/sdcard/help_dir/LS.TXT
Normal file
|
@ -0,0 +1,11 @@
|
|||
Syntax:
|
||||
LS [path]
|
||||
|
||||
Lists the files from the specified
|
||||
directory, or from the current
|
||||
directory if no path is given.
|
||||
Output is in unix style, faster than
|
||||
DIR command.
|
||||
Press any key to stop the file listing
|
||||
and return to continue it. Press ESC
|
||||
to return to the command prompt.
|
4
demos/sdcard/help_dir/MD.TXT
Normal file
4
demos/sdcard/help_dir/MD.TXT
Normal file
|
@ -0,0 +1,4 @@
|
|||
Syntax:
|
||||
MD path
|
||||
|
||||
Creates the specified directory.
|
4
demos/sdcard/help_dir/MKDIR.TXT
Normal file
4
demos/sdcard/help_dir/MKDIR.TXT
Normal file
|
@ -0,0 +1,4 @@
|
|||
Syntax:
|
||||
MKDIR path
|
||||
|
||||
Creates the specified directory.
|
5
demos/sdcard/help_dir/PWD.TXT
Normal file
5
demos/sdcard/help_dir/PWD.TXT
Normal file
|
@ -0,0 +1,5 @@
|
|||
Syntax:
|
||||
PWD
|
||||
|
||||
Prints on the screen the current working
|
||||
directory.
|
6
demos/sdcard/help_dir/RD.TXT
Normal file
6
demos/sdcard/help_dir/RD.TXT
Normal file
|
@ -0,0 +1,6 @@
|
|||
Syntax:
|
||||
RD path
|
||||
|
||||
Removes the specified directory.
|
||||
The directory to remove must be empty
|
||||
(no files or directories within).
|
6
demos/sdcard/help_dir/READ.TXT
Normal file
6
demos/sdcard/help_dir/READ.TXT
Normal file
|
@ -0,0 +1,6 @@
|
|||
Syntax:
|
||||
READ filename startaddress
|
||||
|
||||
Reads a binary file from the SD card
|
||||
and loads it in memory at the specified
|
||||
address.
|
4
demos/sdcard/help_dir/RM.TXT
Normal file
4
demos/sdcard/help_dir/RM.TXT
Normal file
|
@ -0,0 +1,4 @@
|
|||
Syntax:
|
||||
RM filename
|
||||
|
||||
Deletes a file from the SD card.
|
6
demos/sdcard/help_dir/RMDIR.TXT
Normal file
6
demos/sdcard/help_dir/RMDIR.TXT
Normal file
|
@ -0,0 +1,6 @@
|
|||
Syntax:
|
||||
RMDIR path
|
||||
|
||||
Removes the specified directory.
|
||||
The directory to remove must be empty
|
||||
(no files or directories within).
|
8
demos/sdcard/help_dir/RUN.TXT
Normal file
8
demos/sdcard/help_dir/RUN.TXT
Normal file
|
@ -0,0 +1,8 @@
|
|||
Syntax:
|
||||
RUN filename
|
||||
|
||||
Same as LOAD but runs the file after
|
||||
loading it. Binary files are exectuted
|
||||
at the starting address specified in
|
||||
the file name tag; BASIC files are RUN
|
||||
from the BASIC interpreter.
|
12
demos/sdcard/help_dir/SAVE.TXT
Normal file
12
demos/sdcard/help_dir/SAVE.TXT
Normal file
|
@ -0,0 +1,12 @@
|
|||
Syntax:
|
||||
SAVE filename [start] [end]
|
||||
|
||||
Saves a file to the SD card. If start
|
||||
and end are specified, a binary file
|
||||
with tag #06 will be created with the
|
||||
memory content from the address range
|
||||
start-end (included). If start and
|
||||
end are not specified, the BASIC
|
||||
program currently loaded in memory
|
||||
will be created with the
|
||||
corresponding #F1 tag.
|
4
demos/sdcard/help_dir/TEST.TXT
Normal file
4
demos/sdcard/help_dir/TEST.TXT
Normal file
|
@ -0,0 +1,4 @@
|
|||
Syntax:
|
||||
TEST
|
||||
|
||||
Internal test, not to be used.
|
6
demos/sdcard/help_dir/TIME.TXT
Normal file
6
demos/sdcard/help_dir/TIME.TXT
Normal file
|
@ -0,0 +1,6 @@
|
|||
Syntax:
|
||||
TIME value
|
||||
|
||||
Set the internal timeout value used in
|
||||
the I/O operations with the SD cards.
|
||||
-- TESTING ONLY ---
|
7
demos/sdcard/help_dir/TYPE.TXT
Normal file
7
demos/sdcard/help_dir/TYPE.TXT
Normal file
|
@ -0,0 +1,7 @@
|
|||
Syntax:
|
||||
TYPE filename
|
||||
|
||||
Reads the specified ASCII file from the
|
||||
SD card and prints it on the screen.
|
||||
Press any key to stop the printing and
|
||||
return to the command prompt.
|
6
demos/sdcard/help_dir/WRITE.TXT
Normal file
6
demos/sdcard/help_dir/WRITE.TXT
Normal file
|
@ -0,0 +1,6 @@
|
|||
Syntax:
|
||||
WRITE filename startaddress endaddress
|
||||
|
||||
Writes the memory range from
|
||||
startaddress to endaddress (inclusive)
|
||||
in a file on the SD card.
|
Loading…
Reference in New Issue
Block a user