remove unnecessary instructions
This commit is contained in:
parent
6f971cf6c7
commit
e2747fc424
1 changed files with 10 additions and 10 deletions
18
messages.asm
18
messages.asm
|
@ -167,7 +167,7 @@ beep:
|
|||
;; interrupt 0x16, ah=0 returns the read scancode in ah
|
||||
;; so ah must be reset
|
||||
mov ah, 0
|
||||
push ax ; store on stack
|
||||
mov cx, ax ; save ax into cx temporarily
|
||||
|
||||
;; move 182 (0b10 11 011 0) into al
|
||||
;; bit 7-6 = channel select (2, PC speaker)
|
||||
|
@ -196,12 +196,9 @@ beep:
|
|||
;; mov bx, 50000 ; Pause for duration of note.
|
||||
|
||||
;; multiply duration by 3125
|
||||
pop bx ; pull duration value from stack into bx
|
||||
push ax ; save ax (contains garbage?)
|
||||
;; (duration is in cx)
|
||||
mov ax, 3125
|
||||
mul bx
|
||||
mov bx, ax ; move dur * 3125 into bx
|
||||
pop ax ; restore ax
|
||||
mul cx ; multiply ax <- ax * cx
|
||||
|
||||
;; play note for a certain duration
|
||||
.pause1:
|
||||
|
@ -210,7 +207,7 @@ beep:
|
|||
dec cx ; count down
|
||||
jne .pause2 ; if not zero keep counting down
|
||||
|
||||
dec bx ; decrement duration counter
|
||||
dec ax ; decrement duration counter
|
||||
jne .pause1 ; keep doing that until it is 0
|
||||
|
||||
in al, 0x61 ; Preserve previous value
|
||||
|
@ -235,7 +232,8 @@ nonewline:
|
|||
int 0x10
|
||||
|
||||
;; Get current cursor position
|
||||
;; dh = row, dl = col
|
||||
;; bh already contains page number
|
||||
;; returns dh = row, dl = col
|
||||
mov ah, 0x03 ; get cursor position and shape
|
||||
int 0x10
|
||||
|
||||
|
@ -252,7 +250,9 @@ nonewline:
|
|||
|
||||
.noeol:
|
||||
;; Move cursor forward
|
||||
inc dl
|
||||
;; bh already contains page number
|
||||
;; dh already contains row
|
||||
inc dl ; go to next col
|
||||
mov ah, 0x02 ; set cursor position, dh (row) already set, dl (col) updated on prev line
|
||||
int 0x10
|
||||
|
||||
|
|
Loading…
Reference in a new issue