initial work on port

updated readme, new "build system," fixed some errors
This commit is contained in:
'mr software' 2023-03-09 21:35:56 -08:00
parent 9fcee05b53
commit ff7c092581
220 changed files with 220138 additions and 220096 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
obj
gen
test.s

View File

@ -1,9 +0,0 @@
IT.EXE: IT.OBJ IT_DISK.OBJ IT_DISPL.OBJ IT_EMS.OBJ IT_ERR.OBJ IT_F.OBJ IT_G.OBJ IT_H.OBJ \
IT_I.OBJ IT_K.OBJ IT_L.OBJ IT_M.OBJ IT_NET.OBJ IT_MSG.OBJ IT_MUSIC.OBJ IT_NET.OBJ IT_OBJ1.OBJ IT_PE.OBJ IT_S.OBJ \
IT_TUTE.OBJ IT_MMTSR.OBJ IT_MOUSE.OBJ IT_MDATA.OBJ IT_FOUR.OBJ IT_VESA.OBJ
tlink /3 /s /v @source.lst
.ASM.OBJ:
# TASM /Zi /m /uT310 /jSMART $*.asm
TASM /m /uT310 /jSMART $*.asm

View File

@ -1,33 +1,20 @@
Impulse Tracker
===============
Full source code for Impulse Tracker, including sound drivers, network drivers,
and some supporting documentation
 
Eventually, maybe, a version of IT for modern systems
Pre-Requisite Software
----------------------
To build Impulse Tracker, you will need:
- Turbo Assembler v4.1
- Netwide Assembler
- Turbo Link v3.01
- GCC
- Borland MAKE v4.0
- sh
- A DOS environment
 
Once you have these, building IT.EXE should be just a single call to `MAKE`
Sound drivers are build individually via M\*.BAT files inside the SoundDrivers
subdirectory
 
Once you have these, building IT should be just a single call to `./build`
Quick File Overview
-------------------
@ -105,8 +92,6 @@ Quick File Overview
- SWITCH.INC:
High level switches for the program
Frequently Asked Questions
--------------------------
@ -129,10 +114,8 @@ A: The original code was compatible all the way back to an 8086 machine. 8086 wo
conditional jumps only within +/-128 bytes, so I spent too much time shuffling code around to meet
this restriction. When I shifted away from this 8086 restriction, I never went back to update the
code that was mutilated by it.
 
License
-------
License for this source code is pending.
Refer to LICENSE.TXT

View File

@ -1,44 +0,0 @@
TRACEENABLED EQU 0
TUTORIAL = 0
EMSUSE41 = 0
SHOWVERSION = 0
SHOWREGISTERNAME = 1
USE32BITSCREENCOPY = 0
SORTENABLED = 1
DDCOMPRESS = 1
ORDERSORT = 1
FILTERENVELOPES = 1
CHORDENTRY = 1
SPECTRUMANALYSER = 1
SAVESAMPLEWAV = 1
ENABLEPRESETENVELOPES = 1
ENABLESOLO = 1
DEFAULTFORMAT = 3 ; 0 = IT214, 1 = S3M, 2 = IT2xx, 3 = IT215
USEFPUCODE = 1 ; For IT_MUSIC, this will change from LUT to FPU code
OLDDRIVER = 0
MUSICDEBUG = 0
EMSDEBUG = 0
MEMORYDEBUG = 0
ENABLEINT3 = 0 ; For debugging.
TIMERSCREEN = 1
NETWORKENABLED = 1
SHOWPATTERNLENGTH = 0
IF TUTORIAL
SORTENABLED = 1
DDCOMPRESS = 1
ENDIF
TRACKERVERSION = 217h ; Still have to change text in IT.ASM, IT_F.ASM

Binary file not shown.

9
build Executable file
View File

@ -0,0 +1,9 @@
mkdir -p obj gen
./gen_deps
for i in *.s; do
echo $i
nasm -g $i -felf32 -o "obj/$(echo $i | sed 's/s$/o/g')"
done
cc -m32 main.c c/* obj/* -g3

View File

@ -2,11 +2,11 @@
; Debug macro. To write to the file, use "Trace <logmessage>"
;
IF TRACEENABLED
%if TRACEENABLED
IF CREATENEWLOGFILE
%if CREATENEWLOGFILE
FirstTime DB 0
ENDIF
%endif
LogFileName DB "Logfile.Txt", 0
@ -23,7 +23,7 @@ Proc WriteDebugFile
Push CX
Mov DX, Offset LogFileName
IF CREATENEWLOGFILE
%if CREATENEWLOGFILE
Cmp DS:FirstTime, 0
JNE WriteDebugFile1
@ -39,7 +39,7 @@ IF CREATENEWLOGFILE
WriteDebugFile1:
ENDIF
%ENDIF
Mov AX, 3D02h
Int 21h
JC WriteDebugFileEnd
@ -67,11 +67,11 @@ WriteDebugFileEnd:
PopA
Ret
EndP WriteDebugFile
;EndP WriteDebugFile
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Trace Macro LogMessage
%macro Trace 1; Macro LogMessage
Local X, Y
PushF
@ -79,29 +79,29 @@ Trace Macro LogMessage
Push SI
Jmp Y
X:
DB LogMessage
DB %1
DB 0Dh, 0Ah
Y:
Mov CX, Offset Y - Offset X
Mov SI, Offset X
Mov CX, Y - X
Mov SI, X
Call WriteDebugFile
Pop SI
Pop CX
PopF
EndM
%endmacro
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
ELSE
%ELSE
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Trace Macro LogMessage
EndM
%macro Trace 1
%endmacro
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
ENDIF
%ENDIF

29
errors-sorted Normal file
View File

@ -0,0 +1,29 @@
18 it_mdata.s
37 it_err.s
51 it_vesa.s
90 it_h.s
140 it_four.s
165 it_tute.s
167 it_m.s
172 it_l.s
174 it_mmtsr.s
238 it_k.s
240 it_ems.s
287 it_s.s
311 it_msg.s
318 it_mouse.s
336 it.s
425 it_g.s
641 it_net.s
815 it_displ.s
1563 it_f.s
1795 it_music.s
2057 it_pe.s
2155 it_i.s
2238 it_disk.s
2398 it_obj1.s
instances in source code:
EndM: 374
EndP: 3320
Proc: 3597

13
gen_deps Executable file
View File

@ -0,0 +1,13 @@
rm -v gen/*
d=512
for i in {1..100}; do
echo "dw $d" >> gen/it_mdata.s
d=$(($d + 554))
done
for i in {1..100}; do
echo "dw $d" >> gen/it_mdata.s
d=$(($d + 80))
done

View File

@ -2,8 +2,8 @@
;ウ Startup Module ウ
;タトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトル
Jumps
.386P
; TODO
;Jumps
include switch.inc
@ -247,6 +247,14 @@ CapitaliseAL1:
EndP CapitaliseAL
CapitaliseAL:
cmp al, 'a'
jb .r
cmp al, 'z'
ja .r
or al, 'A'-'a'
.r: ret
;トトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトト
Proc GetDecimalNumber ; Returns CX

View File

@ -2,10 +2,10 @@
;ウ Critical Error handler. ウ
;タトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトル
Jumps
.386
; Jumps
; .386
include switch.inc
%include "switch.inc"
;レトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトソ
;ウ Externals ウ
@ -20,11 +20,13 @@ include switch.inc
;ヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘ
Segment Error BYTE Public 'Code' USE16
Assume CS:Error
;Segment Error BYTE Public 'Code' USE16
section .text
%warning "USE16"
; Assume CS:Error
CREATENEWLOGFILE EQU 0
include debug.inc
%include "debug.inc"
;レトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトソ
;ウ Variables ウ
@ -33,7 +35,7 @@ include debug.inc
OldHandlerOffset DW ?
OldHandlerSegment DW ?
ErrorMsgs Label Word
ErrorMsgs:; Label Word
DW Offset Error0
DW Offset Error1
DW Offset Error2
@ -70,15 +72,14 @@ UnknownError DB "Unknown critical error", 0
;ウ Functions ウ
;タトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトル
Proc ErrorHandler Far
ErrorHandler:
PushA
Push DS
Push ES
Push CS
Pop DS
Assume DS:Error
; Assume DS:Error
Mov BX, DI
And BX, 0FFh
@ -115,12 +116,12 @@ ErrorHandler4:
IRet
EndP ErrorHandler
Assume DS:Nothing
;EndP ErrorHandler
; Assume DS:Nothing
;トトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトト
Proc Error_InitHandler Far
Error_InitHandler:; Far
Push ES
@ -131,7 +132,7 @@ Proc Error_InitHandler Far
Mov AX, CS
ShL EAX, 16
Mov AX, Offset ErrorHandler
Mov AX, ErrorHandler
XChg [ES:90h], EAX
Mov DWord Ptr CS:OldHandlerOffset, EAX
@ -139,11 +140,11 @@ Proc Error_InitHandler Far
Pop ES
Ret
EndP Error_InitHandler
;EndP Error_InitHandler
;トトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトト
Proc Error_UnInitHandler Far
Error_UnInitHandler:; Far
Push ES
Xor AX, AX
@ -155,14 +156,14 @@ Proc Error_UnInitHandler Far
Pop ES
Ret
EndP Error_UnInitHandler
;EndP Error_UnInitHandler
;トトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトト
;ヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘ
EndS
;EndS
;ヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘ
End
;End

View File

View File

View File

View File

View File

View File

View File

View File

@ -1,10 +1,10 @@
;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
Segment SongData PARA Public 'Data'
Org 0
;Segment SongData PARA Public 'Data'
section .data
extern SongData
SongData:
DB "IMPM", 36 Dup (0)
DW 0, 0, 9, 0
DB 128, 30h, 6, 125, 128, 0
@ -3620,6 +3620,7 @@ Org 0
DW 400 Dup (0)
%if 0
OffsetCounter = 512
Rept 100
@ -3631,22 +3632,26 @@ Rept 100
DW OffsetCounter
OffsetCounter = OffsetCounter + 80
EndM
%endif
%include "gen/it_mdata.s"
DW 65114
MIDISampleHeader Label Byte
MIDISampleHeader:; Label Byte
DB "MIDI", 13 Dup (0), 64, 11h, 64, "MIDI Instrument", 13 Dup (0)
DD 8, 0, 8, 44100, 0, 0
DW 1
DW SongData+4075
;DW SongData+4075
DW 4075
DD 0
DB 22 Dup (0)
DW (128+16+9)*32/2 Dup (0)
EndS
;EndS
;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
End
;End

View File

View File

12
main.c Normal file
View File

@ -0,0 +1,12 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
int main(int argc, char** argv) {
int arglen = 1; // null terminator
for(int i = 0; i < argc; i++) arglen += strlen(argv[i]);
char* args = memset(malloc(arglen * sizeof(char)), 0, arglen);
for(int i = 0; i < argc; i++) strcat(args, argv[i]);
return printf("pretend this is impulse tracker\n"); // TODO make this impulse tracker
}

32
switch.inc Normal file
View File

@ -0,0 +1,32 @@
TRACKERVERSION equ 217h; Still have to change text in IT.ASM, IT_F.ASM
TRACEENABLED equ 0
TUTORIAL equ 0
EMSUSE41 equ 0
SHOWVERSION equ 0
SHOWREGISTERNAME equ 1
USE32BITSCREENCOPY equ 0
SORTENABLED equ 1
DDCOMPRESS equ 1
ORDERSORT equ 1
FILTERENVELOPES equ 1
CHORDENTRY equ 1
SPECTRUMANALYSER equ 1
SAVESAMPLEWAV equ 1
ENABLEPRESETENVELOPES equ 1
ENABLESOLO equ 1
DEFAULTFORMAT equ 3 ; 0 equ IT214, 1 equ S3M, 2 equ IT2xx, 3 equ IT215
USEFPUCODE equ 1 ; For IT_MUSIC, this will change from LUT to FPU code
OLDDRIVER equ 0
MUSICDEBUG equ 0
EMSDEBUG equ 0
MEMORYDEBUG equ 0
ENABLEINT3 equ 0 ; For debugging.
TIMERSCREEN equ 1
NETWORKENABLED equ 1
SHOWPATTERNLENGTH equ 0
%if TUTORIAL
SORTENABLED equ 1
DDCOMPRESS equ 1
%endif