More syscalls and CLI beginning
Added more syscalls. Started the command line utility.
This commit is contained in:
parent
b172a7e086
commit
52f1882a25
|
@ -1,7 +1,7 @@
|
||||||
assign CS_GABE_Config_o = ( iBUS_A_i[16:6] == 11'b0_0000_0000_00) & iBUS_CS_GABE_i; // $00C00000..$00C0003F - Control Registers
|
assign CS_GABE_Config_o = ( iBUS_A_i[16:6] == 11'b0_0000_0000_00) & iBUS_CS_GABE_i; // $00C00000..$00C0003F - Control Registers
|
||||||
assign CS_A2560K_KB_o = ( iBUS_A_i[16:6] == 11'b0_0000_0000_01) & iBUS_CS_GABE_i; // $00C00040..$00C0007F - Control Registers
|
assign CS_A2560K_KB_o = ( iBUS_A_i[16:6] == 11'b0_0000_0000_01) & iBUS_CS_GABE_i; // $00C00040..$00C0007F - Control Registers
|
||||||
|
|
||||||
assign CS_RTC_o = ( iBUS_A_i[16:7] == 10'b0_0000_0000_1) & iBUS_CS_GABE_i; // $00C00000..$00C0008F - Control Registers
|
assign CS_RTC_o = ( iBUS_A_i[16:7] == 10'b0_0000_0000_1) & iBUS_CS_GABE_i; // $00C00080..$00C0008F - Control Registers
|
||||||
assign CS_Interrupt_Ctrl_o = ( iBUS_A_i[16:8] == 9'b0_0000_0001) & iBUS_CS_GABE_i; // $00C00100..$00C001FF - Interrupt Controllers
|
assign CS_Interrupt_Ctrl_o = ( iBUS_A_i[16:8] == 9'b0_0000_0001) & iBUS_CS_GABE_i; // $00C00100..$00C001FF - Interrupt Controllers
|
||||||
assign CS_Timer_o = ( iBUS_A_i[16:8] == 9'b0_0000_0010) & iBUS_CS_GABE_i; // $00C00200..$00C002FF - Timer Block
|
assign CS_Timer_o = ( iBUS_A_i[16:8] == 9'b0_0000_0010) & iBUS_CS_GABE_i; // $00C00200..$00C002FF - Timer Block
|
||||||
assign CS_SDCard_o = ( iBUS_A_i[16:8] == 9'b0_0000_0011) & iBUS_CS_GABE_i; // $00C00300..$00C003FF - SD Card Controller
|
assign CS_SDCard_o = ( iBUS_A_i[16:8] == 9'b0_0000_0011) & iBUS_CS_GABE_i; // $00C00300..$00C003FF - SD Card Controller
|
||||||
|
|
16
src/Makefile
16
src/Makefile
|
@ -15,10 +15,12 @@ snd_c_src := $(wildcard snd/*.c)
|
||||||
snd_c_obj := $(subst .c,.o,$(snd_c_src))
|
snd_c_obj := $(subst .c,.o,$(snd_c_src))
|
||||||
fat_c_src := $(wildcard fatfs/*.c)
|
fat_c_src := $(wildcard fatfs/*.c)
|
||||||
fat_c_obj := $(subst .c,.o,$(fat_c_src))
|
fat_c_obj := $(subst .c,.o,$(fat_c_src))
|
||||||
|
cli_c_src := $(wildcard cli/*.c)
|
||||||
|
cli_c_obj := $(subst .c,.o,$(cli_c_src))
|
||||||
|
|
||||||
.PHONY: all $(cpu) dev fatfs snd
|
.PHONY: all $(cpu) dev fatfs snd cli
|
||||||
|
|
||||||
all: foenixmcp.s68 $(cpu) dev snd
|
all: foenixmcp.s68 $(cpu) dev snd cli
|
||||||
|
|
||||||
$(cpu):
|
$(cpu):
|
||||||
$(MAKE) --directory=$@
|
$(MAKE) --directory=$@
|
||||||
|
@ -32,8 +34,11 @@ fatfs:
|
||||||
snd:
|
snd:
|
||||||
$(MAKE) --directory=snd
|
$(MAKE) --directory=snd
|
||||||
|
|
||||||
foenixmcp.s68: foenixmcp.o log.o ring_buffer.o interrupt.o $(cpu) dev fatfs snd
|
cli:
|
||||||
$(CC) $(CFLAGS) -o foenixmcp.s68 foenixmcp.o log.o ring_buffer.o interrupt.o $(cpu_c_obj) $(dev_c_obj) $(fat_c_obj) $(snd_c_obj)
|
$(MAKE) --directory=cli
|
||||||
|
|
||||||
|
foenixmcp.s68: foenixmcp.o log.o ring_buffer.o interrupt.o syscalls.o $(cpu) dev fatfs snd cli
|
||||||
|
$(CC) $(CFLAGS) -o foenixmcp.s68 foenixmcp.o log.o ring_buffer.o interrupt.o syscalls.o $(cpu_c_obj) $(dev_c_obj) $(fat_c_obj) $(snd_c_obj) $(cli_c_obj)
|
||||||
|
|
||||||
%.o: %.c $(DEPS)
|
%.o: %.c $(DEPS)
|
||||||
$(CC) -S -c -o $@ $< $(CFLAGS)
|
$(CC) -S -c -o $@ $< $(CFLAGS)
|
||||||
|
@ -44,3 +49,6 @@ clean:
|
||||||
$(RM) *.s68 *.o *.asm
|
$(RM) *.s68 *.o *.asm
|
||||||
$(MAKE) --directory=$(cpu) clean
|
$(MAKE) --directory=$(cpu) clean
|
||||||
$(MAKE) --directory=dev clean
|
$(MAKE) --directory=dev clean
|
||||||
|
$(MAKE) --directory=fatfs clean
|
||||||
|
$(MAKE) --directory=snd clean
|
||||||
|
$(MAKE) --directory=cli clean
|
||||||
|
|
15
src/cli/Makefile
Normal file
15
src/cli/Makefile
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
override CFLAGS = +../../vbcc/config/m68k-foenix -I. -I.. -I../include
|
||||||
|
|
||||||
|
csources = $(wildcard *.c)
|
||||||
|
cobjects = $(subst .c,.o,$(csources))
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
all: $(cobjects)
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
$(CC) -c -o $@ $< $(CFLAGS)
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) $(aobjects) $(cobjects) *.asm
|
88
src/cli/README.md
Normal file
88
src/cli/README.md
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
# Folder: CLI -- Command Line Interpreter
|
||||||
|
|
||||||
|
This folder contains the code for a simple command line interpreter (CLI) for Foenix/MCP.
|
||||||
|
This CLI supports several built-in commands tailored to the Foenix computers, as well as
|
||||||
|
running executable binary files that are supported by the operating system.
|
||||||
|
|
||||||
|
## Paths
|
||||||
|
|
||||||
|
Drives, files, and directories are specified using paths.
|
||||||
|
A path starts with an optional drive specification, which starts with an "@" character and ends with a ":". Some drive specifications:
|
||||||
|
|
||||||
|
* ``@S:`` -- The SD card slot.
|
||||||
|
* ``@F:`` -- The floppy drive (if installed).
|
||||||
|
* ``@H:`` -- The first partition of the IDE hard drive (if installed).
|
||||||
|
|
||||||
|
After the drive specification, comes the directories, separated by ":".
|
||||||
|
After the directories comes the file name, which is a name followed by a dot,
|
||||||
|
followed by the file extension.
|
||||||
|
|
||||||
|
Example paths:
|
||||||
|
|
||||||
|
* ``@S:Project Files:Hello.txt`` -- the file "Hello.txt" in the "Project Files" directory in the SD card.
|
||||||
|
* ``@H:STARTUP.SYS`` -- The "STARTUP.SYS" file in the root directory of the hard drive.
|
||||||
|
* ``:Samples:PrettyPicture.PGZ`` -- The "PrettyPicture.PGZ" file in the "Samples" directory of the current drive.
|
||||||
|
* ``game.pgz`` -- The "game.pgz" file in the current drive and directory.
|
||||||
|
|
||||||
|
## External Commands
|
||||||
|
|
||||||
|
If the first "word" entered on a line is not recognized as a built-in command, the CLI
|
||||||
|
will look to see if there is an executable file in the search path corresponding to that word.
|
||||||
|
To match, the word must be the same as the file name (case does not matter), and the extension
|
||||||
|
of the file must be that of an executable file format supported by the Foenix/MCP.
|
||||||
|
|
||||||
|
If a matching executable is found, it will be loaded and executed.
|
||||||
|
|
||||||
|
**How exactly this is to be done is TBD.**
|
||||||
|
|
||||||
|
## Built-in Commands
|
||||||
|
|
||||||
|
Several commands accept numbers as arguments.
|
||||||
|
All numbers may be specified using decimal, binary, or hexidecimal formats.
|
||||||
|
Hexidecimal numbers may be specified either with a leading "$" or a leading "0x".
|
||||||
|
Binary numbers may be specified using either "%" or "0b" as a prefix.
|
||||||
|
|
||||||
|
* ``1234`` -- Decimal 1234
|
||||||
|
* ``0`` -- Decimal 0
|
||||||
|
* ``0xff`` -- Hexidecimal 255
|
||||||
|
* ``$000A`` -- Hexidecimal 10
|
||||||
|
* ``%111`` -- Binary 7
|
||||||
|
* ``0b1010`` -- Binary 10
|
||||||
|
|
||||||
|
### Storage Media Commands
|
||||||
|
|
||||||
|
* ``DIR <path>`` -- Print a directory listing for a given drive or directory.
|
||||||
|
* ``DEL <path>`` -- Delete a file.
|
||||||
|
* ``MKDIR <path>`` -- Create a directory.
|
||||||
|
* ``RMDIR <path>`` -- Delete a directory.
|
||||||
|
* ``RENAME <old path> <new name>`` -- Rename a file.
|
||||||
|
* ``COPY <src path> <dest path>`` -- Copy a file (possibly to another drive or folder).
|
||||||
|
* ``PWD`` -- Print the current default drive/directory.
|
||||||
|
* ``CD <path>`` -- Change the default drive/directory.
|
||||||
|
|
||||||
|
### Memory Commands
|
||||||
|
|
||||||
|
* ``DUMP <address> <count>`` -- Print out ``<count>`` bytes of memory starting at ``<address>``
|
||||||
|
* ``POKE8 <address> <value>`` -- Store the 8-bit ``<value>`` to memory at ``<address>``
|
||||||
|
* ``POKE16 <address> <value>`` -- Store the 16-bit ``<value>`` to memory at ``<address>``
|
||||||
|
* ``POKE32 <address> <value>`` -- Store the 32-bit ``<value>`` to memory at ``<address>``
|
||||||
|
* ``PEEK8 <address>`` -- Print the 8-bit value in memory at ``<address>``
|
||||||
|
* ``PEEK16 <address>`` -- Print the 8-bit value in memory at ``<address>``
|
||||||
|
* ``PEEK32 <address>`` -- Print the 8-bit value in memory at ``<address>``
|
||||||
|
* ``BLOAD <path> [<address>]`` -- Load a binary file into memory (optionally force an address)
|
||||||
|
* ``BSAVE <path> <start address> <size>`` -- Save a block of memory to a file
|
||||||
|
|
||||||
|
### Graphics Commands
|
||||||
|
|
||||||
|
All graphics commands take a screen number: 0 = Channel A, or the main screen; 1 = Channel B, or the EVID card (if present).
|
||||||
|
|
||||||
|
* ``TEXTCOLOR <screen> <foreground> <background>`` -- Set the text foreground and background colors using color numbers in the text color look up tables.
|
||||||
|
* ``SETBORDER <screen> <visible> [<size> [<r> <g> <b>]]`` -- Set the border visibility, size, and color. Visible is 0 for "no", any other number for "yes". ``<size>`` is in pixels. The colors are specified in RGB color components from 0 to 255.
|
||||||
|
* ``SETCOLOR <lut #> <color #> <r> <g> <b>`` -- Set a color in a look up table to a specific RGB color using components in the range 0 to 255.
|
||||||
|
* ``GRAPHICS <screen> [<mode>]`` -- Set the graphics mode (if no mode specified, go back to text only mode)
|
||||||
|
* ``CLS <screen>`` -- Clear the text screen.
|
||||||
|
|
||||||
|
## Possible Future Developments
|
||||||
|
|
||||||
|
* Environment Variables
|
||||||
|
* Simple scripting ability to be executed at boot time from the selected boot device
|
150
src/cli/cli.c
Normal file
150
src/cli/cli.c
Normal file
|
@ -0,0 +1,150 @@
|
||||||
|
/**
|
||||||
|
* Implementation of the command line interface
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "types.h"
|
||||||
|
#include "syscalls.h"
|
||||||
|
#include "cli/cli.h"
|
||||||
|
#include "cli/dos_cmds.h"
|
||||||
|
|
||||||
|
#define MAX_COMMAND_SIZE 128
|
||||||
|
|
||||||
|
//
|
||||||
|
// Types
|
||||||
|
//
|
||||||
|
|
||||||
|
// Structure to hold a record about a command...
|
||||||
|
|
||||||
|
typedef struct s_cli_command {
|
||||||
|
char *name;
|
||||||
|
char *help;
|
||||||
|
cli_cmd_handler handler;
|
||||||
|
} t_cli_command, *p_cli_command;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Commands
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern const t_cli_command g_cli_commands[];
|
||||||
|
|
||||||
|
//
|
||||||
|
// List all the commands
|
||||||
|
//
|
||||||
|
int cmd_help(short channel, char * parameters) {
|
||||||
|
p_cli_command command;
|
||||||
|
|
||||||
|
for (command = g_cli_commands; (command != 0) && (command->name != 0); command++) {
|
||||||
|
sys_chan_write(channel, command->help, strlen(command->help));
|
||||||
|
sys_chan_write(channel, "\n", 2);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// CLI variables
|
||||||
|
//
|
||||||
|
|
||||||
|
const t_cli_command g_cli_commands[] = {
|
||||||
|
{ "DIR", "DIR <path> -- print directory listing", cmd_dir },
|
||||||
|
{ "MBR", "MBR @S: | @F: | @H: -- fetch and display the MBR of the drive", cmd_dump_mbr},
|
||||||
|
{ "HELP", "HELP -- print this helpful message", cmd_help },
|
||||||
|
{ "?", "? -- print this helpful message", cmd_help },
|
||||||
|
{ 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Attempt to execute a command
|
||||||
|
//
|
||||||
|
// Inputs:
|
||||||
|
// command = the upper case name of the command (first word of the command line)
|
||||||
|
// parameters = the string of parameters to be passed to the command
|
||||||
|
//
|
||||||
|
short cli_exec(short channel, char * command, char * parameters) {
|
||||||
|
const char * cmd_not_found = "Command not found.\n";
|
||||||
|
|
||||||
|
p_cli_command commands;
|
||||||
|
|
||||||
|
commands = g_cli_commands;
|
||||||
|
|
||||||
|
while ((commands != 0) && (commands->name != 0)) {
|
||||||
|
// Does the command match the name?
|
||||||
|
if (strcmp(commands->name, command) == 0) {
|
||||||
|
// Found it, execute the handler
|
||||||
|
return commands->handler(channel, parameters);
|
||||||
|
} else {
|
||||||
|
// No match, keep checking...
|
||||||
|
commands++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Built in command not found..
|
||||||
|
// TODO: search the current drive for an executable file
|
||||||
|
sys_chan_write(channel, cmd_not_found, strlen(cmd_not_found));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char * command_line[MAX_COMMAND_SIZE];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Enter the CLI's read-eval-print loop
|
||||||
|
//
|
||||||
|
short cli_repl(short channel) {
|
||||||
|
char * command;
|
||||||
|
char * parameters;
|
||||||
|
|
||||||
|
const char * welcome = "\n\nFoenix/MCP Command Line Utility... online.\nType \"HELP\" or \"?\" for help.\n\n";
|
||||||
|
sys_chan_write(channel, welcome, strlen(welcome));
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
sys_chan_write(channel, "\n> ", 3); // Print our prompt
|
||||||
|
sys_chan_readline(channel, command_line, MAX_COMMAND_SIZE); // Attempt to read line
|
||||||
|
sys_chan_write(channel, "\n", 1);
|
||||||
|
|
||||||
|
// Start at the beginning of the command line
|
||||||
|
command = command_line;
|
||||||
|
|
||||||
|
// Skip over leading white space
|
||||||
|
while (*command != 0 && isspace(*command)) {
|
||||||
|
command++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start at the beginning of the command
|
||||||
|
parameters = command;
|
||||||
|
|
||||||
|
// Skip over any non-space character... converting to uppercase as we go
|
||||||
|
while (*parameters != 0 && !isspace(*parameters)) {
|
||||||
|
if (islower(*parameters)) {
|
||||||
|
*parameters = toupper(*parameters);
|
||||||
|
}
|
||||||
|
parameters++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we're not at the end of the line
|
||||||
|
if (*parameters != 0) {
|
||||||
|
// Mark this spot with a 0... end of command
|
||||||
|
*parameters++ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we are at a space, move to the first non-space character
|
||||||
|
while (*parameters != 0 && isspace(*parameters)) {
|
||||||
|
parameters++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to execute the command
|
||||||
|
cli_exec(channel, command, parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialize the CLI
|
||||||
|
//
|
||||||
|
// Returns:
|
||||||
|
// 0 on success, negative number on error
|
||||||
|
//
|
||||||
|
short cli_init() {
|
||||||
|
return 0;
|
||||||
|
}
|
37
src/cli/cli.h
Normal file
37
src/cli/cli.h
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
/**
|
||||||
|
* Command Line Interface
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __CLI_H
|
||||||
|
#define __CLI_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A function pointer for command implementations:
|
||||||
|
* int cmd_foo(short screen, char * parameters) { ... }
|
||||||
|
*/
|
||||||
|
typedef int (*cli_cmd_handler)(short screen, char * parameters);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* About the CLI...
|
||||||
|
* The CLI will interpret simple commands from the console in the style of CP/M, DOS, Unix, etc.
|
||||||
|
* There are built-in commands, but if a command is issued that is not a built-in, the CLI
|
||||||
|
* will look for an executable file with that name somewhere in the search path.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the CLI
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* 0 on success, negative number on error
|
||||||
|
*/
|
||||||
|
extern short cli_init();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter the CLI's read-eval-print loop
|
||||||
|
*
|
||||||
|
* Inputs:
|
||||||
|
* channel = the console channel to use for I/O
|
||||||
|
*/
|
||||||
|
extern short cli_repl(short channel);
|
||||||
|
|
||||||
|
#endif
|
121
src/cli/dos_cmds.c
Normal file
121
src/cli/dos_cmds.c
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "syscalls.h"
|
||||||
|
#include "cli/dos_cmds.h"
|
||||||
|
#include "dev/block.h"
|
||||||
|
#include "fatfs/ff.h"
|
||||||
|
|
||||||
|
void test_get_mbr(short screen, short device) {
|
||||||
|
short x;
|
||||||
|
short result;
|
||||||
|
char buffer[512];
|
||||||
|
|
||||||
|
for (x = 0; x < 512; x++) {
|
||||||
|
buffer[x] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bdev_init(device);
|
||||||
|
|
||||||
|
print(1, "Master Boot Record:\n");
|
||||||
|
result = bdev_read(device, 0, buffer, 512);
|
||||||
|
if (result > 0) {
|
||||||
|
for (x = 0; x < result; x++) {
|
||||||
|
if (x % 16 == 0) {
|
||||||
|
print(screen, "\n");
|
||||||
|
}
|
||||||
|
print_hex(screen, buffer[x]);
|
||||||
|
print(screen, " ");
|
||||||
|
}
|
||||||
|
print(screen, "\n");
|
||||||
|
} else if (result < 0) {
|
||||||
|
DEBUG("Drive returned an error.");
|
||||||
|
} else {
|
||||||
|
DEBUG("Drive returned nothing.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fetch and display the MBR for the specified device:
|
||||||
|
*
|
||||||
|
* Inputs:
|
||||||
|
* drive = "@S" for SDC, "@H" for hard drive
|
||||||
|
*/
|
||||||
|
short cmd_dump_mbr(short screen, char * drive) {
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < strlen(drive); i++) {
|
||||||
|
if (islower(drive[i])) {
|
||||||
|
drive[i] = toupper(drive[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcmp(drive, "@S:") == 0) {
|
||||||
|
test_get_mbr(screen, BDEV_SDC);
|
||||||
|
|
||||||
|
} else if (strcmp(drive, "@H:") == 0) {
|
||||||
|
test_get_mbr(screen, BDEV_HDC);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
const char * bad_spec = "Error: Unknown specification.";
|
||||||
|
sys_chan_write(screen, bad_spec, strlen(bad_spec));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DIR my_dir;
|
||||||
|
FILINFO my_file;
|
||||||
|
FATFS my_fs;
|
||||||
|
|
||||||
|
short dos_cmd_dir(short screen, char * path) {
|
||||||
|
FRESULT fres;
|
||||||
|
char line[255];
|
||||||
|
|
||||||
|
print(screen, "Attempting to read directory for [");
|
||||||
|
print(screen, path);
|
||||||
|
print(screen, "]\n");
|
||||||
|
|
||||||
|
fres = f_mount(&my_fs, path, 0);
|
||||||
|
if (fres == FR_OK) {
|
||||||
|
fres = f_opendir(&my_dir, "/");
|
||||||
|
if (fres == FR_OK) {
|
||||||
|
do {
|
||||||
|
fres = f_readdir(&my_dir, &my_file);
|
||||||
|
if ((fres == FR_OK) && (my_file.fname[0] != 0)) {
|
||||||
|
if ((my_file.fattrib & AM_HID) == 0) {
|
||||||
|
sys_chan_write(screen, my_file.fname, strlen(my_file.fname));
|
||||||
|
if (my_file.fattrib & AM_DIR) {
|
||||||
|
sys_chan_write_b(screen, '/');
|
||||||
|
}
|
||||||
|
sys_chan_write(screen, "\n", 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while(1);
|
||||||
|
|
||||||
|
f_closedir(&my_dir);
|
||||||
|
} else {
|
||||||
|
char * err = "Could not open directory: ";
|
||||||
|
sys_chan_write(screen, err, strlen(err));
|
||||||
|
//print_hex_16(screen, fres);
|
||||||
|
sys_chan_write_b(screen, '\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
f_mount(0, "", 0);
|
||||||
|
} else {
|
||||||
|
char * err = "Could not mount drive: ";
|
||||||
|
//sys_chan_write(screen, err, strlen(err));
|
||||||
|
print_hex_16(screen, fres);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* List the directory at the given path
|
||||||
|
*/
|
||||||
|
short cmd_dir(short screen, char * path) {
|
||||||
|
return dos_cmd_dir(screen, path);
|
||||||
|
}
|
21
src/cli/dos_cmds.h
Normal file
21
src/cli/dos_cmds.h
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
/*
|
||||||
|
* Declare DOS commands
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __DOS_CMDS_H
|
||||||
|
#define __DOS_CMDS_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fetch and display the MBR for the specified device:
|
||||||
|
*
|
||||||
|
* Inputs:
|
||||||
|
* drive = "@S" for SDC, "@H" for hard drive
|
||||||
|
*/
|
||||||
|
extern short cmd_dump_mbr(char * drive);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* List the directory at the given path
|
||||||
|
*/
|
||||||
|
extern short cmd_dir(char * path);
|
||||||
|
|
||||||
|
#endif
|
|
@ -7,9 +7,9 @@ cobjects = $(subst .c,.o,$(csources))
|
||||||
all: $(cobjects)
|
all: $(cobjects)
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(CC) -k -c -o $@ $< $(CFLAGS)
|
$(CC) -c -o $@ $< $(CFLAGS)
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) $(aobjects) $(cobjects)
|
$(RM) $(aobjects) $(cobjects) *.asm
|
||||||
|
|
|
@ -1,395 +0,0 @@
|
||||||
idnt "block.c"
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
section "CODE",code
|
|
||||||
public _bdev_init_system
|
|
||||||
cnop 0,4
|
|
||||||
_bdev_init_system
|
|
||||||
movem.l l7,-(a7)
|
|
||||||
moveq #0,d1
|
|
||||||
bra l4
|
|
||||||
l3
|
|
||||||
moveq #30,d0
|
|
||||||
move.l d0,d2
|
|
||||||
move.l d1,d3
|
|
||||||
swap d2
|
|
||||||
swap d3
|
|
||||||
mulu.w d1,d2
|
|
||||||
mulu.w d0,d3
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d3,d2
|
|
||||||
swap d2
|
|
||||||
clr.w d2
|
|
||||||
add.l d2,d0
|
|
||||||
lea _g_block_devs,a0
|
|
||||||
move.w #0,(0,a0,d0.l)
|
|
||||||
moveq #30,d0
|
|
||||||
move.l d0,d2
|
|
||||||
move.l d1,d3
|
|
||||||
swap d2
|
|
||||||
swap d3
|
|
||||||
mulu.w d1,d2
|
|
||||||
mulu.w d0,d3
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d3,d2
|
|
||||||
swap d2
|
|
||||||
clr.w d2
|
|
||||||
add.l d2,d0
|
|
||||||
lea _g_block_devs,a0
|
|
||||||
move.l #0,(2,a0,d0.l)
|
|
||||||
l6
|
|
||||||
addq.l #1,d1
|
|
||||||
l4
|
|
||||||
moveq #8,d0
|
|
||||||
cmp.l d1,d0
|
|
||||||
bgt l3
|
|
||||||
l5
|
|
||||||
l1
|
|
||||||
l7 reg d2/d3
|
|
||||||
movem.l (a7)+,d2/d3
|
|
||||||
l9 equ 8
|
|
||||||
rts
|
|
||||||
; stacksize=8
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _bdev_register
|
|
||||||
cnop 0,4
|
|
||||||
_bdev_register
|
|
||||||
movem.l l15,-(a7)
|
|
||||||
move.l (4+l17,a7),a3
|
|
||||||
move.w (a3),d1
|
|
||||||
cmp.w #8,d1
|
|
||||||
bge l13
|
|
||||||
l12
|
|
||||||
move.w d1,d0
|
|
||||||
ext.l d0
|
|
||||||
moveq #30,d2
|
|
||||||
move.l d0,d3
|
|
||||||
move.l d2,d4
|
|
||||||
swap d3
|
|
||||||
swap d4
|
|
||||||
mulu.w d2,d3
|
|
||||||
mulu.w d0,d4
|
|
||||||
mulu.w d2,d0
|
|
||||||
add.w d4,d3
|
|
||||||
swap d3
|
|
||||||
clr.w d3
|
|
||||||
add.l d3,d0
|
|
||||||
lea _g_block_devs,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l a0,a2
|
|
||||||
move.w (a3),(a2)
|
|
||||||
move.l (2,a3),(2,a2)
|
|
||||||
move.l (6,a3),(6,a2)
|
|
||||||
move.l (10,a3),(10,a2)
|
|
||||||
move.l (14,a3),(14,a2)
|
|
||||||
move.l (18,a3),(18,a2)
|
|
||||||
move.l (22,a3),(22,a2)
|
|
||||||
move.l (26,a3),(26,a2)
|
|
||||||
moveq #0,d0
|
|
||||||
bra l10
|
|
||||||
l13
|
|
||||||
moveq #-2,d0
|
|
||||||
l14
|
|
||||||
l10
|
|
||||||
l15 reg a2/a3/d2/d3/d4
|
|
||||||
movem.l (a7)+,a2/a3/d2/d3/d4
|
|
||||||
l17 equ 20
|
|
||||||
rts
|
|
||||||
; stacksize=20
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _bdev_init
|
|
||||||
cnop 0,4
|
|
||||||
_bdev_init
|
|
||||||
subq.w #8,a7
|
|
||||||
movem.l l25,-(a7)
|
|
||||||
move.w (14+l27,a7),d2
|
|
||||||
cmp.w #8,d2
|
|
||||||
bge l21
|
|
||||||
l20
|
|
||||||
move.w d2,d0
|
|
||||||
ext.l d0
|
|
||||||
moveq #30,d1
|
|
||||||
move.l d0,d3
|
|
||||||
move.l d1,d4
|
|
||||||
swap d3
|
|
||||||
swap d4
|
|
||||||
mulu.w d1,d3
|
|
||||||
mulu.w d0,d4
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d4,d3
|
|
||||||
swap d3
|
|
||||||
clr.w d3
|
|
||||||
add.l d3,d0
|
|
||||||
lea _g_block_devs,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l a0,a2
|
|
||||||
cmp.w (a2),d2
|
|
||||||
bne l23
|
|
||||||
l22
|
|
||||||
move.l (6,a2),a1
|
|
||||||
move.l a1,(4+l27,a7)
|
|
||||||
jsr (a1)
|
|
||||||
bra l18
|
|
||||||
l23
|
|
||||||
moveq #-2,d0
|
|
||||||
l24
|
|
||||||
l21
|
|
||||||
l18
|
|
||||||
l25 reg a2/d2/d3/d4
|
|
||||||
movem.l (a7)+,a2/d2/d3/d4
|
|
||||||
l27 equ 16
|
|
||||||
addq.w #8,a7
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _bdev_read
|
|
||||||
cnop 0,4
|
|
||||||
_bdev_read
|
|
||||||
subq.w #8,a7
|
|
||||||
movem.l l35,-(a7)
|
|
||||||
move.w (26+l37,a7),d4
|
|
||||||
move.l (16+l37,a7),d3
|
|
||||||
move.w (14+l37,a7),d2
|
|
||||||
move.l (20+l37,a7),a3
|
|
||||||
cmp.w #8,d2
|
|
||||||
bge l31
|
|
||||||
l30
|
|
||||||
move.w d2,d0
|
|
||||||
ext.l d0
|
|
||||||
moveq #30,d1
|
|
||||||
move.l d0,d5
|
|
||||||
move.l d1,d6
|
|
||||||
swap d5
|
|
||||||
swap d6
|
|
||||||
mulu.w d1,d5
|
|
||||||
mulu.w d0,d6
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d6,d5
|
|
||||||
swap d5
|
|
||||||
clr.w d5
|
|
||||||
add.l d5,d0
|
|
||||||
lea _g_block_devs,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l a0,a2
|
|
||||||
cmp.w (a2),d2
|
|
||||||
bne l33
|
|
||||||
l32
|
|
||||||
move.w d4,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
move.l a3,-(a7)
|
|
||||||
move.l d3,-(a7)
|
|
||||||
move.l (10,a2),a1
|
|
||||||
move.l a1,(16+l37,a7)
|
|
||||||
jsr (a1)
|
|
||||||
add.w #12,a7
|
|
||||||
bra l28
|
|
||||||
l33
|
|
||||||
moveq #-2,d0
|
|
||||||
l34
|
|
||||||
l31
|
|
||||||
l28
|
|
||||||
l35 reg a2/a3/d2/d3/d4/d5/d6
|
|
||||||
movem.l (a7)+,a2/a3/d2/d3/d4/d5/d6
|
|
||||||
l37 equ 28
|
|
||||||
addq.w #8,a7
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _bdev_write
|
|
||||||
cnop 0,4
|
|
||||||
_bdev_write
|
|
||||||
subq.w #8,a7
|
|
||||||
movem.l l45,-(a7)
|
|
||||||
move.w (26+l47,a7),d4
|
|
||||||
move.l (16+l47,a7),d3
|
|
||||||
move.w (14+l47,a7),d2
|
|
||||||
move.l (20+l47,a7),a3
|
|
||||||
cmp.w #8,d2
|
|
||||||
bge l41
|
|
||||||
l40
|
|
||||||
move.w d2,d0
|
|
||||||
ext.l d0
|
|
||||||
moveq #30,d1
|
|
||||||
move.l d0,d5
|
|
||||||
move.l d1,d6
|
|
||||||
swap d5
|
|
||||||
swap d6
|
|
||||||
mulu.w d1,d5
|
|
||||||
mulu.w d0,d6
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d6,d5
|
|
||||||
swap d5
|
|
||||||
clr.w d5
|
|
||||||
add.l d5,d0
|
|
||||||
lea _g_block_devs,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l a0,a2
|
|
||||||
cmp.w (a2),d2
|
|
||||||
bne l43
|
|
||||||
l42
|
|
||||||
move.w d4,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
move.l a3,-(a7)
|
|
||||||
move.l d3,-(a7)
|
|
||||||
move.l (14,a2),a1
|
|
||||||
move.l a1,(16+l47,a7)
|
|
||||||
jsr (a1)
|
|
||||||
add.w #12,a7
|
|
||||||
bra l38
|
|
||||||
l43
|
|
||||||
moveq #-2,d0
|
|
||||||
l44
|
|
||||||
l41
|
|
||||||
l38
|
|
||||||
l45 reg a2/a3/d2/d3/d4/d5/d6
|
|
||||||
movem.l (a7)+,a2/a3/d2/d3/d4/d5/d6
|
|
||||||
l47 equ 28
|
|
||||||
addq.w #8,a7
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _bdev_status
|
|
||||||
cnop 0,4
|
|
||||||
_bdev_status
|
|
||||||
subq.w #8,a7
|
|
||||||
movem.l l55,-(a7)
|
|
||||||
move.w (14+l57,a7),d2
|
|
||||||
cmp.w #8,d2
|
|
||||||
bge l51
|
|
||||||
l50
|
|
||||||
move.w d2,d0
|
|
||||||
ext.l d0
|
|
||||||
moveq #30,d1
|
|
||||||
move.l d0,d3
|
|
||||||
move.l d1,d4
|
|
||||||
swap d3
|
|
||||||
swap d4
|
|
||||||
mulu.w d1,d3
|
|
||||||
mulu.w d0,d4
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d4,d3
|
|
||||||
swap d3
|
|
||||||
clr.w d3
|
|
||||||
add.l d3,d0
|
|
||||||
lea _g_block_devs,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l a0,a2
|
|
||||||
cmp.w (a2),d2
|
|
||||||
bne l53
|
|
||||||
l52
|
|
||||||
move.l (18,a2),a1
|
|
||||||
move.l a1,(4+l57,a7)
|
|
||||||
jsr (a1)
|
|
||||||
bra l48
|
|
||||||
l53
|
|
||||||
moveq #-2,d0
|
|
||||||
l54
|
|
||||||
l51
|
|
||||||
l48
|
|
||||||
l55 reg a2/d2/d3/d4
|
|
||||||
movem.l (a7)+,a2/d2/d3/d4
|
|
||||||
l57 equ 16
|
|
||||||
addq.w #8,a7
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _bdev_flush
|
|
||||||
cnop 0,4
|
|
||||||
_bdev_flush
|
|
||||||
subq.w #8,a7
|
|
||||||
movem.l l65,-(a7)
|
|
||||||
move.w (14+l67,a7),d2
|
|
||||||
cmp.w #8,d2
|
|
||||||
bge l61
|
|
||||||
l60
|
|
||||||
move.w d2,d0
|
|
||||||
ext.l d0
|
|
||||||
moveq #30,d1
|
|
||||||
move.l d0,d3
|
|
||||||
move.l d1,d4
|
|
||||||
swap d3
|
|
||||||
swap d4
|
|
||||||
mulu.w d1,d3
|
|
||||||
mulu.w d0,d4
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d4,d3
|
|
||||||
swap d3
|
|
||||||
clr.w d3
|
|
||||||
add.l d3,d0
|
|
||||||
lea _g_block_devs,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l a0,a2
|
|
||||||
cmp.w (a2),d2
|
|
||||||
bne l63
|
|
||||||
l62
|
|
||||||
move.l (22,a2),a1
|
|
||||||
move.l a1,(4+l67,a7)
|
|
||||||
jsr (a1)
|
|
||||||
bra l58
|
|
||||||
l63
|
|
||||||
moveq #-2,d0
|
|
||||||
l64
|
|
||||||
l61
|
|
||||||
l58
|
|
||||||
l65 reg a2/d2/d3/d4
|
|
||||||
movem.l (a7)+,a2/d2/d3/d4
|
|
||||||
l67 equ 16
|
|
||||||
addq.w #8,a7
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _bdev_ioctrl
|
|
||||||
cnop 0,4
|
|
||||||
_bdev_ioctrl
|
|
||||||
subq.w #8,a7
|
|
||||||
movem.l l75,-(a7)
|
|
||||||
move.w (26+l77,a7),d4
|
|
||||||
move.w (18+l77,a7),d3
|
|
||||||
move.w (14+l77,a7),d2
|
|
||||||
move.l (20+l77,a7),a3
|
|
||||||
cmp.w #8,d2
|
|
||||||
bge l71
|
|
||||||
l70
|
|
||||||
move.w d2,d0
|
|
||||||
ext.l d0
|
|
||||||
moveq #30,d1
|
|
||||||
move.l d0,d5
|
|
||||||
move.l d1,d6
|
|
||||||
swap d5
|
|
||||||
swap d6
|
|
||||||
mulu.w d1,d5
|
|
||||||
mulu.w d0,d6
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d6,d5
|
|
||||||
swap d5
|
|
||||||
clr.w d5
|
|
||||||
add.l d5,d0
|
|
||||||
lea _g_block_devs,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l a0,a2
|
|
||||||
cmp.w (a2),d2
|
|
||||||
bne l73
|
|
||||||
l72
|
|
||||||
move.w d4,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
move.l a3,-(a7)
|
|
||||||
move.w d3,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
move.l (26,a2),a1
|
|
||||||
move.l a1,(16+l77,a7)
|
|
||||||
jsr (a1)
|
|
||||||
add.w #12,a7
|
|
||||||
bra l68
|
|
||||||
l73
|
|
||||||
moveq #-2,d0
|
|
||||||
l74
|
|
||||||
l71
|
|
||||||
l68
|
|
||||||
l75 reg a2/a3/d2/d3/d4/d5/d6
|
|
||||||
movem.l (a7)+,a2/a3/d2/d3/d4/d5/d6
|
|
||||||
l77 equ 28
|
|
||||||
addq.w #8,a7
|
|
||||||
rts
|
|
||||||
public _g_block_devs
|
|
||||||
section "BSS",bss
|
|
||||||
cnop 0,4
|
|
||||||
_g_block_devs
|
|
||||||
ds.b 240
|
|
|
@ -2,6 +2,7 @@
|
||||||
* Implementation of block device routines
|
* Implementation of block device routines
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "log.h"
|
||||||
#include "block.h"
|
#include "block.h"
|
||||||
|
|
||||||
t_dev_block g_block_devs[BDEV_DEVICES_MAX];
|
t_dev_block g_block_devs[BDEV_DEVICES_MAX];
|
||||||
|
@ -11,6 +12,9 @@ t_dev_block g_block_devs[BDEV_DEVICES_MAX];
|
||||||
//
|
//
|
||||||
void bdev_init_system() {
|
void bdev_init_system() {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
TRACE("bdev_init_system");
|
||||||
|
|
||||||
for (i = 0; i < BDEV_DEVICES_MAX; i++) {
|
for (i = 0; i < BDEV_DEVICES_MAX; i++) {
|
||||||
g_block_devs[i].number = 0;
|
g_block_devs[i].number = 0;
|
||||||
g_block_devs[i].name = 0;
|
g_block_devs[i].name = 0;
|
||||||
|
@ -23,6 +27,8 @@ void bdev_init_system() {
|
||||||
short bdev_register(p_dev_block device) {
|
short bdev_register(p_dev_block device) {
|
||||||
short dev;
|
short dev;
|
||||||
|
|
||||||
|
TRACE("bdev_register");
|
||||||
|
|
||||||
dev = device->number;
|
dev = device->number;
|
||||||
if (dev < BDEV_DEVICES_MAX) {
|
if (dev < BDEV_DEVICES_MAX) {
|
||||||
// Copy the device description into the master table
|
// Copy the device description into the master table
|
||||||
|
@ -52,6 +58,9 @@ short bdev_register(p_dev_block device) {
|
||||||
// 0 on success, any negative number is an error code
|
// 0 on success, any negative number is an error code
|
||||||
//
|
//
|
||||||
short bdev_init(short dev) {
|
short bdev_init(short dev) {
|
||||||
|
|
||||||
|
TRACE("bdev_init");
|
||||||
|
|
||||||
if (dev < BDEV_DEVICES_MAX) {
|
if (dev < BDEV_DEVICES_MAX) {
|
||||||
p_dev_block bdev = &g_block_devs[dev];
|
p_dev_block bdev = &g_block_devs[dev];
|
||||||
if (bdev->number == dev) {
|
if (bdev->number == dev) {
|
||||||
|
@ -75,6 +84,8 @@ short bdev_init(short dev) {
|
||||||
// number of bytes read, any negative number is an error code
|
// number of bytes read, any negative number is an error code
|
||||||
//
|
//
|
||||||
short bdev_read(short dev, long lba, unsigned char * buffer, short size) {
|
short bdev_read(short dev, long lba, unsigned char * buffer, short size) {
|
||||||
|
TRACE("bdev_read");
|
||||||
|
|
||||||
if (dev < BDEV_DEVICES_MAX) {
|
if (dev < BDEV_DEVICES_MAX) {
|
||||||
p_dev_block bdev = &g_block_devs[dev];
|
p_dev_block bdev = &g_block_devs[dev];
|
||||||
if (bdev->number == dev) {
|
if (bdev->number == dev) {
|
||||||
|
@ -98,6 +109,8 @@ short bdev_read(short dev, long lba, unsigned char * buffer, short size) {
|
||||||
// number of bytes written, any negative number is an error code
|
// number of bytes written, any negative number is an error code
|
||||||
//
|
//
|
||||||
short bdev_write(short dev, long lba, const unsigned char * buffer, short size) {
|
short bdev_write(short dev, long lba, const unsigned char * buffer, short size) {
|
||||||
|
TRACE("bdev_write");
|
||||||
|
|
||||||
if (dev < BDEV_DEVICES_MAX) {
|
if (dev < BDEV_DEVICES_MAX) {
|
||||||
p_dev_block bdev = &g_block_devs[dev];
|
p_dev_block bdev = &g_block_devs[dev];
|
||||||
if (bdev->number == dev) {
|
if (bdev->number == dev) {
|
||||||
|
@ -118,6 +131,8 @@ short bdev_write(short dev, long lba, const unsigned char * buffer, short size)
|
||||||
// the status of the device
|
// the status of the device
|
||||||
//
|
//
|
||||||
short bdev_status(short dev) {
|
short bdev_status(short dev) {
|
||||||
|
TRACE("bdev_status");
|
||||||
|
|
||||||
if (dev < BDEV_DEVICES_MAX) {
|
if (dev < BDEV_DEVICES_MAX) {
|
||||||
p_dev_block bdev = &g_block_devs[dev];
|
p_dev_block bdev = &g_block_devs[dev];
|
||||||
if (bdev->number == dev) {
|
if (bdev->number == dev) {
|
||||||
|
@ -138,6 +153,8 @@ short bdev_status(short dev) {
|
||||||
// 0 on success, any negative number is an error code
|
// 0 on success, any negative number is an error code
|
||||||
//
|
//
|
||||||
short bdev_flush(short dev) {
|
short bdev_flush(short dev) {
|
||||||
|
TRACE("bdev_flush");
|
||||||
|
|
||||||
if (dev < BDEV_DEVICES_MAX) {
|
if (dev < BDEV_DEVICES_MAX) {
|
||||||
p_dev_block bdev = &g_block_devs[dev];
|
p_dev_block bdev = &g_block_devs[dev];
|
||||||
if (bdev->number == dev) {
|
if (bdev->number == dev) {
|
||||||
|
@ -161,6 +178,8 @@ short bdev_flush(short dev) {
|
||||||
// 0 on success, any negative number is an error code
|
// 0 on success, any negative number is an error code
|
||||||
//
|
//
|
||||||
short bdev_ioctrl(short dev, short command, unsigned char * buffer, short size) {
|
short bdev_ioctrl(short dev, short command, unsigned char * buffer, short size) {
|
||||||
|
TRACE("bdev_ioctrl");
|
||||||
|
|
||||||
if (dev < BDEV_DEVICES_MAX) {
|
if (dev < BDEV_DEVICES_MAX) {
|
||||||
p_dev_block bdev = &g_block_devs[dev];
|
p_dev_block bdev = &g_block_devs[dev];
|
||||||
if (bdev->number == dev) {
|
if (bdev->number == dev) {
|
||||||
|
|
|
@ -1,759 +0,0 @@
|
||||||
idnt "channel.c"
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
section "CODE",code
|
|
||||||
public _cdev_init_system
|
|
||||||
cnop 0,4
|
|
||||||
_cdev_init_system
|
|
||||||
movem.l l11,-(a7)
|
|
||||||
moveq #0,d1
|
|
||||||
bra l4
|
|
||||||
l3
|
|
||||||
moveq #46,d0
|
|
||||||
move.l d0,d2
|
|
||||||
move.l d1,d3
|
|
||||||
swap d2
|
|
||||||
swap d3
|
|
||||||
mulu.w d1,d2
|
|
||||||
mulu.w d0,d3
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d3,d2
|
|
||||||
swap d2
|
|
||||||
clr.w d2
|
|
||||||
add.l d2,d0
|
|
||||||
lea _g_channel_devs,a0
|
|
||||||
move.w #0,(0,a0,d0.l)
|
|
||||||
moveq #46,d0
|
|
||||||
move.l d0,d2
|
|
||||||
move.l d1,d3
|
|
||||||
swap d2
|
|
||||||
swap d3
|
|
||||||
mulu.w d1,d2
|
|
||||||
mulu.w d0,d3
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d3,d2
|
|
||||||
swap d2
|
|
||||||
clr.w d2
|
|
||||||
add.l d2,d0
|
|
||||||
lea _g_channel_devs,a0
|
|
||||||
move.l #0,(2,a0,d0.l)
|
|
||||||
l6
|
|
||||||
addq.l #1,d1
|
|
||||||
l4
|
|
||||||
moveq #8,d0
|
|
||||||
cmp.l d1,d0
|
|
||||||
bgt l3
|
|
||||||
l5
|
|
||||||
moveq #0,d1
|
|
||||||
bra l8
|
|
||||||
l7
|
|
||||||
moveq #36,d0
|
|
||||||
move.l d0,d2
|
|
||||||
move.l d1,d3
|
|
||||||
swap d2
|
|
||||||
swap d3
|
|
||||||
mulu.w d1,d2
|
|
||||||
mulu.w d0,d3
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d3,d2
|
|
||||||
swap d2
|
|
||||||
clr.w d2
|
|
||||||
add.l d2,d0
|
|
||||||
lea _g_channels,a0
|
|
||||||
move.w #-1,(0,a0,d0.l)
|
|
||||||
moveq #36,d0
|
|
||||||
move.l d0,d2
|
|
||||||
move.l d1,d3
|
|
||||||
swap d2
|
|
||||||
swap d3
|
|
||||||
mulu.w d1,d2
|
|
||||||
mulu.w d0,d3
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d3,d2
|
|
||||||
swap d2
|
|
||||||
clr.w d2
|
|
||||||
add.l d2,d0
|
|
||||||
lea _g_channels,a0
|
|
||||||
move.w #-1,(2,a0,d0.l)
|
|
||||||
l10
|
|
||||||
addq.l #1,d1
|
|
||||||
l8
|
|
||||||
moveq #16,d0
|
|
||||||
cmp.l d1,d0
|
|
||||||
bgt l7
|
|
||||||
l9
|
|
||||||
move.w #0,_g_channels
|
|
||||||
move.w #0,2+_g_channels
|
|
||||||
move.w #1,36+_g_channels
|
|
||||||
move.w #1,38+_g_channels
|
|
||||||
l1
|
|
||||||
l11 reg d2/d3
|
|
||||||
movem.l (a7)+,d2/d3
|
|
||||||
l13 equ 8
|
|
||||||
rts
|
|
||||||
; stacksize=8
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _cdev_register
|
|
||||||
cnop 0,4
|
|
||||||
_cdev_register
|
|
||||||
movem.l l19,-(a7)
|
|
||||||
move.l (4+l21,a7),a3
|
|
||||||
move.w (a3),d1
|
|
||||||
cmp.w #8,d1
|
|
||||||
bge l17
|
|
||||||
l16
|
|
||||||
move.w d1,d0
|
|
||||||
ext.l d0
|
|
||||||
moveq #46,d2
|
|
||||||
move.l d0,d3
|
|
||||||
move.l d2,d4
|
|
||||||
swap d3
|
|
||||||
swap d4
|
|
||||||
mulu.w d2,d3
|
|
||||||
mulu.w d0,d4
|
|
||||||
mulu.w d2,d0
|
|
||||||
add.w d4,d3
|
|
||||||
swap d3
|
|
||||||
clr.w d3
|
|
||||||
add.l d3,d0
|
|
||||||
lea _g_channel_devs,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l a0,a2
|
|
||||||
move.w (a3),(a2)
|
|
||||||
move.l (2,a3),(2,a2)
|
|
||||||
move.l (6,a3),(6,a2)
|
|
||||||
move.l (10,a3),(10,a2)
|
|
||||||
move.l (14,a3),(14,a2)
|
|
||||||
move.l (18,a3),(18,a2)
|
|
||||||
move.l (22,a3),(22,a2)
|
|
||||||
move.l (26,a3),(26,a2)
|
|
||||||
move.l (30,a3),(30,a2)
|
|
||||||
move.l (38,a3),(38,a2)
|
|
||||||
move.l (34,a3),(34,a2)
|
|
||||||
move.l (42,a3),(42,a2)
|
|
||||||
moveq #0,d0
|
|
||||||
bra l14
|
|
||||||
l17
|
|
||||||
moveq #-2,d0
|
|
||||||
l18
|
|
||||||
l14
|
|
||||||
l19 reg a2/a3/d2/d3/d4
|
|
||||||
movem.l (a7)+,a2/a3/d2/d3/d4
|
|
||||||
l21 equ 20
|
|
||||||
rts
|
|
||||||
; stacksize=20
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _chan_alloc
|
|
||||||
cnop 0,4
|
|
||||||
_chan_alloc
|
|
||||||
movem.l l30,-(a7)
|
|
||||||
moveq #0,d1
|
|
||||||
bra l25
|
|
||||||
l24
|
|
||||||
moveq #36,d0
|
|
||||||
move.l d0,d2
|
|
||||||
move.l d1,d3
|
|
||||||
swap d2
|
|
||||||
swap d3
|
|
||||||
mulu.w d1,d2
|
|
||||||
mulu.w d0,d3
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d3,d2
|
|
||||||
swap d2
|
|
||||||
clr.w d2
|
|
||||||
add.l d2,d0
|
|
||||||
lea _g_channels,a0
|
|
||||||
tst.w (0,a0,d0.l)
|
|
||||||
bge l29
|
|
||||||
l28
|
|
||||||
moveq #36,d0
|
|
||||||
move.l d0,d2
|
|
||||||
move.l d1,d3
|
|
||||||
swap d2
|
|
||||||
swap d3
|
|
||||||
mulu.w d1,d2
|
|
||||||
mulu.w d0,d3
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d3,d2
|
|
||||||
swap d2
|
|
||||||
clr.w d2
|
|
||||||
add.l d2,d0
|
|
||||||
lea _g_channels,a0
|
|
||||||
move.w d1,(0,a0,d0.l)
|
|
||||||
moveq #36,d0
|
|
||||||
move.l d0,d2
|
|
||||||
move.l d1,d3
|
|
||||||
swap d2
|
|
||||||
swap d3
|
|
||||||
mulu.w d1,d2
|
|
||||||
mulu.w d0,d3
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d3,d2
|
|
||||||
swap d2
|
|
||||||
clr.w d2
|
|
||||||
add.l d2,d0
|
|
||||||
lea _g_channels,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l a0,d0
|
|
||||||
bra l22
|
|
||||||
l29
|
|
||||||
l27
|
|
||||||
addq.l #1,d1
|
|
||||||
l25
|
|
||||||
moveq #16,d0
|
|
||||||
cmp.l d1,d0
|
|
||||||
bgt l24
|
|
||||||
l26
|
|
||||||
moveq #0,d0
|
|
||||||
l22
|
|
||||||
l30 reg d2/d3
|
|
||||||
movem.l (a7)+,d2/d3
|
|
||||||
l32 equ 8
|
|
||||||
rts
|
|
||||||
; stacksize=8
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _chan_get_record
|
|
||||||
cnop 0,4
|
|
||||||
_chan_get_record
|
|
||||||
movem.l l35,-(a7)
|
|
||||||
move.w (6+l37,a7),d1
|
|
||||||
move.w d1,d0
|
|
||||||
ext.l d0
|
|
||||||
moveq #36,d2
|
|
||||||
move.l d0,d3
|
|
||||||
move.l d2,d4
|
|
||||||
swap d3
|
|
||||||
swap d4
|
|
||||||
mulu.w d2,d3
|
|
||||||
mulu.w d0,d4
|
|
||||||
mulu.w d2,d0
|
|
||||||
add.w d4,d3
|
|
||||||
swap d3
|
|
||||||
clr.w d3
|
|
||||||
add.l d3,d0
|
|
||||||
lea _g_channels,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l a0,d0
|
|
||||||
l33
|
|
||||||
l35 reg d2/d3/d4
|
|
||||||
movem.l (a7)+,d2/d3/d4
|
|
||||||
l37 equ 12
|
|
||||||
rts
|
|
||||||
; stacksize=12
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _chan_free
|
|
||||||
cnop 0,4
|
|
||||||
_chan_free
|
|
||||||
movem.l l40,-(a7)
|
|
||||||
move.l (4+l42,a7),a1
|
|
||||||
move.w #-1,(a1)
|
|
||||||
move.w #0,(2,a1)
|
|
||||||
l38
|
|
||||||
l40 reg
|
|
||||||
l42 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _cdev_init
|
|
||||||
cnop 0,4
|
|
||||||
_cdev_init
|
|
||||||
subq.w #8,a7
|
|
||||||
movem.l l50,-(a7)
|
|
||||||
move.w (14+l52,a7),d2
|
|
||||||
cmp.w #8,d2
|
|
||||||
bge l46
|
|
||||||
l45
|
|
||||||
move.w d2,d0
|
|
||||||
ext.l d0
|
|
||||||
moveq #46,d1
|
|
||||||
move.l d0,d3
|
|
||||||
move.l d1,d4
|
|
||||||
swap d3
|
|
||||||
swap d4
|
|
||||||
mulu.w d1,d3
|
|
||||||
mulu.w d0,d4
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d4,d3
|
|
||||||
swap d3
|
|
||||||
clr.w d3
|
|
||||||
add.l d3,d0
|
|
||||||
lea _g_channel_devs,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l a0,a2
|
|
||||||
cmp.w (a2),d2
|
|
||||||
bne l48
|
|
||||||
l47
|
|
||||||
move.l (6,a2),a1
|
|
||||||
move.l a1,(4+l52,a7)
|
|
||||||
jsr (a1)
|
|
||||||
bra l43
|
|
||||||
l48
|
|
||||||
moveq #-2,d0
|
|
||||||
l49
|
|
||||||
l46
|
|
||||||
l43
|
|
||||||
l50 reg a2/d2/d3/d4
|
|
||||||
movem.l (a7)+,a2/d2/d3/d4
|
|
||||||
l52 equ 16
|
|
||||||
addq.w #8,a7
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _chan_get_records
|
|
||||||
cnop 0,4
|
|
||||||
_chan_get_records
|
|
||||||
movem.l l64,-(a7)
|
|
||||||
move.l (12+l66,a7),a2
|
|
||||||
move.w (6+l66,a7),d1
|
|
||||||
move.l (8+l66,a7),a1
|
|
||||||
cmp.w #16,d1
|
|
||||||
bge l56
|
|
||||||
l55
|
|
||||||
move.w d1,d0
|
|
||||||
ext.l d0
|
|
||||||
moveq #36,d2
|
|
||||||
move.l d0,d3
|
|
||||||
move.l d2,d4
|
|
||||||
swap d3
|
|
||||||
swap d4
|
|
||||||
mulu.w d2,d3
|
|
||||||
mulu.w d0,d4
|
|
||||||
mulu.w d2,d0
|
|
||||||
add.w d4,d3
|
|
||||||
swap d3
|
|
||||||
clr.w d3
|
|
||||||
add.l d3,d0
|
|
||||||
lea _g_channels,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l a0,(a1)
|
|
||||||
move.l (a1),a0
|
|
||||||
cmp.w (a0),d1
|
|
||||||
bne l58
|
|
||||||
l57
|
|
||||||
move.l (a1),a0
|
|
||||||
cmp.w #8,(2,a0)
|
|
||||||
bge l60
|
|
||||||
l59
|
|
||||||
move.l (a1),a0
|
|
||||||
move.w (2,a0),d0
|
|
||||||
ext.l d0
|
|
||||||
moveq #46,d2
|
|
||||||
move.l d0,d3
|
|
||||||
move.l d2,d4
|
|
||||||
swap d3
|
|
||||||
swap d4
|
|
||||||
mulu.w d2,d3
|
|
||||||
mulu.w d0,d4
|
|
||||||
mulu.w d2,d0
|
|
||||||
add.w d4,d3
|
|
||||||
swap d3
|
|
||||||
clr.w d3
|
|
||||||
add.l d3,d0
|
|
||||||
lea _g_channel_devs,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l a0,(a2)
|
|
||||||
moveq #0,d0
|
|
||||||
bra l53
|
|
||||||
l60
|
|
||||||
moveq #-2,d0
|
|
||||||
bra l53
|
|
||||||
l61
|
|
||||||
bra l62
|
|
||||||
l58
|
|
||||||
moveq #-2,d0
|
|
||||||
bra l53
|
|
||||||
l62
|
|
||||||
bra l63
|
|
||||||
l56
|
|
||||||
moveq #-10,d0
|
|
||||||
l63
|
|
||||||
l53
|
|
||||||
l64 reg a2/d2/d3/d4
|
|
||||||
movem.l (a7)+,a2/d2/d3/d4
|
|
||||||
l66 equ 16
|
|
||||||
rts
|
|
||||||
; stacksize=16
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _chan_read
|
|
||||||
cnop 0,4
|
|
||||||
_chan_read
|
|
||||||
sub.w #16,a7
|
|
||||||
movem.l l72,-(a7)
|
|
||||||
move.w (30+l74,a7),d4
|
|
||||||
move.w (22+l74,a7),d3
|
|
||||||
move.l (24+l74,a7),a2
|
|
||||||
lea (4+l74,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
lea (4+l74,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
move.w d3,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _chan_get_records
|
|
||||||
move.w d0,d2
|
|
||||||
add.w #12,a7
|
|
||||||
bne l70
|
|
||||||
l69
|
|
||||||
move.w d4,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
move.l a2,-(a7)
|
|
||||||
move.l (8+l74,a7),-(a7)
|
|
||||||
move.l (16+l74,a7),a0
|
|
||||||
move.l (10,a0),a1
|
|
||||||
move.l a1,(22+l74,a7)
|
|
||||||
jsr (a1)
|
|
||||||
add.w #12,a7
|
|
||||||
bra l67
|
|
||||||
l70
|
|
||||||
move.w d2,d0
|
|
||||||
l71
|
|
||||||
l67
|
|
||||||
l72 reg a2/d2/d3/d4
|
|
||||||
movem.l (a7)+,a2/d2/d3/d4
|
|
||||||
l74 equ 16
|
|
||||||
add.w #16,a7
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _chan_readline
|
|
||||||
cnop 0,4
|
|
||||||
_chan_readline
|
|
||||||
sub.w #16,a7
|
|
||||||
movem.l l80,-(a7)
|
|
||||||
move.w (30+l82,a7),d4
|
|
||||||
move.w (22+l82,a7),d3
|
|
||||||
move.l (24+l82,a7),a2
|
|
||||||
lea (4+l82,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
lea (4+l82,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
move.w d3,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _chan_get_records
|
|
||||||
move.w d0,d2
|
|
||||||
add.w #12,a7
|
|
||||||
bne l78
|
|
||||||
l77
|
|
||||||
move.w d4,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
move.l a2,-(a7)
|
|
||||||
move.l (8+l82,a7),-(a7)
|
|
||||||
move.l (16+l82,a7),a0
|
|
||||||
move.l (14,a0),a1
|
|
||||||
move.l a1,(22+l82,a7)
|
|
||||||
jsr (a1)
|
|
||||||
add.w #12,a7
|
|
||||||
bra l75
|
|
||||||
l78
|
|
||||||
move.w d2,d0
|
|
||||||
l79
|
|
||||||
l75
|
|
||||||
l80 reg a2/d2/d3/d4
|
|
||||||
movem.l (a7)+,a2/d2/d3/d4
|
|
||||||
l82 equ 16
|
|
||||||
add.w #16,a7
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _chan_read_b
|
|
||||||
cnop 0,4
|
|
||||||
_chan_read_b
|
|
||||||
sub.w #16,a7
|
|
||||||
movem.l l88,-(a7)
|
|
||||||
move.w (22+l90,a7),d3
|
|
||||||
lea (4+l90,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
lea (4+l90,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
move.w d3,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _chan_get_records
|
|
||||||
move.w d0,d2
|
|
||||||
add.w #12,a7
|
|
||||||
bne l86
|
|
||||||
l85
|
|
||||||
move.l (0+l90,a7),-(a7)
|
|
||||||
move.l (8+l90,a7),a0
|
|
||||||
move.l (18,a0),a1
|
|
||||||
move.l a1,(14+l90,a7)
|
|
||||||
jsr (a1)
|
|
||||||
addq.w #4,a7
|
|
||||||
bra l83
|
|
||||||
l86
|
|
||||||
move.w d2,d0
|
|
||||||
l87
|
|
||||||
l83
|
|
||||||
l88 reg d2/d3
|
|
||||||
movem.l (a7)+,d2/d3
|
|
||||||
l90 equ 8
|
|
||||||
add.w #16,a7
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _chan_write
|
|
||||||
cnop 0,4
|
|
||||||
_chan_write
|
|
||||||
sub.w #16,a7
|
|
||||||
movem.l l97,-(a7)
|
|
||||||
move.w (30+l99,a7),d4
|
|
||||||
move.w (22+l99,a7),d3
|
|
||||||
move.l (24+l99,a7),a2
|
|
||||||
lea (4+l99,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
lea (4+l99,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
move.w d3,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _chan_get_records
|
|
||||||
move.w d0,d2
|
|
||||||
add.w #12,a7
|
|
||||||
bne l94
|
|
||||||
l93
|
|
||||||
move.w d4,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
move.l a2,-(a7)
|
|
||||||
move.l (8+l99,a7),-(a7)
|
|
||||||
move.l (16+l99,a7),a0
|
|
||||||
move.l (22,a0),a1
|
|
||||||
move.l a1,(22+l99,a7)
|
|
||||||
jsr (a1)
|
|
||||||
add.w #12,a7
|
|
||||||
bra l91
|
|
||||||
l94
|
|
||||||
pea l96
|
|
||||||
jsr _DEBUG
|
|
||||||
move.w d2,d0
|
|
||||||
addq.w #4,a7
|
|
||||||
l95
|
|
||||||
l91
|
|
||||||
l97 reg a2/d2/d3/d4
|
|
||||||
movem.l (a7)+,a2/d2/d3/d4
|
|
||||||
l99 equ 16
|
|
||||||
add.w #16,a7
|
|
||||||
rts
|
|
||||||
cnop 0,4
|
|
||||||
l96
|
|
||||||
dc.b 99
|
|
||||||
dc.b 104
|
|
||||||
dc.b 97
|
|
||||||
dc.b 110
|
|
||||||
dc.b 95
|
|
||||||
dc.b 119
|
|
||||||
dc.b 114
|
|
||||||
dc.b 105
|
|
||||||
dc.b 116
|
|
||||||
dc.b 101
|
|
||||||
dc.b 32
|
|
||||||
dc.b 101
|
|
||||||
dc.b 114
|
|
||||||
dc.b 114
|
|
||||||
dc.b 111
|
|
||||||
dc.b 114
|
|
||||||
dc.b 10
|
|
||||||
dc.b 0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _chan_write_b
|
|
||||||
cnop 0,4
|
|
||||||
_chan_write_b
|
|
||||||
sub.w #16,a7
|
|
||||||
movem.l l105,-(a7)
|
|
||||||
move.b (27+l107,a7),d4
|
|
||||||
move.w (22+l107,a7),d3
|
|
||||||
lea (4+l107,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
lea (4+l107,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
move.w d3,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _chan_get_records
|
|
||||||
move.w d0,d2
|
|
||||||
add.w #12,a7
|
|
||||||
bne l103
|
|
||||||
l102
|
|
||||||
moveq #0,d0
|
|
||||||
move.b d4,d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
move.l (4+l107,a7),-(a7)
|
|
||||||
move.l (12+l107,a7),a0
|
|
||||||
move.l (26,a0),a1
|
|
||||||
move.l a1,(18+l107,a7)
|
|
||||||
jsr (a1)
|
|
||||||
addq.w #8,a7
|
|
||||||
bra l100
|
|
||||||
l103
|
|
||||||
move.w d2,d0
|
|
||||||
l104
|
|
||||||
l100
|
|
||||||
l105 reg d2/d3/d4
|
|
||||||
movem.l (a7)+,d2/d3/d4
|
|
||||||
l107 equ 12
|
|
||||||
add.w #16,a7
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _chan_status
|
|
||||||
cnop 0,4
|
|
||||||
_chan_status
|
|
||||||
sub.w #16,a7
|
|
||||||
movem.l l113,-(a7)
|
|
||||||
move.w (22+l115,a7),d3
|
|
||||||
lea (4+l115,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
lea (4+l115,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
move.w d3,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _chan_get_records
|
|
||||||
move.w d0,d2
|
|
||||||
add.w #12,a7
|
|
||||||
bne l111
|
|
||||||
l110
|
|
||||||
move.l (0+l115,a7),-(a7)
|
|
||||||
move.l (8+l115,a7),a0
|
|
||||||
move.l (30,a0),a1
|
|
||||||
move.l a1,(14+l115,a7)
|
|
||||||
jsr (a1)
|
|
||||||
addq.w #4,a7
|
|
||||||
bra l108
|
|
||||||
l111
|
|
||||||
move.w d2,d0
|
|
||||||
l112
|
|
||||||
l108
|
|
||||||
l113 reg d2/d3
|
|
||||||
movem.l (a7)+,d2/d3
|
|
||||||
l115 equ 8
|
|
||||||
add.w #16,a7
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _chan_flush
|
|
||||||
cnop 0,4
|
|
||||||
_chan_flush
|
|
||||||
sub.w #16,a7
|
|
||||||
movem.l l121,-(a7)
|
|
||||||
move.w (22+l123,a7),d3
|
|
||||||
lea (4+l123,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
lea (4+l123,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
move.w d3,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _chan_get_records
|
|
||||||
move.w d0,d2
|
|
||||||
add.w #12,a7
|
|
||||||
bne l119
|
|
||||||
l118
|
|
||||||
move.l (0+l123,a7),-(a7)
|
|
||||||
move.l (8+l123,a7),a0
|
|
||||||
move.l (34,a0),a1
|
|
||||||
move.l a1,(14+l123,a7)
|
|
||||||
jsr (a1)
|
|
||||||
addq.w #4,a7
|
|
||||||
bra l116
|
|
||||||
l119
|
|
||||||
move.w d2,d0
|
|
||||||
l120
|
|
||||||
l116
|
|
||||||
l121 reg d2/d3
|
|
||||||
movem.l (a7)+,d2/d3
|
|
||||||
l123 equ 8
|
|
||||||
add.w #16,a7
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _chan_seek
|
|
||||||
cnop 0,4
|
|
||||||
_chan_seek
|
|
||||||
sub.w #16,a7
|
|
||||||
movem.l l129,-(a7)
|
|
||||||
move.w (30+l131,a7),d5
|
|
||||||
move.l (24+l131,a7),d4
|
|
||||||
move.w (22+l131,a7),d3
|
|
||||||
lea (4+l131,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
lea (4+l131,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
move.w d3,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _chan_get_records
|
|
||||||
move.w d0,d2
|
|
||||||
add.w #12,a7
|
|
||||||
bne l127
|
|
||||||
l126
|
|
||||||
move.w d5,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
move.l d4,-(a7)
|
|
||||||
move.l (8+l131,a7),-(a7)
|
|
||||||
move.l (16+l131,a7),a0
|
|
||||||
move.l (38,a0),a1
|
|
||||||
move.l a1,(22+l131,a7)
|
|
||||||
jsr (a1)
|
|
||||||
add.w #12,a7
|
|
||||||
bra l124
|
|
||||||
l127
|
|
||||||
move.w d2,d0
|
|
||||||
l128
|
|
||||||
l124
|
|
||||||
l129 reg d2/d3/d4/d5
|
|
||||||
movem.l (a7)+,d2/d3/d4/d5
|
|
||||||
l131 equ 16
|
|
||||||
add.w #16,a7
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _chan_ioctrl
|
|
||||||
cnop 0,4
|
|
||||||
_chan_ioctrl
|
|
||||||
sub.w #16,a7
|
|
||||||
movem.l l137,-(a7)
|
|
||||||
move.w (34+l139,a7),d5
|
|
||||||
move.w (26+l139,a7),d4
|
|
||||||
move.w (22+l139,a7),d3
|
|
||||||
move.l (28+l139,a7),a2
|
|
||||||
lea (4+l139,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
lea (4+l139,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
move.w d3,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _chan_get_records
|
|
||||||
move.w d0,d2
|
|
||||||
add.w #12,a7
|
|
||||||
bne l135
|
|
||||||
l134
|
|
||||||
move.w d5,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
move.l a2,-(a7)
|
|
||||||
move.w d4,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
move.l (12+l139,a7),-(a7)
|
|
||||||
move.l (20+l139,a7),a0
|
|
||||||
move.l (42,a0),a1
|
|
||||||
move.l a1,(26+l139,a7)
|
|
||||||
jsr (a1)
|
|
||||||
add.w #16,a7
|
|
||||||
bra l132
|
|
||||||
l135
|
|
||||||
move.w d2,d0
|
|
||||||
l136
|
|
||||||
l132
|
|
||||||
l137 reg a2/d2/d3/d4/d5
|
|
||||||
movem.l (a7)+,a2/d2/d3/d4/d5
|
|
||||||
l139 equ 20
|
|
||||||
add.w #16,a7
|
|
||||||
rts
|
|
||||||
public _DEBUG
|
|
||||||
public _g_channel_devs
|
|
||||||
section "BSS",bss
|
|
||||||
cnop 0,4
|
|
||||||
_g_channel_devs
|
|
||||||
ds.b 368
|
|
||||||
public _g_channels
|
|
||||||
cnop 0,4
|
|
||||||
_g_channels
|
|
||||||
ds.b 576
|
|
|
@ -1,8 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* Implmentation of support low level channel device drivers
|
* Implmentation of support low level channel device drivers
|
||||||
*
|
*
|
||||||
* A channel or stream is a sequence of bytes that may be read or written to.
|
* A channel or stream is a sequence of bytes that may be read or written to.
|
||||||
*
|
*
|
||||||
* Examples include: console, serial port, an open file, etc.
|
* Examples include: console, serial port, an open file, etc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ short chan_get_records(short channel, p_channel * chan, p_dev_chan * cdev) {
|
||||||
// Inputs:
|
// Inputs:
|
||||||
// channel = the number of the channel
|
// channel = the number of the channel
|
||||||
// buffer = the buffer into which to copy the channel data
|
// buffer = the buffer into which to copy the channel data
|
||||||
// size = the size of the buffer.
|
// size = the size of the buffer.
|
||||||
//
|
//
|
||||||
// Returns:
|
// Returns:
|
||||||
// number of bytes read, any negative number is an error code
|
// number of bytes read, any negative number is an error code
|
||||||
|
@ -178,7 +178,7 @@ short chan_read(short channel, uint8_t * buffer, short size) {
|
||||||
p_channel chan;
|
p_channel chan;
|
||||||
p_dev_chan cdev;
|
p_dev_chan cdev;
|
||||||
short res;
|
short res;
|
||||||
|
|
||||||
res = chan_get_records(channel, &chan, &cdev);
|
res = chan_get_records(channel, &chan, &cdev);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
return cdev->read(chan, buffer, size);
|
return cdev->read(chan, buffer, size);
|
||||||
|
@ -193,7 +193,7 @@ short chan_read(short channel, uint8_t * buffer, short size) {
|
||||||
// Inputs:
|
// Inputs:
|
||||||
// channel = the number of the channel
|
// channel = the number of the channel
|
||||||
// buffer = the buffer into which to copy the channel data
|
// buffer = the buffer into which to copy the channel data
|
||||||
// size = the size of the buffer.
|
// size = the size of the buffer.
|
||||||
//
|
//
|
||||||
// Returns:
|
// Returns:
|
||||||
// number of bytes read, any negative number is an error code
|
// number of bytes read, any negative number is an error code
|
||||||
|
@ -202,7 +202,7 @@ short chan_readline(short channel, uint8_t * buffer, short size) {
|
||||||
p_channel chan;
|
p_channel chan;
|
||||||
p_dev_chan cdev;
|
p_dev_chan cdev;
|
||||||
short res;
|
short res;
|
||||||
|
|
||||||
res = chan_get_records(channel, &chan, &cdev);
|
res = chan_get_records(channel, &chan, &cdev);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
return cdev->readline(chan, buffer, size);
|
return cdev->readline(chan, buffer, size);
|
||||||
|
@ -225,7 +225,7 @@ short chan_read_b(short channel) {
|
||||||
p_channel chan;
|
p_channel chan;
|
||||||
p_dev_chan cdev;
|
p_dev_chan cdev;
|
||||||
short res;
|
short res;
|
||||||
|
|
||||||
res = chan_get_records(channel, &chan, &cdev);
|
res = chan_get_records(channel, &chan, &cdev);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
return cdev->read_b(chan);
|
return cdev->read_b(chan);
|
||||||
|
@ -240,7 +240,7 @@ short chan_read_b(short channel) {
|
||||||
// Inputs:
|
// Inputs:
|
||||||
// channel = the number of the channel
|
// channel = the number of the channel
|
||||||
// buffer = the buffer containing the data to write
|
// buffer = the buffer containing the data to write
|
||||||
// size = the size of the buffer.
|
// size = the size of the buffer.
|
||||||
//
|
//
|
||||||
// Returns:
|
// Returns:
|
||||||
// number of bytes written, any negative number is an error code
|
// number of bytes written, any negative number is an error code
|
||||||
|
@ -249,7 +249,7 @@ short chan_write(short channel, const uint8_t * buffer, short size) {
|
||||||
p_channel chan;
|
p_channel chan;
|
||||||
p_dev_chan cdev;
|
p_dev_chan cdev;
|
||||||
short res;
|
short res;
|
||||||
|
|
||||||
res = chan_get_records(channel, &chan, &cdev);
|
res = chan_get_records(channel, &chan, &cdev);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
return cdev->write(chan, buffer, size);
|
return cdev->write(chan, buffer, size);
|
||||||
|
@ -273,13 +273,13 @@ short chan_write_b(short channel, uint8_t b) {
|
||||||
p_channel chan;
|
p_channel chan;
|
||||||
p_dev_chan cdev;
|
p_dev_chan cdev;
|
||||||
short res;
|
short res;
|
||||||
|
|
||||||
res = chan_get_records(channel, &chan, &cdev);
|
res = chan_get_records(channel, &chan, &cdev);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
return cdev->write_b(chan, b);
|
return cdev->write_b(chan, b);
|
||||||
} else {
|
} else {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -296,13 +296,13 @@ short chan_status(short channel) {
|
||||||
p_channel chan;
|
p_channel chan;
|
||||||
p_dev_chan cdev;
|
p_dev_chan cdev;
|
||||||
short res;
|
short res;
|
||||||
|
|
||||||
res = chan_get_records(channel, &chan, &cdev);
|
res = chan_get_records(channel, &chan, &cdev);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
return cdev->status(chan);
|
return cdev->status(chan);
|
||||||
} else {
|
} else {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -318,13 +318,13 @@ short chan_flush(short channel) {
|
||||||
p_channel chan;
|
p_channel chan;
|
||||||
p_dev_chan cdev;
|
p_dev_chan cdev;
|
||||||
short res;
|
short res;
|
||||||
|
|
||||||
res = chan_get_records(channel, &chan, &cdev);
|
res = chan_get_records(channel, &chan, &cdev);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
return cdev->flush(chan);
|
return cdev->flush(chan);
|
||||||
} else {
|
} else {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -342,13 +342,13 @@ short chan_seek(short channel, long position, short base) {
|
||||||
p_channel chan;
|
p_channel chan;
|
||||||
p_dev_chan cdev;
|
p_dev_chan cdev;
|
||||||
short res;
|
short res;
|
||||||
|
|
||||||
res = chan_get_records(channel, &chan, &cdev);
|
res = chan_get_records(channel, &chan, &cdev);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
return cdev->seek(chan, position, base);
|
return cdev->seek(chan, position, base);
|
||||||
} else {
|
} else {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -367,11 +367,11 @@ short chan_ioctrl(short channel, short command, uint8_t * buffer, short size) {
|
||||||
p_channel chan;
|
p_channel chan;
|
||||||
p_dev_chan cdev;
|
p_dev_chan cdev;
|
||||||
short res;
|
short res;
|
||||||
|
|
||||||
res = chan_get_records(channel, &chan, &cdev);
|
res = chan_get_records(channel, &chan, &cdev);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
return cdev->ioctrl(chan, command, buffer, size);
|
return cdev->ioctrl(chan, command, buffer, size);
|
||||||
} else {
|
} else {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,304 +0,0 @@
|
||||||
idnt "console.c"
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
section "CODE",code
|
|
||||||
public _con_init
|
|
||||||
cnop 0,4
|
|
||||||
_con_init
|
|
||||||
movem.l l3,-(a7)
|
|
||||||
moveq #0,d0
|
|
||||||
l1
|
|
||||||
l3 reg
|
|
||||||
l5 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _con_write_b
|
|
||||||
cnop 0,4
|
|
||||||
_con_write_b
|
|
||||||
movem.l l8,-(a7)
|
|
||||||
move.b (11+l10,a7),d2
|
|
||||||
move.l (4+l10,a7),a2
|
|
||||||
move.b d2,d0
|
|
||||||
ext.w d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
move.w (2,a2),d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _text_put_raw
|
|
||||||
moveq #0,d0
|
|
||||||
addq.w #8,a7
|
|
||||||
l6
|
|
||||||
l8 reg a2/d2
|
|
||||||
movem.l (a7)+,a2/d2
|
|
||||||
l10 equ 8
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _con_read_b
|
|
||||||
cnop 0,4
|
|
||||||
_con_read_b
|
|
||||||
movem.l l13,-(a7)
|
|
||||||
moveq #0,d0
|
|
||||||
l11
|
|
||||||
l13 reg
|
|
||||||
l15 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _con_read
|
|
||||||
cnop 0,4
|
|
||||||
_con_read
|
|
||||||
movem.l l27,-(a7)
|
|
||||||
move.w (14+l29,a7),d4
|
|
||||||
move.l (8+l29,a7),a3
|
|
||||||
move.l (4+l29,a7),a2
|
|
||||||
moveq #0,d3
|
|
||||||
bra l19
|
|
||||||
l18
|
|
||||||
move.l a2,-(a7)
|
|
||||||
jsr _con_read_b
|
|
||||||
move.w d0,d2
|
|
||||||
addq.w #4,a7
|
|
||||||
bge l23
|
|
||||||
l22
|
|
||||||
move.w d2,d0
|
|
||||||
bra l16
|
|
||||||
l23
|
|
||||||
tst.w d2
|
|
||||||
ble l26
|
|
||||||
l25
|
|
||||||
move.w d2,d0
|
|
||||||
ext.l d0
|
|
||||||
and.l #255,d0
|
|
||||||
move.b d0,(0,a3,d3.l)
|
|
||||||
l26
|
|
||||||
l24
|
|
||||||
l21
|
|
||||||
addq.l #1,d3
|
|
||||||
l19
|
|
||||||
move.w d4,d0
|
|
||||||
ext.l d0
|
|
||||||
cmp.l d3,d0
|
|
||||||
bgt l18
|
|
||||||
l20
|
|
||||||
move.w d3,d0
|
|
||||||
l16
|
|
||||||
l27 reg a2/a3/d2/d3/d4
|
|
||||||
movem.l (a7)+,a2/a3/d2/d3/d4
|
|
||||||
l29 equ 20
|
|
||||||
rts
|
|
||||||
; stacksize=28
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _con_readline
|
|
||||||
cnop 0,4
|
|
||||||
_con_readline
|
|
||||||
movem.l l46,-(a7)
|
|
||||||
move.w (14+l48,a7),d4
|
|
||||||
move.l (4+l48,a7),a3
|
|
||||||
move.l (8+l48,a7),a2
|
|
||||||
moveq #0,d2
|
|
||||||
bra l33
|
|
||||||
l32
|
|
||||||
move.l a3,-(a7)
|
|
||||||
jsr _con_read_b
|
|
||||||
move.w d0,d3
|
|
||||||
addq.w #4,a7
|
|
||||||
bge l36
|
|
||||||
l35
|
|
||||||
move.w d3,d0
|
|
||||||
bra l30
|
|
||||||
l36
|
|
||||||
tst.w d3
|
|
||||||
ble l39
|
|
||||||
l38
|
|
||||||
move.b d3,d0
|
|
||||||
and.b #255,d0
|
|
||||||
moveq #0,d3
|
|
||||||
move.b d0,d3
|
|
||||||
move.b #0,(0,a2,d2.l)
|
|
||||||
move.w d3,d0
|
|
||||||
subq.w #8,d0
|
|
||||||
beq l42
|
|
||||||
subq.w #2,d0
|
|
||||||
beq l41
|
|
||||||
bra l45
|
|
||||||
l41
|
|
||||||
move.b #0,(0,a2,d2.l)
|
|
||||||
move.w d2,d0
|
|
||||||
bra l30
|
|
||||||
l42
|
|
||||||
tst.l d2
|
|
||||||
ble l44
|
|
||||||
l43
|
|
||||||
subq.l #1,d2
|
|
||||||
move.b #0,(0,a2,d2.l)
|
|
||||||
l44
|
|
||||||
bra l40
|
|
||||||
l45
|
|
||||||
move.b d3,d0
|
|
||||||
move.l d2,d1
|
|
||||||
addq.l #1,d2
|
|
||||||
move.b d0,(0,a2,d1.l)
|
|
||||||
move.b #0,(0,a2,d2.l)
|
|
||||||
l40
|
|
||||||
l39
|
|
||||||
l37
|
|
||||||
l33
|
|
||||||
move.w d4,d0
|
|
||||||
ext.l d0
|
|
||||||
subq.l #1,d0
|
|
||||||
cmp.l d2,d0
|
|
||||||
bgt l32
|
|
||||||
l34
|
|
||||||
move.w d2,d0
|
|
||||||
l30
|
|
||||||
l46 reg a2/a3/d2/d3/d4
|
|
||||||
movem.l (a7)+,a2/a3/d2/d3/d4
|
|
||||||
l48 equ 20
|
|
||||||
rts
|
|
||||||
; stacksize=28
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _con_write
|
|
||||||
cnop 0,4
|
|
||||||
_con_write
|
|
||||||
movem.l l58,-(a7)
|
|
||||||
move.w (14+l60,a7),d4
|
|
||||||
move.l (8+l60,a7),a3
|
|
||||||
move.l (4+l60,a7),a2
|
|
||||||
moveq #0,d2
|
|
||||||
bra l52
|
|
||||||
l51
|
|
||||||
move.b (0,a3,d2.l),d3
|
|
||||||
bne l56
|
|
||||||
l55
|
|
||||||
bra l53
|
|
||||||
l56
|
|
||||||
move.b d3,d0
|
|
||||||
ext.w d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
move.w (2,a2),d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _text_put_raw
|
|
||||||
addq.w #8,a7
|
|
||||||
l57
|
|
||||||
l54
|
|
||||||
addq.l #1,d2
|
|
||||||
l52
|
|
||||||
move.w d4,d0
|
|
||||||
ext.l d0
|
|
||||||
cmp.l d2,d0
|
|
||||||
bgt l51
|
|
||||||
l53
|
|
||||||
move.w d2,d0
|
|
||||||
l49
|
|
||||||
l58 reg a2/a3/d2/d3/d4
|
|
||||||
movem.l (a7)+,a2/a3/d2/d3/d4
|
|
||||||
l60 equ 20
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _con_status
|
|
||||||
cnop 0,4
|
|
||||||
_con_status
|
|
||||||
movem.l l63,-(a7)
|
|
||||||
moveq #12,d0
|
|
||||||
l61
|
|
||||||
l63 reg
|
|
||||||
l65 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _con_flush
|
|
||||||
cnop 0,4
|
|
||||||
_con_flush
|
|
||||||
movem.l l68,-(a7)
|
|
||||||
moveq #0,d0
|
|
||||||
l66
|
|
||||||
l68 reg
|
|
||||||
l70 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _con_seek
|
|
||||||
cnop 0,4
|
|
||||||
_con_seek
|
|
||||||
movem.l l73,-(a7)
|
|
||||||
moveq #0,d0
|
|
||||||
l71
|
|
||||||
l73 reg
|
|
||||||
l75 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _con_ioctrl
|
|
||||||
cnop 0,4
|
|
||||||
_con_ioctrl
|
|
||||||
movem.l l78,-(a7)
|
|
||||||
moveq #0,d0
|
|
||||||
l76
|
|
||||||
l78 reg
|
|
||||||
l80 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _con_install
|
|
||||||
cnop 0,4
|
|
||||||
_con_install
|
|
||||||
sub.w #48,a7
|
|
||||||
movem.l l85,-(a7)
|
|
||||||
move.l #l83,(2+l87,a7)
|
|
||||||
move.w #0,(0+l87,a7)
|
|
||||||
move.l #_con_init,(6+l87,a7)
|
|
||||||
move.l #_con_read,(10+l87,a7)
|
|
||||||
move.l #_con_readline,(14+l87,a7)
|
|
||||||
move.l #_con_read_b,(18+l87,a7)
|
|
||||||
move.l #_con_write,(22+l87,a7)
|
|
||||||
move.l #_con_write_b,(26+l87,a7)
|
|
||||||
move.l #_con_flush,(34+l87,a7)
|
|
||||||
move.l #_con_seek,(38+l87,a7)
|
|
||||||
move.l #_con_status,(30+l87,a7)
|
|
||||||
move.l #_con_ioctrl,(42+l87,a7)
|
|
||||||
lea (0+l87,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
jsr _cdev_register
|
|
||||||
move.l #l84,(6+l87,a7)
|
|
||||||
move.w #1,(4+l87,a7)
|
|
||||||
move.l #_con_init,(10+l87,a7)
|
|
||||||
move.l #_con_read,(14+l87,a7)
|
|
||||||
move.l #_con_readline,(18+l87,a7)
|
|
||||||
move.l #_con_read_b,(22+l87,a7)
|
|
||||||
move.l #_con_write,(26+l87,a7)
|
|
||||||
move.l #_con_write_b,(30+l87,a7)
|
|
||||||
move.l #_con_flush,(38+l87,a7)
|
|
||||||
move.l #_con_seek,(42+l87,a7)
|
|
||||||
move.l #_con_status,(34+l87,a7)
|
|
||||||
move.l #_con_ioctrl,(46+l87,a7)
|
|
||||||
lea (4+l87,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
jsr _cdev_register
|
|
||||||
addq.w #8,a7
|
|
||||||
l81
|
|
||||||
l85 reg
|
|
||||||
l87 equ 0
|
|
||||||
add.w #48,a7
|
|
||||||
rts
|
|
||||||
cnop 0,4
|
|
||||||
l83
|
|
||||||
dc.b 67
|
|
||||||
dc.b 79
|
|
||||||
dc.b 78
|
|
||||||
dc.b 83
|
|
||||||
dc.b 79
|
|
||||||
dc.b 76
|
|
||||||
dc.b 69
|
|
||||||
dc.b 0
|
|
||||||
cnop 0,4
|
|
||||||
l84
|
|
||||||
dc.b 69
|
|
||||||
dc.b 86
|
|
||||||
dc.b 73
|
|
||||||
dc.b 68
|
|
||||||
dc.b 0
|
|
||||||
public _cdev_register
|
|
||||||
public _text_put_raw
|
|
|
@ -1,14 +1,15 @@
|
||||||
/**
|
/**
|
||||||
* Implementation of the console channel device
|
* Implementation of the console channel device
|
||||||
*
|
*
|
||||||
* The console maps to the main screen and keyboard.
|
* The console maps to the main screen and keyboard.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "dev/channel.h"
|
#include "dev/channel.h"
|
||||||
#include "dev/console.h"
|
#include "dev/console.h"
|
||||||
|
#include "dev/ps2.h"
|
||||||
#include "dev/text_screen_iii.h"
|
#include "dev/text_screen_iii.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,17 +32,15 @@ short con_write_b(p_channel chan, uint8_t b) {
|
||||||
// Attempt to read from the keyboard.
|
// Attempt to read from the keyboard.
|
||||||
//
|
//
|
||||||
short con_read_b(p_channel chan) {
|
short con_read_b(p_channel chan) {
|
||||||
// char c;
|
char c;
|
||||||
// do {
|
do {
|
||||||
// c = kbd_getc();
|
c = kbd_getc_poll();
|
||||||
// } while (c == 0);
|
} while (c == 0);
|
||||||
|
|
||||||
// // Echo the character to the screen
|
// Echo the character to the screen
|
||||||
// con_write_b(chan, c);
|
con_write_b(chan, c);
|
||||||
|
|
||||||
// return c;
|
return c;
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,6 +87,11 @@ short con_readline(p_channel chan, uint8_t * buffer, short size) {
|
||||||
buffer[i] = 0;
|
buffer[i] = 0;
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
|
case CHAR_CR:
|
||||||
|
// Newline character, end the string and return the size of the string
|
||||||
|
buffer[i] = 0;
|
||||||
|
return i;
|
||||||
|
|
||||||
case CHAR_BS:
|
case CHAR_BS:
|
||||||
// Backspace character, delete the character to the left
|
// Backspace character, delete the character to the left
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
|
|
734
src/dev/fsys.asm
734
src/dev/fsys.asm
|
@ -1,734 +0,0 @@
|
||||||
idnt "fsys.c"
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
section "CODE",code
|
|
||||||
public _fatfs_to_foenix
|
|
||||||
cnop 0,4
|
|
||||||
_fatfs_to_foenix
|
|
||||||
movem.l l6,-(a7)
|
|
||||||
move.l (4+l8,a7),d0
|
|
||||||
bne l4
|
|
||||||
l3
|
|
||||||
moveq #0,d0
|
|
||||||
bra l1
|
|
||||||
l4
|
|
||||||
moveq #-1,d0
|
|
||||||
l5
|
|
||||||
l1
|
|
||||||
l6 reg
|
|
||||||
l8 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fsys_open
|
|
||||||
cnop 0,4
|
|
||||||
_fsys_open
|
|
||||||
movem.l l25,-(a7)
|
|
||||||
move.w (10+l27,a7),d5
|
|
||||||
move.l (4+l27,a7),a3
|
|
||||||
move.l #0,a2
|
|
||||||
moveq #-1,d3
|
|
||||||
moveq #0,d2
|
|
||||||
bra l12
|
|
||||||
l11
|
|
||||||
lea _g_fil_state,a0
|
|
||||||
tst.b (0,a0,d2.w)
|
|
||||||
bne l16
|
|
||||||
l15
|
|
||||||
lea _g_fil_state,a0
|
|
||||||
move.b #1,(0,a0,d2.w)
|
|
||||||
move.w d2,d3
|
|
||||||
bra l13
|
|
||||||
l16
|
|
||||||
l14
|
|
||||||
addq.w #1,d2
|
|
||||||
l12
|
|
||||||
cmp.w #8,d2
|
|
||||||
blt l11
|
|
||||||
l13
|
|
||||||
tst.w d3
|
|
||||||
bge l18
|
|
||||||
l17
|
|
||||||
moveq #-11,d0
|
|
||||||
bra l9
|
|
||||||
l18
|
|
||||||
jsr _chan_alloc
|
|
||||||
move.l d0,a2
|
|
||||||
tst.l d0
|
|
||||||
beq l20
|
|
||||||
move.w #6,(2,a2)
|
|
||||||
move.w d5,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
move.l a3,-(a7)
|
|
||||||
move.w d3,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l #550,d1
|
|
||||||
move.l d0,d6
|
|
||||||
move.l d1,d7
|
|
||||||
swap d6
|
|
||||||
swap d7
|
|
||||||
mulu.w d1,d6
|
|
||||||
mulu.w d0,d7
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d7,d6
|
|
||||||
swap d6
|
|
||||||
clr.w d6
|
|
||||||
add.l d6,d0
|
|
||||||
lea _g_file,a0
|
|
||||||
pea (0,a0,d0.l)
|
|
||||||
jsr _f_open
|
|
||||||
move.l d0,d4
|
|
||||||
add.w #12,a7
|
|
||||||
bne l22
|
|
||||||
l21
|
|
||||||
move.w d3,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l #255,d1
|
|
||||||
move.l d0,d6
|
|
||||||
move.l d1,d7
|
|
||||||
swap d6
|
|
||||||
swap d7
|
|
||||||
mulu.w d1,d6
|
|
||||||
mulu.w d0,d7
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d7,d6
|
|
||||||
swap d6
|
|
||||||
clr.w d6
|
|
||||||
add.l d6,d0
|
|
||||||
move.b d0,(4,a2)
|
|
||||||
move.w d3,d0
|
|
||||||
bra l9
|
|
||||||
l22
|
|
||||||
lea _g_fil_state,a0
|
|
||||||
move.b #0,(0,a0,d3.w)
|
|
||||||
move.l a2,-(a7)
|
|
||||||
jsr _chan_free
|
|
||||||
move.l d4,-(a7)
|
|
||||||
jsr _fatfs_to_foenix
|
|
||||||
addq.w #8,a7
|
|
||||||
bra l9
|
|
||||||
l23
|
|
||||||
bra l24
|
|
||||||
l20
|
|
||||||
lea _g_fil_state,a0
|
|
||||||
move.b #0,(0,a0,d3.w)
|
|
||||||
moveq #-11,d0
|
|
||||||
l24
|
|
||||||
l9
|
|
||||||
l25 reg a2/a3/d2/d3/d4/d5/d6/d7
|
|
||||||
movem.l (a7)+,a2/a3/d2/d3/d4/d5/d6/d7
|
|
||||||
l27 equ 32
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fsys_close
|
|
||||||
cnop 0,4
|
|
||||||
_fsys_close
|
|
||||||
movem.l l30,-(a7)
|
|
||||||
move.w (6+l32,a7),d4
|
|
||||||
move.l #0,a2
|
|
||||||
moveq #0,d2
|
|
||||||
move.w d4,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _chan_get_record
|
|
||||||
move.l d0,a2
|
|
||||||
moveq #0,d0
|
|
||||||
move.b (4,a2),d0
|
|
||||||
move.w d0,d2
|
|
||||||
move.w d2,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l #550,d1
|
|
||||||
move.l d0,d5
|
|
||||||
move.l d1,d6
|
|
||||||
swap d5
|
|
||||||
swap d6
|
|
||||||
mulu.w d1,d5
|
|
||||||
mulu.w d0,d6
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d6,d5
|
|
||||||
swap d5
|
|
||||||
clr.w d5
|
|
||||||
add.l d5,d0
|
|
||||||
lea _g_file,a0
|
|
||||||
pea (0,a0,d0.l)
|
|
||||||
jsr _f_close
|
|
||||||
move.l d0,d3
|
|
||||||
move.l a2,-(a7)
|
|
||||||
jsr _chan_free
|
|
||||||
lea _g_fil_state,a0
|
|
||||||
move.b #0,(0,a0,d2.w)
|
|
||||||
move.l d3,-(a7)
|
|
||||||
jsr _fatfs_to_foenix
|
|
||||||
add.w #16,a7
|
|
||||||
l28
|
|
||||||
l30 reg a2/d2/d3/d4/d5/d6
|
|
||||||
movem.l (a7)+,a2/d2/d3/d4/d5/d6
|
|
||||||
l32 equ 24
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fsys_opendir
|
|
||||||
cnop 0,4
|
|
||||||
_fsys_opendir
|
|
||||||
movem.l l35,-(a7)
|
|
||||||
moveq #-1,d0
|
|
||||||
l33
|
|
||||||
l35 reg
|
|
||||||
l37 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fsys_closedir
|
|
||||||
cnop 0,4
|
|
||||||
_fsys_closedir
|
|
||||||
movem.l l40,-(a7)
|
|
||||||
moveq #-1,d0
|
|
||||||
l38
|
|
||||||
l40 reg
|
|
||||||
l42 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fsys_readdir
|
|
||||||
cnop 0,4
|
|
||||||
_fsys_readdir
|
|
||||||
movem.l l45,-(a7)
|
|
||||||
moveq #-1,d0
|
|
||||||
l43
|
|
||||||
l45 reg
|
|
||||||
l47 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fsys_findfirst
|
|
||||||
cnop 0,4
|
|
||||||
_fsys_findfirst
|
|
||||||
movem.l l50,-(a7)
|
|
||||||
moveq #-1,d0
|
|
||||||
l48
|
|
||||||
l50 reg
|
|
||||||
l52 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fsys_findnext
|
|
||||||
cnop 0,4
|
|
||||||
_fsys_findnext
|
|
||||||
movem.l l55,-(a7)
|
|
||||||
moveq #-1,d0
|
|
||||||
l53
|
|
||||||
l55 reg
|
|
||||||
l57 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fsys_mkdir
|
|
||||||
cnop 0,4
|
|
||||||
_fsys_mkdir
|
|
||||||
movem.l l60,-(a7)
|
|
||||||
moveq #-1,d0
|
|
||||||
l58
|
|
||||||
l60 reg
|
|
||||||
l62 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fsys_delete
|
|
||||||
cnop 0,4
|
|
||||||
_fsys_delete
|
|
||||||
movem.l l65,-(a7)
|
|
||||||
moveq #-1,d0
|
|
||||||
l63
|
|
||||||
l65 reg
|
|
||||||
l67 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fsys_rename
|
|
||||||
cnop 0,4
|
|
||||||
_fsys_rename
|
|
||||||
movem.l l70,-(a7)
|
|
||||||
moveq #-1,d0
|
|
||||||
l68
|
|
||||||
l70 reg
|
|
||||||
l72 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fsys_setcwd
|
|
||||||
cnop 0,4
|
|
||||||
_fsys_setcwd
|
|
||||||
movem.l l75,-(a7)
|
|
||||||
moveq #-1,d0
|
|
||||||
l73
|
|
||||||
l75 reg
|
|
||||||
l77 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fsys_getcwd
|
|
||||||
cnop 0,4
|
|
||||||
_fsys_getcwd
|
|
||||||
movem.l l80,-(a7)
|
|
||||||
moveq #-1,d0
|
|
||||||
l78
|
|
||||||
l80 reg
|
|
||||||
l82 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fchan_init
|
|
||||||
cnop 0,4
|
|
||||||
_fchan_init
|
|
||||||
movem.l l85,-(a7)
|
|
||||||
moveq #0,d0
|
|
||||||
l83
|
|
||||||
l85 reg
|
|
||||||
l87 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fchan_to_file
|
|
||||||
cnop 0,4
|
|
||||||
_fchan_to_file
|
|
||||||
movem.l l93,-(a7)
|
|
||||||
move.l (4+l95,a7),a1
|
|
||||||
moveq #0,d0
|
|
||||||
move.b (4,a1),d0
|
|
||||||
move.w d0,d1
|
|
||||||
cmp.w #8,d1
|
|
||||||
bge l91
|
|
||||||
l90
|
|
||||||
move.w d1,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l #550,d2
|
|
||||||
move.l d0,d3
|
|
||||||
move.l d2,d4
|
|
||||||
swap d3
|
|
||||||
swap d4
|
|
||||||
mulu.w d2,d3
|
|
||||||
mulu.w d0,d4
|
|
||||||
mulu.w d2,d0
|
|
||||||
add.w d4,d3
|
|
||||||
swap d3
|
|
||||||
clr.w d3
|
|
||||||
add.l d3,d0
|
|
||||||
lea _g_file,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l a0,d0
|
|
||||||
bra l88
|
|
||||||
l91
|
|
||||||
moveq #0,d0
|
|
||||||
l92
|
|
||||||
l88
|
|
||||||
l93 reg d2/d3/d4
|
|
||||||
movem.l (a7)+,d2/d3/d4
|
|
||||||
l95 equ 12
|
|
||||||
rts
|
|
||||||
; stacksize=12
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fchan_read
|
|
||||||
cnop 0,4
|
|
||||||
_fchan_read
|
|
||||||
sub.w #12,a7
|
|
||||||
movem.l l103,-(a7)
|
|
||||||
move.w (26+l105,a7),d3
|
|
||||||
move.l (20+l105,a7),a4
|
|
||||||
move.l (16+l105,a7),a3
|
|
||||||
move.l a3,-(a7)
|
|
||||||
jsr _fchan_to_file
|
|
||||||
move.l d0,a2
|
|
||||||
addq.w #4,a7
|
|
||||||
move.l a2,d0
|
|
||||||
beq l99
|
|
||||||
lea (8+l105,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
move.w d3,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
move.l a4,-(a7)
|
|
||||||
move.l a2,-(a7)
|
|
||||||
jsr _f_read
|
|
||||||
move.l d0,d2
|
|
||||||
add.w #16,a7
|
|
||||||
bne l101
|
|
||||||
l100
|
|
||||||
move.w (10+l105,a7),d0
|
|
||||||
bra l96
|
|
||||||
l101
|
|
||||||
move.l d2,-(a7)
|
|
||||||
jsr _fatfs_to_foenix
|
|
||||||
addq.w #4,a7
|
|
||||||
bra l96
|
|
||||||
l102
|
|
||||||
l99
|
|
||||||
moveq #-10,d0
|
|
||||||
l96
|
|
||||||
l103 reg a2/a3/a4/d2/d3
|
|
||||||
movem.l (a7)+,a2/a3/a4/d2/d3
|
|
||||||
l105 equ 20
|
|
||||||
add.w #12,a7
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fchan_readline
|
|
||||||
cnop 0,4
|
|
||||||
_fchan_readline
|
|
||||||
movem.l l113,-(a7)
|
|
||||||
move.w (14+l115,a7),d2
|
|
||||||
move.l (4+l115,a7),a5
|
|
||||||
move.l (8+l115,a7),a3
|
|
||||||
move.l a5,-(a7)
|
|
||||||
jsr _fchan_to_file
|
|
||||||
move.l d0,a2
|
|
||||||
addq.w #4,a7
|
|
||||||
move.l a2,d0
|
|
||||||
beq l109
|
|
||||||
move.l a2,-(a7)
|
|
||||||
move.w d2,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
move.l a3,-(a7)
|
|
||||||
jsr _f_gets
|
|
||||||
move.l d0,a4
|
|
||||||
add.w #12,a7
|
|
||||||
move.l a4,d0
|
|
||||||
beq l111
|
|
||||||
move.l a3,a0
|
|
||||||
inline
|
|
||||||
move.l a0,d0
|
|
||||||
.l1
|
|
||||||
tst.b (a0)+
|
|
||||||
bne .l1
|
|
||||||
sub.l a0,d0
|
|
||||||
not.l d0
|
|
||||||
einline
|
|
||||||
bra l106
|
|
||||||
l111
|
|
||||||
moveq #0,d0
|
|
||||||
move.b (17,a2),d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _fatfs_to_foenix
|
|
||||||
addq.w #4,a7
|
|
||||||
bra l106
|
|
||||||
l112
|
|
||||||
l109
|
|
||||||
moveq #-10,d0
|
|
||||||
l106
|
|
||||||
l113 reg a2/a3/a4/a5/d2
|
|
||||||
movem.l (a7)+,a2/a3/a4/a5/d2
|
|
||||||
l115 equ 20
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fchan_read_b
|
|
||||||
cnop 0,4
|
|
||||||
_fchan_read_b
|
|
||||||
movem.l l118,-(a7)
|
|
||||||
moveq #0,d0
|
|
||||||
l116
|
|
||||||
l118 reg
|
|
||||||
l120 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fchan_write
|
|
||||||
cnop 0,4
|
|
||||||
_fchan_write
|
|
||||||
sub.w #12,a7
|
|
||||||
movem.l l128,-(a7)
|
|
||||||
move.w (26+l130,a7),d3
|
|
||||||
move.l (20+l130,a7),a4
|
|
||||||
move.l (16+l130,a7),a3
|
|
||||||
move.l a3,-(a7)
|
|
||||||
jsr _fchan_to_file
|
|
||||||
move.l d0,a2
|
|
||||||
addq.w #4,a7
|
|
||||||
move.l a2,d0
|
|
||||||
beq l124
|
|
||||||
lea (8+l130,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
move.w d3,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
move.l a4,-(a7)
|
|
||||||
move.l a2,-(a7)
|
|
||||||
jsr _f_write
|
|
||||||
move.l d0,d2
|
|
||||||
add.w #16,a7
|
|
||||||
bne l126
|
|
||||||
l125
|
|
||||||
move.w (10+l130,a7),d0
|
|
||||||
bra l121
|
|
||||||
l126
|
|
||||||
move.l d2,-(a7)
|
|
||||||
jsr _fatfs_to_foenix
|
|
||||||
addq.w #4,a7
|
|
||||||
bra l121
|
|
||||||
l127
|
|
||||||
l124
|
|
||||||
moveq #-10,d0
|
|
||||||
l121
|
|
||||||
l128 reg a2/a3/a4/d2/d3
|
|
||||||
movem.l (a7)+,a2/a3/a4/d2/d3
|
|
||||||
l130 equ 20
|
|
||||||
add.w #12,a7
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fchan_write_b
|
|
||||||
cnop 0,4
|
|
||||||
_fchan_write_b
|
|
||||||
sub.w #16,a7
|
|
||||||
movem.l l138,-(a7)
|
|
||||||
move.b (27+l140,a7),d3
|
|
||||||
move.l (20+l140,a7),a3
|
|
||||||
move.l a3,-(a7)
|
|
||||||
jsr _fchan_to_file
|
|
||||||
move.l d0,a2
|
|
||||||
addq.w #4,a7
|
|
||||||
move.l a2,d0
|
|
||||||
beq l134
|
|
||||||
move.b d3,(12+l140,a7)
|
|
||||||
lea (8+l140,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
move.l #1,-(a7)
|
|
||||||
lea (20+l140,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
move.l a2,-(a7)
|
|
||||||
jsr _f_write
|
|
||||||
move.l d0,d2
|
|
||||||
add.w #16,a7
|
|
||||||
bne l136
|
|
||||||
l135
|
|
||||||
move.w (10+l140,a7),d0
|
|
||||||
bra l131
|
|
||||||
l136
|
|
||||||
move.l d2,-(a7)
|
|
||||||
jsr _fatfs_to_foenix
|
|
||||||
addq.w #4,a7
|
|
||||||
bra l131
|
|
||||||
l137
|
|
||||||
l134
|
|
||||||
moveq #-10,d0
|
|
||||||
l131
|
|
||||||
l138 reg a2/a3/d2/d3
|
|
||||||
movem.l (a7)+,a2/a3/d2/d3
|
|
||||||
l140 equ 16
|
|
||||||
add.w #16,a7
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fchan_status
|
|
||||||
cnop 0,4
|
|
||||||
_fchan_status
|
|
||||||
movem.l l152,-(a7)
|
|
||||||
move.l (4+l154,a7),a3
|
|
||||||
move.l a3,-(a7)
|
|
||||||
jsr _fchan_to_file
|
|
||||||
move.l d0,a2
|
|
||||||
addq.w #4,a7
|
|
||||||
move.l a2,d0
|
|
||||||
beq l144
|
|
||||||
moveq #0,d2
|
|
||||||
move.l (18,a2),d0
|
|
||||||
cmp.l (12,a2),d0
|
|
||||||
beq l147
|
|
||||||
l149
|
|
||||||
moveq #0,d0
|
|
||||||
bra l148
|
|
||||||
l147
|
|
||||||
moveq #1,d0
|
|
||||||
l148
|
|
||||||
tst.l d0
|
|
||||||
beq l146
|
|
||||||
or.w #1,d2
|
|
||||||
l146
|
|
||||||
tst.b (17,a2)
|
|
||||||
beq l151
|
|
||||||
l150
|
|
||||||
or.w #2,d2
|
|
||||||
l151
|
|
||||||
move.w d2,d0
|
|
||||||
bra l141
|
|
||||||
l144
|
|
||||||
moveq #-10,d0
|
|
||||||
l141
|
|
||||||
l152 reg a2/a3/d2
|
|
||||||
movem.l (a7)+,a2/a3/d2
|
|
||||||
l154 equ 12
|
|
||||||
rts
|
|
||||||
; stacksize=32
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fchan_flush
|
|
||||||
cnop 0,4
|
|
||||||
_fchan_flush
|
|
||||||
movem.l l159,-(a7)
|
|
||||||
move.l (4+l161,a7),a3
|
|
||||||
move.l a3,-(a7)
|
|
||||||
jsr _fchan_to_file
|
|
||||||
move.l d0,a2
|
|
||||||
addq.w #4,a7
|
|
||||||
move.l a2,d0
|
|
||||||
beq l158
|
|
||||||
move.l a2,-(a7)
|
|
||||||
jsr _f_sync
|
|
||||||
move.l d0,d2
|
|
||||||
move.l d2,-(a7)
|
|
||||||
jsr _fatfs_to_foenix
|
|
||||||
addq.w #8,a7
|
|
||||||
bra l155
|
|
||||||
l158
|
|
||||||
moveq #-10,d0
|
|
||||||
l155
|
|
||||||
l159 reg a2/a3/d2
|
|
||||||
movem.l (a7)+,a2/a3/d2
|
|
||||||
l161 equ 12
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fchan_seek
|
|
||||||
cnop 0,4
|
|
||||||
_fchan_seek
|
|
||||||
movem.l l171,-(a7)
|
|
||||||
move.w (14+l173,a7),d5
|
|
||||||
move.l (8+l173,a7),d4
|
|
||||||
move.l (4+l173,a7),a3
|
|
||||||
move.l a3,-(a7)
|
|
||||||
jsr _fchan_to_file
|
|
||||||
move.l d0,a2
|
|
||||||
addq.w #4,a7
|
|
||||||
move.l a2,d0
|
|
||||||
beq l165
|
|
||||||
tst.w d5
|
|
||||||
bne l167
|
|
||||||
l166
|
|
||||||
move.l d4,-(a7)
|
|
||||||
move.l a2,-(a7)
|
|
||||||
jsr _f_lseek
|
|
||||||
move.l d0,d2
|
|
||||||
move.l d2,-(a7)
|
|
||||||
jsr _fatfs_to_foenix
|
|
||||||
add.w #12,a7
|
|
||||||
bra l162
|
|
||||||
l167
|
|
||||||
cmp.w #1,d5
|
|
||||||
bne l170
|
|
||||||
l169
|
|
||||||
move.l (18,a2),d3
|
|
||||||
move.l d3,d0
|
|
||||||
add.l d4,d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
move.l a2,-(a7)
|
|
||||||
jsr _f_lseek
|
|
||||||
move.l d0,d2
|
|
||||||
move.l d2,-(a7)
|
|
||||||
jsr _fatfs_to_foenix
|
|
||||||
add.w #12,a7
|
|
||||||
bra l162
|
|
||||||
l170
|
|
||||||
l168
|
|
||||||
l165
|
|
||||||
moveq #-10,d0
|
|
||||||
l162
|
|
||||||
l171 reg a2/a3/d2/d3/d4/d5
|
|
||||||
movem.l (a7)+,a2/a3/d2/d3/d4/d5
|
|
||||||
l173 equ 24
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fchan_ioctrl
|
|
||||||
cnop 0,4
|
|
||||||
_fchan_ioctrl
|
|
||||||
movem.l l176,-(a7)
|
|
||||||
moveq #0,d0
|
|
||||||
l174
|
|
||||||
l176 reg
|
|
||||||
l178 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _fsys_init
|
|
||||||
cnop 0,4
|
|
||||||
_fsys_init
|
|
||||||
movem.l l190,-(a7)
|
|
||||||
moveq #0,d2
|
|
||||||
bra l182
|
|
||||||
l181
|
|
||||||
lea _g_dir_state,a0
|
|
||||||
move.b #0,(0,a0,d2.l)
|
|
||||||
l184
|
|
||||||
addq.l #1,d2
|
|
||||||
l182
|
|
||||||
moveq #8,d0
|
|
||||||
cmp.l d2,d0
|
|
||||||
bgt l181
|
|
||||||
l183
|
|
||||||
moveq #0,d2
|
|
||||||
bra l186
|
|
||||||
l185
|
|
||||||
lea _g_fil_state,a0
|
|
||||||
move.b #0,(0,a0,d2.l)
|
|
||||||
l188
|
|
||||||
addq.l #1,d2
|
|
||||||
l186
|
|
||||||
moveq #8,d0
|
|
||||||
cmp.l d2,d0
|
|
||||||
bgt l185
|
|
||||||
l187
|
|
||||||
move.w #6,_g_file_dev
|
|
||||||
move.l #l189,2+_g_file_dev
|
|
||||||
move.l #_fchan_init,6+_g_file_dev
|
|
||||||
move.l #_fchan_ioctrl,42+_g_file_dev
|
|
||||||
move.l #_fchan_read,10+_g_file_dev
|
|
||||||
move.l #_fchan_read_b,18+_g_file_dev
|
|
||||||
move.l #_fchan_readline,14+_g_file_dev
|
|
||||||
move.l #_fchan_write,22+_g_file_dev
|
|
||||||
move.l #_fchan_write_b,26+_g_file_dev
|
|
||||||
move.l #_fchan_seek,38+_g_file_dev
|
|
||||||
move.l #_fchan_status,30+_g_file_dev
|
|
||||||
move.l #_fchan_flush,34+_g_file_dev
|
|
||||||
pea _g_file_dev
|
|
||||||
jsr _cdev_register
|
|
||||||
addq.w #4,a7
|
|
||||||
l179
|
|
||||||
l190 reg d2
|
|
||||||
movem.l (a7)+,d2
|
|
||||||
l192 equ 4
|
|
||||||
rts
|
|
||||||
cnop 0,4
|
|
||||||
l189
|
|
||||||
dc.b 70
|
|
||||||
dc.b 73
|
|
||||||
dc.b 76
|
|
||||||
dc.b 69
|
|
||||||
dc.b 0
|
|
||||||
public _f_open
|
|
||||||
public _f_close
|
|
||||||
public _f_read
|
|
||||||
public _f_write
|
|
||||||
public _f_lseek
|
|
||||||
public _f_sync
|
|
||||||
public _f_gets
|
|
||||||
public _cdev_register
|
|
||||||
public _chan_alloc
|
|
||||||
public _chan_free
|
|
||||||
public _chan_get_record
|
|
||||||
public _g_drive
|
|
||||||
section "BSS",bss
|
|
||||||
cnop 0,4
|
|
||||||
_g_drive
|
|
||||||
ds.b 4512
|
|
||||||
public _g_dir_state
|
|
||||||
cnop 0,4
|
|
||||||
_g_dir_state
|
|
||||||
ds.b 8
|
|
||||||
public _g_directory
|
|
||||||
cnop 0,4
|
|
||||||
_g_directory
|
|
||||||
ds.b 384
|
|
||||||
public _g_fil_state
|
|
||||||
cnop 0,4
|
|
||||||
_g_fil_state
|
|
||||||
ds.b 8
|
|
||||||
public _g_file
|
|
||||||
cnop 0,4
|
|
||||||
_g_file
|
|
||||||
ds.b 4400
|
|
||||||
public _g_file_dev
|
|
||||||
cnop 0,4
|
|
||||||
_g_file_dev
|
|
||||||
ds.b 46
|
|
410
src/dev/kbd_mo.c
Normal file
410
src/dev/kbd_mo.c
Normal file
|
@ -0,0 +1,410 @@
|
||||||
|
/*
|
||||||
|
* Declarations for Mo, the built-in keyboard of the A2560K
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "log.h"
|
||||||
|
#include "interrupt.h"
|
||||||
|
#include "kbd_mo.h"
|
||||||
|
#include "ring_buffer.h"
|
||||||
|
|
||||||
|
#define KBD_MO_DATA ((volatile unsigned short *)0x00C00040) /* Data register for the keyboard (scan codes will be here) */
|
||||||
|
#define KBD_MO_STAT ((volatile unsigned short *)0x00C00042) /* Status register for the keyboard */
|
||||||
|
#define KBD_MO_EMPTY 0x8000 /* Status flag that will be set if the keyboard buffer is empty */
|
||||||
|
#define KBD_MO_FULL 0x4000 /* Status flag that will be set if the keyboard buffer is full */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Modifier bit flags
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define KBD_LOCK_SCROLL 0x01
|
||||||
|
#define KBD_LOCK_NUM 0x02
|
||||||
|
#define KBD_LOCK_CAPS 0x04
|
||||||
|
#define KBD_MOD_SHIFT 0x08
|
||||||
|
#define KBD_MOD_CTRL 0x10
|
||||||
|
#define KBD_MOD_ALT 0x20
|
||||||
|
#define KBD_MOD_OS 0x40
|
||||||
|
#define KBD_MOD_MENU 0x80
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Structure to track the keyboard input
|
||||||
|
*/
|
||||||
|
struct s_kdbmo_kbd {
|
||||||
|
unsigned char control; /* Bits to control how the keyboard processes things */
|
||||||
|
unsigned char status; /* Status of the keyboard */
|
||||||
|
t_word_ring sc_buf; /* Buffer containing scancodes that have been processed */
|
||||||
|
t_word_ring char_buf; /* Buffer containing characters to be read */
|
||||||
|
unsigned char modifiers; /* State of the modifier keys (CTRL, ALT, SHIFT) and caps lock */
|
||||||
|
|
||||||
|
/* Scan code to character lookup tables */
|
||||||
|
|
||||||
|
char * keys_unmodified;
|
||||||
|
char * keys_shift;
|
||||||
|
char * keys_control;
|
||||||
|
char * keys_control_shift;
|
||||||
|
char * keys_caps;
|
||||||
|
char * keys_caps_shift;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Driver global variables
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct s_kdbmo_kbd g_kbdmo_control;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* US keyboard layout scancode translation tables
|
||||||
|
*/
|
||||||
|
|
||||||
|
static char g_us_sc_unmodified[] = {
|
||||||
|
0x00, 0x1B, '1', '2', '3', '4', '5', '6', /* 0x00 - 0x07 */
|
||||||
|
'7', '8', '9', '0', '-', '=', 0x08, 0x09, /* 0x08 - 0x0F */
|
||||||
|
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', /* 0x10 - 0x17 */
|
||||||
|
'o', 'p', '[', ']', 0x0D, 0x00, 'a', 's', /* 0x18 - 0x1F */
|
||||||
|
'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', /* 0x20 - 0x27 */
|
||||||
|
0x27, '`', 0x00, '\\', 'z', 'x', 'c', 'v', /* 0x28 - 0x2F */
|
||||||
|
'b', 'n', 'm', ',', '.', '/', 0x00, '*', /* 0x30 - 0x37 */
|
||||||
|
0x00, ' ', 0x00, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, /* 0x38 - 0x3F */
|
||||||
|
0x8F, 0x90, 0x91, 0x92, 0x93, 0x00, 0x00, 0x80, /* 0x40 - 0x47 */
|
||||||
|
0x86, 0x84, '-', 0x89, '5', 0x88, '+', 0x83, /* 0x48 - 0x4F */
|
||||||
|
0x87, 0x85, 0x81, 0x82, 0x00, 0x00, 0x00, 0x94, /* 0x50 - 0x57 */
|
||||||
|
0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58 - 0x5F */
|
||||||
|
0x00, 0x00, 0x81, 0x80, 0x84, 0x82, 0x83, 0x85, /* 0x60 - 0x67 */
|
||||||
|
0x86, 0x89, 0x87, 0x88, '/', 0x0D, 0x00, 0x00, /* 0x68 - 0x6F */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70 - 0x77 */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0x78 - 0x7F */
|
||||||
|
};
|
||||||
|
|
||||||
|
static char g_us_sc_shift[] = {
|
||||||
|
0x00, 0x1B, '!', '@', '#', '$', '%', '^', /* 0x00 - 0x07 */
|
||||||
|
'&', '*', '(', ')', '_', '+', 0x08, 0x09, /* 0x08 - 0x0F */
|
||||||
|
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', /* 0x10 - 0x17 */
|
||||||
|
'O', 'P', '{', '}', 0x0A, 0x00, 'A', 'S', /* 0x18 - 0x1F */
|
||||||
|
'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', /* 0x20 - 0x27 */
|
||||||
|
0x22, '~', 0x00, '|', 'Z', 'X', 'C', 'V', /* 0x28 - 0x2F */
|
||||||
|
'B', 'N', 'M', '<', '>', '?', 0x00, 0x00, /* 0x30 - 0x37 */
|
||||||
|
0x00, ' ', 0x00, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, /* 0x38 - 0x3F */
|
||||||
|
0x8F, 0x90, 0x91, 0x92, 0x93, 0x00, 0x00, 0x80, /* 0x40 - 0x47 */
|
||||||
|
0x86, 0x84, '-', 0x89, '5', 0x88, '+', 0x83, /* 0x48 - 0x4F */
|
||||||
|
0x87, 0x85, 0x81, 0x82, 0x00, 0x00, 0x00, 0x94, /* 0x50 - 0x57 */
|
||||||
|
0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58 - 0x5F */
|
||||||
|
0x00, 0x00, 0x81, 0x80, 0x84, 0x82, 0x83, 0x85, /* 0x60 - 0x67 */
|
||||||
|
0x86, 0x89, 0x87, 0x88, '/', 0x0D, 0x00, 0x00, /* 0x68 - 0x6F */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70 - 0x77 */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0x78 - 0x7F */
|
||||||
|
};
|
||||||
|
|
||||||
|
static char g_us_sc_ctrl[] = {
|
||||||
|
0x00, 0x1B, '1', '2', '3', '4', '5', 0x1E, /* 0x00 - 0x07 */
|
||||||
|
'7', '8', '9', '0', 0x1F, '=', 0x08, 0x09, /* 0x08 - 0x0F */
|
||||||
|
0x11, 0x17, 0x05, 0x12, 0x14, 0x19, 0x15, 0x09, /* 0x10 - 0x17 */
|
||||||
|
0x0F, 0x10, 0x1B, 0x1D, 0x0A, 0x00, 0x01, 0x13, /* 0x18 - 0x1F */
|
||||||
|
0x04, 0x06, 0x07, 0x08, 0x0A, 0x0B, 0x0C, ';', /* 0x20 - 0x27 */
|
||||||
|
0x22, '`', 0x00, '\\', 0x1A, 0x18, 0x03, 0x16, /* 0x28 - 0x2F */
|
||||||
|
0x02, 0x0E, 0x0D, ',', '.', 0x1C, 0x00, 0x00, /* 0x30 - 0x37 */
|
||||||
|
0x00, ' ', 0x00, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, /* 0x38 - 0x3F */
|
||||||
|
0x8F, 0x90, 0x91, 0x92, 0x93, 0x00, 0x00, 0x80, /* 0x40 - 0x47 */
|
||||||
|
0x86, 0x84, '-', 0x89, '5', 0x88, '+', 0x83, /* 0x48 - 0x4F */
|
||||||
|
0x87, 0x85, 0x81, 0x82, 0x00, 0x00, 0x00, 0x94, /* 0x50 - 0x57 */
|
||||||
|
0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58 - 0x5F */
|
||||||
|
0x00, 0x00, 0x81, 0x80, 0x84, 0x82, 0x83, 0x85, /* 0x60 - 0x67 */
|
||||||
|
0x86, 0x89, 0x87, 0x88, '/', 0x0D, 0x00, 0x00, /* 0x68 - 0x6F */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70 - 0x77 */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0x78 - 0x7F */
|
||||||
|
};
|
||||||
|
|
||||||
|
static char g_us_sc_lock[] = {
|
||||||
|
0x00, 0x1B, '1', '2', '3', '4', '5', '6', /* 0x00 - 0x07 */
|
||||||
|
'7', '8', '9', '0', '-', '=', 0x08, 0x09, /* 0x08 - 0x0F */
|
||||||
|
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', /* 0x10 - 0x17 */
|
||||||
|
'O', 'P', '[', ']', 0x0D, 0x00, 'A', 'S', /* 0x18 - 0x1F */
|
||||||
|
'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', /* 0x20 - 0x27 */
|
||||||
|
0x27, '`', 0x00, '\\', 'Z', 'X', 'C', 'V', /* 0x28 - 0x2F */
|
||||||
|
'B', 'N', 'M', ',', '.', '/', 0x00, 0x00, /* 0x30 - 0x37 */
|
||||||
|
0x00, ' ', 0x00, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, /* 0x38 - 0x3F */
|
||||||
|
0x8F, 0x90, 0x91, 0x92, 0x93, 0x00, 0x00, '7', /* 0x40 - 0x47 */
|
||||||
|
'8', '9', '-', '4', '5', '6', '+', '1', /* 0x48 - 0x4F */
|
||||||
|
'2', '3', '0', '.', 0x00, 0x00, 0x00, 0x94, /* 0x50 - 0x57 */
|
||||||
|
0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58 - 0x5F */
|
||||||
|
0x00, 0x00, 0x81, 0x80, 0x84, 0x82, 0x83, 0x85, /* 0x60 - 0x67 */
|
||||||
|
0x86, 0x89, 0x87, 0x88, '/', 0x0D, 0x00, 0x00, /* 0x68 - 0x6F */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70 - 0x77 */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0x78 - 0x7F */
|
||||||
|
};
|
||||||
|
|
||||||
|
static char g_us_sc_lock_shift[] = {
|
||||||
|
0x00, 0x1B, '!', '@', '#', '$', '%', '^', /* 0x00 - 0x07 */
|
||||||
|
'&', '*', '(', ')', '_', '+', 0x08, 0x09, /* 0x08 - 0x0F */
|
||||||
|
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', /* 0x10 - 0x17 */
|
||||||
|
'o', 'p', '{', '}', 0x0A, 0x00, 'a', 's', /* 0x18 - 0x1F */
|
||||||
|
'd', 'f', 'g', 'h', 'j', 'k', 'l', ':', /* 0x20 - 0x27 */
|
||||||
|
0x22, '~', 0x00, '|', 'z', 'x', 'c', 'v', /* 0x28 - 0x2F */
|
||||||
|
'b', 'n', 'm', '<', '>', '?', 0x00, 0x00, /* 0x30 - 0x37 */
|
||||||
|
0x00, ' ', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38 - 0x3F */
|
||||||
|
0x8F, 0x90, 0x91, 0x92, 0x93, 0x00, 0x00, '7', /* 0x40 - 0x47 */
|
||||||
|
'8', '9', '-', '4', '5', '6', '+', '1', /* 0x48 - 0x4F */
|
||||||
|
'2', '3', '0', '.', 0x00, 0x00, 0x00, 0x94, /* 0x50 - 0x57 */
|
||||||
|
0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58 - 0x5F */
|
||||||
|
0x00, 0x00, 0x81, 0x80, 0x84, 0x82, 0x83, 0x85, /* 0x60 - 0x67 */
|
||||||
|
0x86, 0x89, 0x87, 0x88, '/', 0x0D, 0x00, 0x00, /* 0x68 - 0x6F */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70 - 0x77 */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0x78 - 0x7F */
|
||||||
|
};
|
||||||
|
|
||||||
|
static char g_us_sc_ctrl_shift[] = {
|
||||||
|
0x00, 0x1B, '!', '@', '#', '$', '%', '^', /* 0x00 - 0x07 */
|
||||||
|
'&', '*', '(', ')', '_', '+', 0x08, 0x09, /* 0x08 - 0x0F */
|
||||||
|
0x11, 0x17, 0x05, 0x12, 0x14, 0x19, 0x15, 0x09, /* 0x10 - 0x17 */
|
||||||
|
0x0F, 0x10, 0x1B, 0x1D, 0x0A, 0x00, 0x01, 0x13, /* 0x18 - 0x1F */
|
||||||
|
0x04, 0x06, 0x07, 0x08, 0x0A, 0x0B, 0x0C, ';', /* 0x20 - 0x27 */
|
||||||
|
0x22, '`', 0x00, '\\', 0x1A, 0x18, 0x03, 0x16, /* 0x28 - 0x2F */
|
||||||
|
0x02, 0x0E, 0x0D, ',', '.', 0x1C, 0x00, 0x00, /* 0x30 - 0x37 */
|
||||||
|
0x00, ' ', 0x00, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, /* 0x38 - 0x3F */
|
||||||
|
0x8F, 0x90, 0x91, 0x92, 0x93, 0x00, 0x00, 0x80, /* 0x40 - 0x47 */
|
||||||
|
0x86, 0x84, '-', 0x89, '5', 0x88, '+', 0x83, /* 0x48 - 0x4F */
|
||||||
|
0x87, 0x85, 0x81, 0x82, 0x00, 0x00, 0x00, 0x94, /* 0x50 - 0x57 */
|
||||||
|
0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58 - 0x5F */
|
||||||
|
0x00, 0x00, 0x81, 0x80, 0x84, 0x82, 0x83, 0x85, /* 0x60 - 0x67 */
|
||||||
|
0x86, 0x89, 0x87, 0x88, '/', 0x0D, 0x00, 0x00, /* 0x68 - 0x6F */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70 - 0x77 */
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0x78 - 0x7F */
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Make sure everything is removed from Mo's input buffer
|
||||||
|
*/
|
||||||
|
void kbdmo_flush_out() {
|
||||||
|
TRACE("kbdmo_flush_out");
|
||||||
|
|
||||||
|
/* While there is data in the buffer ... */
|
||||||
|
while ((*KBD_MO_STAT & 0x00ff) != 0) {
|
||||||
|
/* Read and throw out the scan codes */
|
||||||
|
unsigned short dummy = *KBD_MO_DATA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize the PS2 controller and any attached devices
|
||||||
|
* Enable keyboard and mouse interrupts as appropriate.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* Status code indicating if either the mouse or the keyboard is missing.
|
||||||
|
*/
|
||||||
|
short kbdmo_init() {
|
||||||
|
TRACE("kbdmo_init");
|
||||||
|
|
||||||
|
int_disable(INT_KBD_A2560K);
|
||||||
|
|
||||||
|
/* Set up the ring buffers */
|
||||||
|
|
||||||
|
rb_word_init(&g_kbdmo_control.sc_buf); /* Scan-code ring buffer is empty */
|
||||||
|
rb_word_init(&g_kbdmo_control.char_buf); /* Character ring buffer is empty */
|
||||||
|
|
||||||
|
/* Set the default keyboard layout to US */
|
||||||
|
|
||||||
|
g_kbdmo_control.keys_unmodified = g_us_sc_unmodified;
|
||||||
|
g_kbdmo_control.keys_shift = g_us_sc_shift;
|
||||||
|
g_kbdmo_control.keys_control = g_us_sc_ctrl;
|
||||||
|
g_kbdmo_control.keys_control_shift = g_us_sc_ctrl_shift;
|
||||||
|
g_kbdmo_control.keys_caps = g_us_sc_lock;
|
||||||
|
g_kbdmo_control.keys_caps_shift = g_us_sc_lock_shift;
|
||||||
|
|
||||||
|
g_kbdmo_control.status = 0;
|
||||||
|
g_kbdmo_control.modifiers = 0;
|
||||||
|
|
||||||
|
/* Make sure everything is read */
|
||||||
|
kbdmo_flush_out();
|
||||||
|
|
||||||
|
/* Clear out any pending interrupt */
|
||||||
|
// int_clear(INT_KBD_A2560K);
|
||||||
|
//
|
||||||
|
// /* Register a handler for the keyboard */
|
||||||
|
// int_register(INT_KBD_A2560K, kbdmo_handle_irq);
|
||||||
|
//
|
||||||
|
// /* Enable the interrupt for the keyboard */
|
||||||
|
// int_enable(INT_KBD_A2560K);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Toggle the lock bit based on the flag.
|
||||||
|
*/
|
||||||
|
void kbdmo_toggle_modifier(short flag) {
|
||||||
|
g_kbdmo_control.modifiers ^= flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set or clear the modifier flag depending on if the scan code is a make or break code.
|
||||||
|
*/
|
||||||
|
void kbdmo_makebreak_modifier(short flag, short is_break) {
|
||||||
|
if (is_break) {
|
||||||
|
g_kbdmo_control.modifiers &= ~flag;
|
||||||
|
} else {
|
||||||
|
g_kbdmo_control.modifiers |= flag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add the scan code to the queue of scan codes
|
||||||
|
*/
|
||||||
|
void kbdmo_enqueue_scan(unsigned char scan_code) {
|
||||||
|
// Make sure the scan code isn't 0 or 128, which are invalid make/break codes
|
||||||
|
if ((scan_code != 0) && (scan_code != 0x80)) {
|
||||||
|
unsigned char is_break = scan_code & 0x80;
|
||||||
|
|
||||||
|
// Check the scan code to see if it's a modifier key or a lock key
|
||||||
|
// update the modifier and lock variables accordingly...
|
||||||
|
switch (scan_code & 0x7f) {
|
||||||
|
case 0x2A:
|
||||||
|
case 0x36:
|
||||||
|
kbdmo_makebreak_modifier(KBD_MOD_SHIFT, is_break);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x1D:
|
||||||
|
case 0x5E:
|
||||||
|
kbdmo_makebreak_modifier(KBD_MOD_CTRL, is_break);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x38:
|
||||||
|
case 0x5C:
|
||||||
|
kbdmo_makebreak_modifier(KBD_MOD_ALT, is_break);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x5D:
|
||||||
|
kbdmo_makebreak_modifier(KBD_MOD_MENU, is_break);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x5B:
|
||||||
|
kbdmo_makebreak_modifier(KBD_MOD_OS, is_break);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x3A:
|
||||||
|
if (!is_break) kbdmo_toggle_modifier(KBD_LOCK_CAPS);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x45:
|
||||||
|
if (!is_break) kbdmo_toggle_modifier(KBD_LOCK_NUM);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x46:
|
||||||
|
if (!is_break) kbdmo_toggle_modifier(KBD_LOCK_SCROLL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
rb_word_put(&g_kbdmo_control.sc_buf, g_kbdmo_control.modifiers << 8 | scan_code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Try to retrieve the next scancode from the keyboard.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* The next scancode to be processed, 0 if nothing.
|
||||||
|
*/
|
||||||
|
unsigned short kbdmo_get_scancode() {
|
||||||
|
return rb_word_get(&g_kbdmo_control.sc_buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IRQ handler for the keyboard... read a scan code and queue it
|
||||||
|
*/
|
||||||
|
void kbdmo_handle_irq() {
|
||||||
|
/* We got an interrupt for MO.
|
||||||
|
* While there is data in the input queue...
|
||||||
|
*/
|
||||||
|
while ((*KBD_MO_STAT & 0x00ff) != 0) {
|
||||||
|
/* Get a scan code from the input buffer */
|
||||||
|
unsigned char scan_code = *KBD_MO_DATA;
|
||||||
|
|
||||||
|
if ((scan_code & 0x7fff) != 0) {
|
||||||
|
/* TODO: beep if the input was full or the ring buffer is full */
|
||||||
|
|
||||||
|
/* Process it and enqueue it */
|
||||||
|
kbdmo_enqueue_scan((unsigned char)(scan_code & 0x00ff));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Try to get a character from the keyboard...
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* the next character to be read from the keyboard (0 if none available)
|
||||||
|
*/
|
||||||
|
char kbdmo_getc() {
|
||||||
|
if (!rb_word_empty(&g_kbdmo_control.char_buf)) {
|
||||||
|
// If there is a character waiting in the character buffer, return it...
|
||||||
|
return (char)rb_word_get(&g_kbdmo_control.char_buf);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Otherwise, we need to check the scan code queue...
|
||||||
|
unsigned short raw_code = kbdmo_get_scancode();
|
||||||
|
while (raw_code != 0) {
|
||||||
|
if ((raw_code & 0x80) == 0) {
|
||||||
|
// If it's a make code, let's try to look it up...
|
||||||
|
unsigned char modifiers = (raw_code >> 8) & 0xff; // Get the modifiers
|
||||||
|
unsigned char scan_code = raw_code & 0x7f; // Get the base code for the key
|
||||||
|
|
||||||
|
// Check the modifiers to see what we should lookup...
|
||||||
|
|
||||||
|
if ((modifiers & (KBD_MOD_SHIFT | KBD_MOD_CTRL | KBD_LOCK_CAPS)) == 0) {
|
||||||
|
// No modifiers... just return the base character
|
||||||
|
return g_kbdmo_control.keys_unmodified[scan_code];
|
||||||
|
|
||||||
|
} else if (modifiers & KBD_MOD_CTRL) {
|
||||||
|
// If CTRL is pressed...
|
||||||
|
if (modifiers & KBD_MOD_SHIFT) {
|
||||||
|
// If SHIFT is also pressed, return CTRL-SHIFT form
|
||||||
|
return g_kbdmo_control.keys_control_shift[scan_code];
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Otherwise, return just CTRL form
|
||||||
|
return g_kbdmo_control.keys_control[scan_code];
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (modifiers & KBD_LOCK_CAPS) {
|
||||||
|
// If CAPS is locked...
|
||||||
|
if (modifiers & KBD_MOD_SHIFT) {
|
||||||
|
// If SHIFT is also pressed, return CAPS-SHIFT form
|
||||||
|
return g_kbdmo_control.keys_caps_shift[scan_code];
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Otherwise, return just CAPS form
|
||||||
|
return g_kbdmo_control.keys_caps[scan_code];
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// SHIFT is pressed, return SHIFT form
|
||||||
|
return g_kbdmo_control.keys_shift[scan_code];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we reach this point, it wasn't a useful scan-code...
|
||||||
|
// So try to fetch another
|
||||||
|
raw_code = kbdmo_get_scancode();
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we reach this point, there are no useful scan codes
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Use polling to fetch a key
|
||||||
|
*/
|
||||||
|
char kbdmo_getc_poll() {
|
||||||
|
kbdmo_handle_irq();
|
||||||
|
return kbdmo_getc();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Use polling to fetch a scan code
|
||||||
|
*/
|
||||||
|
unsigned short kbdmo_get_scancode_poll() {
|
||||||
|
kbdmo_handle_irq();
|
||||||
|
return kbdmo_get_scancode();
|
||||||
|
}
|
43
src/dev/kbd_mo.h
Normal file
43
src/dev/kbd_mo.h
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
* Declarations for Mo, the built-in keyboard of the A2560K
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __KBD_MO_H
|
||||||
|
#define __KBD_MO_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize the PS2 controller and any attached devices
|
||||||
|
* Enable keyboard and mouse interrupts as appropriate.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* Status code indicating if either the mouse or the keyboard is missing.
|
||||||
|
*/
|
||||||
|
extern short kbdmo_init();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Try to retrieve the next scancode from the keyboard.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* The next scancode to be processed, 0 if nothing.
|
||||||
|
*/
|
||||||
|
extern unsigned short kbdmo_get_scancode();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Try to get a character from the keyboard...
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* the next character to be read from the keyboard (0 if none available)
|
||||||
|
*/
|
||||||
|
extern char kbdmo_getc();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Use polling to fetch a key
|
||||||
|
*/
|
||||||
|
extern char kbdmo_getc_poll();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Use polling to fetch a scan code
|
||||||
|
*/
|
||||||
|
extern unsigned short kbdmo_get_scancode_poll();
|
||||||
|
|
||||||
|
#endif
|
945
src/dev/pata.asm
945
src/dev/pata.asm
|
@ -1,945 +0,0 @@
|
||||||
idnt "pata.c"
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
section "CODE",code
|
|
||||||
public _pata_wait_not_busy
|
|
||||||
cnop 0,4
|
|
||||||
_pata_wait_not_busy
|
|
||||||
movem.l l11,-(a7)
|
|
||||||
move.w #10000,d2
|
|
||||||
pea l3
|
|
||||||
jsr _DEBUG
|
|
||||||
addq.w #4,a7
|
|
||||||
l4
|
|
||||||
move.b 12583950,d3
|
|
||||||
l6
|
|
||||||
move.b d3,d0
|
|
||||||
ext.w d0
|
|
||||||
and.b #128,d0
|
|
||||||
and.w #255,d0
|
|
||||||
and.l #65535,d0
|
|
||||||
tst.l d0
|
|
||||||
beq l5
|
|
||||||
l7
|
|
||||||
move.w d2,d0
|
|
||||||
subq.w #1,d2
|
|
||||||
tst.w d0
|
|
||||||
bgt l4
|
|
||||||
l5
|
|
||||||
tst.w d2
|
|
||||||
bne l9
|
|
||||||
l8
|
|
||||||
moveq #-3,d0
|
|
||||||
bra l1
|
|
||||||
l9
|
|
||||||
moveq #0,d0
|
|
||||||
l10
|
|
||||||
l1
|
|
||||||
l11 reg d2/d3
|
|
||||||
movem.l (a7)+,d2/d3
|
|
||||||
l13 equ 8
|
|
||||||
rts
|
|
||||||
cnop 0,4
|
|
||||||
l3
|
|
||||||
dc.b 112
|
|
||||||
dc.b 97
|
|
||||||
dc.b 116
|
|
||||||
dc.b 97
|
|
||||||
dc.b 95
|
|
||||||
dc.b 119
|
|
||||||
dc.b 97
|
|
||||||
dc.b 105
|
|
||||||
dc.b 116
|
|
||||||
dc.b 95
|
|
||||||
dc.b 110
|
|
||||||
dc.b 111
|
|
||||||
dc.b 116
|
|
||||||
dc.b 95
|
|
||||||
dc.b 98
|
|
||||||
dc.b 117
|
|
||||||
dc.b 115
|
|
||||||
dc.b 121
|
|
||||||
dc.b 0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _pata_wait_ready
|
|
||||||
cnop 0,4
|
|
||||||
_pata_wait_ready
|
|
||||||
movem.l l24,-(a7)
|
|
||||||
move.w #10000,d2
|
|
||||||
pea l16
|
|
||||||
jsr _DEBUG
|
|
||||||
addq.w #4,a7
|
|
||||||
l17
|
|
||||||
move.b 12583950,d3
|
|
||||||
l19
|
|
||||||
move.b d3,d0
|
|
||||||
ext.w d0
|
|
||||||
and.b #64,d0
|
|
||||||
and.w #255,d0
|
|
||||||
and.l #65535,d0
|
|
||||||
tst.l d0
|
|
||||||
bne l18
|
|
||||||
l20
|
|
||||||
move.w d2,d0
|
|
||||||
subq.w #1,d2
|
|
||||||
tst.w d0
|
|
||||||
bgt l17
|
|
||||||
l18
|
|
||||||
tst.w d2
|
|
||||||
bne l22
|
|
||||||
l21
|
|
||||||
moveq #-3,d0
|
|
||||||
bra l14
|
|
||||||
l22
|
|
||||||
moveq #0,d0
|
|
||||||
l23
|
|
||||||
l14
|
|
||||||
l24 reg d2/d3
|
|
||||||
movem.l (a7)+,d2/d3
|
|
||||||
l26 equ 8
|
|
||||||
rts
|
|
||||||
cnop 0,4
|
|
||||||
l16
|
|
||||||
dc.b 112
|
|
||||||
dc.b 97
|
|
||||||
dc.b 116
|
|
||||||
dc.b 97
|
|
||||||
dc.b 95
|
|
||||||
dc.b 119
|
|
||||||
dc.b 97
|
|
||||||
dc.b 105
|
|
||||||
dc.b 116
|
|
||||||
dc.b 95
|
|
||||||
dc.b 114
|
|
||||||
dc.b 101
|
|
||||||
dc.b 97
|
|
||||||
dc.b 100
|
|
||||||
dc.b 121
|
|
||||||
dc.b 0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _pata_wait_ready_not_busy
|
|
||||||
cnop 0,4
|
|
||||||
_pata_wait_ready_not_busy
|
|
||||||
movem.l l37,-(a7)
|
|
||||||
move.w #10000,d2
|
|
||||||
pea l29
|
|
||||||
jsr _DEBUG
|
|
||||||
addq.w #4,a7
|
|
||||||
l30
|
|
||||||
move.b 12583950,d3
|
|
||||||
l32
|
|
||||||
move.b d3,d0
|
|
||||||
ext.w d0
|
|
||||||
and.b #192,d0
|
|
||||||
and.w #255,d0
|
|
||||||
and.l #65535,d0
|
|
||||||
moveq #64,d1
|
|
||||||
cmp.l d0,d1
|
|
||||||
beq l31
|
|
||||||
l33
|
|
||||||
move.w d2,d0
|
|
||||||
subq.w #1,d2
|
|
||||||
tst.w d0
|
|
||||||
bgt l30
|
|
||||||
l31
|
|
||||||
tst.w d2
|
|
||||||
bne l35
|
|
||||||
l34
|
|
||||||
moveq #-3,d0
|
|
||||||
bra l27
|
|
||||||
l35
|
|
||||||
moveq #0,d0
|
|
||||||
l36
|
|
||||||
l27
|
|
||||||
l37 reg d2/d3
|
|
||||||
movem.l (a7)+,d2/d3
|
|
||||||
l39 equ 8
|
|
||||||
rts
|
|
||||||
cnop 0,4
|
|
||||||
l29
|
|
||||||
dc.b 112
|
|
||||||
dc.b 97
|
|
||||||
dc.b 116
|
|
||||||
dc.b 97
|
|
||||||
dc.b 95
|
|
||||||
dc.b 119
|
|
||||||
dc.b 97
|
|
||||||
dc.b 105
|
|
||||||
dc.b 116
|
|
||||||
dc.b 95
|
|
||||||
dc.b 114
|
|
||||||
dc.b 101
|
|
||||||
dc.b 97
|
|
||||||
dc.b 100
|
|
||||||
dc.b 121
|
|
||||||
dc.b 95
|
|
||||||
dc.b 110
|
|
||||||
dc.b 111
|
|
||||||
dc.b 116
|
|
||||||
dc.b 95
|
|
||||||
dc.b 98
|
|
||||||
dc.b 117
|
|
||||||
dc.b 115
|
|
||||||
dc.b 121
|
|
||||||
dc.b 0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _pata_wait_data_request
|
|
||||||
cnop 0,4
|
|
||||||
_pata_wait_data_request
|
|
||||||
movem.l l50,-(a7)
|
|
||||||
move.w #10000,d2
|
|
||||||
pea l42
|
|
||||||
jsr _DEBUG
|
|
||||||
addq.w #4,a7
|
|
||||||
l43
|
|
||||||
move.b 12583950,d3
|
|
||||||
l45
|
|
||||||
move.b d3,d0
|
|
||||||
ext.w d0
|
|
||||||
and.b #8,d0
|
|
||||||
and.w #255,d0
|
|
||||||
and.l #65535,d0
|
|
||||||
tst.l d0
|
|
||||||
bne l44
|
|
||||||
l46
|
|
||||||
move.w d2,d0
|
|
||||||
subq.w #1,d2
|
|
||||||
tst.w d0
|
|
||||||
bgt l43
|
|
||||||
l44
|
|
||||||
tst.w d2
|
|
||||||
bne l48
|
|
||||||
l47
|
|
||||||
moveq #-3,d0
|
|
||||||
bra l40
|
|
||||||
l48
|
|
||||||
moveq #0,d0
|
|
||||||
l49
|
|
||||||
l40
|
|
||||||
l50 reg d2/d3
|
|
||||||
movem.l (a7)+,d2/d3
|
|
||||||
l52 equ 8
|
|
||||||
rts
|
|
||||||
cnop 0,4
|
|
||||||
l42
|
|
||||||
dc.b 112
|
|
||||||
dc.b 97
|
|
||||||
dc.b 116
|
|
||||||
dc.b 97
|
|
||||||
dc.b 95
|
|
||||||
dc.b 119
|
|
||||||
dc.b 97
|
|
||||||
dc.b 105
|
|
||||||
dc.b 116
|
|
||||||
dc.b 95
|
|
||||||
dc.b 100
|
|
||||||
dc.b 97
|
|
||||||
dc.b 116
|
|
||||||
dc.b 97
|
|
||||||
dc.b 95
|
|
||||||
dc.b 114
|
|
||||||
dc.b 101
|
|
||||||
dc.b 113
|
|
||||||
dc.b 117
|
|
||||||
dc.b 101
|
|
||||||
dc.b 115
|
|
||||||
dc.b 116
|
|
||||||
dc.b 0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _pata_identity
|
|
||||||
cnop 0,4
|
|
||||||
_pata_identity
|
|
||||||
movem.l l66,-(a7)
|
|
||||||
move.l (4+l68,a7),a2
|
|
||||||
pea l55
|
|
||||||
jsr _DEBUG
|
|
||||||
move.b #224,12583948
|
|
||||||
move.b #1,12583940
|
|
||||||
move.b #0,12583942
|
|
||||||
move.b #0,12583944
|
|
||||||
move.b #0,12583946
|
|
||||||
move.b #236,12583950
|
|
||||||
jsr _pata_wait_not_busy
|
|
||||||
addq.w #4,a7
|
|
||||||
tst.w d0
|
|
||||||
beq l57
|
|
||||||
moveq #-3,d0
|
|
||||||
bra l53
|
|
||||||
l57
|
|
||||||
jsr _pata_wait_ready_not_busy
|
|
||||||
tst.w d0
|
|
||||||
beq l59
|
|
||||||
moveq #-3,d0
|
|
||||||
bra l53
|
|
||||||
l59
|
|
||||||
pea l60
|
|
||||||
jsr _DEBUG
|
|
||||||
lea _g_buffer,a3
|
|
||||||
moveq #0,d3
|
|
||||||
addq.w #4,a7
|
|
||||||
bra l62
|
|
||||||
l61
|
|
||||||
move.w 12583936,d4
|
|
||||||
moveq #0,d0
|
|
||||||
move.w d4,d0
|
|
||||||
and.l #255,d0
|
|
||||||
move.w d3,d1
|
|
||||||
addq.w #1,d3
|
|
||||||
lea _g_buffer,a0
|
|
||||||
move.b d0,(0,a0,d1.w)
|
|
||||||
moveq #0,d0
|
|
||||||
move.w d4,d0
|
|
||||||
asr.l #8,d0
|
|
||||||
and.l #255,d0
|
|
||||||
move.w d3,d1
|
|
||||||
addq.w #1,d3
|
|
||||||
lea _g_buffer,a0
|
|
||||||
move.b d0,(0,a0,d1.w)
|
|
||||||
l64
|
|
||||||
l62
|
|
||||||
cmp.w #512,d3
|
|
||||||
blt l61
|
|
||||||
l63
|
|
||||||
pea l65
|
|
||||||
jsr _DEBUG
|
|
||||||
move.l a4,a3
|
|
||||||
move.b 1+_g_buffer,d0
|
|
||||||
ext.w d0
|
|
||||||
ext.l d0
|
|
||||||
moveq #16,d1
|
|
||||||
lsl.l d1,d0
|
|
||||||
move.b _g_buffer,d1
|
|
||||||
ext.w d1
|
|
||||||
ext.l d1
|
|
||||||
or.l d1,d0
|
|
||||||
move.w d0,(a2)
|
|
||||||
move.b 99+_g_buffer,d0
|
|
||||||
ext.w d0
|
|
||||||
ext.l d0
|
|
||||||
moveq #16,d1
|
|
||||||
lsl.l d1,d0
|
|
||||||
move.b 98+_g_buffer,d1
|
|
||||||
ext.w d1
|
|
||||||
ext.l d1
|
|
||||||
or.l d1,d0
|
|
||||||
move.w d0,(64,a2)
|
|
||||||
move.b 121+_g_buffer,d0
|
|
||||||
ext.w d0
|
|
||||||
ext.l d0
|
|
||||||
lsl.l #8,d0
|
|
||||||
move.b 120+_g_buffer,d1
|
|
||||||
ext.w d1
|
|
||||||
ext.l d1
|
|
||||||
or.l d1,d0
|
|
||||||
move.w d0,(66,a2)
|
|
||||||
move.b 123+_g_buffer,d0
|
|
||||||
ext.w d0
|
|
||||||
ext.l d0
|
|
||||||
lsl.l #8,d0
|
|
||||||
move.b 122+_g_buffer,d1
|
|
||||||
ext.w d1
|
|
||||||
ext.l d1
|
|
||||||
or.l d1,d0
|
|
||||||
lea (66,a2),a0
|
|
||||||
move.w d0,(2,a0)
|
|
||||||
moveq #18,d2
|
|
||||||
lea 22+_g_buffer,a1
|
|
||||||
lea (2,a2),a0
|
|
||||||
inline
|
|
||||||
move.l a0,d0
|
|
||||||
cmp.l #16,d2
|
|
||||||
blo .l5
|
|
||||||
moveq #1,d1
|
|
||||||
and.b d0,d1
|
|
||||||
beq .l1
|
|
||||||
move.b (a1)+,(a0)+
|
|
||||||
subq.l #1,d2
|
|
||||||
.l1
|
|
||||||
move.l a1,d1
|
|
||||||
and.b #1,d1
|
|
||||||
beq .l3
|
|
||||||
cmp.l #$10000,d2
|
|
||||||
blo .l5
|
|
||||||
.l2
|
|
||||||
move.b (a1)+,(a0)+
|
|
||||||
subq.l #1,d2
|
|
||||||
bne .l2
|
|
||||||
bra .l7
|
|
||||||
.l3
|
|
||||||
moveq #3,d1
|
|
||||||
and.l d2,d1
|
|
||||||
sub.l d1,d2
|
|
||||||
.l4
|
|
||||||
move.l (a1)+,(a0)+
|
|
||||||
subq.l #4,d2
|
|
||||||
bne .l4
|
|
||||||
move.w d1,d2
|
|
||||||
.l5
|
|
||||||
subq.w #1,d2
|
|
||||||
blo .l7
|
|
||||||
.l6
|
|
||||||
move.b (a1)+,(a0)+
|
|
||||||
dbf d2,.l6
|
|
||||||
.l7
|
|
||||||
einline
|
|
||||||
moveq #6,d2
|
|
||||||
lea 46+_g_buffer,a1
|
|
||||||
lea (20,a2),a0
|
|
||||||
inline
|
|
||||||
move.l a0,d0
|
|
||||||
cmp.l #16,d2
|
|
||||||
blo .l5
|
|
||||||
moveq #1,d1
|
|
||||||
and.b d0,d1
|
|
||||||
beq .l1
|
|
||||||
move.b (a1)+,(a0)+
|
|
||||||
subq.l #1,d2
|
|
||||||
.l1
|
|
||||||
move.l a1,d1
|
|
||||||
and.b #1,d1
|
|
||||||
beq .l3
|
|
||||||
cmp.l #$10000,d2
|
|
||||||
blo .l5
|
|
||||||
.l2
|
|
||||||
move.b (a1)+,(a0)+
|
|
||||||
subq.l #1,d2
|
|
||||||
bne .l2
|
|
||||||
bra .l7
|
|
||||||
.l3
|
|
||||||
moveq #3,d1
|
|
||||||
and.l d2,d1
|
|
||||||
sub.l d1,d2
|
|
||||||
.l4
|
|
||||||
move.l (a1)+,(a0)+
|
|
||||||
subq.l #4,d2
|
|
||||||
bne .l4
|
|
||||||
move.w d1,d2
|
|
||||||
.l5
|
|
||||||
subq.w #1,d2
|
|
||||||
blo .l7
|
|
||||||
.l6
|
|
||||||
move.b (a1)+,(a0)+
|
|
||||||
dbf d2,.l6
|
|
||||||
.l7
|
|
||||||
einline
|
|
||||||
moveq #38,d2
|
|
||||||
lea 54+_g_buffer,a1
|
|
||||||
lea (26,a2),a0
|
|
||||||
inline
|
|
||||||
move.l a0,d0
|
|
||||||
cmp.l #16,d2
|
|
||||||
blo .l5
|
|
||||||
moveq #1,d1
|
|
||||||
and.b d0,d1
|
|
||||||
beq .l1
|
|
||||||
move.b (a1)+,(a0)+
|
|
||||||
subq.l #1,d2
|
|
||||||
.l1
|
|
||||||
move.l a1,d1
|
|
||||||
and.b #1,d1
|
|
||||||
beq .l3
|
|
||||||
cmp.l #$10000,d2
|
|
||||||
blo .l5
|
|
||||||
.l2
|
|
||||||
move.b (a1)+,(a0)+
|
|
||||||
subq.l #1,d2
|
|
||||||
bne .l2
|
|
||||||
bra .l7
|
|
||||||
.l3
|
|
||||||
moveq #3,d1
|
|
||||||
and.l d2,d1
|
|
||||||
sub.l d1,d2
|
|
||||||
.l4
|
|
||||||
move.l (a1)+,(a0)+
|
|
||||||
subq.l #4,d2
|
|
||||||
bne .l4
|
|
||||||
move.w d1,d2
|
|
||||||
.l5
|
|
||||||
subq.w #1,d2
|
|
||||||
blo .l7
|
|
||||||
.l6
|
|
||||||
move.b (a1)+,(a0)+
|
|
||||||
dbf d2,.l6
|
|
||||||
.l7
|
|
||||||
einline
|
|
||||||
moveq #0,d0
|
|
||||||
addq.w #4,a7
|
|
||||||
l53
|
|
||||||
l66 reg a2/a3/a4/d2/d3/d4
|
|
||||||
movem.l (a7)+,a2/a3/a4/d2/d3/d4
|
|
||||||
l68 equ 24
|
|
||||||
rts
|
|
||||||
cnop 0,4
|
|
||||||
l55
|
|
||||||
dc.b 112
|
|
||||||
dc.b 97
|
|
||||||
dc.b 116
|
|
||||||
dc.b 97
|
|
||||||
dc.b 95
|
|
||||||
dc.b 105
|
|
||||||
dc.b 100
|
|
||||||
dc.b 101
|
|
||||||
dc.b 110
|
|
||||||
dc.b 116
|
|
||||||
dc.b 105
|
|
||||||
dc.b 116
|
|
||||||
dc.b 121
|
|
||||||
dc.b 0
|
|
||||||
cnop 0,4
|
|
||||||
l60
|
|
||||||
dc.b 99
|
|
||||||
dc.b 111
|
|
||||||
dc.b 112
|
|
||||||
dc.b 121
|
|
||||||
dc.b 105
|
|
||||||
dc.b 110
|
|
||||||
dc.b 103
|
|
||||||
dc.b 32
|
|
||||||
dc.b 100
|
|
||||||
dc.b 97
|
|
||||||
dc.b 116
|
|
||||||
dc.b 97
|
|
||||||
dc.b 0
|
|
||||||
cnop 0,4
|
|
||||||
l65
|
|
||||||
dc.b 100
|
|
||||||
dc.b 97
|
|
||||||
dc.b 116
|
|
||||||
dc.b 97
|
|
||||||
dc.b 32
|
|
||||||
dc.b 99
|
|
||||||
dc.b 111
|
|
||||||
dc.b 112
|
|
||||||
dc.b 105
|
|
||||||
dc.b 101
|
|
||||||
dc.b 100
|
|
||||||
dc.b 0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _pata_init
|
|
||||||
cnop 0,4
|
|
||||||
_pata_init
|
|
||||||
movem.l l76,-(a7)
|
|
||||||
pea l71
|
|
||||||
jsr _DEBUG
|
|
||||||
move.b #0,12583950
|
|
||||||
jsr _pata_wait_not_busy
|
|
||||||
addq.w #4,a7
|
|
||||||
tst.w d0
|
|
||||||
beq l73
|
|
||||||
moveq #-3,d0
|
|
||||||
bra l69
|
|
||||||
l73
|
|
||||||
move.b #160,12583948
|
|
||||||
move.b #1,12583940
|
|
||||||
move.b #0,12583942
|
|
||||||
move.b #0,12583944
|
|
||||||
move.b #0,12583946
|
|
||||||
jsr _pata_wait_ready_not_busy
|
|
||||||
tst.w d0
|
|
||||||
beq l75
|
|
||||||
moveq #-3,d0
|
|
||||||
bra l69
|
|
||||||
l75
|
|
||||||
move.w #2,_g_pata_status
|
|
||||||
moveq #0,d0
|
|
||||||
l69
|
|
||||||
l76 reg
|
|
||||||
l78 equ 0
|
|
||||||
rts
|
|
||||||
cnop 0,4
|
|
||||||
l71
|
|
||||||
dc.b 112
|
|
||||||
dc.b 97
|
|
||||||
dc.b 116
|
|
||||||
dc.b 97
|
|
||||||
dc.b 95
|
|
||||||
dc.b 105
|
|
||||||
dc.b 110
|
|
||||||
dc.b 105
|
|
||||||
dc.b 116
|
|
||||||
dc.b 0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _pata_read
|
|
||||||
cnop 0,4
|
|
||||||
_pata_read
|
|
||||||
movem.l l92,-(a7)
|
|
||||||
move.l (4+l94,a7),d4
|
|
||||||
move.w (14+l94,a7),d3
|
|
||||||
move.l (8+l94,a7),a3
|
|
||||||
pea l81
|
|
||||||
jsr _DEBUG
|
|
||||||
jsr _pata_wait_ready_not_busy
|
|
||||||
addq.w #4,a7
|
|
||||||
tst.w d0
|
|
||||||
beq l83
|
|
||||||
moveq #-3,d0
|
|
||||||
bra l79
|
|
||||||
l83
|
|
||||||
moveq #24,d1
|
|
||||||
move.l d4,d0
|
|
||||||
asr.l d1,d0
|
|
||||||
and.l #7,d0
|
|
||||||
or.l #224,d0
|
|
||||||
move.b d0,12583948
|
|
||||||
jsr _pata_wait_ready_not_busy
|
|
||||||
tst.w d0
|
|
||||||
beq l85
|
|
||||||
moveq #-3,d0
|
|
||||||
bra l79
|
|
||||||
l85
|
|
||||||
move.b #1,12583940
|
|
||||||
move.l #255,d0
|
|
||||||
and.l d4,d0
|
|
||||||
move.b d0,12583942
|
|
||||||
move.l d4,d0
|
|
||||||
asr.l #8,d0
|
|
||||||
and.l #255,d0
|
|
||||||
move.b d0,12583944
|
|
||||||
moveq #16,d1
|
|
||||||
move.l d4,d0
|
|
||||||
asr.l d1,d0
|
|
||||||
and.l #255,d0
|
|
||||||
move.b d0,12583944
|
|
||||||
move.b #33,12583950
|
|
||||||
jsr _pata_wait_ready_not_busy
|
|
||||||
tst.w d0
|
|
||||||
beq l87
|
|
||||||
moveq #-3,d0
|
|
||||||
bra l79
|
|
||||||
l87
|
|
||||||
moveq #0,d2
|
|
||||||
move.l a3,a2
|
|
||||||
bra l89
|
|
||||||
l88
|
|
||||||
move.l a2,a0
|
|
||||||
addq.l #2,a2
|
|
||||||
move.w 12583936,(a0)
|
|
||||||
l91
|
|
||||||
addq.w #2,d2
|
|
||||||
l89
|
|
||||||
cmp.w d2,d3
|
|
||||||
bgt l88
|
|
||||||
l90
|
|
||||||
move.w d2,d0
|
|
||||||
l79
|
|
||||||
l92 reg a2/a3/d2/d3/d4
|
|
||||||
movem.l (a7)+,a2/a3/d2/d3/d4
|
|
||||||
l94 equ 20
|
|
||||||
rts
|
|
||||||
cnop 0,4
|
|
||||||
l81
|
|
||||||
dc.b 112
|
|
||||||
dc.b 97
|
|
||||||
dc.b 116
|
|
||||||
dc.b 97
|
|
||||||
dc.b 95
|
|
||||||
dc.b 114
|
|
||||||
dc.b 101
|
|
||||||
dc.b 97
|
|
||||||
dc.b 100
|
|
||||||
dc.b 0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _pata_write
|
|
||||||
cnop 0,4
|
|
||||||
_pata_write
|
|
||||||
movem.l l108,-(a7)
|
|
||||||
move.l (4+l110,a7),d4
|
|
||||||
move.w (14+l110,a7),d3
|
|
||||||
move.l (8+l110,a7),a3
|
|
||||||
pea l97
|
|
||||||
jsr _DEBUG
|
|
||||||
jsr _pata_wait_ready_not_busy
|
|
||||||
addq.w #4,a7
|
|
||||||
tst.w d0
|
|
||||||
beq l99
|
|
||||||
moveq #-3,d0
|
|
||||||
bra l95
|
|
||||||
l99
|
|
||||||
moveq #24,d1
|
|
||||||
move.l d4,d0
|
|
||||||
asr.l d1,d0
|
|
||||||
and.l #7,d0
|
|
||||||
or.l #224,d0
|
|
||||||
move.b d0,12583948
|
|
||||||
jsr _pata_wait_ready_not_busy
|
|
||||||
tst.w d0
|
|
||||||
beq l101
|
|
||||||
moveq #-3,d0
|
|
||||||
bra l95
|
|
||||||
l101
|
|
||||||
move.b #1,12583940
|
|
||||||
move.l #255,d0
|
|
||||||
and.l d4,d0
|
|
||||||
move.b d0,12583942
|
|
||||||
move.l d4,d0
|
|
||||||
asr.l #8,d0
|
|
||||||
and.l #255,d0
|
|
||||||
move.b d0,12583944
|
|
||||||
moveq #16,d1
|
|
||||||
move.l d4,d0
|
|
||||||
asr.l d1,d0
|
|
||||||
and.l #255,d0
|
|
||||||
move.b d0,12583944
|
|
||||||
move.b #48,12583950
|
|
||||||
jsr _pata_wait_ready_not_busy
|
|
||||||
tst.w d0
|
|
||||||
beq l103
|
|
||||||
moveq #-3,d0
|
|
||||||
bra l95
|
|
||||||
l103
|
|
||||||
moveq #0,d2
|
|
||||||
move.l a3,a2
|
|
||||||
bra l105
|
|
||||||
l104
|
|
||||||
move.l a2,a0
|
|
||||||
addq.l #2,a2
|
|
||||||
move.w (a0),12583936
|
|
||||||
l107
|
|
||||||
addq.w #2,d2
|
|
||||||
l105
|
|
||||||
cmp.w d2,d3
|
|
||||||
bgt l104
|
|
||||||
l106
|
|
||||||
moveq #0,d0
|
|
||||||
l95
|
|
||||||
l108 reg a2/a3/d2/d3/d4
|
|
||||||
movem.l (a7)+,a2/a3/d2/d3/d4
|
|
||||||
l110 equ 20
|
|
||||||
rts
|
|
||||||
cnop 0,4
|
|
||||||
l97
|
|
||||||
dc.b 112
|
|
||||||
dc.b 97
|
|
||||||
dc.b 116
|
|
||||||
dc.b 97
|
|
||||||
dc.b 95
|
|
||||||
dc.b 119
|
|
||||||
dc.b 114
|
|
||||||
dc.b 105
|
|
||||||
dc.b 116
|
|
||||||
dc.b 101
|
|
||||||
dc.b 0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _pata_status
|
|
||||||
cnop 0,4
|
|
||||||
_pata_status
|
|
||||||
movem.l l114,-(a7)
|
|
||||||
pea l113
|
|
||||||
jsr _DEBUG
|
|
||||||
move.w _g_pata_status,d0
|
|
||||||
addq.w #4,a7
|
|
||||||
l111
|
|
||||||
l114 reg
|
|
||||||
l116 equ 0
|
|
||||||
rts
|
|
||||||
cnop 0,4
|
|
||||||
l113
|
|
||||||
dc.b 112
|
|
||||||
dc.b 97
|
|
||||||
dc.b 116
|
|
||||||
dc.b 97
|
|
||||||
dc.b 95
|
|
||||||
dc.b 115
|
|
||||||
dc.b 116
|
|
||||||
dc.b 97
|
|
||||||
dc.b 116
|
|
||||||
dc.b 117
|
|
||||||
dc.b 115
|
|
||||||
dc.b 0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _pata_error
|
|
||||||
cnop 0,4
|
|
||||||
_pata_error
|
|
||||||
movem.l l120,-(a7)
|
|
||||||
pea l119
|
|
||||||
jsr _DEBUG
|
|
||||||
move.w _g_pata_error,d0
|
|
||||||
addq.w #4,a7
|
|
||||||
l117
|
|
||||||
l120 reg
|
|
||||||
l122 equ 0
|
|
||||||
rts
|
|
||||||
cnop 0,4
|
|
||||||
l119
|
|
||||||
dc.b 112
|
|
||||||
dc.b 97
|
|
||||||
dc.b 116
|
|
||||||
dc.b 97
|
|
||||||
dc.b 95
|
|
||||||
dc.b 101
|
|
||||||
dc.b 114
|
|
||||||
dc.b 114
|
|
||||||
dc.b 111
|
|
||||||
dc.b 114
|
|
||||||
dc.b 0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _pata_flush
|
|
||||||
cnop 0,4
|
|
||||||
_pata_flush
|
|
||||||
movem.l l126,-(a7)
|
|
||||||
pea l125
|
|
||||||
jsr _DEBUG
|
|
||||||
moveq #0,d0
|
|
||||||
addq.w #4,a7
|
|
||||||
l123
|
|
||||||
l126 reg
|
|
||||||
l128 equ 0
|
|
||||||
rts
|
|
||||||
cnop 0,4
|
|
||||||
l125
|
|
||||||
dc.b 112
|
|
||||||
dc.b 97
|
|
||||||
dc.b 116
|
|
||||||
dc.b 97
|
|
||||||
dc.b 95
|
|
||||||
dc.b 102
|
|
||||||
dc.b 108
|
|
||||||
dc.b 117
|
|
||||||
dc.b 115
|
|
||||||
dc.b 104
|
|
||||||
dc.b 0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _pata_ioctrl
|
|
||||||
cnop 0,4
|
|
||||||
_pata_ioctrl
|
|
||||||
sub.w #88,a7
|
|
||||||
movem.l l142,-(a7)
|
|
||||||
move.w (94+l144,a7),d3
|
|
||||||
move.l (96+l144,a7),a2
|
|
||||||
pea l131
|
|
||||||
jsr _DEBUG
|
|
||||||
move.w d3,d0
|
|
||||||
subq.w #1,d0
|
|
||||||
addq.w #4,a7
|
|
||||||
beq l133
|
|
||||||
subq.w #1,d0
|
|
||||||
beq l136
|
|
||||||
subq.w #1,d0
|
|
||||||
beq l137
|
|
||||||
subq.w #1,d0
|
|
||||||
beq l138
|
|
||||||
bra l141
|
|
||||||
l133
|
|
||||||
move.l a2,a5
|
|
||||||
lea (14+l144,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
jsr _pata_identity
|
|
||||||
move.w d0,d2
|
|
||||||
addq.w #4,a7
|
|
||||||
beq l135
|
|
||||||
l134
|
|
||||||
move.w d2,d0
|
|
||||||
bra l129
|
|
||||||
l135
|
|
||||||
move.l (80+l144,a7),(a5)
|
|
||||||
bra l132
|
|
||||||
l136
|
|
||||||
move.l a2,a4
|
|
||||||
move.w #512,(a4)
|
|
||||||
bra l132
|
|
||||||
l137
|
|
||||||
move.l a2,a3
|
|
||||||
moveq #1,d0
|
|
||||||
move.l d0,(a3)
|
|
||||||
bra l132
|
|
||||||
l138
|
|
||||||
move.l a2,a6
|
|
||||||
move.l a6,-(a7)
|
|
||||||
jsr _pata_identity
|
|
||||||
move.w d0,d2
|
|
||||||
addq.w #4,a7
|
|
||||||
beq l140
|
|
||||||
l139
|
|
||||||
move.w d2,d0
|
|
||||||
bra l129
|
|
||||||
l140
|
|
||||||
bra l132
|
|
||||||
l141
|
|
||||||
moveq #0,d0
|
|
||||||
bra l129
|
|
||||||
l132
|
|
||||||
moveq #0,d0
|
|
||||||
l129
|
|
||||||
l142 reg a2/a3/a4/a5/a6/d2/d3
|
|
||||||
movem.l (a7)+,a2/a3/a4/a5/a6/d2/d3
|
|
||||||
l144 equ 28
|
|
||||||
add.w #88,a7
|
|
||||||
rts
|
|
||||||
cnop 0,4
|
|
||||||
l131
|
|
||||||
dc.b 112
|
|
||||||
dc.b 97
|
|
||||||
dc.b 116
|
|
||||||
dc.b 97
|
|
||||||
dc.b 95
|
|
||||||
dc.b 105
|
|
||||||
dc.b 111
|
|
||||||
dc.b 99
|
|
||||||
dc.b 116
|
|
||||||
dc.b 114
|
|
||||||
dc.b 108
|
|
||||||
dc.b 0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _pata_install
|
|
||||||
cnop 0,4
|
|
||||||
_pata_install
|
|
||||||
sub.w #32,a7
|
|
||||||
movem.l l149,-(a7)
|
|
||||||
pea l147
|
|
||||||
jsr _DEBUG
|
|
||||||
move.w #0,_g_pata_error
|
|
||||||
move.w #1,_g_pata_status
|
|
||||||
move.w #2,(4+l151,a7)
|
|
||||||
move.l #l148,(6+l151,a7)
|
|
||||||
move.l #_pata_init,(10+l151,a7)
|
|
||||||
move.l #_pata_read,(14+l151,a7)
|
|
||||||
move.l #_pata_write,(18+l151,a7)
|
|
||||||
move.l #_pata_status,(22+l151,a7)
|
|
||||||
move.l #_pata_flush,(26+l151,a7)
|
|
||||||
move.l #_pata_ioctrl,(30+l151,a7)
|
|
||||||
move.w #0,_g_pata_status
|
|
||||||
lea (4+l151,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
jsr _bdev_register
|
|
||||||
addq.w #8,a7
|
|
||||||
l145
|
|
||||||
l149 reg
|
|
||||||
l151 equ 0
|
|
||||||
add.w #32,a7
|
|
||||||
rts
|
|
||||||
cnop 0,4
|
|
||||||
l147
|
|
||||||
dc.b 112
|
|
||||||
dc.b 97
|
|
||||||
dc.b 116
|
|
||||||
dc.b 97
|
|
||||||
dc.b 95
|
|
||||||
dc.b 105
|
|
||||||
dc.b 110
|
|
||||||
dc.b 115
|
|
||||||
dc.b 116
|
|
||||||
dc.b 97
|
|
||||||
dc.b 108
|
|
||||||
dc.b 108
|
|
||||||
dc.b 0
|
|
||||||
cnop 0,4
|
|
||||||
l148
|
|
||||||
dc.b 72
|
|
||||||
dc.b 68
|
|
||||||
dc.b 68
|
|
||||||
dc.b 0
|
|
||||||
public _g_pata_error
|
|
||||||
section "DATA",data
|
|
||||||
cnop 0,4
|
|
||||||
_g_pata_error
|
|
||||||
dc.w 0
|
|
||||||
public _g_pata_status
|
|
||||||
cnop 0,4
|
|
||||||
_g_pata_status
|
|
||||||
dc.w 1
|
|
||||||
public _DEBUG
|
|
||||||
public _bdev_register
|
|
||||||
public _g_buffer
|
|
||||||
section "BSS",bss
|
|
||||||
cnop 0,4
|
|
||||||
_g_buffer
|
|
||||||
ds.b 512
|
|
1923
src/dev/ps2.asm
1923
src/dev/ps2.asm
File diff suppressed because it is too large
Load diff
|
@ -2,11 +2,12 @@
|
||||||
* Definitions for the PS/2 interface devices... mouse and keyboard
|
* Definitions for the PS/2 interface devices... mouse and keyboard
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "log.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "ring_buffer.h"
|
#include "ring_buffer.h"
|
||||||
#include "dev/ps2.h"
|
#include "dev/ps2.h"
|
||||||
#include "dev/text_screen_iii.h"
|
#include "dev/text_screen_iii.h"
|
||||||
// #include "interrupt.h"
|
#include "interrupt.h"
|
||||||
|
|
||||||
#define PS2_RETRY_MAX 1000
|
#define PS2_RETRY_MAX 1000
|
||||||
|
|
||||||
|
@ -751,8 +752,8 @@ short ps2_init() {
|
||||||
|
|
||||||
// Disable the PS/2 interrupts...
|
// Disable the PS/2 interrupts...
|
||||||
|
|
||||||
// irq_disable(IRQ07_MOUSE); // Disable mouse interrupts
|
int_disable(INT_MOUSE); /* Disable mouse interrupts */
|
||||||
// irq_disable(IRQ08_KBD); // Disable keyboar interrupts
|
int_disable(INT_KBD_PS2); /* Disable keyboar interrupts */
|
||||||
|
|
||||||
// Prevent the keyboard and mouse from sending events
|
// Prevent the keyboard and mouse from sending events
|
||||||
ps2_controller_cmd(PS2_CTRL_DISABLE_1);
|
ps2_controller_cmd(PS2_CTRL_DISABLE_1);
|
||||||
|
@ -761,15 +762,15 @@ short ps2_init() {
|
||||||
// Read and clear out the controller's output buffer
|
// Read and clear out the controller's output buffer
|
||||||
ps2_flush_out();
|
ps2_flush_out();
|
||||||
|
|
||||||
// Controller selftest...
|
// // Controller selftest...
|
||||||
if (ps2_controller_cmd(PS2_CTRL_SELFTEST) != PS2_RESP_OK) {
|
// if (ps2_controller_cmd(PS2_CTRL_SELFTEST) != PS2_RESP_OK) {
|
||||||
return PS2_FAIL_SELFTEST;
|
// ; // return PS2_FAIL_SELFTEST;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// Keyboard test
|
// // Keyboard test
|
||||||
if (ps2_controller_cmd(PS2_CTRL_KBDTEST) != 0) {
|
// if (ps2_controller_cmd(PS2_CTRL_KBDTEST) != 0) {
|
||||||
return PS2_FAIL_KBDTEST;
|
// ; // return PS2_FAIL_KBDTEST;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Set scancode translation to set1, enable interrupts on mouse and keyboard
|
// Set scancode translation to set1, enable interrupts on mouse and keyboard
|
||||||
ps2_controller_cmd_param(PS2_CTRL_WRITECMD, 0x43);
|
ps2_controller_cmd_param(PS2_CTRL_WRITECMD, 0x43);
|
||||||
|
@ -789,14 +790,14 @@ short ps2_init() {
|
||||||
// Make sure everything is read
|
// Make sure everything is read
|
||||||
ps2_flush_out();
|
ps2_flush_out();
|
||||||
|
|
||||||
// // Register the interrupt handler for the keyboard
|
// Register the interrupt handler for the keyboard
|
||||||
// irq_register(IRQ08_KBD, kbd_handle_irq);
|
int_register(INT_KBD_PS2, kbd_handle_irq);
|
||||||
//
|
|
||||||
// // Clear any pending keyboard interrupts
|
// Clear any pending keyboard interrupts
|
||||||
// irq_clear(IRQ08_KBD);
|
int_clear(INT_KBD_PS2);
|
||||||
//
|
|
||||||
// // Enable the keyboard interrupt
|
// Enable the keyboard interrupt
|
||||||
// irq_enable(IRQ08_KBD);
|
int_enable(INT_KBD_PS2);
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
618
src/dev/sdc.asm
618
src/dev/sdc.asm
|
@ -1,618 +0,0 @@
|
||||||
idnt "sdc.c"
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
section "CODE",code
|
|
||||||
public _sdc_reset
|
|
||||||
cnop 0,4
|
|
||||||
_sdc_reset
|
|
||||||
movem.l l4,-(a7)
|
|
||||||
pea l3
|
|
||||||
jsr _DEBUG
|
|
||||||
addq.w #4,a7
|
|
||||||
l1
|
|
||||||
l4 reg
|
|
||||||
l6 equ 0
|
|
||||||
rts
|
|
||||||
cnop 0,4
|
|
||||||
l3
|
|
||||||
dc.b 115
|
|
||||||
dc.b 100
|
|
||||||
dc.b 99
|
|
||||||
dc.b 95
|
|
||||||
dc.b 114
|
|
||||||
dc.b 101
|
|
||||||
dc.b 115
|
|
||||||
dc.b 101
|
|
||||||
dc.b 116
|
|
||||||
dc.b 0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _sdc_detected
|
|
||||||
cnop 0,4
|
|
||||||
_sdc_detected
|
|
||||||
movem.l l9,-(a7)
|
|
||||||
moveq #1,d0
|
|
||||||
l7
|
|
||||||
l9 reg
|
|
||||||
l11 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _sdc_protected
|
|
||||||
cnop 0,4
|
|
||||||
_sdc_protected
|
|
||||||
movem.l l14,-(a7)
|
|
||||||
moveq #0,d0
|
|
||||||
l12
|
|
||||||
l14 reg
|
|
||||||
l16 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _sdc_set_led
|
|
||||||
cnop 0,4
|
|
||||||
_sdc_set_led
|
|
||||||
movem.l l19,-(a7)
|
|
||||||
l17
|
|
||||||
l19 reg
|
|
||||||
l21 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _sdc_wait_busy
|
|
||||||
cnop 0,4
|
|
||||||
_sdc_wait_busy
|
|
||||||
movem.l l29,-(a7)
|
|
||||||
move.w #10000,d1
|
|
||||||
l24
|
|
||||||
move.w d1,d0
|
|
||||||
subq.w #1,d1
|
|
||||||
tst.w d0
|
|
||||||
bne l28
|
|
||||||
l27
|
|
||||||
moveq #-3,d0
|
|
||||||
bra l22
|
|
||||||
l28
|
|
||||||
move.b 12583684,d2
|
|
||||||
l26
|
|
||||||
moveq #0,d0
|
|
||||||
move.b d2,d0
|
|
||||||
and.b #1,d0
|
|
||||||
and.w #255,d0
|
|
||||||
and.l #65535,d0
|
|
||||||
moveq #1,d3
|
|
||||||
cmp.l d0,d3
|
|
||||||
beq l24
|
|
||||||
l25
|
|
||||||
moveq #0,d0
|
|
||||||
l22
|
|
||||||
l29 reg d2/d3
|
|
||||||
movem.l (a7)+,d2/d3
|
|
||||||
l31 equ 8
|
|
||||||
rts
|
|
||||||
; stacksize=8
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _sdc_init
|
|
||||||
cnop 0,4
|
|
||||||
_sdc_init
|
|
||||||
movem.l l46,-(a7)
|
|
||||||
pea l34
|
|
||||||
jsr _DEBUG
|
|
||||||
jsr _sdc_detected
|
|
||||||
addq.w #4,a7
|
|
||||||
tst.w d0
|
|
||||||
bne l36
|
|
||||||
l35
|
|
||||||
move.b #1,_g_sdc_status
|
|
||||||
moveq #-8,d0
|
|
||||||
bra l32
|
|
||||||
l36
|
|
||||||
move.b #1,12583682
|
|
||||||
move.b #1,12583683
|
|
||||||
jsr _sdc_wait_busy
|
|
||||||
tst.w d0
|
|
||||||
bne l38
|
|
||||||
l37
|
|
||||||
move.b 12583685,_g_sdc_error
|
|
||||||
bne l40
|
|
||||||
l39
|
|
||||||
pea l41
|
|
||||||
jsr _DEBUG
|
|
||||||
move.b #0,_g_sdc_status
|
|
||||||
moveq #0,d0
|
|
||||||
addq.w #4,a7
|
|
||||||
bra l32
|
|
||||||
l40
|
|
||||||
pea l43
|
|
||||||
jsr _DEBUG
|
|
||||||
move.b #1,_g_sdc_status
|
|
||||||
moveq #-4,d0
|
|
||||||
addq.w #4,a7
|
|
||||||
bra l32
|
|
||||||
l42
|
|
||||||
bra l44
|
|
||||||
l38
|
|
||||||
pea l45
|
|
||||||
jsr _DEBUG
|
|
||||||
move.b #1,_g_sdc_status
|
|
||||||
moveq #-3,d0
|
|
||||||
addq.w #4,a7
|
|
||||||
l44
|
|
||||||
l32
|
|
||||||
l46 reg
|
|
||||||
l48 equ 0
|
|
||||||
rts
|
|
||||||
cnop 0,4
|
|
||||||
l41
|
|
||||||
dc.b 115
|
|
||||||
dc.b 100
|
|
||||||
dc.b 99
|
|
||||||
dc.b 95
|
|
||||||
dc.b 105
|
|
||||||
dc.b 110
|
|
||||||
dc.b 105
|
|
||||||
dc.b 116
|
|
||||||
dc.b 58
|
|
||||||
dc.b 32
|
|
||||||
dc.b 83
|
|
||||||
dc.b 85
|
|
||||||
dc.b 67
|
|
||||||
dc.b 67
|
|
||||||
dc.b 69
|
|
||||||
dc.b 83
|
|
||||||
dc.b 83
|
|
||||||
dc.b 0
|
|
||||||
cnop 0,4
|
|
||||||
l43
|
|
||||||
dc.b 115
|
|
||||||
dc.b 100
|
|
||||||
dc.b 99
|
|
||||||
dc.b 95
|
|
||||||
dc.b 105
|
|
||||||
dc.b 110
|
|
||||||
dc.b 105
|
|
||||||
dc.b 116
|
|
||||||
dc.b 58
|
|
||||||
dc.b 32
|
|
||||||
dc.b 68
|
|
||||||
dc.b 69
|
|
||||||
dc.b 86
|
|
||||||
dc.b 95
|
|
||||||
dc.b 67
|
|
||||||
dc.b 65
|
|
||||||
dc.b 78
|
|
||||||
dc.b 78
|
|
||||||
dc.b 79
|
|
||||||
dc.b 84
|
|
||||||
dc.b 95
|
|
||||||
dc.b 73
|
|
||||||
dc.b 78
|
|
||||||
dc.b 73
|
|
||||||
dc.b 84
|
|
||||||
dc.b 0
|
|
||||||
cnop 0,4
|
|
||||||
l45
|
|
||||||
dc.b 115
|
|
||||||
dc.b 100
|
|
||||||
dc.b 99
|
|
||||||
dc.b 95
|
|
||||||
dc.b 105
|
|
||||||
dc.b 110
|
|
||||||
dc.b 105
|
|
||||||
dc.b 116
|
|
||||||
dc.b 58
|
|
||||||
dc.b 32
|
|
||||||
dc.b 68
|
|
||||||
dc.b 69
|
|
||||||
dc.b 86
|
|
||||||
dc.b 95
|
|
||||||
dc.b 84
|
|
||||||
dc.b 73
|
|
||||||
dc.b 77
|
|
||||||
dc.b 69
|
|
||||||
dc.b 79
|
|
||||||
dc.b 85
|
|
||||||
dc.b 84
|
|
||||||
dc.b 0
|
|
||||||
cnop 0,4
|
|
||||||
l34
|
|
||||||
dc.b 115
|
|
||||||
dc.b 100
|
|
||||||
dc.b 99
|
|
||||||
dc.b 95
|
|
||||||
dc.b 105
|
|
||||||
dc.b 110
|
|
||||||
dc.b 105
|
|
||||||
dc.b 116
|
|
||||||
dc.b 0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _sdc_read
|
|
||||||
cnop 0,4
|
|
||||||
_sdc_read
|
|
||||||
movem.l l69,-(a7)
|
|
||||||
move.w (14+l71,a7),d6
|
|
||||||
move.l (4+l71,a7),d5
|
|
||||||
move.l (8+l71,a7),a2
|
|
||||||
pea l51
|
|
||||||
jsr _DEBUG
|
|
||||||
jsr _sdc_detected
|
|
||||||
addq.w #4,a7
|
|
||||||
tst.w d0
|
|
||||||
bne l53
|
|
||||||
l52
|
|
||||||
move.b #1,_g_sdc_status
|
|
||||||
moveq #-8,d0
|
|
||||||
bra l49
|
|
||||||
l53
|
|
||||||
move.l #1,-(a7)
|
|
||||||
jsr _sdc_set_led
|
|
||||||
moveq #9,d0
|
|
||||||
move.l d5,d4
|
|
||||||
lsl.l d0,d4
|
|
||||||
move.l #255,d0
|
|
||||||
and.l d4,d0
|
|
||||||
move.b d0,12583687
|
|
||||||
move.l d4,d0
|
|
||||||
asr.l #8,d0
|
|
||||||
and.l #255,d0
|
|
||||||
move.b d0,12583688
|
|
||||||
moveq #16,d1
|
|
||||||
move.l d4,d0
|
|
||||||
asr.l d1,d0
|
|
||||||
and.l #255,d0
|
|
||||||
move.b d0,12583689
|
|
||||||
moveq #24,d1
|
|
||||||
move.l d4,d0
|
|
||||||
asr.l d1,d0
|
|
||||||
and.l #255,d0
|
|
||||||
move.b d0,12583690
|
|
||||||
move.b #2,12583682
|
|
||||||
move.b #1,12583683
|
|
||||||
jsr _sdc_wait_busy
|
|
||||||
addq.w #4,a7
|
|
||||||
tst.w d0
|
|
||||||
bne l55
|
|
||||||
l54
|
|
||||||
move.b 12583685,_g_sdc_error
|
|
||||||
beq l57
|
|
||||||
l56
|
|
||||||
move.l #0,-(a7)
|
|
||||||
jsr _sdc_set_led
|
|
||||||
moveq #-5,d0
|
|
||||||
addq.w #4,a7
|
|
||||||
bra l49
|
|
||||||
l57
|
|
||||||
moveq #0,d0
|
|
||||||
move.b 12583698,d0
|
|
||||||
lsl.l #8,d0
|
|
||||||
moveq #0,d1
|
|
||||||
move.b 12583699,d1
|
|
||||||
or.l d1,d0
|
|
||||||
move.w d0,d3
|
|
||||||
cmp.w d3,d6
|
|
||||||
bge l60
|
|
||||||
l59
|
|
||||||
moveq #-7,d0
|
|
||||||
bra l49
|
|
||||||
l60
|
|
||||||
moveq #0,d2
|
|
||||||
bra l62
|
|
||||||
l61
|
|
||||||
move.b 12583696,(0,a2,d2.w)
|
|
||||||
l64
|
|
||||||
addq.w #1,d2
|
|
||||||
l62
|
|
||||||
cmp.w d2,d3
|
|
||||||
bgt l61
|
|
||||||
l63
|
|
||||||
move.l #0,-(a7)
|
|
||||||
jsr _sdc_set_led
|
|
||||||
move.b 12583685,_g_sdc_error
|
|
||||||
addq.w #4,a7
|
|
||||||
beq l66
|
|
||||||
l65
|
|
||||||
moveq #-5,d0
|
|
||||||
bra l49
|
|
||||||
l66
|
|
||||||
move.w d3,d0
|
|
||||||
bra l49
|
|
||||||
l67
|
|
||||||
l58
|
|
||||||
bra l68
|
|
||||||
l55
|
|
||||||
move.l #0,-(a7)
|
|
||||||
jsr _sdc_set_led
|
|
||||||
moveq #-3,d0
|
|
||||||
addq.w #4,a7
|
|
||||||
l68
|
|
||||||
l49
|
|
||||||
l69 reg a2/d2/d3/d4/d5/d6
|
|
||||||
movem.l (a7)+,a2/d2/d3/d4/d5/d6
|
|
||||||
l71 equ 24
|
|
||||||
rts
|
|
||||||
cnop 0,4
|
|
||||||
l51
|
|
||||||
dc.b 115
|
|
||||||
dc.b 100
|
|
||||||
dc.b 99
|
|
||||||
dc.b 95
|
|
||||||
dc.b 114
|
|
||||||
dc.b 101
|
|
||||||
dc.b 97
|
|
||||||
dc.b 100
|
|
||||||
dc.b 0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _sdc_write
|
|
||||||
cnop 0,4
|
|
||||||
_sdc_write
|
|
||||||
movem.l l96,-(a7)
|
|
||||||
move.l (4+l98,a7),d5
|
|
||||||
move.w (14+l98,a7),d3
|
|
||||||
move.l (8+l98,a7),a2
|
|
||||||
pea l74
|
|
||||||
jsr _DEBUG
|
|
||||||
jsr _sdc_detected
|
|
||||||
addq.w #4,a7
|
|
||||||
tst.w d0
|
|
||||||
bne l76
|
|
||||||
l75
|
|
||||||
move.b #1,_g_sdc_status
|
|
||||||
moveq #-8,d0
|
|
||||||
bra l72
|
|
||||||
l76
|
|
||||||
move.l #1,-(a7)
|
|
||||||
jsr _sdc_set_led
|
|
||||||
addq.w #4,a7
|
|
||||||
cmp.w #512,d3
|
|
||||||
bgt l78
|
|
||||||
l77
|
|
||||||
moveq #0,d2
|
|
||||||
bra l80
|
|
||||||
l79
|
|
||||||
move.b (0,a2,d2.w),12583712
|
|
||||||
l82
|
|
||||||
addq.w #1,d2
|
|
||||||
l80
|
|
||||||
cmp.w d2,d3
|
|
||||||
bgt l79
|
|
||||||
l81
|
|
||||||
cmp.w #512,d3
|
|
||||||
bge l84
|
|
||||||
l83
|
|
||||||
moveq #0,d2
|
|
||||||
bra l86
|
|
||||||
l85
|
|
||||||
move.b #0,12583712
|
|
||||||
l88
|
|
||||||
addq.w #1,d2
|
|
||||||
l86
|
|
||||||
move.w d2,d0
|
|
||||||
ext.l d0
|
|
||||||
move.w d3,d1
|
|
||||||
ext.l d1
|
|
||||||
neg.l d1
|
|
||||||
add.l #512,d1
|
|
||||||
cmp.l d0,d1
|
|
||||||
bgt l85
|
|
||||||
l87
|
|
||||||
l84
|
|
||||||
bra l89
|
|
||||||
l78
|
|
||||||
moveq #-7,d0
|
|
||||||
bra l72
|
|
||||||
l89
|
|
||||||
moveq #9,d0
|
|
||||||
move.l d5,d4
|
|
||||||
lsl.l d0,d4
|
|
||||||
move.l #255,d0
|
|
||||||
and.l d4,d0
|
|
||||||
move.b d0,12583687
|
|
||||||
move.l d4,d0
|
|
||||||
asr.l #8,d0
|
|
||||||
and.l #255,d0
|
|
||||||
move.b d0,12583688
|
|
||||||
moveq #16,d1
|
|
||||||
move.l d4,d0
|
|
||||||
asr.l d1,d0
|
|
||||||
and.l #255,d0
|
|
||||||
move.b d0,12583689
|
|
||||||
moveq #24,d1
|
|
||||||
move.l d4,d0
|
|
||||||
asr.l d1,d0
|
|
||||||
and.l #255,d0
|
|
||||||
move.b d0,12583690
|
|
||||||
move.b #3,12583682
|
|
||||||
move.b #1,12583683
|
|
||||||
jsr _sdc_wait_busy
|
|
||||||
tst.w d0
|
|
||||||
bne l91
|
|
||||||
l90
|
|
||||||
move.b 12583685,_g_sdc_error
|
|
||||||
beq l93
|
|
||||||
l92
|
|
||||||
move.l #0,-(a7)
|
|
||||||
jsr _sdc_set_led
|
|
||||||
moveq #-6,d0
|
|
||||||
addq.w #4,a7
|
|
||||||
bra l72
|
|
||||||
l93
|
|
||||||
move.w d3,d0
|
|
||||||
bra l72
|
|
||||||
l94
|
|
||||||
bra l95
|
|
||||||
l91
|
|
||||||
move.l #0,-(a7)
|
|
||||||
jsr _sdc_set_led
|
|
||||||
moveq #-3,d0
|
|
||||||
addq.w #4,a7
|
|
||||||
l95
|
|
||||||
l72
|
|
||||||
l96 reg a2/d2/d3/d4/d5
|
|
||||||
movem.l (a7)+,a2/d2/d3/d4/d5
|
|
||||||
l98 equ 20
|
|
||||||
rts
|
|
||||||
cnop 0,4
|
|
||||||
l74
|
|
||||||
dc.b 115
|
|
||||||
dc.b 100
|
|
||||||
dc.b 99
|
|
||||||
dc.b 95
|
|
||||||
dc.b 119
|
|
||||||
dc.b 114
|
|
||||||
dc.b 105
|
|
||||||
dc.b 116
|
|
||||||
dc.b 101
|
|
||||||
dc.b 0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _sdc_status
|
|
||||||
cnop 0,4
|
|
||||||
_sdc_status
|
|
||||||
movem.l l105,-(a7)
|
|
||||||
moveq #0,d2
|
|
||||||
move.b _g_sdc_status,d2
|
|
||||||
jsr _sdc_detected
|
|
||||||
tst.w d0
|
|
||||||
beq l102
|
|
||||||
or.w #2,d2
|
|
||||||
l102
|
|
||||||
jsr _sdc_protected
|
|
||||||
tst.w d0
|
|
||||||
beq l104
|
|
||||||
or.w #4,d2
|
|
||||||
l104
|
|
||||||
move.w d2,d0
|
|
||||||
l99
|
|
||||||
l105 reg d2
|
|
||||||
movem.l (a7)+,d2
|
|
||||||
l107 equ 4
|
|
||||||
rts
|
|
||||||
; stacksize=8
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _sdc_error
|
|
||||||
cnop 0,4
|
|
||||||
_sdc_error
|
|
||||||
movem.l l110,-(a7)
|
|
||||||
moveq #0,d0
|
|
||||||
move.b _g_sdc_error,d0
|
|
||||||
l108
|
|
||||||
l110 reg
|
|
||||||
l112 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _sdc_flush
|
|
||||||
cnop 0,4
|
|
||||||
_sdc_flush
|
|
||||||
movem.l l115,-(a7)
|
|
||||||
moveq #0,d0
|
|
||||||
l113
|
|
||||||
l115 reg
|
|
||||||
l117 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _sdc_sector_count
|
|
||||||
cnop 0,4
|
|
||||||
_sdc_sector_count
|
|
||||||
movem.l l120,-(a7)
|
|
||||||
move.w #1000,d0
|
|
||||||
l118
|
|
||||||
l120 reg
|
|
||||||
l122 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _sdc_ioctrl
|
|
||||||
cnop 0,4
|
|
||||||
_sdc_ioctrl
|
|
||||||
movem.l l130,-(a7)
|
|
||||||
move.w (6+l132,a7),d2
|
|
||||||
move.l (8+l132,a7),a2
|
|
||||||
move.w d2,d0
|
|
||||||
subq.w #1,d0
|
|
||||||
beq l126
|
|
||||||
subq.w #1,d0
|
|
||||||
beq l127
|
|
||||||
subq.w #1,d0
|
|
||||||
beq l128
|
|
||||||
bra l129
|
|
||||||
l126
|
|
||||||
move.l a2,a5
|
|
||||||
jsr _sdc_sector_count
|
|
||||||
move.w d0,d1
|
|
||||||
ext.l d1
|
|
||||||
move.l d1,(a5)
|
|
||||||
bra l125
|
|
||||||
l127
|
|
||||||
move.l a2,a4
|
|
||||||
move.w #512,(a4)
|
|
||||||
bra l125
|
|
||||||
l128
|
|
||||||
move.l a2,a3
|
|
||||||
moveq #1,d0
|
|
||||||
move.l d0,(a3)
|
|
||||||
bra l125
|
|
||||||
l129
|
|
||||||
moveq #0,d0
|
|
||||||
l125
|
|
||||||
l123
|
|
||||||
l130 reg a2/a3/a4/a5/d2
|
|
||||||
movem.l (a7)+,a2/a3/a4/a5/d2
|
|
||||||
l132 equ 20
|
|
||||||
rts
|
|
||||||
; stacksize=24
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _sdc_install
|
|
||||||
cnop 0,4
|
|
||||||
_sdc_install
|
|
||||||
sub.w #32,a7
|
|
||||||
movem.l l137,-(a7)
|
|
||||||
pea l135
|
|
||||||
jsr _DEBUG
|
|
||||||
jsr _sdc_reset
|
|
||||||
move.w #0,(4+l139,a7)
|
|
||||||
move.l #l136,(6+l139,a7)
|
|
||||||
move.l #_sdc_init,(10+l139,a7)
|
|
||||||
move.l #_sdc_read,(14+l139,a7)
|
|
||||||
move.l #_sdc_write,(18+l139,a7)
|
|
||||||
move.l #_sdc_flush,(26+l139,a7)
|
|
||||||
move.l #_sdc_status,(22+l139,a7)
|
|
||||||
move.l #_sdc_ioctrl,(30+l139,a7)
|
|
||||||
lea (4+l139,a7),a0
|
|
||||||
move.l a0,-(a7)
|
|
||||||
jsr _bdev_register
|
|
||||||
addq.w #8,a7
|
|
||||||
l133
|
|
||||||
l137 reg
|
|
||||||
l139 equ 0
|
|
||||||
add.w #32,a7
|
|
||||||
rts
|
|
||||||
cnop 0,4
|
|
||||||
l135
|
|
||||||
dc.b 115
|
|
||||||
dc.b 100
|
|
||||||
dc.b 99
|
|
||||||
dc.b 95
|
|
||||||
dc.b 105
|
|
||||||
dc.b 110
|
|
||||||
dc.b 115
|
|
||||||
dc.b 116
|
|
||||||
dc.b 97
|
|
||||||
dc.b 108
|
|
||||||
dc.b 108
|
|
||||||
dc.b 0
|
|
||||||
cnop 0,4
|
|
||||||
l136
|
|
||||||
dc.b 83
|
|
||||||
dc.b 68
|
|
||||||
dc.b 67
|
|
||||||
dc.b 0
|
|
||||||
public _g_sdc_status
|
|
||||||
section "DATA",data
|
|
||||||
cnop 0,4
|
|
||||||
_g_sdc_status
|
|
||||||
dc.b 1
|
|
||||||
public _g_sdc_error
|
|
||||||
cnop 0,4
|
|
||||||
_g_sdc_error
|
|
||||||
dc.b 0
|
|
||||||
public _DEBUG
|
|
||||||
public _bdev_register
|
|
|
@ -1,795 +0,0 @@
|
||||||
idnt "text_screen_iii.c"
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
section "CODE",code
|
|
||||||
public _text_init
|
|
||||||
cnop 0,4
|
|
||||||
_text_init
|
|
||||||
movem.l l8,-(a7)
|
|
||||||
lea l1,a2
|
|
||||||
lea 46+l1,a3
|
|
||||||
moveq #0,d2
|
|
||||||
bra l5
|
|
||||||
l4
|
|
||||||
move.l d2,d0
|
|
||||||
lsl.l #1,d0
|
|
||||||
lea _fg_color_lut,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l d2,d0
|
|
||||||
lsl.l #1,d0
|
|
||||||
move.l #13026304,a1
|
|
||||||
move.w (a0),(0,a1,d0.l)
|
|
||||||
move.l d2,d0
|
|
||||||
lsl.l #1,d0
|
|
||||||
lea _fg_color_lut,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l d2,d0
|
|
||||||
lsl.l #1,d0
|
|
||||||
move.l #13288448,a1
|
|
||||||
move.w (a0),(0,a1,d0.l)
|
|
||||||
move.l d2,d0
|
|
||||||
lsl.l #1,d0
|
|
||||||
lea _bg_color_lut,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l d2,d0
|
|
||||||
lsl.l #1,d0
|
|
||||||
move.l #13026368,a1
|
|
||||||
move.w (a0),(0,a1,d0.l)
|
|
||||||
move.l d2,d0
|
|
||||||
lsl.l #1,d0
|
|
||||||
lea _bg_color_lut,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l d2,d0
|
|
||||||
lsl.l #1,d0
|
|
||||||
move.l #13288512,a1
|
|
||||||
move.w (a0),(0,a1,d0.l)
|
|
||||||
l7
|
|
||||||
addq.l #1,d2
|
|
||||||
l5
|
|
||||||
moveq #32,d0
|
|
||||||
cmp.l d2,d0
|
|
||||||
bgt l4
|
|
||||||
l6
|
|
||||||
move.l #12845056,(a2)
|
|
||||||
move.l #12976128,(4,a2)
|
|
||||||
move.l #13008896,(8,a2)
|
|
||||||
move.l #12845072,(12,a2)
|
|
||||||
move.l #12845076,(16,a2)
|
|
||||||
move.l #12845060,(20,a2)
|
|
||||||
move.l (a2),a0
|
|
||||||
moveq #1,d0
|
|
||||||
move.l d0,(a0)
|
|
||||||
move.l (20,a2),a0
|
|
||||||
move.l #1056769,(a0)
|
|
||||||
move.l (20,a2),a0
|
|
||||||
moveq #64,d0
|
|
||||||
move.l d0,(4,a0)
|
|
||||||
move.l #0,-(a7)
|
|
||||||
jsr _text_setsizes
|
|
||||||
move.l #0,-(a7)
|
|
||||||
move.l #15,-(a7)
|
|
||||||
move.l #0,-(a7)
|
|
||||||
jsr _text_set_color
|
|
||||||
move.l #0,-(a7)
|
|
||||||
jsr _text_clear
|
|
||||||
move.l #0,-(a7)
|
|
||||||
move.l #0,-(a7)
|
|
||||||
move.l #0,-(a7)
|
|
||||||
jsr _text_set_xy
|
|
||||||
move.l #13107200,(a3)
|
|
||||||
move.l #13238272,(4,a3)
|
|
||||||
move.l #13271040,(8,a3)
|
|
||||||
move.l #13107216,(12,a3)
|
|
||||||
move.l #13107220,(16,a3)
|
|
||||||
move.l #13107204,(20,a3)
|
|
||||||
move.l (a3),a0
|
|
||||||
moveq #1,d0
|
|
||||||
move.l d0,(a0)
|
|
||||||
move.l (20,a3),a0
|
|
||||||
move.l #1056768,(a0)
|
|
||||||
move.l (20,a3),a0
|
|
||||||
move.l #4194304,(4,a0)
|
|
||||||
move.l #1,-(a7)
|
|
||||||
jsr _text_setsizes
|
|
||||||
move.l #0,-(a7)
|
|
||||||
move.l #15,-(a7)
|
|
||||||
move.l #1,-(a7)
|
|
||||||
jsr _text_set_color
|
|
||||||
move.l #1,-(a7)
|
|
||||||
jsr _text_clear
|
|
||||||
move.l #0,-(a7)
|
|
||||||
move.l #0,-(a7)
|
|
||||||
move.l #1,-(a7)
|
|
||||||
jsr _text_set_xy
|
|
||||||
moveq #0,d0
|
|
||||||
add.w #64,a7
|
|
||||||
l2
|
|
||||||
l8 reg a2/a3/d2
|
|
||||||
movem.l (a7)+,a2/a3/d2
|
|
||||||
l10 equ 12
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _text_set_cursor
|
|
||||||
cnop 0,4
|
|
||||||
_text_set_cursor
|
|
||||||
movem.l l15,-(a7)
|
|
||||||
move.w (22+l17,a7),d6
|
|
||||||
move.w (18+l17,a7),d5
|
|
||||||
move.b (15+l17,a7),d4
|
|
||||||
move.w (10+l17,a7),d3
|
|
||||||
move.w (6+l17,a7),d2
|
|
||||||
cmp.w #2,d2
|
|
||||||
bge l14
|
|
||||||
l13
|
|
||||||
move.w d2,d0
|
|
||||||
ext.l d0
|
|
||||||
moveq #46,d1
|
|
||||||
move.l d2,-(a7)
|
|
||||||
move.l d0,d7
|
|
||||||
move.l d1,d2
|
|
||||||
swap d7
|
|
||||||
swap d2
|
|
||||||
mulu.w d1,d7
|
|
||||||
mulu.w d0,d2
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d2,d7
|
|
||||||
swap d7
|
|
||||||
clr.w d7
|
|
||||||
add.l d7,d0
|
|
||||||
move.l (a7)+,d2
|
|
||||||
lea l1,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l a0,a1
|
|
||||||
move.b d3,d0
|
|
||||||
and.b #255,d0
|
|
||||||
and.w #255,d0
|
|
||||||
and.l #65535,d0
|
|
||||||
moveq #24,d1
|
|
||||||
lsl.l d1,d0
|
|
||||||
move.b d4,d1
|
|
||||||
ext.w d1
|
|
||||||
ext.l d1
|
|
||||||
moveq #16,d7
|
|
||||||
lsl.l d7,d1
|
|
||||||
or.l d1,d0
|
|
||||||
move.b d5,d1
|
|
||||||
and.b #2,d1
|
|
||||||
and.w #255,d1
|
|
||||||
and.l #65535,d1
|
|
||||||
lsl.l #1,d1
|
|
||||||
or.l d1,d0
|
|
||||||
move.b d6,d1
|
|
||||||
and.b #1,d1
|
|
||||||
and.w #255,d1
|
|
||||||
and.l #65535,d1
|
|
||||||
or.l d1,d0
|
|
||||||
move.l (12,a1),a0
|
|
||||||
move.l d0,(a0)
|
|
||||||
l14
|
|
||||||
l11
|
|
||||||
l15 reg d2/d3/d4/d5/d6/d7
|
|
||||||
movem.l (a7)+,d2/d3/d4/d5/d6/d7
|
|
||||||
l17 equ 24
|
|
||||||
rts
|
|
||||||
; stacksize=28
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _text_set_xy
|
|
||||||
cnop 0,4
|
|
||||||
_text_set_xy
|
|
||||||
movem.l l26,-(a7)
|
|
||||||
move.w (6+l28,a7),d5
|
|
||||||
move.w (10+l28,a7),d3
|
|
||||||
move.w (14+l28,a7),d2
|
|
||||||
cmp.w #2,d5
|
|
||||||
bge l21
|
|
||||||
l20
|
|
||||||
move.w d5,d0
|
|
||||||
ext.l d0
|
|
||||||
moveq #46,d1
|
|
||||||
move.l d0,d6
|
|
||||||
move.l d1,d7
|
|
||||||
swap d6
|
|
||||||
swap d7
|
|
||||||
mulu.w d1,d6
|
|
||||||
mulu.w d0,d7
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d7,d6
|
|
||||||
swap d6
|
|
||||||
clr.w d6
|
|
||||||
add.l d6,d0
|
|
||||||
lea l1,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l a0,a2
|
|
||||||
moveq #0,d0
|
|
||||||
move.w d3,d0
|
|
||||||
move.w (28,a2),d1
|
|
||||||
ext.l d1
|
|
||||||
cmp.l d0,d1
|
|
||||||
bgt l23
|
|
||||||
l22
|
|
||||||
moveq #0,d3
|
|
||||||
addq.w #1,d2
|
|
||||||
l23
|
|
||||||
moveq #0,d0
|
|
||||||
move.w d2,d0
|
|
||||||
move.w (30,a2),d1
|
|
||||||
ext.l d1
|
|
||||||
cmp.l d0,d1
|
|
||||||
bgt l25
|
|
||||||
l24
|
|
||||||
move.w (30,a2),d0
|
|
||||||
subq.w #1,d0
|
|
||||||
move.w d0,d2
|
|
||||||
move.w d5,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _text_scroll
|
|
||||||
addq.w #4,a7
|
|
||||||
l25
|
|
||||||
move.w d3,(32,a2)
|
|
||||||
move.w d2,(34,a2)
|
|
||||||
moveq #0,d0
|
|
||||||
move.w d2,d0
|
|
||||||
moveq #16,d1
|
|
||||||
lsl.l d1,d0
|
|
||||||
moveq #0,d1
|
|
||||||
move.w d3,d1
|
|
||||||
or.l d1,d0
|
|
||||||
move.l (16,a2),a0
|
|
||||||
move.l d0,(a0)
|
|
||||||
move.w d2,d0
|
|
||||||
muls.w (24,a2),d0
|
|
||||||
move.w d0,d4
|
|
||||||
add.w d3,d4
|
|
||||||
move.l (4,a2),a0
|
|
||||||
add.w d4,a0
|
|
||||||
move.l a0,(36,a2)
|
|
||||||
move.l (8,a2),a0
|
|
||||||
add.w d4,a0
|
|
||||||
move.l a0,(40,a2)
|
|
||||||
l21
|
|
||||||
l18
|
|
||||||
l26 reg a2/d2/d3/d4/d5/d6/d7
|
|
||||||
movem.l (a7)+,a2/d2/d3/d4/d5/d6/d7
|
|
||||||
l28 equ 28
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _text_setsizes
|
|
||||||
cnop 0,4
|
|
||||||
_text_setsizes
|
|
||||||
sub.w #20,a7
|
|
||||||
movem.l l45,-(a7)
|
|
||||||
cmp.w #2,(26+l47,a7)
|
|
||||||
bge l32
|
|
||||||
l31
|
|
||||||
moveq #0,d2
|
|
||||||
moveq #0,d5
|
|
||||||
moveq #0,d6
|
|
||||||
move.w (26+l47,a7),d0
|
|
||||||
ext.l d0
|
|
||||||
moveq #46,d1
|
|
||||||
move.l d2,-(a7)
|
|
||||||
move.l d3,-(a7)
|
|
||||||
move.l d0,d2
|
|
||||||
move.l d1,d3
|
|
||||||
swap d2
|
|
||||||
swap d3
|
|
||||||
mulu.w d1,d2
|
|
||||||
mulu.w d0,d3
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d3,d2
|
|
||||||
swap d2
|
|
||||||
clr.w d2
|
|
||||||
add.l d2,d0
|
|
||||||
move.l (a7)+,d3
|
|
||||||
move.l (a7)+,d2
|
|
||||||
lea l1,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l a0,a2
|
|
||||||
move.l (20,a2),a0
|
|
||||||
move.l (a0),d2
|
|
||||||
move.l (a2),a0
|
|
||||||
move.l #1024,d0
|
|
||||||
and.l (a0),d0
|
|
||||||
move.w d0,d5
|
|
||||||
move.l (a2),a0
|
|
||||||
move.w (2,a0),d0
|
|
||||||
and.w #768,d0
|
|
||||||
and.l #65535,d0
|
|
||||||
lsr.l #8,d0
|
|
||||||
move.w d0,d6
|
|
||||||
move.w d6,d0
|
|
||||||
sub.w #0,d0
|
|
||||||
beq l34
|
|
||||||
subq.w #1,d0
|
|
||||||
beq l35
|
|
||||||
subq.w #1,d0
|
|
||||||
beq l36
|
|
||||||
subq.w #1,d0
|
|
||||||
beq l37
|
|
||||||
bra l38
|
|
||||||
l34
|
|
||||||
move.w #80,(24,a2)
|
|
||||||
move.w #60,(26,a2)
|
|
||||||
bra l33
|
|
||||||
l35
|
|
||||||
move.w #100,(24,a2)
|
|
||||||
move.w #75,(26,a2)
|
|
||||||
bra l33
|
|
||||||
l36
|
|
||||||
move.w #128,(24,a2)
|
|
||||||
move.w #96,(26,a2)
|
|
||||||
bra l33
|
|
||||||
l37
|
|
||||||
move.w #80,(24,a2)
|
|
||||||
move.w #50,(26,a2)
|
|
||||||
bra l33
|
|
||||||
l38
|
|
||||||
l33
|
|
||||||
tst.w d5
|
|
||||||
beq l40
|
|
||||||
lea (24,a2),a0
|
|
||||||
move.w (a0),d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,d1
|
|
||||||
bge l48
|
|
||||||
addq.l #1,d1
|
|
||||||
l48:
|
|
||||||
asr.l #1,d1
|
|
||||||
move.w d1,(a0)
|
|
||||||
lea (26,a2),a0
|
|
||||||
move.w (a0),d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,d1
|
|
||||||
bge l49
|
|
||||||
addq.l #1,d1
|
|
||||||
l49:
|
|
||||||
asr.l #1,d1
|
|
||||||
move.w d1,(a0)
|
|
||||||
l40
|
|
||||||
move.w (26,a2),(30,a2)
|
|
||||||
move.w (24,a2),(28,a2)
|
|
||||||
move.w d2,d0
|
|
||||||
and.b #1,d0
|
|
||||||
and.w #255,d0
|
|
||||||
and.l #65535,d0
|
|
||||||
beq l42
|
|
||||||
move.w d2,d0
|
|
||||||
and.w #16128,d0
|
|
||||||
and.l #65535,d0
|
|
||||||
lsr.l #8,d0
|
|
||||||
move.w d0,d7
|
|
||||||
move.l #4128768,d0
|
|
||||||
and.l d2,d0
|
|
||||||
moveq #16,d1
|
|
||||||
lsr.l d1,d0
|
|
||||||
move.w d0,(14+l47,a7)
|
|
||||||
move.w d7,d0
|
|
||||||
ext.l d0
|
|
||||||
tst.l d0
|
|
||||||
bge l50
|
|
||||||
addq.l #3,d0
|
|
||||||
l50:
|
|
||||||
asr.l #2,d0
|
|
||||||
move.w d0,d3
|
|
||||||
move.w (14+l47,a7),d0
|
|
||||||
ext.l d0
|
|
||||||
tst.l d0
|
|
||||||
bge l51
|
|
||||||
addq.l #3,d0
|
|
||||||
l51:
|
|
||||||
asr.l #2,d0
|
|
||||||
move.w d0,d4
|
|
||||||
tst.w d5
|
|
||||||
beq l44
|
|
||||||
move.w d3,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,d1
|
|
||||||
bge l52
|
|
||||||
addq.l #1,d1
|
|
||||||
l52:
|
|
||||||
asr.l #1,d1
|
|
||||||
move.w d1,d3
|
|
||||||
move.w d4,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,d1
|
|
||||||
bge l53
|
|
||||||
addq.l #1,d1
|
|
||||||
l53:
|
|
||||||
asr.l #1,d1
|
|
||||||
move.w d1,d4
|
|
||||||
l44
|
|
||||||
lea (28,a2),a0
|
|
||||||
sub.w d3,(a0)
|
|
||||||
lea (30,a2),a0
|
|
||||||
sub.w d4,(a0)
|
|
||||||
l42
|
|
||||||
l32
|
|
||||||
l29
|
|
||||||
l45 reg a2/d2/d3/d4/d5/d6/d7
|
|
||||||
movem.l (a7)+,a2/d2/d3/d4/d5/d6/d7
|
|
||||||
l47 equ 28
|
|
||||||
add.w #20,a7
|
|
||||||
rts
|
|
||||||
; stacksize=56
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _text_set_color
|
|
||||||
cnop 0,4
|
|
||||||
_text_set_color
|
|
||||||
movem.l l58,-(a7)
|
|
||||||
move.w (14+l60,a7),d4
|
|
||||||
move.w (10+l60,a7),d3
|
|
||||||
move.w (6+l60,a7),d2
|
|
||||||
cmp.w #2,d2
|
|
||||||
bge l57
|
|
||||||
l56
|
|
||||||
move.w d2,d0
|
|
||||||
ext.l d0
|
|
||||||
moveq #46,d1
|
|
||||||
move.l d0,d5
|
|
||||||
move.l d1,d6
|
|
||||||
swap d5
|
|
||||||
swap d6
|
|
||||||
mulu.w d1,d5
|
|
||||||
mulu.w d0,d6
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d6,d5
|
|
||||||
swap d5
|
|
||||||
clr.w d5
|
|
||||||
add.l d5,d0
|
|
||||||
lea l1,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l a0,a1
|
|
||||||
move.b d3,d0
|
|
||||||
and.b #15,d0
|
|
||||||
and.w #255,d0
|
|
||||||
and.l #65535,d0
|
|
||||||
lsl.l #4,d0
|
|
||||||
move.w d4,d1
|
|
||||||
ext.l d1
|
|
||||||
and.l #15,d1
|
|
||||||
or.l d1,d0
|
|
||||||
move.b d0,(44,a1)
|
|
||||||
l57
|
|
||||||
l54
|
|
||||||
l58 reg d2/d3/d4/d5/d6
|
|
||||||
movem.l (a7)+,d2/d3/d4/d5/d6
|
|
||||||
l60 equ 20
|
|
||||||
rts
|
|
||||||
; stacksize=20
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _text_clear
|
|
||||||
cnop 0,4
|
|
||||||
_text_clear
|
|
||||||
movem.l l69,-(a7)
|
|
||||||
move.w (6+l71,a7),d3
|
|
||||||
cmp.w #2,d3
|
|
||||||
bge l64
|
|
||||||
l63
|
|
||||||
move.w d3,d0
|
|
||||||
ext.l d0
|
|
||||||
moveq #46,d1
|
|
||||||
move.l d0,d4
|
|
||||||
move.l d1,d5
|
|
||||||
swap d4
|
|
||||||
swap d5
|
|
||||||
mulu.w d1,d4
|
|
||||||
mulu.w d0,d5
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d5,d4
|
|
||||||
swap d4
|
|
||||||
clr.w d4
|
|
||||||
add.l d4,d0
|
|
||||||
lea l1,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l a0,a2
|
|
||||||
moveq #0,d2
|
|
||||||
bra l66
|
|
||||||
l65
|
|
||||||
move.l (4,a2),a0
|
|
||||||
move.b #32,(0,a0,d2.l)
|
|
||||||
move.l (8,a2),a1
|
|
||||||
move.b (44,a2),(0,a1,d2.l)
|
|
||||||
l68
|
|
||||||
addq.l #1,d2
|
|
||||||
l66
|
|
||||||
move.w (24,a2),d0
|
|
||||||
ext.l d0
|
|
||||||
move.w (26,a2),d1
|
|
||||||
ext.l d1
|
|
||||||
move.l d0,d4
|
|
||||||
move.l d1,d5
|
|
||||||
swap d4
|
|
||||||
swap d5
|
|
||||||
mulu.w d1,d4
|
|
||||||
mulu.w d0,d5
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d5,d4
|
|
||||||
swap d4
|
|
||||||
clr.w d4
|
|
||||||
add.l d4,d0
|
|
||||||
cmp.l d2,d0
|
|
||||||
bgt l65
|
|
||||||
l67
|
|
||||||
l64
|
|
||||||
l61
|
|
||||||
l69 reg a2/d2/d3/d4/d5
|
|
||||||
movem.l (a7)+,a2/d2/d3/d4/d5
|
|
||||||
l71 equ 20
|
|
||||||
rts
|
|
||||||
; stacksize=20
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _text_scroll
|
|
||||||
cnop 0,4
|
|
||||||
_text_scroll
|
|
||||||
sub.w #28,a7
|
|
||||||
movem.l l88,-(a7)
|
|
||||||
cmp.w #2,(34+l90,a7)
|
|
||||||
bge l75
|
|
||||||
l74
|
|
||||||
move.w (34+l90,a7),d0
|
|
||||||
ext.l d0
|
|
||||||
moveq #46,d1
|
|
||||||
move.l d2,-(a7)
|
|
||||||
move.l d3,-(a7)
|
|
||||||
move.l d0,d2
|
|
||||||
move.l d1,d3
|
|
||||||
swap d2
|
|
||||||
swap d3
|
|
||||||
mulu.w d1,d2
|
|
||||||
mulu.w d0,d3
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d3,d2
|
|
||||||
swap d2
|
|
||||||
clr.w d2
|
|
||||||
add.l d2,d0
|
|
||||||
move.l (a7)+,d3
|
|
||||||
move.l (a7)+,d2
|
|
||||||
lea l1,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l a0,a6
|
|
||||||
moveq #0,d3
|
|
||||||
bra l77
|
|
||||||
l76
|
|
||||||
move.w d3,d0
|
|
||||||
muls.w (24,a6),d0
|
|
||||||
move.w d0,d4
|
|
||||||
moveq #1,d0
|
|
||||||
add.w d3,d0
|
|
||||||
muls.w (24,a6),d0
|
|
||||||
move.w d0,d5
|
|
||||||
move.l (4,a6),a2
|
|
||||||
add.w d4,a2
|
|
||||||
move.l (8,a6),a3
|
|
||||||
add.w d4,a3
|
|
||||||
move.l (4,a6),a4
|
|
||||||
add.w d5,a4
|
|
||||||
move.l (8,a6),a5
|
|
||||||
add.w d5,a5
|
|
||||||
moveq #0,d2
|
|
||||||
bra l81
|
|
||||||
l80
|
|
||||||
move.l a4,a0
|
|
||||||
addq.l #2,a4
|
|
||||||
move.l a2,a1
|
|
||||||
addq.l #2,a2
|
|
||||||
move.w (a0),(a1)
|
|
||||||
move.l a5,a0
|
|
||||||
addq.l #2,a5
|
|
||||||
move.l a3,a1
|
|
||||||
addq.l #2,a3
|
|
||||||
move.w (a0),(a1)
|
|
||||||
l83
|
|
||||||
addq.w #2,d2
|
|
||||||
l81
|
|
||||||
cmp.w (24,a6),d2
|
|
||||||
blt l80
|
|
||||||
l82
|
|
||||||
l79
|
|
||||||
addq.w #1,d3
|
|
||||||
l77
|
|
||||||
move.w d3,d0
|
|
||||||
ext.l d0
|
|
||||||
move.w (30,a6),d1
|
|
||||||
ext.l d1
|
|
||||||
subq.l #1,d1
|
|
||||||
cmp.l d0,d1
|
|
||||||
bgt l76
|
|
||||||
l78
|
|
||||||
move.w (30,a6),d0
|
|
||||||
subq.w #1,d0
|
|
||||||
muls.w (24,a6),d0
|
|
||||||
move.w d0,d7
|
|
||||||
move.l (4,a6),a1
|
|
||||||
add.w d7,a1
|
|
||||||
move.l a1,(10+l90,a7)
|
|
||||||
move.l (8,a6),a1
|
|
||||||
add.w d7,a1
|
|
||||||
move.l a1,(14+l90,a7)
|
|
||||||
move.b (44,a6),d6
|
|
||||||
moveq #0,d2
|
|
||||||
bra l85
|
|
||||||
l84
|
|
||||||
move.l (10+l90,a7),a0
|
|
||||||
addq.l #2,(10+l90,a7)
|
|
||||||
move.w #32,(a0)
|
|
||||||
move.l (14+l90,a7),a0
|
|
||||||
addq.l #2,(14+l90,a7)
|
|
||||||
moveq #0,d0
|
|
||||||
move.b d6,d0
|
|
||||||
move.w d0,(a0)
|
|
||||||
l87
|
|
||||||
addq.w #2,d2
|
|
||||||
l85
|
|
||||||
cmp.w (24,a6),d2
|
|
||||||
blt l84
|
|
||||||
l86
|
|
||||||
l75
|
|
||||||
l72
|
|
||||||
l88 reg a2/a3/a4/a5/a6/d2/d3/d4/d5/d6/d7
|
|
||||||
movem.l (a7)+,a2/a3/a4/a5/a6/d2/d3/d4/d5/d6/d7
|
|
||||||
l90 equ 44
|
|
||||||
add.w #28,a7
|
|
||||||
rts
|
|
||||||
; stacksize=80
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _text_put_raw
|
|
||||||
cnop 0,4
|
|
||||||
_text_put_raw
|
|
||||||
movem.l l99,-(a7)
|
|
||||||
move.b (11+l101,a7),d3
|
|
||||||
move.w (6+l101,a7),d2
|
|
||||||
cmp.w #2,d2
|
|
||||||
bge l94
|
|
||||||
l93
|
|
||||||
move.w d2,d0
|
|
||||||
ext.l d0
|
|
||||||
moveq #46,d1
|
|
||||||
move.l d0,d4
|
|
||||||
move.l d1,d5
|
|
||||||
swap d4
|
|
||||||
swap d5
|
|
||||||
mulu.w d1,d4
|
|
||||||
mulu.w d0,d5
|
|
||||||
mulu.w d1,d0
|
|
||||||
add.w d5,d4
|
|
||||||
swap d4
|
|
||||||
clr.w d4
|
|
||||||
add.l d4,d0
|
|
||||||
lea l1,a0
|
|
||||||
add.l d0,a0
|
|
||||||
move.l a0,a3
|
|
||||||
move.b d3,d0
|
|
||||||
sub.b #10,d0
|
|
||||||
beq l96
|
|
||||||
subq.b #3,d0
|
|
||||||
beq l97
|
|
||||||
bra l98
|
|
||||||
l96
|
|
||||||
move.w (34,a3),d0
|
|
||||||
ext.l d0
|
|
||||||
addq.l #1,d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
move.l #0,-(a7)
|
|
||||||
move.w d2,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _text_set_xy
|
|
||||||
add.w #12,a7
|
|
||||||
bra l95
|
|
||||||
l97
|
|
||||||
bra l95
|
|
||||||
l98
|
|
||||||
lea (36,a3),a0
|
|
||||||
move.l (a0),a1
|
|
||||||
addq.l #1,(a0)
|
|
||||||
move.b d3,(a1)
|
|
||||||
lea (40,a3),a1
|
|
||||||
move.l (a1),a2
|
|
||||||
addq.l #1,(a1)
|
|
||||||
move.b (44,a3),(a2)
|
|
||||||
move.w (34,a3),d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
move.w (32,a3),d0
|
|
||||||
ext.l d0
|
|
||||||
addq.l #1,d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
move.w d2,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _text_set_xy
|
|
||||||
add.w #12,a7
|
|
||||||
l95
|
|
||||||
l94
|
|
||||||
l91
|
|
||||||
l99 reg a2/a3/d2/d3/d4/d5
|
|
||||||
movem.l (a7)+,a2/a3/d2/d3/d4/d5
|
|
||||||
l101 equ 24
|
|
||||||
rts
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _text_put_ansi
|
|
||||||
cnop 0,4
|
|
||||||
_text_put_ansi
|
|
||||||
movem.l l106,-(a7)
|
|
||||||
move.w (6+l108,a7),d0
|
|
||||||
l104
|
|
||||||
l105
|
|
||||||
l102
|
|
||||||
l106 reg
|
|
||||||
l108 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
public _fg_color_lut
|
|
||||||
cnop 0,4
|
|
||||||
_fg_color_lut
|
|
||||||
dc.w 0
|
|
||||||
dc.w 65280
|
|
||||||
dc.w 0
|
|
||||||
dc.w 65408
|
|
||||||
dc.w 32768
|
|
||||||
dc.w 65280
|
|
||||||
dc.w 128
|
|
||||||
dc.w 65280
|
|
||||||
dc.w 32768
|
|
||||||
dc.w 65408
|
|
||||||
dc.w 32896
|
|
||||||
dc.w 65280
|
|
||||||
dc.w 128
|
|
||||||
dc.w 65408
|
|
||||||
dc.w 32896
|
|
||||||
dc.w 65408
|
|
||||||
dc.w 17664
|
|
||||||
dc.w 65535
|
|
||||||
dc.w 17683
|
|
||||||
dc.w 65419
|
|
||||||
dc.w 0
|
|
||||||
dc.w 65312
|
|
||||||
dc.w 8192
|
|
||||||
dc.w 65280
|
|
||||||
dc.w 32
|
|
||||||
dc.w 65280
|
|
||||||
dc.w 8224
|
|
||||||
dc.w 65312
|
|
||||||
dc.w 16448
|
|
||||||
dc.w 65344
|
|
||||||
dc.w 65535
|
|
||||||
dc.w 65535
|
|
||||||
public _bg_color_lut
|
|
||||||
cnop 0,4
|
|
||||||
_bg_color_lut
|
|
||||||
dc.w 0
|
|
||||||
dc.w 65280
|
|
||||||
dc.w 0
|
|
||||||
dc.w 65408
|
|
||||||
dc.w 32768
|
|
||||||
dc.w 65280
|
|
||||||
dc.w 128
|
|
||||||
dc.w 65280
|
|
||||||
dc.w 8192
|
|
||||||
dc.w 65312
|
|
||||||
dc.w 8224
|
|
||||||
dc.w 65280
|
|
||||||
dc.w 32
|
|
||||||
dc.w 65312
|
|
||||||
dc.w 8224
|
|
||||||
dc.w 65312
|
|
||||||
dc.w 26910
|
|
||||||
dc.w 65490
|
|
||||||
dc.w 17683
|
|
||||||
dc.w 65419
|
|
||||||
dc.w 0
|
|
||||||
dc.w 65312
|
|
||||||
dc.w 8192
|
|
||||||
dc.w 65280
|
|
||||||
dc.w 32
|
|
||||||
dc.w 65280
|
|
||||||
dc.w 4112
|
|
||||||
dc.w 65296
|
|
||||||
dc.w 16448
|
|
||||||
dc.w 65344
|
|
||||||
dc.w 65535
|
|
||||||
dc.w 65535
|
|
||||||
section "BSS",bss
|
|
||||||
cnop 0,4
|
|
||||||
l1
|
|
||||||
ds.b 92
|
|
|
@ -106,8 +106,9 @@ int text_init() {
|
||||||
chan_a->border_control[1] = 0x00000040; //Dark Blue
|
chan_a->border_control[1] = 0x00000040; //Dark Blue
|
||||||
|
|
||||||
text_setsizes(0);
|
text_setsizes(0);
|
||||||
text_set_color(0, 15, 0);
|
text_set_color(0, 15, 3);
|
||||||
text_clear(0);
|
text_clear(0);
|
||||||
|
text_set_cursor(0, 0xF3, 0xB1, 1, 1);
|
||||||
text_set_xy(0, 0, 0);
|
text_set_xy(0, 0, 0);
|
||||||
|
|
||||||
chan_b->master_control = MasterControlReg_B;
|
chan_b->master_control = MasterControlReg_B;
|
||||||
|
@ -123,8 +124,9 @@ int text_init() {
|
||||||
chan_b->border_control[1] = 0x00400000; //Dark Red
|
chan_b->border_control[1] = 0x00400000; //Dark Red
|
||||||
|
|
||||||
text_setsizes(1);
|
text_setsizes(1);
|
||||||
text_set_color(1, 15, 0);
|
text_set_color(1, 15, 3);
|
||||||
text_clear(1);
|
text_clear(1);
|
||||||
|
text_set_cursor(1, 0xF3, 0xB1, 1, 1);
|
||||||
text_set_xy(1, 0, 0);
|
text_set_xy(1, 0, 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -317,7 +319,7 @@ void text_scroll(short screen) {
|
||||||
uint8_t color = chan->current_color;
|
uint8_t color = chan->current_color;
|
||||||
for (column = 0; column < chan->columns_max; column += 2) {
|
for (column = 0; column < chan->columns_max; column += 2) {
|
||||||
*text_dest++ = ' ';
|
*text_dest++ = ' ';
|
||||||
*color_dest++ = color;
|
*color_dest++ = color << 8 | color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -341,6 +343,13 @@ void text_put_raw(short screen, char c) {
|
||||||
case CHAR_CR:
|
case CHAR_CR:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CHAR_BS:
|
||||||
|
if (chan->x > 0) {
|
||||||
|
text_set_xy(screen, chan->x - 1, chan->y);
|
||||||
|
*chan->text_cursor_ptr++ = ' ';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
*chan->text_cursor_ptr++ = c;
|
*chan->text_cursor_ptr++ = c;
|
||||||
*chan->color_cursor_ptr++ = chan->current_color;
|
*chan->color_cursor_ptr++ = chan->current_color;
|
||||||
|
|
268
src/dev/uart.asm
268
src/dev/uart.asm
|
@ -1,268 +0,0 @@
|
||||||
idnt "uart.c"
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
section "CODE",code
|
|
||||||
public _uart_get_base
|
|
||||||
cnop 0,4
|
|
||||||
_uart_get_base
|
|
||||||
movem.l l6,-(a7)
|
|
||||||
move.w (6+l8,a7),d0
|
|
||||||
bne l4
|
|
||||||
l3
|
|
||||||
move.l #12592120,d0
|
|
||||||
bra l1
|
|
||||||
l4
|
|
||||||
move.l #12591864,d0
|
|
||||||
l5
|
|
||||||
l1
|
|
||||||
l6 reg
|
|
||||||
l8 equ 0
|
|
||||||
rts
|
|
||||||
; stacksize=0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _uart_setbps
|
|
||||||
cnop 0,4
|
|
||||||
_uart_setbps
|
|
||||||
movem.l l13,-(a7)
|
|
||||||
move.w (6+l15,a7),d3
|
|
||||||
move.w (10+l15,a7),d2
|
|
||||||
move.w d3,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _uart_get_base
|
|
||||||
move.l d0,a2
|
|
||||||
addq.w #4,a7
|
|
||||||
move.l a2,d0
|
|
||||||
beq l12
|
|
||||||
lea (3,a2),a0
|
|
||||||
or.b #128,(a0)
|
|
||||||
moveq #0,d0
|
|
||||||
move.w d2,d0
|
|
||||||
and.l #255,d0
|
|
||||||
move.b d0,(a2)
|
|
||||||
moveq #0,d0
|
|
||||||
move.w d2,d0
|
|
||||||
asr.l #8,d0
|
|
||||||
and.l #255,d0
|
|
||||||
move.b d0,(1,a2)
|
|
||||||
lea (3,a2),a0
|
|
||||||
and.b #127,(a0)
|
|
||||||
l12
|
|
||||||
l9
|
|
||||||
l13 reg a2/d2/d3
|
|
||||||
movem.l (a7)+,a2/d2/d3
|
|
||||||
l15 equ 12
|
|
||||||
rts
|
|
||||||
; stacksize=20
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _uart_setlcr
|
|
||||||
cnop 0,4
|
|
||||||
_uart_setlcr
|
|
||||||
movem.l l22,-(a7)
|
|
||||||
move.w (6+l24,a7),d3
|
|
||||||
move.b (11+l24,a7),d2
|
|
||||||
move.w d3,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _uart_get_base
|
|
||||||
move.l d0,a2
|
|
||||||
pea l18
|
|
||||||
jsr _DEBUG
|
|
||||||
move.b d2,(3,a2)
|
|
||||||
addq.w #8,a7
|
|
||||||
cmp.b (3,a2),d2
|
|
||||||
beq l20
|
|
||||||
l19
|
|
||||||
pea l21
|
|
||||||
jsr _DEBUG
|
|
||||||
addq.w #4,a7
|
|
||||||
l20
|
|
||||||
l16
|
|
||||||
l22 reg a2/d2/d3
|
|
||||||
movem.l (a7)+,a2/d2/d3
|
|
||||||
l24 equ 12
|
|
||||||
rts
|
|
||||||
cnop 0,4
|
|
||||||
l21
|
|
||||||
dc.b 76
|
|
||||||
dc.b 67
|
|
||||||
dc.b 82
|
|
||||||
dc.b 32
|
|
||||||
dc.b 109
|
|
||||||
dc.b 105
|
|
||||||
dc.b 115
|
|
||||||
dc.b 109
|
|
||||||
dc.b 97
|
|
||||||
dc.b 116
|
|
||||||
dc.b 99
|
|
||||||
dc.b 104
|
|
||||||
dc.b 101
|
|
||||||
dc.b 100
|
|
||||||
dc.b 33
|
|
||||||
dc.b 0
|
|
||||||
cnop 0,4
|
|
||||||
l18
|
|
||||||
dc.b 117
|
|
||||||
dc.b 97
|
|
||||||
dc.b 114
|
|
||||||
dc.b 116
|
|
||||||
dc.b 95
|
|
||||||
dc.b 115
|
|
||||||
dc.b 101
|
|
||||||
dc.b 116
|
|
||||||
dc.b 108
|
|
||||||
dc.b 99
|
|
||||||
dc.b 114
|
|
||||||
dc.b 0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _uart_init
|
|
||||||
cnop 0,4
|
|
||||||
_uart_init
|
|
||||||
movem.l l30,-(a7)
|
|
||||||
move.w (6+l32,a7),d2
|
|
||||||
move.w d2,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _uart_get_base
|
|
||||||
move.l d0,a2
|
|
||||||
pea l27
|
|
||||||
jsr _DEBUG
|
|
||||||
addq.w #8,a7
|
|
||||||
move.l a2,d0
|
|
||||||
beq l29
|
|
||||||
move.l #1,-(a7)
|
|
||||||
move.w d2,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _uart_setbps
|
|
||||||
move.l #3,-(a7)
|
|
||||||
move.w d2,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _uart_setlcr
|
|
||||||
move.b #193,(2,a2)
|
|
||||||
add.w #16,a7
|
|
||||||
l29
|
|
||||||
l25
|
|
||||||
l30 reg a2/d2
|
|
||||||
movem.l (a7)+,a2/d2
|
|
||||||
l32 equ 8
|
|
||||||
rts
|
|
||||||
cnop 0,4
|
|
||||||
l27
|
|
||||||
dc.b 117
|
|
||||||
dc.b 97
|
|
||||||
dc.b 114
|
|
||||||
dc.b 116
|
|
||||||
dc.b 95
|
|
||||||
dc.b 105
|
|
||||||
dc.b 110
|
|
||||||
dc.b 105
|
|
||||||
dc.b 116
|
|
||||||
dc.b 0
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _uart_has_bytes
|
|
||||||
cnop 0,4
|
|
||||||
_uart_has_bytes
|
|
||||||
movem.l l41,-(a7)
|
|
||||||
move.w (6+l43,a7),d2
|
|
||||||
move.w d2,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _uart_get_base
|
|
||||||
move.l d0,a2
|
|
||||||
addq.w #4,a7
|
|
||||||
move.l a2,d0
|
|
||||||
beq l36
|
|
||||||
moveq #0,d0
|
|
||||||
move.b (5,a2),d0
|
|
||||||
and.b #1,d0
|
|
||||||
and.w #255,d0
|
|
||||||
and.l #65535,d0
|
|
||||||
tst.l d0
|
|
||||||
beq l38
|
|
||||||
moveq #1,d0
|
|
||||||
bra l33
|
|
||||||
l38
|
|
||||||
moveq #0,d0
|
|
||||||
bra l33
|
|
||||||
l39
|
|
||||||
bra l40
|
|
||||||
l36
|
|
||||||
moveq #0,d0
|
|
||||||
l40
|
|
||||||
l33
|
|
||||||
l41 reg a2/d2
|
|
||||||
movem.l (a7)+,a2/d2
|
|
||||||
l43 equ 8
|
|
||||||
rts
|
|
||||||
; stacksize=16
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _uart_put
|
|
||||||
cnop 0,4
|
|
||||||
_uart_put
|
|
||||||
movem.l l51,-(a7)
|
|
||||||
move.b (11+l53,a7),d4
|
|
||||||
move.w (6+l53,a7),d3
|
|
||||||
move.w d3,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _uart_get_base
|
|
||||||
move.l d0,a2
|
|
||||||
addq.w #4,a7
|
|
||||||
move.l a2,d0
|
|
||||||
beq l47
|
|
||||||
moveq #0,d2
|
|
||||||
l48
|
|
||||||
move.b (5,a2),d2
|
|
||||||
l50
|
|
||||||
moveq #0,d0
|
|
||||||
move.b d2,d0
|
|
||||||
and.b #32,d0
|
|
||||||
and.w #255,d0
|
|
||||||
and.l #65535,d0
|
|
||||||
tst.l d0
|
|
||||||
beq l48
|
|
||||||
l49
|
|
||||||
move.b d4,(a2)
|
|
||||||
l47
|
|
||||||
l44
|
|
||||||
l51 reg a2/d2/d3/d4
|
|
||||||
movem.l (a7)+,a2/d2/d3/d4
|
|
||||||
l53 equ 16
|
|
||||||
rts
|
|
||||||
; stacksize=24
|
|
||||||
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
|
|
||||||
public _uart_get
|
|
||||||
cnop 0,4
|
|
||||||
_uart_get
|
|
||||||
movem.l l61,-(a7)
|
|
||||||
move.w (6+l63,a7),d3
|
|
||||||
move.w d3,d0
|
|
||||||
ext.l d0
|
|
||||||
move.l d0,-(a7)
|
|
||||||
jsr _uart_get_base
|
|
||||||
move.l d0,a2
|
|
||||||
addq.w #4,a7
|
|
||||||
move.l a2,d0
|
|
||||||
beq l57
|
|
||||||
moveq #0,d2
|
|
||||||
l58
|
|
||||||
move.b (5,a2),d2
|
|
||||||
l60
|
|
||||||
moveq #0,d0
|
|
||||||
move.b d2,d0
|
|
||||||
and.b #1,d0
|
|
||||||
and.w #255,d0
|
|
||||||
and.l #65535,d0
|
|
||||||
tst.l d0
|
|
||||||
beq l58
|
|
||||||
l59
|
|
||||||
move.b (a2),d0
|
|
||||||
l57
|
|
||||||
l54
|
|
||||||
l61 reg a2/d2/d3
|
|
||||||
movem.l (a7)+,a2/d2/d3
|
|
||||||
l63 equ 12
|
|
||||||
rts
|
|
||||||
; stacksize=20
|
|
||||||
public _DEBUG
|
|
|
@ -26,14 +26,14 @@ void uart_setbps(short uart, unsigned short bps_code) {
|
||||||
unsigned char lcr;
|
unsigned char lcr;
|
||||||
if (uart_base) {
|
if (uart_base) {
|
||||||
/* Enable divisor latch */
|
/* Enable divisor latch */
|
||||||
uart_base[UART_LCR] |= 0x80;
|
uart_base[UART_LCR] = uart_base[UART_LCR] | 0x80;
|
||||||
|
|
||||||
/* Set the divisor */
|
/* Set the divisor */
|
||||||
uart_base[UART_TRHB] = bps_code & 0xff;
|
uart_base[UART_TRHB] = bps_code & 0xff;
|
||||||
uart_base[UART_TRHB+1] = (bps_code >> 8) & 0xff;
|
uart_base[UART_TRHB+1] = (bps_code >> 8) & 0xff;
|
||||||
|
|
||||||
/* Disable divisor latch */
|
/* Disable divisor latch */
|
||||||
uart_base[UART_LCR] &= 0x7F;
|
uart_base[UART_LCR] = uart_base[UART_LCR] & 0x7F;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ void uart_init(short uart) {
|
||||||
DEBUG("uart_init");
|
DEBUG("uart_init");
|
||||||
if (uart_base) {
|
if (uart_base) {
|
||||||
/* Default to 9600 bps */
|
/* Default to 9600 bps */
|
||||||
uart_setbps(uart, UART_115200);
|
uart_setbps(uart, UART_9600);
|
||||||
|
|
||||||
/* Set: no parity, 1 stop bit, 8 data bits */
|
/* Set: no parity, 1 stop bit, 8 data bits */
|
||||||
uart_setlcr(uart, LCR_PARITY_NONE | LCR_STOPBIT_1 | LCR_DATABITS_8);
|
uart_setlcr(uart, LCR_PARITY_NONE | LCR_STOPBIT_1 | LCR_DATABITS_8);
|
||||||
|
|
|
@ -12,4 +12,4 @@ all: $(cobjects)
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) $(aobjects) $(cobjects)
|
$(RM) $(aobjects) $(cobjects) *.asm
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
/* Definitions of physical drive number for each drive */
|
/* Definitions of physical drive number for each drive */
|
||||||
#define DEV_SDC 0 /* Example: Map Ramdisk to physical drive 0 */
|
#define DEV_SDC 0 /* Example: Map Ramdisk to physical drive 0 */
|
||||||
|
#define DEV_FDC 1
|
||||||
#define DEV_HDC 2
|
#define DEV_HDC 2
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
/ f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */
|
/ f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */
|
||||||
|
|
||||||
|
|
||||||
#define FF_USE_MKFS 0
|
#define FF_USE_MKFS 1
|
||||||
/* This option switches f_mkfs() function. (0:Disable or 1:Enable) */
|
/* This option switches f_mkfs() function. (0:Disable or 1:Enable) */
|
||||||
|
|
||||||
|
|
||||||
|
@ -170,8 +170,8 @@
|
||||||
/* Number of volumes (logical drives) to be used. (1-10) */
|
/* Number of volumes (logical drives) to be used. (1-10) */
|
||||||
|
|
||||||
|
|
||||||
#define FF_STR_VOLUME_ID 0
|
#define FF_STR_VOLUME_ID 1
|
||||||
// #define FF_VOLUME_STRS "012"
|
// #define FF_VOLUME_STRS "S,F,H"
|
||||||
/* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings.
|
/* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings.
|
||||||
/ When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive
|
/ When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive
|
||||||
/ number in the path name. FF_VOLUME_STRS defines the volume ID strings for each
|
/ number in the path name. FF_VOLUME_STRS defines the volume ID strings for each
|
||||||
|
@ -183,7 +183,6 @@
|
||||||
/ const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sd","usb",...
|
/ const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sd","usb",...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#define FF_MULTI_PARTITION 0
|
#define FF_MULTI_PARTITION 0
|
||||||
/* This option switches support for multiple volumes on the physical drive.
|
/* This option switches support for multiple volumes on the physical drive.
|
||||||
/ By default (0), each logical drive number is bound to the same physical drive
|
/ By default (0), each logical drive number is bound to the same physical drive
|
||||||
|
|
433
src/foenixmcp.c
433
src/foenixmcp.c
|
@ -14,14 +14,18 @@
|
||||||
#include "dev/text_screen_iii.h"
|
#include "dev/text_screen_iii.h"
|
||||||
#include "dev/pata.h"
|
#include "dev/pata.h"
|
||||||
#include "dev/ps2.h"
|
#include "dev/ps2.h"
|
||||||
|
// #include "dev/kbd_mo.h"
|
||||||
#include "dev/sdc.h"
|
#include "dev/sdc.h"
|
||||||
#include "dev/uart.h"
|
#include "dev/uart.h"
|
||||||
#include "snd/codec.h"
|
#include "snd/codec.h"
|
||||||
#include "snd/psg.h"
|
#include "snd/psg.h"
|
||||||
#include "snd/sid.h"
|
#include "snd/sid.h"
|
||||||
#include "fatfs/ff.h"
|
#include "fatfs/ff.h"
|
||||||
|
// #include "cli/cli.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
|
const char* VolumeStr[FF_VOLUMES] = { "@S", "@F", "@H" };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the SuperIO registers
|
* Initialize the SuperIO registers
|
||||||
*/
|
*/
|
||||||
|
@ -75,10 +79,60 @@
|
||||||
*LED2_REG = 0x02;
|
*LED2_REG = 0x02;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void print(short channel, char * message) {
|
||||||
|
sys_chan_write(channel, message, strlen(message));
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char number[5];
|
||||||
|
unsigned char hex_digits[] = "0123456789ABCDEF";
|
||||||
|
|
||||||
|
void print_hex(short channel, unsigned short x) {
|
||||||
|
short digit;
|
||||||
|
|
||||||
|
digit = (x & 0xf0) >> 4;
|
||||||
|
number[0] = hex_digits[digit];
|
||||||
|
|
||||||
|
digit = (x & 0x0f);
|
||||||
|
number[1] = hex_digits[digit];
|
||||||
|
|
||||||
|
number[2] = 0;
|
||||||
|
|
||||||
|
print(channel, number);
|
||||||
|
}
|
||||||
|
|
||||||
|
void print_hex_16(short channel, unsigned short x) {
|
||||||
|
short digit;
|
||||||
|
|
||||||
|
digit = (x >> 12) & 0x000f;
|
||||||
|
number[0] = hex_digits[digit];
|
||||||
|
|
||||||
|
digit = (x >> 8) & 0x000f;
|
||||||
|
number[1] = hex_digits[digit];
|
||||||
|
|
||||||
|
digit = (x >> 4) & 0x000f;
|
||||||
|
number[2] = hex_digits[digit];
|
||||||
|
|
||||||
|
digit = x & 0x000f;
|
||||||
|
number[3] = hex_digits[digit];
|
||||||
|
|
||||||
|
number[4] = 0;
|
||||||
|
|
||||||
|
print(channel, number);
|
||||||
|
}
|
||||||
|
|
||||||
|
void print_error(short channel, char * message, short code) {
|
||||||
|
print(channel, message);
|
||||||
|
print(channel, ": ");
|
||||||
|
print_hex_16(channel, code);
|
||||||
|
print(channel, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the kernel systems.
|
* Initialize the kernel systems.
|
||||||
*/
|
*/
|
||||||
void initialize() {
|
void initialize() {
|
||||||
|
short res;
|
||||||
|
|
||||||
text_init(); // Initialize the text channels
|
text_init(); // Initialize the text channels
|
||||||
DEBUG("Foenix/MCP starting up...");
|
DEBUG("Foenix/MCP starting up...");
|
||||||
|
|
||||||
|
@ -110,224 +164,111 @@ void initialize() {
|
||||||
bdev_init_system(); // Initialize the channel device system
|
bdev_init_system(); // Initialize the channel device system
|
||||||
DEBUG("Block device system ready.");
|
DEBUG("Block device system ready.");
|
||||||
|
|
||||||
if (con_install()) {
|
if (res = con_install()) {
|
||||||
DEBUG("FAILED: Console installation.");
|
print_error(0, "FAILED: Console installation", res);
|
||||||
} else {
|
} else {
|
||||||
DEBUG("Console installed.");
|
DEBUG("Console installed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pata_install()) {
|
if (res = pata_install()) {
|
||||||
DEBUG("FAILED: PATA driver installation.");
|
print_error(0, "FAILED: PATA driver installation", res);
|
||||||
} else {
|
} else {
|
||||||
DEBUG("PATA driver installed.");
|
DEBUG("PATA driver installed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sdc_install()) {
|
if (res = sdc_install()) {
|
||||||
DEBUG("FAILED: SDC driver installation.");
|
print_error(0, "FAILED: SDC driver installation", res);
|
||||||
} else {
|
} else {
|
||||||
DEBUG("SDC driver installed.");
|
DEBUG("SDC driver installed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// At this point, we should be able to call into to console to print to the screens
|
// At this point, we should be able to call into to console to print to the screens
|
||||||
|
|
||||||
if (ps2_init()) {
|
if (res = ps2_init()) {
|
||||||
DEBUG("FAILED: PS/2 initialization.");
|
print_error(0, "FAILED: PS/2 keyboard initialization", res);
|
||||||
} else {
|
} else {
|
||||||
DEBUG("PS/2 initialized.");
|
DEBUG("PS/2 keyboard initialized.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bdev_init(BDEV_HDC)) {
|
// if (res = kbdmo_init()) {
|
||||||
DEBUG("Unable to initialize the PATA!");
|
// print_error(0, "FAILED: A2560K built-in keyboard initialization", res);
|
||||||
} else {
|
// } else {
|
||||||
DEBUG("PATA initialized.");
|
// DEBUG("A2560K built-in keyboard initialized.");
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (bdev_init(BDEV_SDC)) {
|
// if (res = cli_init()) {
|
||||||
DEBUG("Unable to initialize the SDC!");
|
// print_error(0, "FAILED: CLI initialization", res);
|
||||||
} else {
|
// } else {
|
||||||
DEBUG("SDC initialized.");
|
// DEBUG("CLI initialized.");
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
print(0, "MASK_GRP1: ");
|
||||||
|
unsigned short grp1 = *MASK_GRP1;
|
||||||
|
print_hex_16(0, grp1);
|
||||||
|
print(0, "\n");
|
||||||
|
|
||||||
/* Enable all interrupts */
|
/* Enable all interrupts */
|
||||||
int_enable_all();
|
// int_enable_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
void print(short channel, char * message) {
|
// void try_mo_scancodes(short screen) {
|
||||||
//syscall(KFN_CHAN_WRITE, channel, message, strlen(message));
|
// // volatile unsigned short * kbd_mo_data = ((volatile unsigned short *)0x00C00040);
|
||||||
char * c;
|
// // volatile unsigned short * kbd_mo_stat = ((volatile unsigned short *)0x00C00042);
|
||||||
for (c = message; *c; c++) {
|
//
|
||||||
text_put_raw(channel, *c);
|
// print(screen, "mo> ");
|
||||||
}
|
//
|
||||||
}
|
// do {
|
||||||
|
// // unsigned short status = *kbd_mo_stat;
|
||||||
|
// // if ((status & KBD_MO_STAT_EMPTY) != KBD_MO_STAT_EMPTY) {
|
||||||
|
// // unsigned short data = *kbd_mo_data;
|
||||||
|
// // print(screen, "[");
|
||||||
|
// // print_hex_16(screen, status);
|
||||||
|
// // print(screen, "]: {");
|
||||||
|
// //
|
||||||
|
// // print_hex_16(screen, data);
|
||||||
|
// // print(screen, "}\n ");
|
||||||
|
// // // }
|
||||||
|
// // }
|
||||||
|
//
|
||||||
|
// unsigned short scancode = kbdmo_get_scancode_poll();
|
||||||
|
// if (scancode != 0) {
|
||||||
|
// print(screen, "[");
|
||||||
|
// print_hex_16(screen, scancode);
|
||||||
|
// print(screen, "]\n");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// } while (1);
|
||||||
|
// }
|
||||||
|
|
||||||
unsigned char number[5];
|
// void try_mo_chars(short screen) {
|
||||||
unsigned char hex_digits[] = "0123456789ABCDEF";
|
// char buffer[2];
|
||||||
|
// buffer[1] = 0;
|
||||||
void print_hex(short channel, unsigned short x) {
|
//
|
||||||
short digit;
|
// print(screen, "mo> ");
|
||||||
|
//
|
||||||
digit = (x & 0xf0) >> 4;
|
// while (1) {
|
||||||
number[0] = hex_digits[digit];
|
// unsigned char c = kbdmo_getc_poll();
|
||||||
|
// if (c) {
|
||||||
digit = (x & 0x0f);
|
// // text_put_raw(screen, c);
|
||||||
number[1] = hex_digits[digit];
|
// return;
|
||||||
|
// }
|
||||||
number[2] = 0;
|
// }
|
||||||
|
// }
|
||||||
print(channel, number);
|
|
||||||
}
|
|
||||||
|
|
||||||
void print_hex_16(short channel, unsigned short x) {
|
|
||||||
short digit;
|
|
||||||
|
|
||||||
digit = (x >> 12) & 0x000f;
|
|
||||||
number[0] = hex_digits[digit];
|
|
||||||
|
|
||||||
digit = (x >> 8) & 0x000f;
|
|
||||||
number[1] = hex_digits[digit];
|
|
||||||
|
|
||||||
digit = (x >> 4) & 0x000f;
|
|
||||||
number[2] = hex_digits[digit];
|
|
||||||
|
|
||||||
digit = x & 0x000f;
|
|
||||||
number[3] = hex_digits[digit];
|
|
||||||
|
|
||||||
number[4] = 0;
|
|
||||||
|
|
||||||
print(channel, number);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define KBD_MO_STAT_FULL 0x4000
|
|
||||||
#define KBD_MO_STAT_EMPTY 0x8000
|
|
||||||
|
|
||||||
void try_mo(short screen) {
|
|
||||||
volatile unsigned short * kbd_mo_data = ((volatile unsigned short *)0x00C00040);
|
|
||||||
volatile unsigned short * kbd_mo_stat = ((volatile unsigned short *)0x00C00042);
|
|
||||||
|
|
||||||
print(screen, "mo> ");
|
|
||||||
|
|
||||||
do {
|
|
||||||
unsigned short status = *kbd_mo_stat;
|
|
||||||
if ((status & KBD_MO_STAT_EMPTY) != KBD_MO_STAT_EMPTY) {
|
|
||||||
unsigned short data = *kbd_mo_data;
|
|
||||||
print(screen, "[");
|
|
||||||
print_hex_16(screen, status);
|
|
||||||
print(screen, "]: {");
|
|
||||||
|
|
||||||
print_hex_16(screen, data);
|
|
||||||
print(screen, "}\n ");
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
// unsigned short data = *kbd_mo_data;
|
|
||||||
// if (data != 0) {
|
|
||||||
// print(screen, "{");
|
|
||||||
// print_hex_16(screen, data);
|
|
||||||
// print(screen, "}\n ");
|
|
||||||
// }
|
|
||||||
} while (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
DIR my_dir;
|
|
||||||
FILINFO my_file;
|
|
||||||
FATFS my_fs;
|
|
||||||
char line[255];
|
|
||||||
|
|
||||||
short dos_cmd_dir(short screen, char * path) {
|
|
||||||
FRESULT fres;
|
|
||||||
|
|
||||||
TRACE("dos_cmd_dir");
|
|
||||||
|
|
||||||
fres = f_mount(&my_fs, path, 0);
|
|
||||||
TRACE("f_mount");
|
|
||||||
if (fres == FR_OK) {
|
|
||||||
fres = f_opendir(&my_dir, "/");
|
|
||||||
TRACE("f_opendir");
|
|
||||||
if (fres == FR_OK) {
|
|
||||||
do {
|
|
||||||
fres = f_readdir(&my_dir, &my_file);
|
|
||||||
TRACE("f_readdir");
|
|
||||||
if ((fres == FR_OK) && (my_file.fname[0] != 0)) {
|
|
||||||
if ((my_file.fattrib & AM_HID) == 0) {
|
|
||||||
chan_write(screen, my_file.fname, strlen(my_file.fname));
|
|
||||||
if (my_file.fattrib & AM_DIR) {
|
|
||||||
chan_write_b(screen, '/');
|
|
||||||
}
|
|
||||||
chan_write_b(screen, '\n');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} while(1);
|
|
||||||
|
|
||||||
f_closedir(&my_dir);
|
|
||||||
} else {
|
|
||||||
char * err = "Could not open directory.\r";
|
|
||||||
chan_write(screen, err, strlen(err));
|
|
||||||
}
|
|
||||||
|
|
||||||
f_mount(0, "", 0);
|
|
||||||
} else {
|
|
||||||
char * err = "Could not mount drive.\r";
|
|
||||||
chan_write(screen, err, strlen(err));
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void repl(short screen) {
|
|
||||||
print(screen, "> ");
|
|
||||||
while (1) {
|
|
||||||
char c = kbd_getc_poll();
|
|
||||||
if (c) {
|
|
||||||
char buffer[2];
|
|
||||||
buffer[0] = c;
|
|
||||||
buffer[1] = 0;
|
|
||||||
print(screen, buffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_get_mbr(short screen, short device) {
|
|
||||||
short x;
|
|
||||||
short result;
|
|
||||||
char buffer[512];
|
|
||||||
|
|
||||||
for (x = 0; x < 512; x++) {
|
|
||||||
buffer[x] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
print(1, "Master Boot Record:\n");
|
|
||||||
result = bdev_read(device, 0, buffer, 512);
|
|
||||||
if (result > 0) {
|
|
||||||
for (x = 0; x < result; x++) {
|
|
||||||
if (x % 16 == 0) {
|
|
||||||
print(screen, "\n");
|
|
||||||
}
|
|
||||||
print_hex(screen, buffer[x]);
|
|
||||||
print(screen, " ");
|
|
||||||
}
|
|
||||||
print(screen, "\n");
|
|
||||||
} else if (result < 0) {
|
|
||||||
DEBUG("IDE returned an error.");
|
|
||||||
} else {
|
|
||||||
DEBUG("IDE returned nothing.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void uart_send(short uart, char * message) {
|
void uart_send(short uart, char * message) {
|
||||||
int i;
|
int i, j;
|
||||||
|
|
||||||
uart_init(uart);
|
|
||||||
for (i = 0; i < strlen(message); i++) {
|
for (i = 0; i < strlen(message); i++) {
|
||||||
uart_put(uart, message[i]);
|
uart_put(uart, message[i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void uart_test_send(short uart) {
|
void uart_test_send(short uart) {
|
||||||
while (1) {
|
while (1) {
|
||||||
uart_send(uart, 'a');
|
int j;
|
||||||
|
uart_put(uart, 'a');
|
||||||
|
for (j = 1; j < 10000; j++) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,7 +293,108 @@ void int_sof_a() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Acknowledge the interrupt before leaving */
|
/* Acknowledge the interrupt before leaving */
|
||||||
int_ack(SOF_A_INT00);
|
int_clear(SOF_A_INT00);
|
||||||
|
}
|
||||||
|
|
||||||
|
void try_format(short screen, char * path) {
|
||||||
|
FATFS fs; /* Filesystem object */
|
||||||
|
FIL fil; /* File object */
|
||||||
|
FRESULT res; /* API result code */
|
||||||
|
UINT bw; /* Bytes written */
|
||||||
|
BYTE work[FF_MAX_SS]; /* Work area (larger is better for processing time) */
|
||||||
|
|
||||||
|
/* Format the HDD with default parameters */
|
||||||
|
res = f_mkfs(path, 0, work, sizeof work);
|
||||||
|
if (res) {
|
||||||
|
print(screen, "Could not format drive.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Give a work area to the default drive */
|
||||||
|
f_mount(&fs, path, 0);
|
||||||
|
|
||||||
|
/* Create a file as new */
|
||||||
|
res = f_open(&fil, "hello.txt", FA_CREATE_NEW | FA_WRITE);
|
||||||
|
if (res) {
|
||||||
|
print(screen, "Could not create hello.txt.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Write a message */
|
||||||
|
f_write(&fil, "Hello, World!\r\n", 15, &bw);
|
||||||
|
if (bw != 15) {
|
||||||
|
print(screen, "Error writing file.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Close the file */
|
||||||
|
f_close(&fil);
|
||||||
|
|
||||||
|
/* Unregister work area */
|
||||||
|
f_mount(0, "", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void try_write(short screen, char * path) {
|
||||||
|
FATFS fs; /* Filesystem object */
|
||||||
|
FIL fil; /* File object */
|
||||||
|
FRESULT res; /* API result code */
|
||||||
|
UINT bw; /* Bytes written */
|
||||||
|
|
||||||
|
/* Give a work area to the default drive */
|
||||||
|
f_mount(&fs, path, 0);
|
||||||
|
|
||||||
|
/* Create a file as new */
|
||||||
|
res = f_open(&fil, "hello.txt", FA_CREATE_NEW | FA_WRITE);
|
||||||
|
if (res) {
|
||||||
|
print(screen, "Could not create hello.txt: ");
|
||||||
|
print_hex_16(screen, res);
|
||||||
|
print(screen, "\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Write a message */
|
||||||
|
f_write(&fil, "Hello, World!\r\n", 15, &bw);
|
||||||
|
if (bw != 15) {
|
||||||
|
print(screen, "Error writing file.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Close the file */
|
||||||
|
f_close(&fil);
|
||||||
|
|
||||||
|
/* Unregister work area */
|
||||||
|
f_mount(0, "", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char test_block_1[512];
|
||||||
|
unsigned char test_block_2[512];
|
||||||
|
|
||||||
|
void try_bdev_getput(short screen, short dev) {
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < 512; i++) {
|
||||||
|
test_block_1[i] = (unsigned short)i & 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
|
short n = bdev_write(dev, 0x010000, test_block_1, 512);
|
||||||
|
if (n != 512) {
|
||||||
|
print(screen, "Could not write block.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
n = bdev_read(dev, 0x010000, test_block_2, 512);
|
||||||
|
if (n != 512) {
|
||||||
|
print(screen, "Could not read block.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < 512; i++) {
|
||||||
|
if (test_block_1[i] != test_block_2[i]) {
|
||||||
|
print(screen, "Block did not verify.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print(screen, "BDEV read/write success.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char * argv[]) {
|
int main(int argc, char * argv[]) {
|
||||||
|
@ -360,8 +402,8 @@ int main(int argc, char * argv[]) {
|
||||||
|
|
||||||
initialize();
|
initialize();
|
||||||
|
|
||||||
print(CDEV_CONSOLE, "Foenix/MCP\n\nText Channel A\n");
|
print(CDEV_CONSOLE, "Text Channel A\n");
|
||||||
print(CDEV_EVID, "Foenix/MCP\n\nText Channel B\n");
|
print(CDEV_EVID, "Text Channel B\n");
|
||||||
|
|
||||||
// uart_test_send(0);
|
// uart_test_send(0);
|
||||||
|
|
||||||
|
@ -369,14 +411,17 @@ int main(int argc, char * argv[]) {
|
||||||
int_register(0x00, int_sof_a);
|
int_register(0x00, int_sof_a);
|
||||||
int_enable(0x00);
|
int_enable(0x00);
|
||||||
|
|
||||||
// dos_cmd_dir(0, "2:");
|
// uart_init(0);
|
||||||
|
// uart_test_send(0);
|
||||||
|
|
||||||
// while (1) {
|
// test_get_mbr(0, BDEV_SDC);
|
||||||
// text_set_xy(0, 40, 0);
|
// try_write(0, "0:");
|
||||||
// print_hex_16(0, g_sof_counter);
|
// dos_cmd_dir(0, "0:");
|
||||||
// }
|
// try_mo(0);
|
||||||
|
// try_mo_scancodes(0);
|
||||||
|
// try_bdev_getput(0, BDEV_SDC);
|
||||||
|
|
||||||
try_mo(0);
|
cli_repl(0);
|
||||||
|
|
||||||
DEBUG("Stopping.");
|
DEBUG("Stopping.");
|
||||||
|
|
||||||
|
|
2652
src/foenixmcp.s68
2652
src/foenixmcp.s68
File diff suppressed because it is too large
Load diff
|
@ -79,4 +79,66 @@
|
||||||
*/
|
*/
|
||||||
extern int32_t syscall(int32_t function, ...);
|
extern int32_t syscall(int32_t function, ...);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read a single byte from the channel
|
||||||
|
*
|
||||||
|
* Inputs:
|
||||||
|
* channel = the number of the channel
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* the value read (if negative, error)
|
||||||
|
*/
|
||||||
|
extern short sys_chan_read_b(short channel);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read bytes from the channel
|
||||||
|
*
|
||||||
|
* Inputs:
|
||||||
|
* channel = the number of the channel
|
||||||
|
* buffer = the buffer into which to copy the channel data
|
||||||
|
* size = the size of the buffer.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* number of bytes read, any negative number is an error code
|
||||||
|
*/
|
||||||
|
extern short sys_chan_read(short channel, unsigned char * buffer, short size);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read a line of text from the channel
|
||||||
|
*
|
||||||
|
* Inputs:
|
||||||
|
* channel = the number of the channel
|
||||||
|
* buffer = the buffer into which to copy the channel data
|
||||||
|
* size = the size of the buffer
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* number of bytes read, any negative number is an error code
|
||||||
|
*/
|
||||||
|
extern short sys_chan_readline(short channel, unsigned char * buffer, short size);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write a single byte to the device
|
||||||
|
*
|
||||||
|
* Inputs:
|
||||||
|
* channel = the number of the channel
|
||||||
|
* b = the byte to write
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* 0 on success, a negative value on error
|
||||||
|
*/
|
||||||
|
extern short sys_chan_write_b(short channel, unsigned char b);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write a byte to the channel
|
||||||
|
*
|
||||||
|
* Inputs:
|
||||||
|
* channel = the number of the channel
|
||||||
|
* b = the byte to write
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* number of bytes written, any negative number is an error code
|
||||||
|
*/
|
||||||
|
extern short sys_chan_write(short channel, unsigned char * buffer, short size);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,10 +3,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "interrupt.h"
|
#include "interrupt.h"
|
||||||
|
#include "dev/text_screen_iii.h"
|
||||||
|
|
||||||
#define MAX_HANDLERS 48
|
#define MAX_HANDLERS 48
|
||||||
|
|
||||||
static p_int_handler g_int_handler[MAX_HANDLERS];
|
p_int_handler g_int_handler[MAX_HANDLERS];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the group number for the interrupt number
|
* Return the group number for the interrupt number
|
||||||
|
@ -62,9 +63,10 @@ void int_disable(unsigned short n) {
|
||||||
|
|
||||||
/* Find the mask for the interrupt */
|
/* Find the mask for the interrupt */
|
||||||
unsigned short mask = int_mask(n);
|
unsigned short mask = int_mask(n);
|
||||||
|
unsigned short new_mask = MASK_GRP0[group] | mask;
|
||||||
|
|
||||||
/* Set the mask bit for the interrupt in the correct MASK register */
|
/* Set the mask bit for the interrupt in the correct MASK register */
|
||||||
MASK_GRP0[group] |= mask;
|
MASK_GRP0[group] = new_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -83,9 +85,10 @@ void int_enable(unsigned short n) {
|
||||||
|
|
||||||
/* Find the mask for the interrupt */
|
/* Find the mask for the interrupt */
|
||||||
unsigned short mask = int_mask(n);
|
unsigned short mask = int_mask(n);
|
||||||
|
unsigned short new_mask = MASK_GRP0[group] & ~mask;
|
||||||
|
|
||||||
/* Clear the mask bit for the interrupt in the correct MASK register */
|
/* Clear the mask bit for the interrupt in the correct MASK register */
|
||||||
MASK_GRP0[group] &= ~mask;
|
MASK_GRP0[group] = new_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -134,15 +137,16 @@ short int_pending(unsigned short n) {
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* n = the number of the interrupt: n[7..4] = group number, n[3..0] = individual number.
|
* n = the number of the interrupt: n[7..4] = group number, n[3..0] = individual number.
|
||||||
*/
|
*/
|
||||||
void int_ack(unsigned short n) {
|
void int_clear(unsigned short n) {
|
||||||
/* Find the group (the relevant interrupt mask register) for the interrupt */
|
/* Find the group (the relevant interrupt mask register) for the interrupt */
|
||||||
unsigned short group = int_group(n);
|
unsigned short group = int_group(n);
|
||||||
|
|
||||||
/* Find the mask for the interrupt */
|
/* Find the mask for the interrupt */
|
||||||
unsigned short mask = int_mask(n);
|
unsigned short mask = int_mask(n);
|
||||||
|
unsigned short new_mask = PENDING_GRP0[group] | mask;
|
||||||
|
|
||||||
/* Set the mask bit for the interrupt in the correct MASK register */
|
/* Set the bit for the interrupt to mark it as cleared */
|
||||||
PENDING_GRP0[group] |= mask;
|
PENDING_GRP0[group] = new_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -162,7 +166,7 @@ void int_vicky_channel_a() {
|
||||||
handler();
|
handler();
|
||||||
|
|
||||||
/* And acknowledge the interrupt */
|
/* And acknowledge the interrupt */
|
||||||
int_ack(n);
|
int_clear(n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +193,7 @@ void int_vicky_channel_b() {
|
||||||
handler();
|
handler();
|
||||||
|
|
||||||
/* And acknowledge the interrupt */
|
/* And acknowledge the interrupt */
|
||||||
int_ack(n);
|
int_clear(n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,6 +107,61 @@ typedef void (*p_int_handler)();
|
||||||
#define RESERVED8 0x4000 // No Interrupt - Reserved
|
#define RESERVED8 0x4000 // No Interrupt - Reserved
|
||||||
#define DAC0_PB_INT2F 0x8000 // DAC0 Playback Done Interrupt (44.1K)
|
#define DAC0_PB_INT2F 0x8000 // DAC0 Playback Done Interrupt (44.1K)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define standard interrupt numbers to be used for enabling, disabling an interrupt or setting its handler
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define INT_SOF_A 0x00 /* Vicky Channel A Start of Frame */
|
||||||
|
#define INT_SOL_A 0x01 /* Vicky Channel A Start of Line */
|
||||||
|
#define INT_VICKY_A_1 0x02
|
||||||
|
#define INT_VICKY_A_2 0x03
|
||||||
|
#define INT_VICKY_A_3 0x04
|
||||||
|
#define INT_VICKY_A_4 0x05
|
||||||
|
#define INT_RESERVED_1 0x06
|
||||||
|
#define INT_VICKY_A_DAC 0x07
|
||||||
|
#define INT_SOF_B 0x08 /* Vicky Channel B Start of Frame */
|
||||||
|
#define INT_SOL_B 0x09 /* Vicky Channel B Start of Line */
|
||||||
|
#define INT_VICKY_B_1 0x0A
|
||||||
|
#define INT_VICKY_B_2 0x0B
|
||||||
|
#define INT_VICKY_B_3 0x0C
|
||||||
|
#define INT_VICKY_B_4 0x0D
|
||||||
|
#define INT_RESERVED_2 0x0E
|
||||||
|
#define INT_VICKY_B_DAC 0x0F
|
||||||
|
|
||||||
|
#define INT_KBD_PS2 0x10 /* SuperIO - PS/2 Keyboard */
|
||||||
|
#define INT_KBD_A2560K 0x11 /* SuperIO - A2560K Built in keyboard (Mo) */
|
||||||
|
#define INT_MOUSE 0x12 /* SuperIO - PS/2 Mouse */
|
||||||
|
#define INT_COM1 0x13 /* SuperIO - COM1 */
|
||||||
|
#define INT_COM2 0x14 /* SuperIO - COM2 */
|
||||||
|
#define INT_LPT1 0x15 /* SuperIO - LPT1 */
|
||||||
|
#define INT_FDC 0x16 /* SuperIO - Floppy Drive Controller */
|
||||||
|
#define INT_MIDI 0x17 /* SuperIO - MIDI */
|
||||||
|
#define INT_TIMER0 0x18 /* Timer 0, Clocked with the CPU Clock */
|
||||||
|
#define INT_TIMER1 0x19 /* Timer 1, Clocked with the CPU Clock */
|
||||||
|
#define INT_TIMER2 0x1A /* Timer 2, Clocked with the CPU Clock */
|
||||||
|
#define INT_TIMER3 0x1B /* Timer 3, Clocked with the SOF Channel A */
|
||||||
|
#define INT_TIMER4 0x1C /* Timer 4, Clocked with the SOF Channel B */
|
||||||
|
#define INT_RESERVED_3 0x1D /* Reserved */
|
||||||
|
#define INT_RESERVED_4 0x1E /* Reserved */
|
||||||
|
#define INT_RTC 0x1F /* Real Time Clock */
|
||||||
|
|
||||||
|
#define INT_PATA 0x20 /* IDE/PATA Hard drive interrupt */
|
||||||
|
#define INT_SDC_INS 0x21 /* SD card inserted */
|
||||||
|
#define INT_SDC 0x22 /* SD card controller */
|
||||||
|
#define INT_OPM_INT 0x23 /* Internal OPM */
|
||||||
|
#define INT_OPN2_EXT 0x24 /* External OPN */
|
||||||
|
#define INT_OPL3_EXT 0x25 /* External OPL */
|
||||||
|
#define INT_RESERVED_5 0x26 /* Reserved */
|
||||||
|
#define INT_RESERVED_6 0x27 /* Reserved */
|
||||||
|
#define INT_BEATRIX_0 0x28 /* Beatrix 0 */
|
||||||
|
#define INT_BEATRIX_1 0x29 /* Beatrix 1 */
|
||||||
|
#define INT_BEATRIX_2 0x2A /* Beatrix 2 */
|
||||||
|
#define INT_BEATRIX_3 0x2B /* Beatrix 3 */
|
||||||
|
#define INT_RESERVED_7 0x2C /* Reserved */
|
||||||
|
#define INT_DAC1_PB 0x2D /* DAC1 Playback Done (48K) */
|
||||||
|
#define INT_RESERVED_8 0x2E /* Reserved */
|
||||||
|
#define INT_DAC0_PB 0x2F /* DAC0 Playback Done (44.1K) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the interrupt registers
|
* Initialize the interrupt registers
|
||||||
*/
|
*/
|
||||||
|
@ -171,6 +226,6 @@ extern short int_pending(unsigned short n);
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* n = the number of the interrupt: n[7..4] = group number, n[3..0] = individual number.
|
* n = the number of the interrupt: n[7..4] = group number, n[3..0] = individual number.
|
||||||
*/
|
*/
|
||||||
extern void int_ack(unsigned short n);
|
extern void int_clear(unsigned short n);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,3 +16,10 @@ void DEBUG(char * message) {
|
||||||
}
|
}
|
||||||
text_put_raw(0, '\n');
|
text_put_raw(0, '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Send a single character to the debugging channel
|
||||||
|
*/
|
||||||
|
void logc(c) {
|
||||||
|
text_put_raw(0, c);
|
||||||
|
}
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
*/
|
*/
|
||||||
extern void DEBUG(char * message);
|
extern void DEBUG(char * message);
|
||||||
|
|
||||||
#define TRACE(msg) DEBUG(msg);
|
extern void logc(char c);
|
||||||
|
|
||||||
|
#define TRACE(msg) /*DEBUG(msg);*/
|
||||||
|
|
||||||
|
#define TRACEC(c) logc(c);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,8 +20,18 @@ int32_t syscall_dispatch(int32_t function, int32_t param0, int32_t param1, int32
|
||||||
case KFN_CHAN_WRITE:
|
case KFN_CHAN_WRITE:
|
||||||
return chan_write((short)param0, (const uint8_t *)param1, (short)param2);
|
return chan_write((short)param0, (const uint8_t *)param1, (short)param2);
|
||||||
|
|
||||||
|
case KFN_CHAN_READ_B:
|
||||||
|
return chan_read_b((short)param0);
|
||||||
|
|
||||||
|
case KFN_CHAN_READ:
|
||||||
|
return chan_read((short)param0, (const uint8_t *)param1, (short)param2);
|
||||||
|
|
||||||
|
case KFN_CHAN_READ_LINE:
|
||||||
|
return chan_readline((short)param0, (const uint8_t *)param1, (short)param2);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DEBUG("syscall unknown function\n");
|
DEBUG("syscall unknown function\n");
|
||||||
|
do {} while (1);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,55 @@
|
||||||
dc.l h_trap_13 ; 45 - TRAP #13
|
dc.l h_trap_13 ; 45 - TRAP #13
|
||||||
dc.l not_impl ; 46 - TRAP #14
|
dc.l not_impl ; 46 - TRAP #14
|
||||||
dc.l not_impl ; 47 - TRAP #15
|
dc.l not_impl ; 47 - TRAP #15
|
||||||
|
dc.l not_impl ; 48 - Reserved
|
||||||
|
dc.l not_impl ; 49 - Reserved
|
||||||
|
dc.l not_impl ; 50 - Reserved
|
||||||
|
dc.l not_impl ; 51 - Reserved
|
||||||
|
dc.l not_impl ; 52 - Reserved
|
||||||
|
dc.l not_impl ; 53 - Reserved
|
||||||
|
dc.l not_impl ; 54 - Reserved
|
||||||
|
dc.l not_impl ; 55 - Reserved
|
||||||
|
dc.l not_impl ; 56 - Reserved
|
||||||
|
dc.l not_impl ; 57 - Reserved
|
||||||
|
dc.l not_impl ; 58 - Reserved
|
||||||
|
dc.l not_impl ; 59 - Reserved
|
||||||
|
dc.l not_impl ; 60 - Reserved
|
||||||
|
dc.l not_impl ; 61 - Reserved
|
||||||
|
dc.l not_impl ; 62 - Reserved
|
||||||
|
dc.l not_impl ; 63 - Reserved
|
||||||
|
dc.l interrupt_x10 ; 64 - Interrupt 0x10 - SuperIO - PS/2 Keyboard
|
||||||
|
dc.l interrupt_x11 ; 65 - Interrupt 0x11 - A2560K Built-in Keyboard (Mo)
|
||||||
|
; dc.l interrupt_x12 ; 66 - Interrupt 0x12 - SuperIO - PS/2 Mouse
|
||||||
|
; dc.l interrupt_x13 ; 67 - Interrupt 0x13 - SuperIO - COM1
|
||||||
|
; dc.l interrupt_x14 ; 68 - Interrupt 0x14 - SuperIO - COM2
|
||||||
|
; dc.l interrupt_x15 ; 69 - Interrupt 0x15 - SuperIO - LPT1
|
||||||
|
; dc.l interrupt_x16 ; 70 - Interrupt 0x16 - SuperIO - Floppy Disk Controller
|
||||||
|
; dc.l interrupt_x17 ; 71 - Interrupt 0x17 - SuperIO - MIDI
|
||||||
|
; dc.l interrupt_x18 ; 72 - Interrupt 0x18 - Timer 0
|
||||||
|
; dc.l interrupt_x19 ; 73 - Interrupt 0x19 - Timer 1
|
||||||
|
; dc.l interrupt_x1A ; 74 - Interrupt 0x1A - Timer 2
|
||||||
|
; dc.l interrupt_x1B ; 76 - Interrupt 0x1B - Timer 3
|
||||||
|
; dc.l interrupt_x1C ; 75 - Interrupt 0x1C - Timer 4
|
||||||
|
; dc.l not_impl ; 77 - Interrupt 0x1D - Reserved
|
||||||
|
; dc.l not_impl ; 78 - Interrupt 0x1E - Reserved
|
||||||
|
; dc.l interrupt_x1F ; 79 - Interrupt 0x1F - Real Time Clock
|
||||||
|
|
||||||
|
; dc.l interrupt_x20 ; 80 - Interrupt 0x20 - IDE HDD Generated Interrupt
|
||||||
|
; dc.l interrupt_x21 ; 81 - Interrupt 0x21 - SDCard Insert
|
||||||
|
; dc.l interrupt_x22 ; 82 - Interrupt 0x22 - SDCard Controller
|
||||||
|
; dc.l interrupt_x23 ; 83 - Interrupt 0x23 - Internal OPM
|
||||||
|
; dc.l interrupt_x24 ; 84 - Interrupt 0x24 - External OPN2
|
||||||
|
; dc.l interrupt_x25 ; 85 - Interrupt 0x25 - External OPL3
|
||||||
|
; dc.l interrupt_x26 ; 86 - Interrupt 0x26 - Reserved
|
||||||
|
; dc.l interrupt_x27 ; 87 - Interrupt 0x27 - Reserved
|
||||||
|
; dc.l interrupt_x28 ; 88 - Interrupt 0x28 - Beatrix Interrupt 0
|
||||||
|
; dc.l interrupt_x29 ; 89 - Interrupt 0x29 - Beatrix Interrupt 1
|
||||||
|
; dc.l interrupt_x2A ; 90 - Interrupt 0x2A - Beatrix Interrupt 2
|
||||||
|
; dc.l interrupt_x2B ; 91 - Interrupt 0x2B - Beatrix Interrupt 3
|
||||||
|
; dc.l interrupt_x2C ; 92 - Interrupt 0x2C - Reserved
|
||||||
|
; dc.l interrupt_x2D ; 93 - Interrupt 0x2D - DAC1 Playback Done Interrupt (48K)
|
||||||
|
; dc.l interrupt_x2E ; 94 - Interrupt 0x2E - Reserved
|
||||||
|
; dc.l interrupt_x2F ; 95 - Interrupt 0x2F - DAC0 Playback Done Interrupt (44.1K)
|
||||||
|
|
||||||
; TODO: make room for reserved and User Interrupt Vectors
|
; TODO: make room for reserved and User Interrupt Vectors
|
||||||
|
|
||||||
|
@ -89,6 +138,51 @@ autovec1: movem.l d0-d7/a0-a6,-(a7)
|
||||||
movem.l (a7)+,d0-d7/a0-a6
|
movem.l (a7)+,d0-d7/a0-a6
|
||||||
rte
|
rte
|
||||||
|
|
||||||
|
;
|
||||||
|
; Interrupt Vector 0x10 -- SuperIO Keyboard
|
||||||
|
;
|
||||||
|
interrupt_x10:
|
||||||
|
movem.l d0-d7/a0-a6,-(a7) ; Save all the registers
|
||||||
|
;lea _g_int_handler,a0 ; Look in the interrupt handler table
|
||||||
|
;move.w #($10<<2),d0 ; Offset to interrupt #16
|
||||||
|
;movea.l (0,a0,d0),a1 ; Get the address of the handler
|
||||||
|
;beq done_intx10 ; If there isn't one, just return
|
||||||
|
|
||||||
|
; moveq #0,d2
|
||||||
|
; moveq #'!',d3
|
||||||
|
; moveq #$14,d1
|
||||||
|
; trap #13
|
||||||
|
|
||||||
|
jsr _kbd_handle_irq ; If there is, call it.
|
||||||
|
|
||||||
|
done_intx10 movem.l (a7)+,d0-d7/a0-a6 ; Restore the registers
|
||||||
|
rte
|
||||||
|
|
||||||
|
;
|
||||||
|
; Interrupt Vector 0x11 -- SuperIO Keyboard
|
||||||
|
;
|
||||||
|
interrupt_x11:
|
||||||
|
movem.l d0-d7/a0-a6,-(a7) ; Save all the registers
|
||||||
|
; ; lea _g_int_handler,a0 ; Look in the interrupt handler table
|
||||||
|
; ; move.w #($11<<2),d0 ; Offset to interrupt #16
|
||||||
|
; ; movea.l (0,a0,d0),a1 ; Get the address of the handler
|
||||||
|
; ; beq done_intx10 ; If there isn't one, just return
|
||||||
|
;
|
||||||
|
; moveq #0,d2
|
||||||
|
; moveq #'@',d3
|
||||||
|
; moveq #$14,d1
|
||||||
|
; trap #13
|
||||||
|
;
|
||||||
|
; ; jsr (a1) ; If there is, call it.
|
||||||
|
|
||||||
|
; moveq #0,d2
|
||||||
|
; moveq #'!',d3
|
||||||
|
; moveq #$14,d1
|
||||||
|
; trap #13
|
||||||
|
|
||||||
|
done_intx11 movem.l (a7)+,d0-d7/a0-a6 ; Restore the registers
|
||||||
|
rte
|
||||||
|
|
||||||
;
|
;
|
||||||
; Autovector #1: Used by VICKY III Channel A interrupts
|
; Autovector #1: Used by VICKY III Channel A interrupts
|
||||||
;
|
;
|
||||||
|
|
6747
src/mapfile
6747
src/mapfile
File diff suppressed because it is too large
Load diff
73
src/syscalls.c
Normal file
73
src/syscalls.c
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
#include "syscalls.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read a single byte from the channel
|
||||||
|
*
|
||||||
|
* Inputs:
|
||||||
|
* channel = the number of the channel
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* the value read (if negative, error)
|
||||||
|
*/
|
||||||
|
short sys_chan_read_b(short channel) {
|
||||||
|
return syscall(KFN_CHAN_READ_B, channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read bytes from the channel
|
||||||
|
*
|
||||||
|
* Inputs:
|
||||||
|
* channel = the number of the channel
|
||||||
|
* buffer = the buffer into which to copy the channel data
|
||||||
|
* size = the size of the buffer.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* number of bytes read, any negative number is an error code
|
||||||
|
*/
|
||||||
|
short sys_chan_read(short channel, unsigned char * buffer, short size) {
|
||||||
|
return syscall(KFN_CHAN_READ, channel, buffer, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read a line of text from the channel
|
||||||
|
*
|
||||||
|
* Inputs:
|
||||||
|
* channel = the number of the channel
|
||||||
|
* buffer = the buffer into which to copy the channel data
|
||||||
|
* size = the size of the buffer
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* number of bytes read, any negative number is an error code
|
||||||
|
*/
|
||||||
|
short sys_chan_readline(short channel, unsigned char * buffer, short size) {
|
||||||
|
return syscall(KFN_CHAN_READ_LINE, channel, buffer, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write a single byte to the device
|
||||||
|
*
|
||||||
|
* Inputs:
|
||||||
|
* channel = the number of the channel
|
||||||
|
* b = the byte to write
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* 0 on success, a negative value on error
|
||||||
|
*/
|
||||||
|
short sys_chan_write_b(short channel, unsigned char b) {
|
||||||
|
return syscall(KFN_CHAN_WRITE_B, channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write a byte to the channel
|
||||||
|
*
|
||||||
|
* Inputs:
|
||||||
|
* channel = the number of the channel
|
||||||
|
* b = the byte to write
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* number of bytes written, any negative number is an error code
|
||||||
|
*/
|
||||||
|
short sys_chan_write(short channel, unsigned char * buffer, short size) {
|
||||||
|
return syscall(KFN_CHAN_WRITE, channel, buffer, size);
|
||||||
|
}
|
Loading…
Reference in a new issue