Add test for copying test memory, use the #defines in cli.c so it doesn't crash, reduce default log level, remove logging of all system function calls.

This commit is contained in:
Vincent Barrilliot 2022-06-12 15:45:33 +02:00
parent 462b05d634
commit 528e7fbc0d
7 changed files with 113 additions and 17 deletions

View file

@ -56,8 +56,8 @@
#define CLI_KEY_HELP 0x8012 /* A2560K Menu/Help key */
// DEBUG: if I uncomment this then I get a crash
//#define sys_txt_get_region txt_get_region
//#define sys_txt_set_region txt_set_region
#define sys_txt_get_region txt_get_region
#define sys_txt_set_region txt_set_region
//
// Types

View file

@ -774,6 +774,85 @@ short cmd_test_ansi(short screen, int argc, const char * argv[]) {
return 0;
}
static short cli_test_textscroll (short screen, int argc, const char * argv[]) {
int i;
char c;
char *scr;
short *swrw;
char *dst;
if (argc != 2) {
printf("Copy size missing!");
return 0;
}
#if MODEL == MODEL_FOENIX_A2560K
switch (screen)
case TXT_SCREEN_A2560K_A:
scr = (char*)ScreenText_A;
break:
case TXT_SCREEN_A2560K_B:
scr = (char*)ScreenText_B;
break;
default:
// How would we even get here ??
return 0;
end;
#elif MODEL == MODEL_FOENIX_A2560U || MODEL == MODEL_FOENIX_A2560U_PLUS
scr = (short*)ScreenText_A;
#endif
// Fill screen byte by byte
const int line_length = 640/8; // # chars on a line
const int full_screen_size= line_length*480/8;
unsigned long jiffies = sys_time_jiffies() + 60*3;
if (strcmp("word", argv[1]) == 0) {
short *dstw;
char w[2];
// Fill using words
for (i=0, dstw=(short*)scr; i<full_screen_size/2; i++) {
if (w[0] > 'Y' || (i % (line_length/2)) == 0) {
w[0] = 'A';
w[1] = 'B';
}
*dstw++ = *((short*)&w);
w[0] += 2;
w[1] += 2;
}
// Wait a bit
while (sys_time_jiffies() < jiffies);
for (i=0, dstw = (short*)scr; i<(full_screen_size-line_length)/2; i++) {
*dstw = dstw[1];
dstw++;
}
}
else if (strcmp("byte", argv[1]) == 0) {
// Fill using bytes
for (i=0, dst=scr; i<full_screen_size; i++) {
if (c > 'Z' || (i % line_length) == 0)
c = 'A';
*dst++ = c++;
}
// Wait a bit
while (sys_time_jiffies() < jiffies);
for (i=0, dst = scr; i<full_screen_size-line_length; i++) {
*dst = dst[1];
dst++;
}
}
else
print(screen, "Unrecognized option!");
return 0;
}
const t_cli_test_feature cli_test_features[] = {
{"ANSI", "ANSI: test the ANSI escape codes", cmd_test_ansi},
{"BITMAP", "BITMAP: test the bitmap screen", cli_test_bitmap},
@ -802,6 +881,7 @@ const t_cli_test_feature cli_test_features[] = {
{"SID", "SID [EXT|INT]: test the SID sound chips", sid_test},
#endif
{"UART","UART [1|2]: test the serial port",cli_test_uart},
{"TEXTSCROLL", "TEXTSCROLL [byte|word]: fills the text memory with A..Z then scroll one char to the left", cli_test_textscroll},
{"END", "END", 0}
};

View file

@ -344,7 +344,7 @@ static short txt_a2560u_set_region(const p_rect region) {
char msg[80];
sprintf(msg,"SET REGION %p x:%d, y:%d, w:%d, h:%d (visible:%d,%d)",
region, region->origin.x, region->origin.y, region->size.width, region->size.height, a2560u_visible_size.width, a2560u_visible_size.height);
//DEBUG(msg);
DEBUG(msg);
if ((region->size.width == 0) || (region->size.height == 0)) {
/* Set the region to the default (full screen) */
@ -504,7 +504,6 @@ static void txt_a2560u_scroll(short horizontal, short vertical) {
}
#endif
/* Clear the rectangles */
if (horizontal != 0) {
for (y = y0; y != y3; y += dy) {
int row_dst = y * a2560u_max_size.width;

View file

@ -5,7 +5,7 @@
#ifndef __VICKYIII_General_H
#define __VICKYIII_General_H
#define VKY3_LUT_SIZE 16
#define VKY3_TEXT_LUT_SIZE 16
#define VKY3_TEXT_LUT_FG ((volatile unsigned long *)0x00B6C400) /**< Text foreground color look up table */
#define VKY3_TEXT_LUT_BG ((volatile unsigned long *)0x00B6C440) /**< Text background color look up table */

View file

@ -20,7 +20,7 @@
* Settings
*/
#ifndef DEFAULT_LOG_LEVEL
#define DEFAULT_LOG_LEVEL LOG_TRACE
#define DEFAULT_LOG_LEVEL LOG_DEBUG
#endif
#ifndef LOG_CHANNEL

View file

@ -1,9 +1,11 @@
/**
* Implementation of 68000 specific syscall routines.
*
* NOTE: these routines are not called directly but are instead called through TRAP#13
* NOTE: these routines are not called directly but are instead called through TRAP#15
*/
// #define KDEBUG
#include "log.h"
#include "types.h"
#include "syscalls.h"
@ -21,11 +23,17 @@
#else
#include "dev/ps2.h"
#endif
#include <stdio.h>
/*
* Determine the correct system function implementation and call it.
*/
unsigned long syscall_dispatch(int32_t function, int32_t param0, int32_t param1, int32_t param2, int32_t param3, int32_t param4, int32_t param5) {
#ifdef KDEBUG
char buf[80];
sprintf(buf,"fn:0x%04x d1:%04x d2:0x%04x d3:0x%04x", (int)function, (int)param0, (int)param1, (int)param2);
DEBUG(buf);
#endif
switch (function & 0x00f0) {
case 0x00:
/* Core System Calls */
@ -306,21 +314,30 @@ unsigned long syscall_dispatch(int32_t function, int32_t param0, int32_t param1,
return 0;
case KFN_TXT_SET_REGION:
#ifdef KDEBUG
{
char buf[60];
sprintf(buf, "KFN_TXT_SET_REGION: %d %p", (short)param0, (p_rect)param1);
short ret;
sprintf(buf, "KFN_TXT_SET_REGION: %d %p", param0, (p_rect)param1);
DEBUG(buf);
ret = txt_set_region((short)param0, (p_rect)param1);
sprintf(buf, "KFN_TXT_SET_REGION returning");
DEBUG(buf);
/* Sets the clipping/scrolling region for further text operations */
return ret;
}
/* Sets the clipping/scrolling region for further text operations */
#else
return txt_set_region((short)param0, (p_rect)param1);
#endif
case KFN_TXT_GET_REGION:
#ifdef KDEBUG
/* Gets the current clipping/scrolling region */
{
char buf[60];
sprintf(buf, "KFN_TXT_GET_REGION: %d %p", (short)param0, (p_rect)param1);
DEBUG(buf);
}
#endif
return txt_get_region((short)param0, (p_rect)param1);
case KFN_TXT_SET_COLOR:

View file

@ -358,7 +358,7 @@ _syscall:
move.l (44,sp),d3 ; Parameter 2 to D3
move.l (40,sp),d2 ; Parameter 1 to D2
move.l (36,sp),d1 ; Parameter 0 to D1
move.l (32,sp),d0 ; Function number to D0
move.l (32,sp),d0 ; Function number to D0 (32 = 4(PC)+7(regs)*4)
TRAP #15 ; Call into the kernel
@ -383,7 +383,7 @@ h_trap_15:
jsr _syscall_dispatch ; Call the C routine to do the dispatch
; Note: the C routine depends upon the register push order
add.l #28,sp ; Remove parameters from the stack
adda.l #7*4,sp ; Remove parameters from the stack
rte ; Return to the caller
h_trap_elev ori #$2000,(a7) ; Change the caller's privilege to supervisor