Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

Assembly MPEG Decoder

Status
Not open for further replies.

sasquadge

Newbie level 1
Joined
Nov 21, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,288
Hi guys I'm working on a assebley program and I'm running into an issue, What the program is supposed to do is have the user input a Hex value, then it will give you the Mpeg Version, Layer, and Sampling Rate. So the issue I'm running into is the sampling rate.How do I have it convert the sampling rate then call the Mpeg Version to decide what the frequency is?

This is the sampling ratechart
bits MPEG1 MPEG2 MPEG2.5
00 44100 Hz 22050 Hz 11025 Hz
01 48000 Hz 24000 Hz 12000 Hz
10 32000 Hz 16000 Hz 8000 Hz
11 reserv. reserv. reserv.

so how do I get the sampling rate bit to tell me what the frequency is by calling the version? Any help is greatly appreciated.

Code:
; Student Name: 
; Assignment Due Date: 11/25/2012

INCLUDE Irvine32.inc
.data
;--------- Enter Data Here
vSemester BYTE "Fall",0
vAssignment BYTE "Assembler",0
vName BYTE "Name",0
vMP3Header BYTE "Enter MP3 Frame Header in Hex: ",0
vMpeg25 BYTE "	MPEG Version 2.5",0
vMpeg20 BYTE "	MPEG Version 2.0",0
vMpeg10 BYTE "	MPEG Version 1.0",0
vMpegRE BYTE "	MPEG Reserved",0
vLayerRE BYTE "	Reserved",0
vLayerIII BYTE "	Layer III",0
vLayerII BYTE "		Layer II",0
vLayerI BYTE "      Layer I	",0
vSample100 BYTE "	44100 Hz",0
vSample101 BYTE "	48000 Hz",0
vSample110 BYTE "	32000 Hz",0
vSample200 BYTE "	22050 Hz",0
vSample201 BYTE "	24000 Hz",0
vSample210 BYTE "	16000 Hz",0
vSample2500 BYTE "	11025 Hz",0
vSample2501 BYTE "	12000 Hz",0
vSample2510 BYTE "	8000 Hz",0
vSampleReserved BYTE "	Reserved",0


.code
main PROC
;--------- Enter Code Below Here
	call Clrscr
	call DisplaySemester
	call DisplayAssignment
	call DisplayName
	call ReadMP3Header
	call DisplayVersion
	call DisplayLayer
	Call SamplingRate

;Semester
	DisplaySemester:
		mov dh, 12
		mov dl, 12
		call Gotoxy
		mov edx, OFFSET vSemester
		call	WriteString
		
;Assignment
	DisplayAssignment:
		mov dh, 13
		mov dl, 12
		call Gotoxy
		mov edx, OFFSET vAssignment
		call	WriteString

;Name
	DisplayName:
		mov dh, 14
		mov dl, 12
		call Gotoxy
		mov edx, OFFSET vName
		call	WriteString

;MP3 Header
	ReadMP3Header:
		mov dh, 16
		mov dl, 12
		call Gotoxy
		mov edx, OFFSET vMP3Header
		call	WriteString
		call	ReadHex

;Version
	DisplayVersion:
		mov ecx, eax
			    ;AAAAAAAAAAABBCCDEEEEFFGHIIJJKLMM
		and eax, 00000000000110000000000000000000b
		shr eax, 19

		cmp eax, 00b
		jz dMpeg25

		cmp eax, 01b
		jz dMpegRE

		cmp eax, 10b
		jz dMpeg20

		mov edx, offset vMpeg10
		jmp DisplayString

	dMpeg25:
		mov edx, offset vMpeg25
		jmp DisplayString

	dMpegRE:
		mov edx, offset vMpegRE
		jmp DisplayString

	dMpeg20:
		mov edx, offset vMpeg20
		jmp DisplayString

	DisplayString:
		call WriteString

		mov eax, ebx
;Layer

	DisplayLayer:
		mov eax, ecx
				;AAAAAAAAAAABBCCDEEEEFFGHIIJJKLMM
		and eax, 00000000000001100000000000000000b
		shr eax, 17

		cmp eax, 00b
		jz dLayerRE

		cmp eax, 01b
		jz dLayerIII

		cmp eax, 10b
		jz dLayerII

		mov edx, offset vLayerI
		jmp LayerDisplay

	dLayerRE:
		mov edx, offset vLayerRE
		jmp	LayerDisplay

	dLayerIII:
		mov edx, offset vLayerIII
		jmp LayerDisplay

	dLayerII:
		mov edx, offset vLayerII
		jmp LayerDisplay

	LayerDisplay:
		call WriteString 


;Sampling Rating
	SamplingRate:
	mov ecx, eax
				;AAAAAAAAAAABBCCDEEEEFFGHIIJJKLMM
		and eax, 00000000000000000000110000000000b
		shr eax, 10
		
		cmp eax, 00b
		jz dSample100

		cmp eax, 00b
		jz dSample200

		cmp eax, 00b
		jz dSample2500

		cmp eax, 01b
		jz dSample101

		cmp eax, 01b
		jz dSample201

		cmp eax, 01b
		jz dSample2501

		cmp eax, 10b
		jz dSample110

		cmp eax, 10b
		jz dSample210

		cmp eax, 10b
		jz dSample2510

		mov edx, offset vSampleReserved
		jmp SampleDisplay



	
	dSample100:
		mov edx, offset vSample100
		jmp	SampleDisplay

	dSample200:
		mov edx, offset vSample200
		jmp	SampleDisplay

	dSample2500:
		mov edx, offset vSample2500
		jmp	SampleDisplay

	dSample101:
		mov edx, offset vSample101
		jmp	SampleDisplay

	dSample201:
		mov edx, offset vSample201
		jmp	SampleDisplay

	dSample2501:
		mov edx, offset vSample2501
		jmp	SampleDisplay

	dSample110:
		mov edx, offset vSample110
		jmp	SampleDisplay

	dSample210:
		mov edx, offset vSample210
		jmp	SampleDisplay

	dSample2510:
		mov edx, offset vSample2510
		jmp	SampleDisplay






	SampleDisplay:
		call WriteString 


call ReadChar
main ENDP

END main
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top