Skip to content

Commit 3f19528

Browse files
committed
SoftCDI naming adjustment
1 parent 877e27b commit 3f19528

File tree

8 files changed

+853
-225
lines changed

8 files changed

+853
-225
lines changed

src/CDI/OS9/Stt.cpp

Lines changed: 522 additions & 112 deletions
Large diffs are not rendered by default.

src/CDI/OS9/Stt.hpp

Lines changed: 283 additions & 80 deletions
Large diffs are not rendered by default.

src/CDI/OS9/SystemCalls.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,8 @@ std::string systemCallInputsToString(const SystemCallType call, const std::map<S
281281
case SystemCallType::I_Write: snprintf(args, 256, "d0.w=%hu d1.l=%u a0=0x%X", REG(D0), REG(D1), REG(A0)); break;
282282
case SystemCallType::I_ReadLn: snprintf(args, 256, "d0.w=%hu d1.l=%u a0=0x%X", REG(D0), REG(D1), REG(A0)); break;
283283
case SystemCallType::I_WritLn: snprintf(args, 256, "d0.w=%hu d1.l=%u a0=0x%X", REG(D0), REG(D1), REG(A0)); break;
284-
case SystemCallType::I_GetStt: snprintf(args, 256, "d0.w=%hu d1.w=%hu (%s) d2.w=%hu d3.l=%u a0=0x%X", REG(D0), REG(D1), sttFunctionToString(REG(D1)).c_str(), REG(D2), REG(D3), REG(A0)); break;
285-
case SystemCallType::I_SetStt: snprintf(args, 256, "d0.w=%hu d1.w=%hu (%s) d2.l=%u d3.w=%hu d4.l=%u a0=0x%X a1=0x%X", REG(D0), REG(D1), sttFunctionToString(REG(D1)).c_str(), REG(D2), REG(D3), REG(D4), REG(A0), REG(A1)); break;
284+
case SystemCallType::I_GetStt: snprintf(args, 256, "d0.w=%hu d1.w=%hu (%s) d2.w=%hu d3.l=%u a0=0x%X", REG(D0), REG(D1), getStatServiceRequestToString(REG(D1)).c_str(), REG(D2), REG(D3), REG(A0)); break;
285+
case SystemCallType::I_SetStt: snprintf(args, 256, "d0.w=%hu d1.w=%hu (%s) d2.l=%u d3.w=%hu d4.l=%u a0=0x%X a1=0x%X", REG(D0), REG(D1), setStatServiceRequestToString(REG(D1)).c_str(), REG(D2), REG(D3), REG(D4), REG(A0), REG(A1)); break;
286286
case SystemCallType::I_Close: snprintf(args, 256, "d0.w=%hu", REG(D0)); break;
287287
default: snprintf(args, 256, "Unknown system call %d", static_cast<int>(call));
288288
}
@@ -384,8 +384,8 @@ std::string systemCallOutputsToString(const SystemCallType call, const std::map<
384384
case SystemCallType::I_Write: snprintf(args, 256, "d1.l=%u", REG(D1)); break;
385385
case SystemCallType::I_ReadLn: snprintf(args, 256, "d1.l=%u", REG(D1)); break;
386386
case SystemCallType::I_WritLn: snprintf(args, 256, "d1.l=%u", REG(D1)); break;
387-
case SystemCallType::I_GetStt: snprintf(args, 256, "d0.l=%u d1.l=%u d2.l=%u", REG(D0), REG(D1), REG(D2)); break;
388-
case SystemCallType::I_SetStt: snprintf(args, 256, "d0.l=%u d1.l=%u d2.l=%u", REG(D0), REG(D1), REG(D2)); break;
387+
case SystemCallType::I_GetStt: snprintf(args, 256, "a0=%X a1=%X d0.l=%u d1.l=%u d2.l=%u d3.l=%u d4.l=%u", REG(A0), REG(A1), REG(D0), REG(D1), REG(D2), REG(D3), REG(D4)); break;
388+
case SystemCallType::I_SetStt: snprintf(args, 256, "a0=%X a1=%X d0.l=%u d1.l=%u d2.l=%u d3.l=%u d4.l=%u", REG(A0), REG(A1), REG(D0), REG(D1), REG(D2), REG(D3), REG(D4)); break;
389389
case SystemCallType::I_Close: return "";
390390
default: snprintf(args, 256, "Unknown system call %d", static_cast<int>(call));
391391
}

src/CDI/SoftCDI/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ See `The OS-9 guru - chapter 6` and the [OS-9 Assembler/Linker](http://icdia.co.
4949
## TODO
5050

5151
- rename sysgo to launcher
52-
- rename ciapdriv to something like cdfmdriv because I do not have a ciap
52+
- rename ciapdriv to something like cdfmdriv because I do not have a ciap, and replace the /cd dev desc
5353

5454
## Useful notes
5555

src/CDI/SoftCDI/ciapdriv.a

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ EntryTable dc.w Init
2525
* (a6) address of the system global variable storage area
2626
Init
2727
* Register IRQ handler
28-
move.b #CdfmDriver_Vector,d0 Vector number
29-
move.b #CdfmDriver_Priority,d1 priority
28+
move.b #CdDrive_Vector,d0 Vector number
29+
move.b #CdDrive_Priority,d1 priority
3030
lea Irq(pc),a0 IRQ service routine entry point
3131
* device static storage is already in a2
32-
movea.l #CdfmDriver_Port,a3 port address
32+
movea.l #CdDrive_Port,a3 port address
3333
os9 F$IRQ
3434
bcc.s _Init_IRQ_NoError
3535
moveq #0,d0
@@ -50,7 +50,7 @@ _Init_IRQ_NoError
5050
clr.l V_APMask(a5) Audio channel mask
5151
clr.b V_PlayFlag(a5) Play in progress flag
5252
clr.b V_Paused(a5) Drive paused flag
53-
move.b #CdfmDriver_Priority,V_IRQlv(a5) Hardware interrupt level
53+
move.b #CdDrive_Priority,V_IRQlv(a5) Hardware interrupt level
5454
clr.b V_ROMFlag(a5) CDROM disc flag
5555
clr.l V_SoundMap(a5) Pointer to current playing soundmap descriptor
5656
clr.w V_ASigPrc(a5) Process identifier for audio signal
@@ -69,16 +69,16 @@ Write
6969
rts
7070

7171
GetStat
72-
softcdi Ucm_GetStat
72+
softcdi CdfmDeviceDriver_GetStat
7373
rts
7474

7575
SetStat
76-
softcdi Ucm_SetStat
76+
softcdi CdfmDeviceDriver_SetStat
7777
rts
7878

7979
Term
8080
* Remove IRQ entry
81-
move.b #CdfmDriver_Vector,d0 Vector number
81+
move.b #CdDrive_Vector,d0 Vector number
8282
movea.l #0,a0 delete IRQ service routine entry point
8383
* device static storage is already in a2
8484
os9 F$IRQ
@@ -201,7 +201,7 @@ _Irq_ProcessPCL
201201
* Copy from CD drive to memory
202202
adda.l PCL_Cnt(a5),a0
203203
move.l d4,d0 Buffer size is the size of the excepted sector
204-
softcdi CdDrive_DmaSector
204+
softcdi CdDrive_CopySector
205205
move.b d6,PCL_Smode(a5)
206206
move.b d7,PCL_Type(a5)
207207
* PCB_Rec is decremented below because I need its value there

src/CDI/SoftCDI/softcdi.d

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
* SoftCDI system calls values (taken from SoftCDI.hpp)
22
SoftCDI_Debug equ $100
33
CdDrive_Play equ $101
4-
CdDrive_DmaSector equ $102
4+
CdDrive_CopySector equ $102
55
CdDrive_GetSubheader equ $103
6-
Ucm_GetStat equ $104
7-
Ucm_SetStat equ $105
6+
CdfmDeviceDriver_GetStat equ $104
7+
CdfmDeviceDriver_SetStat equ $105
88

99
* CDFM device driver useful data
10-
CdfmDriver_Vector equ 200
11-
CdfmDriver_Priority equ 32
12-
CdfmDriver_Port equ 0
10+
CdDrive_Vector equ 200
11+
CdDrive_Priority equ 32
12+
CdDrive_Port equ 0

src/CDI/boards/SoftCDIScheduler/SoftCDIScheduler.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ class SoftCDIScheduler : virtual public CDI
3434

3535
void SoftCDIDebug() noexcept;
3636
void CDDrivePlay() noexcept;
37-
void CDDriveDmaSector() noexcept;
37+
void CDDriveCopySector() noexcept;
3838
void CDDriveGetSubheader() noexcept;
39+
void CDFMDeviceDriverGetStat() noexcept;
40+
void CDFMDeviceDriverSetStat() noexcept;
3941

4042
/** \brief SoftCDI system calls.
4143
* TODO: organise this list.
@@ -45,10 +47,10 @@ class SoftCDIScheduler : virtual public CDI
4547
_Min = 0x100, /**< Minimal syscall index to not overlap with OS-9. */
4648
SoftCDI_Debug = 0x100, /**< Not stable system call that does nothing, used for debug purposes. */
4749
CdDrivePlay = 0x101,
48-
CdDriveDmaSector = 0x102,
50+
CdDriveCopySector = 0x102,
4951
CdDriveGetSubheader = 0x103,
50-
UCMGetStat = 0x104,
51-
UCMSetStat = 0x105,
52+
CdfmDeviceDriverGetStat = 0x104,
53+
CdfmDeviceDriverSetStat = 0x105,
5254
};
5355
};
5456

src/CDI/boards/SoftCDIScheduler/SystemCalls.cpp

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "SoftCDIScheduler.hpp"
22
#include "../../cores/SCC68070/SCC68070.hpp"
3+
#include "../../OS9/Stt.hpp"
34

45
#include <print>
56

@@ -17,20 +18,20 @@ void SoftCDIScheduler::DispatchSystemCall(const uint16_t syscall) noexcept
1718
CDDrivePlay();
1819
break;
1920

20-
case CdDriveDmaSector:
21-
CDDriveDmaSector();
21+
case CdDriveCopySector:
22+
CDDriveCopySector();
2223
break;
2324

2425
case CdDriveGetSubheader:
2526
CDDriveGetSubheader();
2627
break;
2728

28-
case UCMGetStat:
29-
std::println("Get stat");
29+
case CdfmDeviceDriverGetStat:
30+
CDFMDeviceDriverGetStat();
3031
break;
3132

32-
case UCMSetStat:
33-
std::println("Set stat");
33+
case CdfmDeviceDriverSetStat:
34+
CDFMDeviceDriverSetStat();
3435
break;
3536

3637
default:
@@ -61,26 +62,38 @@ void SoftCDIScheduler::CDDrivePlay() noexcept
6162
{
6263
std::map<SCC68070::Register, uint32_t> regs = m_cpu.GetCPURegisters();
6364

64-
std::println("Play start:0x{:X} count:{} file:{} channel:0x{:08X}", regs[D0], regs[D1], regs[D2], regs[D3]);
65+
// std::println("Play start:0x{:X} count:{} file:{} channel:0x{:08X}", regs[D0], regs[D1], regs[D2], regs[D3]);
6566
m_cdDrive.StartPlaying(regs[D0], regs[D1], regs[D2], regs[D3]);
6667
}
6768

6869
/** \brief Handles the copy of the last read sector to memory.
6970
* - a0: pointer to the destination buffer.
7071
* - d0.l: size of the destination buffer.
7172
*/
72-
void SoftCDIScheduler::CDDriveDmaSector() noexcept
73+
void SoftCDIScheduler::CDDriveCopySector() noexcept
7374
{
7475
std::map<SCC68070::Register, uint32_t> regs = m_cpu.GetCPURegisters();
7576

76-
std::println("DMA sector address:0x{:X} size:{}", regs[A0], regs[D0]);
77+
// std::println("Copy sector address:0x{:X} size:{}", regs[A0], regs[D0]);
7778
m_cdDrive.CopyLastSectorToMemory(regs[A0], regs[D0]);
7879
}
7980

8081
/** \brief Returns the last read sector subheader in D0. */
8182
void SoftCDIScheduler::CDDriveGetSubheader() noexcept
8283
{
8384
const uint32_t subheader = m_cdDrive.GetLastSectorSubheader();
84-
std::println("Get subheader 0x{:X}", subheader);
85+
// std::println("Get subheader 0x{:X}", subheader);
8586
m_cpu.SetRegister(D0, subheader);
8687
}
88+
89+
void SoftCDIScheduler::CDFMDeviceDriverGetStat() noexcept
90+
{
91+
std::map<SCC68070::Register, uint32_t> regs = m_cpu.GetCPURegisters();
92+
std::println("CDFM Get stat {} {} {} {} {}", regs[D1], OS9::getStatServiceRequestToString(regs[D1]), regs[D2], regs[D3], regs[D4]);
93+
}
94+
95+
void SoftCDIScheduler::CDFMDeviceDriverSetStat() noexcept
96+
{
97+
std::map<SCC68070::Register, uint32_t> regs = m_cpu.GetCPURegisters();
98+
std::println("CDFM Set stat {} {} {} {} {}", regs[D1], OS9::setStatServiceRequestToString(regs[D1]), regs[D2], regs[D3], regs[D4]);
99+
}

0 commit comments

Comments
 (0)