Post Merge Cleanup

This commit is contained in:
Peter Weingartner 2021-10-25 19:14:57 -04:00
parent 564e1dab85
commit fa2cbf366d
20 changed files with 8257 additions and 9177 deletions

View file

@ -119,21 +119,25 @@ short cmd_testrtc(short channel, int argc, char * argv[]) {
char buffer[80];
char * spinner = "|/-\\";
short count = 0;
long ticks;
*RTC_RATES = 0x0e; /* Periodic interrupt rate: 250 ms */
*RTC_ENABLES = RTC_PIE; /* Turn on the periodic interrupt */
int_enable(INT_RTC);
*RTC_RATES = 0xfe; /* Periodic interrupt rate: 0.5 s */
*RTC_ENABLES = RTC_PIE; /* Turn on the periodic interrupt */
ticks = rtc_get_ticks();
sprintf(buffer, "Waiting for updated ticks starting from %d\n", ticks);
sys_chan_write(channel, buffer, strlen(buffer));
while (1) {
if (*RTC_FLAGS & RTC_PF) {
if (ticks < rtc_get_ticks()) {
/* We got the periodic interrupt */
ScreenText_A[0] = spinner[count];
ColorText_A[0] = 0x14;
sprintf(buffer, "Tick! %d\n", ticks);
sys_chan_write(channel, buffer, strlen(buffer));
if (count++ >= strlen(spinner) - 1) {
count = 0;
}
ticks = rtc_get_ticks();
}
}
}

View file

@ -11,6 +11,7 @@
* Play a sound on the PSG
*/
short psg_test(short channel, int argc, char * argv[]) {
int i;
long target_time;
psg_tone(0, 34923);
@ -22,12 +23,16 @@ short psg_test(short channel, int argc, char * argv[]) {
psg_tone(1, 44000);
psg_attenuation(1, 0);
for (i = 0; i < 10000; i++) ;
target_time = timers_jiffies() + 20;
while (target_time > timers_jiffies()) ;
psg_tone(2, 52325);
psg_attenuation(2, 0);
for (i = 0; i < 100000; i++) ;
target_time = timers_jiffies() + 60;
while (target_time > timers_jiffies()) ;

View file

@ -420,7 +420,7 @@ short con_open(p_channel chan, uint8_t * path, short mode) {
/* Initialize the console data for this channel */
con_data = &(chan->data);
con_data->control = 0; // CON_CTRL_ANSI;
con_data->control = CON_CTRL_ANSI;
con_data->ansi_buffer_count = 0;
for (i = 0; i < ANSI_BUFFER_SIZE; i++) {
con_data->ansi_buffer[i] = 0;

View file

@ -2,6 +2,8 @@
* Definitions support low level FDC device driver
*/
#if MODEL == MODEL_FOENIX_A2560K
#include "log.h"
#include "types.h"
#include "timers.h"
@ -640,3 +642,5 @@ short fdc_ioctrl(short command, unsigned char * buffer, short size) {
return 0;
}
}
#endif

View file

@ -5,6 +5,8 @@
#ifndef __FDC_H
#define __FDC_H
#if MODEL == MODEL_FOENIX_A2560K
#include "types.h"
/*
@ -97,5 +99,6 @@ extern short fdc_flush();
*/
extern short fdc_ioctrl(short command, unsigned char * buffer, short size);
#endif
#endif

View file

@ -791,7 +791,7 @@ short ps2_mouse_get_packet() {
result = ps2_mouse_command(MOUSE_CMD_REQPACK);
if (result == -1) {
log_num(LOG_ERROR, "MOUSE_CMD_REQPACK: ", result);
log_num(LOG_INFO, "MOUSE_CMD_REQPACK: ", result);
return result;
}
@ -851,7 +851,7 @@ short mouse_init() {
result = ps2_mouse_command(MOUSE_CMD_RESET);
if (result == -1) {
log_num(LOG_ERROR, "MOUSE_CMD_RESET: ", result);
log_num(LOG_INFO, "MOUSE_CMD_RESET: ", result);
return result;
}
@ -859,7 +859,7 @@ short mouse_init() {
result = ps2_mouse_command_repeatable(MOUSE_CMD_DISABLE);
if (result != PS2_RESP_ACK) {
log_num(LOG_ERROR, "MOUSE_CMD_DISABLE: ", result);
log_num(LOG_INFO, "MOUSE_CMD_DISABLE: ", result);
return result;
}
@ -867,7 +867,7 @@ short mouse_init() {
result = ps2_mouse_command_repeatable(MOUSE_CMD_DEFAULTS);
if (result != PS2_RESP_ACK) {
log_num(LOG_ERROR, "MOUSE_CMD_DEFAULTS: ", result);
log_num(LOG_INFO, "MOUSE_CMD_DEFAULTS: ", result);
return result;
}
@ -875,13 +875,13 @@ short mouse_init() {
result = ps2_mouse_command_repeatable(MOUSE_CMD_SETRES);
if (result != PS2_RESP_ACK) {
log_num(LOG_ERROR, "MOUSE_CMD_SETRES: ", result);
log_num(LOG_INFO, "MOUSE_CMD_SETRES: ", result);
return result;
}
result = ps2_mouse_command_repeatable(0x00);
if (result != PS2_RESP_ACK) {
log_num(LOG_ERROR, "MOUSE_CMD_SETRES resolution: ", result);
log_num(LOG_INFO, "MOUSE_CMD_SETRES resolution: ", result);
return result;
}
@ -889,7 +889,7 @@ short mouse_init() {
result = ps2_mouse_command_repeatable(MOUSE_CMD_ENABLE);
if (result != PS2_RESP_ACK) {
log_num(LOG_ERROR, "MOUSE_CMD_ENABLE: ", result);
log_num(LOG_INFO, "MOUSE_CMD_ENABLE: ", result);
return result;
}
@ -988,7 +988,7 @@ short ps2_init() {
if (mouse_present) {
/* Initialize the mouse */
if (mouse_error = mouse_init()) {
log_num(LOG_ERROR, "Unable to initialize mouse", res);
log_num(LOG_INFO, "Unable to initialize mouse", res);
}
}

View file

@ -7,42 +7,23 @@
#include "gabe_reg.h"
#include "rtc.h"
#include "rtc_reg.h"
#include "simpleio.h"
static long rtc_ticks;
static long sof_ticks;
/*
* Handle SOF interrupts... these are assumed to be about 1/60 sec apart
* and will be used to drive the tick counter
*/
void sof_handle_int() {
int_clear(INT_SOF_A);
sof_ticks++;
}
/*
* Interrupt handler for the real time clock
*/
void rtc_handle_int() {
char buffer[80];
char * spinner = "|/-\\";
short count = 0;
unsigned char flags;
//flags = *RTC_FLAGS;
//if (flags | RTC_PF) {
int_clear(INT_RTC);
flags = *RTC_FLAGS;
if (flags | RTC_PF) {
/* Peridic interrupt: increment the ticks counter */
rtc_ticks++;
long ticks = rtc_ticks % 6000;
if (ticks == 3000) {
*GABE_CTRL_REG = *GABE_CTRL_REG | POWER_ON_LED;
} else if (ticks == 0){
*GABE_CTRL_REG = *GABE_CTRL_REG & ~POWER_ON_LED;
}
//}
}
}
/*
@ -53,25 +34,19 @@ void rtc_init() {
unsigned char enables;
int_disable(INT_RTC);
int_disable(INT_SOF_A);
/* Reset the ticks counter */
sof_ticks = 0;
/* Set the periodic interrupt to 976.5625 microseconds */
*RTC_RATES = 0; // RTC_RATE_976us;
/* Set the periodic interrupt to 250 ms */
*RTC_RATES = 0x0E;
/* Enable the periodic interrupt */
// *RTC_RATES = 0;
*RTC_ENABLES = 0; // RTC_PIE;
*RTC_ENABLES = RTC_PIE;
/* Make sure the RTC is on */
*RTC_CTRL = RTC_STOP;
/* Register our interrupt handler and clear out any pending interrupts */
int_register(INT_SOF_A, sof_handle_int);
int_clear(INT_SOF_A);
int_enable(INT_SOF_A);
int_register(INT_RTC, rtc_handle_int);
// int_enable(INT_RTC);
}
/*
@ -247,9 +222,5 @@ long rtc_get_jiffies() {
* the number of ticks since the last reset
*/
long rtc_get_ticks() {
long result = 0;
result = sof_ticks;
return rtc_ticks;
}

View file

@ -164,7 +164,7 @@ void initialize() {
int_init();
/* Initialize the timers */
//timers_init();
timers_init();
#if MODEL == MODEL_FOENIX_A2560K
/* Set the power LED to purple */
@ -175,7 +175,6 @@ void initialize() {
init_superio();
#endif
/* Mute the PSG */
psg_mute_all();
@ -185,8 +184,11 @@ void initialize() {
/* Initialize the SID chips */
sid_init_all();
/* Play the SID test bong on the Gideon SID implementation */
sid_test_internal();
/* Display the splash screen */
load_splashscreen();
// load_splashscreen();
cdev_init_system(); // Initialize the channel device system
log(LOG_INFO, "Channel device system ready.");
@ -201,7 +203,7 @@ void initialize() {
}
/* Initialize the real time clock */
// rtc_init();
rtc_init();
if (res = pata_install()) {
log_num(LOG_ERROR, "FAILED: PATA driver installation", res);
@ -245,7 +247,6 @@ void initialize() {
/* Enable all interrupts */
int_enable_all();
}
int main(int argc, char * argv[]) {
@ -282,18 +283,18 @@ int main(int argc, char * argv[]) {
initialize();
timers_init();
sprintf(welcome, " %s%s\n %s %s\n %s %s\n %s %s\n%s %s\n\n", color_bars, title_1, color_bars, title_2, color_bars, title_3, color_bars, title_4, color_bars, title_5);
sys_chan_write(0, welcome, strlen(welcome));
sprintf(welcome, "Foenix/MCP v%02d.%02d-alpha+%04d\n\nType \"HELP\" or \"?\" for command summary.", VER_MAJOR, VER_MINOR, VER_BUILD);
sys_chan_write(0, welcome, strlen(welcome));
#if MODEL == MODEL_FOENIX_A2560K
fdc_init();
if (fdc_ioctrl(FDC_CTRL_MOTOR_ON, 0, 0)) {
log(LOG_ERROR, "Could not turn on the floppy drive motor.");
}
#endif
cli_repl(0);

File diff suppressed because it is too large Load diff

View file

@ -5,7 +5,8 @@
#ifndef __SOUND_A2560U_H
#define __SOUND_A2560U_H
#define PSG_PORT ((volatile unsigned char *)0x00B20100) /* Control register for the SN76489 */
#define PSG_PORT ((volatile unsigned char *)0x00B20130) /* Control register for the SN76489 */
#define OPL3_PORT ((volatile unsigned char *)0x00B20200) /* Access port for the OPL3 */
#define CODEC ((volatile unsigned short *)0x00B20E00) /* Control register for the CODEC */
/*

View file

@ -15,15 +15,20 @@ void log_init() {
log_level = 999;
}
const char * exception_names[] = {
"Bus Error",
"Address Error",
"Illegal Instruction Error",
"Divide by Zero Error"
};
/*
* Display a panic screen
*
* Inputs:
* code = number indicating the type of violation
* pc = the value of the program counter at the time of the error
* address = (optional) the address of the access that caused the issue
* message = the error message to show
*/
void panic(const char * message, unsigned long pc, unsigned long address){
void panic(unsigned short exception_number) {
char buffer[80];
short column = 18;
short row = 10;
@ -50,24 +55,20 @@ void panic(const char * message, unsigned long pc, unsigned long address){
sprintf(buffer, "\xB3 \xB3");
print(0, buffer);
text_set_xy(0, column, row++);
sprintf(buffer, "\xB3 %-40s \xB3", message);
print(0, buffer);
if (exception_number < 4) {
text_set_xy(0, column, row++);
sprintf(buffer, "\xB3 #%10x \xB3", exception_number);
print(0, buffer);
} else {
text_set_xy(0, column, row++);
sprintf(buffer, "\xB3 Unknown Exception \xB3");
print(0, buffer);
}
text_set_xy(0, column, row++);
sprintf(buffer, "\xB3 \xB3");
print(0, buffer);
if (address == 0l) {
text_set_xy(0, column, row++);
sprintf(buffer, "\xB3 PC: %08X \xB3", message);
print(0, buffer);
} else {
text_set_xy(0, column, row++);
sprintf(buffer, "\xB3 PC: %08X ADDRESS: %08X \xB3", pc, address);
print(0, buffer);
}
text_set_xy(0, column, row++);
sprintf(buffer, "\xC0\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xD9");
print(0, buffer);
@ -76,6 +77,22 @@ void panic(const char * message, unsigned long pc, unsigned long address){
while (1) ;
}
__interrupt void handle_bus_err() {
panic(0);
}
__interrupt void handle_addr_err() {
panic(1);
}
__interrupt void handle_inst_err() {
panic(2);
}
__interrupt void handle_div0_err() {
panic(3);
}
/*
* Set the maximum level of verbosity in logging.
* To be printed, a message must have a level lower or equal to this level.

View file

@ -16,11 +16,9 @@
* Display a panic screen
*
* Inputs:
* message = string indicating the type of error
* pc = the value of the program counter at the time of the error
* address = (optional) the address of the access that caused the issue
* vector = the number of the vector that was called
*/
extern void panic(const char * message, unsigned long pc, unsigned long address);
extern void panic(unsigned short exception_number);
/*
* Set the maximum level of verbosity in logging.

View file

@ -1,6 +1,10 @@
xref ___main
xref _cli_rerepl
xref _panic
xref _handle_bus_err
xref _handle_addr_err
xref _handle_inst_err
xref _handle_div0_err
xdef _syscall
xdef ___exit
@ -13,13 +17,13 @@
dc.l ___STACK ; 00 - Initial stack pointer
dc.l coldboot ; 01 - Initial PC
dc.l _handle_bus ; 02 - Bus error
dc.l _handle_address ; 03 - Address error
dc.l _handle_illegal ; 04 - Illegal instruction
dc.l _handle_div0 ; 05 - Zero divide
dc.l _handle_chk ; 06 - CHK instruction
dc.l _handle_trapv ; 07 - TRAPV instruction
dc.l _handle_priv ; 08 - Priviledge error
dc.l _handle_bus_err ; 02 - Bus error
dc.l _handle_addr_err ; 03 - Address error
dc.l _handle_inst_err ; 04 - Illegal instruction
dc.l _handle_div0_err ; 05 - Zero divide
dc.l not_impl ; 06 - CHK instruction
dc.l not_impl ; 07 - TRAPV instruction
dc.l not_impl ; 08 - Priviledge error
dc.l not_impl ; 09 - Trace
dc.l not_impl ; 10 - Line 1010
dc.l not_impl ; 11 - Line 1111
@ -124,9 +128,9 @@ clrloop: clr.l (a0)+
subq.l #4,d0
bne clrloop
; Set TRAP #13 vector handler
; Set TRAP #15 vector handler
lea h_trap_15,a0 ; Address of the handler
move.l #(13+32)<<2,a1 ; TRAP#13 vector address
move.l #(13+32)<<2,a1 ; TRAP#15 vector address
move.l a0,(a1) ; Set the vector
callmain: jsr ___main ; call __main to transfer to the C code
@ -159,19 +163,19 @@ autovec2: movem.l d0-d7/a0-a6,-(a7)
;
int_dispatch:
lea _g_int_handler,a0 ; Look in the interrupt handler table
movea.l (0,a0,d0),a1 ; Get the address of the handler
move.l (0,a0,d0),d0 ; Get the address of the handler
beq intdis_end ; If there isn't one, just return
movea.l d0,a0
jsr (a0) ; If there is, call it.
jsr (a1) ; If there is, call it.
intdis_end: movem.l (a7)+,d0-d7/a0-a6 ; Restore the registers
intdis_end: movem.l (a7)+,d0/a0 ; Restore affected registers
rte
;
; Interrupt Vector 0x10 -- SuperIO Keyboard
;
interrupt_x10:
movem.l d0-d7/a0-a6,-(a7) ; Save all the registers
movem.l d0/a0,-(a7) ; Save affected registers
move.w #($10<<2),d0 ; Get the offset to interrupt 0x11
bra int_dispatch ; And process the interrupt
@ -179,7 +183,7 @@ interrupt_x10:
; Interrupt Vector 0x11 -- A2560K "Mo" keyboard
;
interrupt_x11:
movem.l d0-d7/a0-a6,-(a7) ; Save all the registers
movem.l d0/a0,-(a7) ; Save affected registers
move.w #($11<<2),d0 ; Get the offset to interrupt 0x11
bra int_dispatch ; And process the interrupt
@ -187,18 +191,15 @@ interrupt_x11:
; Interrupt Vector 0x12 -- SuperIO Mouse
;
interrupt_x12:
movem.l d0-d7/a0-a6,-(a7) ; Save all the registers
movem.l d0/a0,-(a7) ; Save affected registers
move.w #($12<<2),d0 ; Get the offset to interrupt 0x11
bra int_dispatch ; And process the interrupt
; jsr _mouse_handle_irq
; movem.l (a7)+,d0-d7/a0-a6 ; Restore the registers
; rte
;
; Interrupt Vector 0x1F -- RTC
;
interrupt_x1F:
movem.l d0-d7/a0-a6,-(a7) ; Save all the registers
movem.l d0/a0,-(a7) ; Save affected registers
move.w #($1f<<2),d0 ; Get the offset to interrupt 0x1f
bra int_dispatch ; And process the interrupt
@ -206,7 +207,7 @@ interrupt_x1F:
; Interrupt Vector 0x21 -- SDCard Insert
;
interrupt_x21:
movem.l d0-d7/a0-a6,-(a7) ; Save all the registers
movem.l d0/a0,-(a7) ; Save affected registers
move.w #($21<<2),d0 ; Get the offset to interrupt 0x1f
bra int_dispatch ; And process the interrupt
@ -284,84 +285,3 @@ _restart_cli:
lea ___STACK,sp
jsr _cli_rerepl
bra _restart_cli
;
; Handle a Bus Error by going to the panic screen
;
_handle_bus:
move.l (2,a7),a0 ; Target address in A0
move.l (10,a7),a1 ; PC in A1
lea MSG_ERR_BUS,a2
bra call_panic
;
; Handle a Address Error by going to the panic screen
;
_handle_address:
move.l (2,a7),a0 ; Target address in A0
move.l (10,a7),a1 ; PC in A1
lea MSG_ERR_ADDRESS,a2
bra call_panic
;
; Handle a Illegal Instruction Error by going to the panic screen
;
_handle_illegal:
move.l #0,a0 ; Target address is 0 in A0
move.l (10,a7),a1 ; PC in A1
lea MSG_ERR_ILLEGAL,a2
bra call_panic
;
; Handle a Divide by Zero Error by going to the panic screen
;
_handle_div0:
move.l #0,a0 ; Target address is 0 in A0
move.l (10,a7),a1 ; PC in A1
lea MSG_ERR_DIV0,a2
bra call_panic
;
; Handle a CHK Error by going to the panic screen
;
_handle_chk:
move.l #0,a0 ; Target address is 0 in A0
move.l (10,a7),a1 ; PC in A1
lea MSG_ERR_CHK,a2
bra call_panic
;
; Handle a TRAPV Error by going to the panic screen
;
_handle_trapv:
move.l #0,a0 ; Target address is 0 in A0
move.l (10,a7),a1 ; PC in A1
lea MSG_ERR_TRAPV,a2
bra call_panic
;
; Handle a Privilege Error by going to the panic screen
;
_handle_priv:
move.l #0,a0 ; Target address is 0 in A0
move.l (10,a7),a1 ; PC in A1
lea MSG_ERR_PRIV,a2
bra call_panic
call_panic:
move.l a2,-(a7)
move.l a1,-(a7)
move.l a0,-(a7)
jsr _panic
panic_loop:
bra panic_loop
data
MSG_ERR_BUS: dc.b "Bus Error"
MSG_ERR_ADDRESS: dc.b "Address Error"
MSG_ERR_ILLEGAL: dc.b "Illegal Instruction Error"
MSG_ERR_DIV0: dc.b "Divide by Zero Error"
MSG_ERR_CHK: dc.b "Range Check Error"
MSG_ERR_TRAPV: dc.b "Overflow Error"
MSG_ERR_PRIV: dc.b "Privilege Error"

11524
src/mapfile

File diff suppressed because it is too large Load diff

View file

@ -7,7 +7,7 @@ cobjects = $(subst .c,.o,$(csources))
all: $(cobjects)
%.o: %.c
$(CC) -k -c -o $@ $< $(CFLAGS) $(DEFINES)
$(CC) -c -o $@ $< $(CFLAGS) $(DEFINES)
.PHONY: clean

View file

@ -1,42 +0,0 @@
idnt "codec.c"
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
section "CODE",code
public _codec_wait
cnop 0,4
_codec_wait
movem.l l6,-(a7)
l3
l4
move.w 11668992,d0
cmp.w #32768,d0
beq l3
l5
l1
l6 reg
l8 equ 0
rts
; stacksize=0
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
public _init_codec
cnop 0,4
_init_codec
movem.l l11,-(a7)
move.w #6656,11668992
jsr _codec_wait
move.w #10783,11668992
jsr _codec_wait
move.w #8961,11668992
jsr _codec_wait
move.w #11271,11668992
jsr _codec_wait
move.w #5122,11668992
jsr _codec_wait
move.w #5634,11668992
jsr _codec_wait
move.w #6213,11668992
jsr _codec_wait
l9
l11 reg
l13 equ 0
rts
; stacksize=4

View file

@ -1,95 +0,0 @@
idnt "psg.c"
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
section "CODE",code
public _psg_mute_all
cnop 0,4
_psg_mute_all
movem.l l7,-(a7)
moveq #0,d2
bra l4
l3
move.l #15,-(a7)
move.w d2,d0
ext.l d0
move.l d0,-(a7)
jsr _psg_attenuation
addq.w #8,a7
l6
addq.w #1,d2
l4
cmp.w #3,d2
blt l3
l5
l1
l7 reg d2
movem.l (a7)+,d2
l9 equ 4
rts
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
public _psg_tone
cnop 0,4
_psg_tone
movem.l l14,-(a7)
move.l (8+l16,a7),d4
move.w (6+l16,a7),d3
cmp.w #3,d3
bcc l13
l12
move.l d4,d0
lsl.l #5,d0
move.l d0,-(a7)
move.l d0,-(a7)
move.l #357954500,-(a7)
public __ldivs
jsr __ldivs
addq.w #8,a7
move.l d0,d2
opt om-
movem.l (a7)+,d0
opt om+
move.b d3,d0
and.b #3,d0
and.w #255,d0
and.l #65535,d0
lsl.l #5,d0
or.l #128,d0
moveq #15,d1
and.l d2,d1
or.l d1,d0
move.b d0,12714240
move.w d2,d0
and.w #1008,d0
and.l #65535,d0
asr.l #4,d0
move.b d0,12714240
l13
l10
l14 reg d2/d3/d4
movem.l (a7)+,d2/d3/d4
l16 equ 12
rts
; stacksize=24
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
public _psg_attenuation
cnop 0,4
_psg_attenuation
movem.l l19,-(a7)
move.w (10+l21,a7),d3
move.w (6+l21,a7),d2
move.b d2,d0
and.b #3,d0
and.w #255,d0
and.l #65535,d0
lsl.l #5,d0
or.l #144,d0
move.w d3,d1
ext.l d1
and.l #15,d1
or.l d1,d0
move.b d0,12714240
l17
l19 reg d2/d3
movem.l (a7)+,d2/d3
l21 equ 8
rts
; stacksize=8

View file

@ -22,11 +22,14 @@ void psg_mute_all() {
*
* Inputs:
* voice = the number of the voice (0 - 2)
* frequency = the frequency
* frequency = the frequency in Hz * 100
*/
void psg_tone(unsigned short voice, int frequency) {
if (voice < 3) {
int n = 357954500 / (32 * frequency);
int n = 0;
if (frequency != 0) {
n = 357954500 / (32 * frequency);
}
*PSG_PORT = (unsigned char)(0x80 | ((voice & 0x03) << 5) | (n & 0x0f));
*PSG_PORT = (unsigned char)((n & 0x3f0) >> 4);
}

View file

@ -1,226 +0,0 @@
idnt "sid.c"
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
section "CODE",code
public _sid_get_base
cnop 0,4
_sid_get_base
movem.l l8,-(a7)
move.w (6+l10,a7),d1
move.w d1,d0
sub.w #0,d0
beq l4
subq.w #1,d0
beq l5
subq.w #1,d0
beq l6
bra l7
l4
move.l #11670528,d0
bra l1
l5
move.l #11669504,d0
bra l1
l6
move.l #11670016,d0
bra l1
l7
moveq #0,d0
l3
l1
l8 reg
l10 equ 0
rts
; stacksize=0
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
public _sid_init
cnop 0,4
_sid_init
movem.l l19,-(a7)
move.w (6+l21,a7),d3
move.w d3,d0
ext.l d0
move.l d0,-(a7)
jsr _sid_get_base
move.l d0,a2
addq.w #4,a7
move.l a2,d0
beq l14
moveq #0,d2
bra l16
l15
move.b #0,(0,a2,d2.l)
l18
addq.l #1,d2
l16
moveq #25,d0
cmp.l d2,d0
bgt l15
l17
l14
l11
l19 reg a2/d2/d3
movem.l (a7)+,a2/d2/d3
l21 equ 12
rts
; stacksize=20
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
public _sid_init_all
cnop 0,4
_sid_init_all
movem.l l28,-(a7)
moveq #0,d2
bra l25
l24
move.l d2,-(a7)
jsr _sid_init
addq.w #4,a7
l27
addq.l #1,d2
l25
moveq #5,d0
cmp.l d2,d0
bgt l24
l26
l22
l28 reg d2
movem.l (a7)+,d2
l30 equ 4
rts
; stacksize=32
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
public _sid_test_internal
cnop 0,4
_sid_test_internal
movem.l l65,-(a7)
move.b #41,11669509
move.b #41,11669516
move.b #41,11669523
move.b #41,11670021
move.b #41,11670028
move.b #41,11670035
move.b #31,11669510
move.b #31,11669517
move.b #31,11669524
move.b #31,11670022
move.b #31,11670029
move.b #31,11670036
move.b #15,11669528
move.b #15,11670040
move.b #96,11669504
move.b #22,11669505
move.b #96,11670016
move.b #22,11670017
move.b #17,11669508
move.b #17,11670020
moveq #0,d1
bra l34
l33
l36
addq.l #1,d1
l34
cmp.l #65536,d1
bcs l33
l35
move.b #49,11669511
move.b #8,11669512
move.b #49,11670023
move.b #8,11670024
move.b #17,11669515
move.b #17,11670027
moveq #0,d1
bra l38
l37
l40
addq.l #1,d1
l38
cmp.l #65536,d1
bcs l37
l39
move.b #135,11669518
move.b #33,11669519
move.b #135,11670030
move.b #33,11670031
move.b #17,11669522
move.b #17,11670034
moveq #0,d1
bra l42
l41
l44
addq.l #1,d1
l42
cmp.l #262144,d1
bcs l41
l43
move.b #16,11669508
move.b #16,11670020
moveq #0,d1
bra l46
l45
l48
addq.l #1,d1
l46
cmp.l #8192,d1
bcs l45
l47
move.b #16,11669515
move.b #16,11670027
moveq #0,d1
bra l50
l49
l52
addq.l #1,d1
l50
cmp.l #8192,d1
bcs l49
l51
move.b #16,11669515
move.b #16,11670027
moveq #0,d1
bra l54
l53
l56
addq.l #1,d1
l54
cmp.l #32768,d1
bcs l53
l55
moveq #0,d2
bra l58
l57
moveq #0,d1
bra l62
l61
l64
addq.l #1,d1
l62
cmp.l #1024,d1
bcs l61
l63
moveq #15,d0
sub.b d2,d0
move.b d0,11669528
moveq #15,d0
sub.b d2,d0
move.b d0,11670040
l60
addq.b #1,d2
l58
cmp.b #16,d2
bcs l57
l59
l31
l65 reg d2
movem.l (a7)+,d2
l67 equ 4
rts
; stacksize=4
opt o+,ol+,op+,oc+,ot+,oj+,ob+,om+
public _sid_text_external
cnop 0,4
_sid_text_external
movem.l l70,-(a7)
l68
l70 reg
l72 equ 0
rts
; stacksize=0

View file

@ -1,5 +1,6 @@
#include "interrupt.h"
#include "timers.h"
#include "gabe_reg.h"
long jiffy_count;
@ -9,7 +10,16 @@ long jiffy_count;
* NOTE: in time, this should be handled by the RTC or another timer.
*/
void sof_a_handler() {
long jc_mod;
jiffy_count++;
jc_mod = jiffy_count % 60;
if (jc_mod == 30) {
*GABE_CTRL_REG = *GABE_CTRL_REG | POWER_ON_LED;
} else if (jc_mod == 0) {
*GABE_CTRL_REG = *GABE_CTRL_REG & ~POWER_ON_LED;
}
}
/*