make indentation a bit more consistent
This commit is contained in:
parent
03be68cfb7
commit
331da168b4
1 changed files with 10 additions and 10 deletions
20
messages.asm
20
messages.asm
|
@ -6,7 +6,7 @@ HEIGHT equ 0x18 ; 24
|
||||||
VIDEO_MODE equ 0x3 ; 80x25 screen, text mode
|
VIDEO_MODE equ 0x3 ; 80x25 screen, text mode
|
||||||
|
|
||||||
PIT_MODECOMMAND_PORT equ 0x43 ; programmable interval timer mode/command port (used for speaker)
|
PIT_MODECOMMAND_PORT equ 0x43 ; programmable interval timer mode/command port (used for speaker)
|
||||||
PIT_CH2_DATA_PORT equ 0x42 ; PIT channel 2 data port
|
PIT_CH2_DATA_PORT equ 0x42 ; PIT channel 2 data port
|
||||||
|
|
||||||
;; see http://www.ctyme.com/intr/int-10.htm for interrupts
|
;; see http://www.ctyme.com/intr/int-10.htm for interrupts
|
||||||
|
|
||||||
|
@ -36,9 +36,9 @@ mov sp, 0x2000 ; initialise stack pointer
|
||||||
;; 1 1 8
|
;; 1 1 8
|
||||||
|
|
||||||
;; initialise serial port
|
;; initialise serial port
|
||||||
mov ah, 0x0 ; initialise UART
|
mov ah, 0x0 ; initialise UART
|
||||||
mov al, 0b111_00_0_11 ; baud 9600, no parity, 1 stop bit, 8 data bits
|
mov al, 0b111_00_0_11 ; baud 9600, no parity, 1 stop bit, 8 data bits
|
||||||
mov dx, 0x0 ; COM1
|
mov dx, 0x0 ; COM1
|
||||||
int 0x14
|
int 0x14
|
||||||
|
|
||||||
;; Use color mode
|
;; Use color mode
|
||||||
|
@ -159,7 +159,7 @@ newline:
|
||||||
beep:
|
beep:
|
||||||
call read_duration ; get duration from keyboard (in al)
|
call read_duration ; get duration from keyboard (in al)
|
||||||
mov ah, 0
|
mov ah, 0
|
||||||
push ax ; store on stack
|
push ax ; store on stack
|
||||||
|
|
||||||
;; move 182 (0b10 11 011 0) into al
|
;; move 182 (0b10 11 011 0) into al
|
||||||
;; bit 7-6 = channel select (2, PC speaker)
|
;; bit 7-6 = channel select (2, PC speaker)
|
||||||
|
@ -185,7 +185,7 @@ beep:
|
||||||
or al, 00000011b ; Set bits 1 and 0 (enable speaker, input = channel 2)
|
or al, 00000011b ; Set bits 1 and 0 (enable speaker, input = channel 2)
|
||||||
out 0x61, al ; Send new value
|
out 0x61, al ; Send new value
|
||||||
|
|
||||||
;; mov bx, 50000 ; Pause for duration of note.
|
;; mov bx, 50000 ; Pause for duration of note.
|
||||||
|
|
||||||
;; multiply duration by 3125
|
;; multiply duration by 3125
|
||||||
pop bx ; pull duration value from stack into bx
|
pop bx ; pull duration value from stack into bx
|
||||||
|
@ -200,10 +200,10 @@ beep:
|
||||||
mov ecx, 65535
|
mov ecx, 65535
|
||||||
.pause2:
|
.pause2:
|
||||||
dec cx ; count down
|
dec cx ; count down
|
||||||
jne .pause2 ; if not zero keep counting down
|
jne .pause2 ; if not zero keep counting down
|
||||||
|
|
||||||
dec bx ; decrement duration counter
|
dec bx ; decrement duration counter
|
||||||
jne .pause1 ; keep doing that until it is 0
|
jne .pause1 ; keep doing that until it is 0
|
||||||
|
|
||||||
in al, 0x61 ; Preserve previous value
|
in al, 0x61 ; Preserve previous value
|
||||||
and al, 11111100b ; Clear bits 1 and 0 (disable speaker, clear channel select)
|
and al, 11111100b ; Clear bits 1 and 0 (disable speaker, clear channel select)
|
||||||
|
@ -220,10 +220,10 @@ beep:
|
||||||
;; - dx
|
;; - dx
|
||||||
nonewline:
|
nonewline:
|
||||||
;; Write character
|
;; Write character
|
||||||
mov ah, 0x09 ; write character with attribute
|
mov ah, 0x09 ; write character with attribute
|
||||||
mov bh, 0x00 ; page number
|
mov bh, 0x00 ; page number
|
||||||
mov bl, [color_mode] ; BIOS colour code
|
mov bl, [color_mode] ; BIOS colour code
|
||||||
mov cx, 0x01 ; amount of times to print character
|
mov cx, 0x01 ; amount of times to print character
|
||||||
int 0x10
|
int 0x10
|
||||||
|
|
||||||
;; Get current cursor position
|
;; Get current cursor position
|
||||||
|
|
Loading…
Reference in a new issue