Skip to content
ย 
ย 

Latest commit

ย 

History

27 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

AdLcom ํŒจ์น˜ํŒ

A AdLib Driver for serial port. this fork builds upon the original project by josephillips85 (adlcom) https://github.com/josephillips85/adlcom

์ด adlcom ํŒจ์น˜ํŒ์€ adlipt๋ฅผ ์‹œ๋ฆฌ์–ผํฌํŠธ์šฉ์œผ๋กœ ํŒจ์น˜ํ•œ adlcom์„ ์‰๋„์šฐ ๋ ˆ์ง€์Šคํ„ฐ ์บ์‹œ ์ตœ์ ํ™”ํ•œ ํŒจ์น˜ํŒ์ž…๋‹ˆ๋‹ค. ์‹œ๋ฆฌ์–ผ๋„๋ชจ๋Ž€์ผ€์ด๋ธ”์„ ํ†ตํ•ด์„œ PC์—์„œ ์žฌ์ƒํ•  ์ˆ˜ ์žˆ๊ณ , ํ˜น์€ MCU๋ฅผ ์ด์šฉํ•œ ์—๋ฎฌ์„ ํ†ตํ•ด์„œ ์žฌ์ƒ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. ์ €๋Š” esp32-s3์— ymfm์ฝ”์–ด๋ฅผ ์˜ฌ๋ ค์„œ ์žฌ์ƒํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์•„๋งˆ๋„ opl3duo ๋„ ๊ฐ€๋Šฅํ•  ๊ฒƒ์œผ๋กœ ๋ณด์ž…๋‹ˆ๋‹ค๋งŒ, ์ œ๊ฒŒ๋Š” ์—†์–ด์„œ ๋ชจ๋ฅด๊ฒ ์Šต๋‹ˆ๋‹ค. ์‹คํ–‰์€ adlcom opl3 ๋กœ ํ•˜์‹œ๋ฉด ๋˜๊ณ , ๊ฒฝ์šฐ์— ๋”ฐ๋ผ์„œ adlcom opl3 nopatch๋กœ๋„ ์‚ฌ์šฉํ•ด ๋ณด์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค. ์ด ํ”„๋กœ๊ทธ๋žจ์€ AI๋ฅผ ์ด์šฉํ•˜์—ฌ ์ œ์ž‘๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

default.mp4
KakaoTalk_20260430_083349088.mp4
KakaoTalk_20260430_083355290.mp4

esp_ymfm

์ €ํ•ญ๊ณผ ์ฝ˜๋ด์„œ๋Š” ์•ˆ์ •์„ฑ์„ ์˜ฌ๋ฆฌ๊ธฐ ์œ„ํ•œ ๊ฒƒ์œผ๋กœ ์—†์œผ๋ฉด ์ƒ๋žตํ•˜์…”๋„ ๋ฉ๋‹ˆ๋‹ค.


adlcom ElectricRay Patch ์ˆ˜์ • ๋‚ด์šฉ ์ •๋ฆฌ

์›๋ณธ: josephillips85/adlcom
ํŒจ์น˜: ElectricRay (https://cafe.naver.com/olddos)
๋นŒ๋“œ ํ™˜๊ฒฝ: Open Watcom 1.9 (ํ•„์ˆ˜ โ€” 2.0 ์ด์ƒ์€ ์„ธ๊ทธ๋จผํŠธ ๊ตฌ์กฐ ๋ฌธ์ œ๋กœ ๋™์ž‘ ์•ˆ ํ•จ)
๋Œ€์ƒ ํ•˜๋“œ์›จ์–ด: Samsung Sens P30 (16550A UART, Windows 9x EMM386)


๋นŒ๋“œ ํ™˜๊ฒฝ ๋ณ€๊ฒฝ

์›๋ณธ

  • build.sh (Linux/Unix ์…ธ ์Šคํฌ๋ฆฝํŠธ)
  • ๋นŒ๋“œ ์ปดํŒŒ์ผ๋Ÿฌ ๋ฒ„์ „ ๋ช…์‹œ ์—†์Œ

ํŒจ์น˜

  • build19.bat (Windows ๋ฐฐ์น˜ ํŒŒ์ผ) ์ถ”๊ฐ€
  • Open Watcom 1.9 ๊ณ ์ • ์‚ฌ์šฉ (C:\watcom19)

์ด์œ 

Open Watcom 2.0์œผ๋กœ ๋นŒ๋“œํ•˜๋ฉด RESIDENT ์„ธ๊ทธ๋จผํŠธ์™€ _TEXT ์„ธ๊ทธ๋จผํŠธ๊ฐ€ ๋ฌผ๋ฆฌ์ ์œผ๋กœ ๋ถ„๋ฆฌ๋œ๋‹ค. EMM386์˜ AX=4A15 (I/O ๊ฐ€์ƒํ™”) ํ˜ธ์ถœ ์‹œ ์ฝœ๋ฐฑ ์ฃผ์†Œ๊ฐ€ ๋‹จ์ผ ์„ธ๊ทธ๋จผํŠธ(CS=0x0000)๋ฅผ ๊ธฐ์ค€์œผ๋กœ ๊ณ„์‚ฐ๋˜๋Š”๋ฐ, ์„ธ๊ทธ๋จผํŠธ๊ฐ€ ๋ถ„๋ฆฌ๋˜๋ฉด ํ•ธ๋“ค๋Ÿฌ ์ฃผ์†Œ ๊ณ„์‚ฐ์ด ํ‹€์–ด์ ธ ์ฆ‰์‹œ ํฌ๋ž˜์‹œ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค.

OW 1.9๋Š” order ์ง€์‹œ์–ด์— ๋”ฐ๋ผ ๋ชจ๋“  CODE ์„ธ๊ทธ๋จผํŠธ๋ฅผ 0000:xxxx ๋‹จ์ผ ์„ธ๊ทธ๋จผํŠธ๋กœ ๋ฌถ์–ด์ค€๋‹ค.

OW 2.0 ๋นŒ๋“œ (์‹คํŒจ):
  RESIDENT: 0000:0008
  _TEXT:    0060:000A  โ† ๋ถ„๋ฆฌ๋จ โ†’ EMM386 ํฌ๋ž˜์‹œ

OW 1.9 ๋นŒ๋“œ (์„ฑ๊ณต):
  RESIDENT: 0000:0008
  _TEXT:    0000:040C  โ† ๋‹จ์ผ ์„ธ๊ทธ๋จผํŠธ ์—ฐ์† โ†’ ์ •์ƒ ๋™์ž‘

ํŒŒ์ผ๋ณ„ ์ˆ˜์ • ๋‚ด์šฉ

1. res_glue.s

1-1. shadow_regs ์ •์ƒ ํ• ๋‹น

/* ์›๋ณธ (๊ณต์‹ ์†Œ์Šค์—๋Š” ์—†๋˜ ๊ฒƒ) */
_shadow_regs:

/* ํŒจ์น˜ */
_shadow_regs:
        db 64 dup (0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh)
        ; = 512 bytes, 0xFF๋กœ ์ดˆ๊ธฐํ™”

์ด์œ : res_opl2.c์˜ shadow cache ๋กœ์ง์ด bank*256 + reg ๋ฐฉ์‹์œผ๋กœ 0~511 ์ธ๋ฑ์Šค๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค. 1๋ฐ”์ดํŠธ ํ• ๋‹น ์ƒํƒœ์—์„œ๋Š” OOB write โ†’ ๋ฉ”๋ชจ๋ฆฌ ์˜ค์—ผ โ†’ ํฌ๋ž˜์‹œ. 0xFF ์ดˆ๊ธฐํ™”๋Š” ์ฒซ write ์‹œ ๋ฐ˜๋“œ์‹œ cache miss๊ฐ€ ๋˜๋„๋ก ๋ณด์žฅํ•œ๋‹ค.


1-2. emulate_opl3_write_high_address bank ๋ฒˆํ˜ธ ์ˆ˜์ •

/* ์›๋ณธ */
WRITE_REG_NUKE(ax, 0, com_port);  /* bank=0 (์ž˜๋ชป๋จ) */

/* ํŒจ์น˜ */
WRITE_REG_NUKE(ax, 1, com_port);  /* bank=1 (high bank, ์˜ฌ๋ฐ”๋ฆ„) */

์ด์œ : OPL3 high bank(ํฌํŠธ 0x38A/0x38B)์— ๋Œ€ํ•œ ๋ ˆ์ง€์Šคํ„ฐ write๋Š” Nuke.YKT ํ”„๋กœํ† ์ฝœ์—์„œ bank=1๋กœ ์ „์†กํ•ด์•ผ ํ•œ๋‹ค. bank=0์œผ๋กœ ์ „์†กํ•˜๋ฉด OPL3 ์นฉ์ด low bank ๋ ˆ์ง€์Šคํ„ฐ๋กœ ์ž˜๋ชป ์ธ์‹ํ•œ๋‹ค.


2. res_opl2.c

2-1. shadow register cache ์ถ”๊ฐ€ (ํ•ต์‹ฌ ์ตœ์ ํ™”)

/* ์›๋ณธ */
else {
    WRITE_VAL_NUKE(ax, com_port);
}

/* ํŒจ์น˜ */
else {
    /* Shadow register cache: 0x00~0x9F (์˜คํผ๋ ˆ์ดํ„ฐ ๋ ˆ์ง€์Šคํ„ฐ)๋งŒ ์บ์‹ฑ
     * 0xA0~0xFF (์ฑ„๋„/KON/F-Num)์€ bypass โ†’ ํ•ญ์ƒ ์ „์†ก */
    int reg_lo = (int)(opl3Reg & 0xFF);
    if (reg_lo < 0xA0) {
        int current_bank = (address & 0x100) ? 1 : 0;
        int cache_idx = (current_bank * 256) + reg_lo;
        if (shadow_regs[cache_idx] == (unsigned char)ax) {
            return ax;  /* ์ค‘๋ณต ์ „์†ก skip */
        }
        shadow_regs[cache_idx] = (unsigned char)ax;
    }
    WRITE_VAL_NUKE(ax, com_port);
}

์ด์œ : ์‹œ๋ฆฌ์–ผ ๋Œ€์—ญํญ(115200 baud = ์ตœ๋Œ€ 3,840 writes/sec)์ด ์ œํ•œ์ ์ด๋ฏ€๋กœ ๊ฐ’์ด ๋ณ€ํ•˜์ง€ ์•Š์€ ๋ ˆ์ง€์Šคํ„ฐ์˜ ์ค‘๋ณต ์ „์†ก์„ ์ œ๊ฑฐํ•ด ์‹ค์งˆ ์ฒ˜๋ฆฌ๋Ÿ‰์„ ๋†’์ธ๋‹ค.

์บ์‹œ ์ ์šฉ ๋ฒ”์œ„:

๋ฒ”์œ„ ๋‚ด์šฉ ์ฒ˜๋ฆฌ
0x00~0x9F ์˜คํผ๋ ˆ์ดํ„ฐ ๋ ˆ์ง€์Šคํ„ฐ (MULT, KSL, AR/DR, SL/RR ๋“ฑ) ์บ์‹œ โ†’ ์ค‘๋ณต skip
0xA0~0xFF ์ฑ„๋„ ๋ ˆ์ง€์Šคํ„ฐ (F-Num, KON, Rhythm, FB/ALG) bypass โ†’ ํ•ญ์ƒ ์ „์†ก

์ฑ„๋„ ๋ ˆ์ง€์Šคํ„ฐ๋ฅผ bypassํ•˜๋Š” ์ด์œ : F-Num, KON์€ ๋…ธํŠธ๋งˆ๋‹ค ๋ณ€ํ•˜๋ฉฐ ์บ์‹œ hit ์˜คํŒ ์‹œ ๋…ธํŠธ๊ฐ€ ์šธ๋ฆฌ์ง€ ์•Š๋Š” ์น˜๋ช…์  ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค.


2-2. UART ์ „์†ก ๋ฐฉ์‹ ๋ณ€๊ฒฝ: ๊ณ ์ • ๋”œ๋ ˆ์ด โ†’ THRE ํด๋ง

/* ์›๋ณธ */
outp(port, sendBuffer[0]);
delay(port, DELAY_SERIAL_DATA);   /* 35ํšŒ ๊ณ ์ • IN ๋ฃจํ”„ */
outp(port, sendBuffer[1]);
delay(port, DELAY_SERIAL_DATA);

/* ํŒจ์น˜ */
while (!(inp(port + 5) & 0x20));  /* THRE(LSR bit5) ํด๋ง */
outp(port, sendBuffer[0]);
while (!(inp(port + 5) & 0x20));
outp(port, sendBuffer[1]);

๋™์ผํ•œ ๋ณ€๊ฒฝ์ด ์ ์šฉ๋œ ์œ„์น˜:

  • WRITE_VAL_NUKE() โ€” OPL ๋ ˆ์ง€์Šคํ„ฐ ๊ฐ’ ์ „์†ก
  • emulate_opl2_write_address() โ€” ๋ ˆ์ง€์Šคํ„ฐ ๋ฒˆํ˜ธ ์ „์†ก ํ›„
  • emulate_opl3_write_high_address() โ€” high bank ๋ ˆ์ง€์Šคํ„ฐ ๋ฒˆํ˜ธ ์ „์†ก ํ›„
  • hw_reset() โ€” ์ดˆ๊ธฐํ™” ์‹œ ์ „์†ก

์ด์œ : ์›๋ณธ์˜ delay(port, 35)๋Š” 35ํšŒ IN ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๋Š” ๊ณ ์ • ๋ฃจํ”„๋‹ค. CPU ์†๋„์— ๋”ฐ๋ผ ์‹ค์ œ ๋Œ€๊ธฐ ์‹œ๊ฐ„์ด ๋‹ฌ๋ผ์ง€๋ฉฐ, ๋น ๋ฅธ CPU์—์„œ๋Š” UART๊ฐ€ ์ค€๋น„๋˜๊ธฐ ์ „์— ๋‹ค์Œ byte๋ฅผ ์ „์†กํ•ด ๋ฐ์ดํ„ฐ ์œ ์‹ค์ด ๋ฐœ์ƒํ•œ๋‹ค. ๋ฐ˜๋ฉด ๋А๋ฆฐ CPU์—์„œ๋Š” ๋ถˆํ•„์š”ํ•œ ๋Œ€๊ธฐ๋กœ ์ฒ˜๋ฆฌ๋Ÿ‰์ด ๋‚ฎ์•„์ง„๋‹ค.

THRE ํด๋ง์€ UART์˜ Transmitter Holding Register๊ฐ€ ์‹ค์ œ๋กœ ๋น„์›Œ์กŒ์„ ๋•Œ๋งŒ ๋‹ค์Œ byte๋ฅผ ์ „์†กํ•˜๋ฏ€๋กœ, CPU ์†๋„์™€ ๋ฌด๊ด€ํ•˜๊ฒŒ ์•ˆ์ •์ ์œผ๋กœ ๋™์ž‘ํ•œ๋‹ค.


์ˆ˜์ • ํŒŒ์ผ ๋ชฉ๋ก ์š”์•ฝ

ํŒŒ์ผ ์ˆ˜์ • ์—ฌ๋ถ€ ์ฃผ์š” ๋ณ€๊ฒฝ ๋‚ด์šฉ
res_opl2.c โœ… shadow cache ์ถ”๊ฐ€, THRE ํด๋ง, bank ์ˆ˜์ •
res_glue.s โœ… shadow_regs 512B ์ •์ƒ ํ• ๋‹น
cmdline.c โŒ ์›๋ณธ ๊ทธ๋Œ€๋กœ
cmdline.h โŒ ์›๋ณธ ๊ทธ๋Œ€๋กœ
cmdline.rl โŒ ์›๋ณธ ๊ทธ๋Œ€๋กœ
cputype.h โŒ ์›๋ณธ ๊ทธ๋Œ€๋กœ
resident.h โŒ ์›๋ณธ ๊ทธ๋Œ€๋กœ
jadlcom.c โŒ ์›๋ณธ ๊ทธ๋Œ€๋กœ
jadlcom.wl โŒ ์›๋ณธ ๊ทธ๋Œ€๋กœ
jlm.h โŒ ์›๋ณธ ๊ทธ๋Œ€๋กœ
patchpe.py โŒ ์›๋ณธ ๊ทธ๋Œ€๋กœ
adlcom.wl โœ… libpath ์ถ”๊ฐ€ (OW 1.9 ๊ฒฝ๋กœ)
build19.bat ๐Ÿ†• OW 1.9์šฉ Windows ๋นŒ๋“œ ์Šคํฌ๋ฆฝํŠธ ์‹ ๊ทœ ์ถ”๊ฐ€

๋นŒ๋“œ ๋ฐฉ๋ฒ•

ํ•„์ˆ˜ ํ™˜๊ฒฝ

  • Open Watcom 1.9 (C:\watcom19์— ํ’€ ์„ค์น˜)
  • Windows (build19.bat ์‚ฌ์šฉ)
  • Python (patchpe.py ์‹คํ–‰์šฉ)

wlsystem.lnk ๊ฒฝ๋กœ ํŒจ์น˜ (์ตœ์ดˆ 1ํšŒ)

OW 1.9์˜ wlink๋Š” %WATCOM%/lib... ํ˜•ํƒœ์˜ ๊ฒฝ๋กœ๋ฅผ Windows์—์„œ ์ œ๋Œ€๋กœ ์ฐพ์ง€ ๋ชปํ•œ๋‹ค. ์•„๋ž˜ PowerShell ๋ช…๋ น์œผ๋กœ ์ ˆ๋Œ€ ๊ฒฝ๋กœ๋กœ ๊ต์ฒดํ•ด์•ผ ํ•œ๋‹ค:

# binnt\wlink.lnk ํŒจ์น˜
$c = Get-Content "C:\watcom19\binnt\wlink.lnk" -Raw
$c = $c -replace '@%watcom%\\binw\\wlsystem.lnk','@C:\watcom19\binw\wlsystem.lnk'
Set-Content "C:\watcom19\binnt\wlink.lnk" $c -Encoding ASCII

# binw\wlsystem.lnk ํŒจ์น˜
$c = Get-Content "C:\watcom19\binw\wlsystem.lnk" -Raw
$c = $c -replace '%WATCOM%/','C:\watcom19\'
$c = $c -replace '%watcom%/','C:\watcom19\'
Set-Content "C:\watcom19\binw\wlsystem.lnk" $c -Encoding ASCII

๋นŒ๋“œ ์‹คํ–‰

cd C:\Users\tiram\Documents\claude\adlcom_electricray
build19.bat

์‚ฌ์šฉ๋ฒ•

adlcom COM1 opl3

์˜ต์…˜:

  • nopatch: ๊ฒŒ์ž„์˜ OPL status read(IN AL,DX)๋ฅผ NOP์œผ๋กœ ํŒจ์น˜ํ•˜์ง€ ์•Š์Œ.
    ์ผ๋ถ€ ๊ฒŒ์ž„/์žฌ์ƒ๊ธฐ์—์„œ ์ž์—ฐ์Šค๋Ÿฌ์šด write ๊ฐ„๊ฒฉ์ด ์ƒ๊ฒจ ์Œ์งˆ์ด ํ–ฅ์ƒ๋  ์ˆ˜ ์žˆ์Œ.

ํ•œ๊ณ„

  • 115200 baud ํ•œ๊ณ„๋กœ ๋งค์šฐ ๋น ๋ฅธ OPL3 ์Œ์•…์—์„œ ์ผ๋ถ€ ๋“œ๋Ÿผ/ํƒ€์ด๋ฐ ๋ถˆ์•ˆ์ • ๊ฐ€๋Šฅ
  • shadow cache ๋ฏธ์ ์šฉ ๋ ˆ์ง€์Šคํ„ฐ(0xA0~0xFF)๋Š” ํ•ญ์ƒ ์ „์†ก๋˜๋ฏ€๋กœ ๋Œ€์—ญํญ ์†Œ๋ชจ
  • ESP32 + ymfm ๊ธฐ๋ฐ˜ OPL3 ์—๋ฎฌ๋ ˆ์ดํ„ฐ ์กฐํ•ฉ์—์„œ ๊ฒ€์ฆ๋จ

AdLcom

A AdLib Driver for serial port.

This is a AdLib TSR Program for MS-DOS Forked from the project AdLipt instead of using LPT port is using COM port to send the Register and value to a serial port.

Hardware Requirements

Download

Download the driver from the Github releases tab.

Wiring instructions

Before usage you should follow the instructions from

https://github.com/DhrBaksteen/ArduinoOPL2

Connect the Arduino to the OPL2Board and Connect the MAX232 with this wiring guide.

MAX232 PIN Arduino
VCC "<------------->" 3.3V
TX "<------------->" TX
RX "<------------->" RX
GND "<------------->" GND

Usage

Load the TSR with the command:

ADLCOM

assuming the board is plugged into COM1. It will use about a kilobyte of RAM. It can be loaded into high memory using the DOS LH command.

The TSR can be unloaded with the command:

ADLCOM UNLOAD

JEMM

Load ADLCOM using the command:

JLOAD JADLCOM.DLL

Options

  • COM1/COM2/COM3/COM4 Select COM port.

  • BLASTER=220 Enable Sound Blaster FM emulation. ADLCOM will intercept the Sound Blaster FM ports in addition to the standard AdLib ports. (It won't however fake enough of a Sound Blaster to pass installation checks, so this won't be very useful if you don't have a Sound Blaster.)

  • NOPATCH Disable runtime patching. Without runtime patching the TSR will be much slower, but the I/O timing will be much more regular, which might help with software that's very timing sensitive.

  • OPL3 Enable support for OPL3 Board.should be used with Nuke.YKT Protocol.

Source code

This program compiles with OpenWatcom, use the build.sh script. You'll also need Python 3 and the Ragel state machine compiler.

Donations

Who want to donate to this project. please doit via Paypal to https://www.paypal.com/paypalme2/josephillips85

Copying

Copyright ยฉ 2023 Jose Phillips Copyright ยฉ 2020 Peter De Wachter (pdewacht@gmail.com)

Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

About

AdLcom patched for esp32-s3 emulate OPL3 (ymfm) with serial port

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages