Skip to content
Snippets Groups Projects
Commit d38fa51a authored by shidel's avatar shidel
Browse files

porting to NASM

parent 0385f107
No related branches found
No related tags found
No related merge requests found
......@@ -132,10 +132,10 @@
%endmacro
%imacro MIXER_SetFMChannel 1 ; Channel : byte =
; 0 : No Steering;
; 1 : ST to Left;
; 2 : ST to Right;
; 3 : MUTE }
; 0 : No Steering
; 1 : Steer to Left
; 2 : Steer to Right
; 3 : MUTE
xor bh, bh
mov bl, %1
mov ax, 0x09
......@@ -358,10 +358,10 @@
%ifndef StdOutStr_Required
%define StdOutStr_Required
%endif
push di
DefReg %1, di
push si
DefReg %1, si
call StdOutStr_Proc
pop di
pop si
%endmacro
%imacro StdOutChar 1
......@@ -420,7 +420,8 @@
%imacro GetEnvStr 1
; %1 is Offset of Search String, returns DS:SI points to data
; if not found then carry flag is set
; if not found then carry flag is set and DS:SI points to null at the end of
; the environment table.
%ifndef GetEnvStr_Required
%define GetEnvStr_Required
%endif
......@@ -434,6 +435,7 @@
%imacro ParseStr 2
; CS:%1 Pointer to sub-string handler
; DS:%2 Pointer to string to processes
; CF is set if error occurred
%ifndef ParseStr_Required
%define ParseStr_Required
%endif
......@@ -476,7 +478,7 @@
%imacro LenStrToWord 2
; %1 Length of String
; DS:%2 Pointer to string to convert
; Return AX = value, CF if Error
; Return AX = value, CF if error
%ifndef LenStrToWord_Required
%define LenStrToWord_Required
%define LenStrToWordHex_Required
......@@ -488,7 +490,8 @@
%endmacro
%imacro LenStrHexToWord 2
; Just like LenStrToWord except always treated as hex
; Just like LenStrToWord except always treated as hex value,
; string should never include a 0x prefix.
%ifndef LenStrHexToWord_Required
%define LenStrHexToWord_Required
%define LenStrToWordHex_Required
......
......@@ -24,17 +24,80 @@ org 0x100
StdOutCRLF
push ds
GetEnvStr String_Blaster
GetEnvStr String_Blaster ; if VAR not found, points to NULL and CF
ParseStr Opts_Blaster, si
pop ds
ParseStr Opts_CommandLn, PSP_CMDLN
StdOutCRLF
MIXER_GetBasePort
StdOutStr Text_BasePort
StdOutHexWord ax
StatusDisplay:
mov si, StatusTypes
cld
.Display:
mov cx, 0x0d
lodsb
test al, al
jz .Done
.PrintStr:
dec cx
StdOut al
lodsb
test al, al
jnz .PrintStr
StdOut 0x3a
mov dl, 0x20
cmp cx, 0x10
ja .NoPadding
.PrintPadding:
int 0x21
loop .PrintPadding
.NoPadding:
lodsw
push ax
lodsb
xor ah, ah
MIXER_CALL SBPMixer
pop di ; was pushed as ax
cmp di, 0x0002
ja .ResultLookup
cmp di, 0x0001
jb .ResultHexWord
ja .ResultMono
push ax
StdOut 'L'
pop ax
push ax
StdOutIntByte al
pop ax
push ax
StdOut ' ', '/', ' ', 'R'
pop ax
push ax
StdOutIntByte al
pop ax
jmp .ResultDone
.ResultMono:
StdOutIntByte al
jmp .ResultDone
.ResultHexWord:
push ax
StdOut '0', 'x'
pop ax
StdOutHexWord ax
jmp .ResultDone
.ResultLookup:
StdOut '?'
.ResultDone:
StdOutCRLF
jmp .Display
.Done:
; MIXER_GetBasePort
; StdOutStr Text_BasePort
; StdOutHexWord ax
; StdOutCRLF
Terminate 0
......@@ -65,7 +128,7 @@ Opts_Blaster:
%include 'PROCS.ASM'
String_Blaster:
db 'BLASTERZ',0
db 'BLASTER',0
Text_Title:
db 'Sound Blaster Pro Mixer Chip Interface',13,10,0
......@@ -73,6 +136,76 @@ Text_Copyright:
db 'Copyright (c) 1993-2022 Jerome Shidel',13,10,0
Text_Version:
db 'Version ',0
Text_BasePort:
db 'Base Port 0x',0
Text_Volume:
db 'Volume',0
StatusTypes:
db 'Base Port',0
dw 0
db 0x01
db 'Master',0
dw 1
db 0x10
db 'Voice',0
dw 1
db 0x11
db 'Line',0
dw 1
db 0x17
db 'FM',0
dw 1
db 0x12
db 'CD',0
dw 2
db 0x13
db 'MIC',0
dw 2
db 0x14
db 'FM Steering',0
dw StatusSteerFM
db 0x15
db 'FM Mode',0
dw StatusModeFM
db 0x16
db 'ADC Channel',0
dw StatusADC
db 0x18
db 'ADC Filter',0
dw StatusFilter
db 0x19
db 'ANFI Filter',0
dw StatusBool
db 0x1A
db 'DNFI Filter',0
dw StatusBool
db 0x1B
db 0
StatusSteerFM:
db 'No Steering',0
db 'Steer Left',0
db 'Steer Right',0
db 'Mute',0
db 0
StatusModeFM:
db 'Mono',0
db 'Stereo',0
db 0
StatusADC:
db 'Microphone',0
db 'CD',0
db '(reserved)',0
db 'Line',0
db 0
StatusFilter:
db 'Low',0
db 'High',0
db 0
StatusBool:
db 'off',0
db 'on',0
db 0
......@@ -42,11 +42,11 @@ Terminate_Proc:
StdOutStr_Proc:
pushm ax, dx
.OutLoop:
mov dl, [di]
mov dl, [si]
inc si
cmp dl, 0
je .Done
StdOut dl
inc di
jmp .OutLoop
.Done:
popm ax, dx
......@@ -175,6 +175,7 @@ Terminate_Proc:
clc
jmp .Done
.Failed:
dec si
stc
.Done:
pop di
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment