--- mp3player051.orrig/player.asm	Sun Dec 17 20:09:27 2000
+++ mp3player051/player.asm	Tue Dec 19 01:26:26 2000
@@ -149,12 +149,15 @@
 .equ	state_next, 0x42		;1 byte
 .equ	state_prev, 0x43		;1 byte
 .equ	state_play, 0x44		;1 byte
-.equ	master_slave, 0x45		;1 byte, ide master/slave setting
+.equ	state_rand, 0x45		;1 byte
+.equ	state_vol_up, 0x46		;1 byte
+.equ	state_vol_down, 0x47		;1 byte
+.equ	master_slave, 0x48		;1 byte, ide master/slave setting
 
-.equ	rand_number, 0x46		;1 byte
-.equ	rand_count, 0x47		;1 byte
+.equ	rand_number, 0x49		;1 byte
+.equ	rand_count, 0x4A		;1 byte
 
-.equ	mm_buf, 0x48			;6 bytes
+.equ	mm_buf, 0x4B			;6 bytes
 
 .equ	stack, 0x80
 
@@ -204,6 +207,9 @@
 	mov	state_play, a
 	mov	state_next, a
 	mov	state_prev, a
+	mov	state_rand, a
+	mov	state_vol_up, a
+	mov	state_vol_down, a
 	acall	read_buttons
 	orl	a, 0x10
 	mov	button_state, a
@@ -555,7 +561,7 @@
 	acall	phex32_at_r0
 	lcall	newline
 
-	ajmp	begin_player
+	ajmp	begin_player_first_time
 
 
 
@@ -568,9 +574,13 @@
 ;**                                                         **
 ;*************************************************************
 
-begin_player:
+begin_player_first_time:
+	clr	rand_mode_flag       ; Don't start in random mode
+
 	mov	dptr, #mesg_begin
 	lcall	pstr
+
+begin_player:
 	clr	next_flag
 	clr	prev_flag
 	clr	paused_flag
@@ -861,10 +871,34 @@
 	mov	dptr, #str_play
 	mov	r0, #state_play
 	acall	lexer
-	jnc	check_all_done
+	jnc	check_rand
 	acall	button_play
 	ret
 
+check_rand:
+	mov	dptr, #str_rand
+	mov	r0, #state_rand
+	acall	lexer
+	jnc	check_vol_up
+	acall	button_rand
+	ret
+
+check_vol_up:
+	mov	dptr, #str_vol_up
+	mov	r0, #state_vol_up
+	acall	lexer
+	jnc	check_vol_down
+	acall	button_vol_up
+	ret
+
+check_vol_down:
+	mov	dptr, #str_vol_down
+	mov	r0, #state_vol_down
+	acall	lexer
+	jnc	check_all_done
+	acall	button_vol_down
+	ret
+
 check_all_done:
 	ret
 
@@ -2881,6 +2915,12 @@
 	.db	4, "NEXT"
 str_previous:
 	.db	8, "PREVIOUS"
+str_rand:
+	.db	6, "RANDOM"
+str_vol_up:
+	.db	2, "UP"
+str_vol_down:
+	.db	4, "DOWN"
 
 mesg_init_mm:
 	.db	"Initialize Memory Manager",13,10,0
