diff --git a/messages.asm b/messages.asm index 529b262..7eb7a7b 100644 --- a/messages.asm +++ b/messages.asm @@ -6,7 +6,7 @@ HEIGHT equ 0x18 ; 24 VIDEO_MODE equ 0x3 ; 80x25 screen, text mode 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 @@ -36,9 +36,9 @@ mov sp, 0x2000 ; initialise stack pointer ;; 1 1 8 ;; 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 dx, 0x0 ; COM1 +mov dx, 0x0 ; COM1 int 0x14 ;; Use color mode @@ -119,7 +119,7 @@ int 0x10 ;; - ax ;; - bl change_color_mode: - call readbyte ; get byte from keyboard (in al) + call readbyte ; get byte from keyboard (in al) mov [color_mode], al ; store byte in color_mode variable jmp compare_virtual_and_jump @@ -159,7 +159,7 @@ newline: beep: call read_duration ; get duration from keyboard (in al) mov ah, 0 - push ax ; store on stack + push ax ; store on stack ;; move 182 (0b10 11 011 0) into al ;; bit 7-6 = channel select (2, PC speaker) @@ -175,15 +175,15 @@ beep: sal ax, 5 ; multiply by 32 add ax, 1140 - out PIT_CH2_DATA_PORT, al ; Output low byte. + out PIT_CH2_DATA_PORT, al ; Output low byte. mov al, ah - out PIT_CH2_DATA_PORT, al ; Output high byte + out PIT_CH2_DATA_PORT, al ; Output high byte ;; Port 0x61 does a whole lot but only the bottom 2 bits are relevant here ;; (speaker enable and speaker input select) - in al, 0x61 ; Preserve previous value + in al, 0x61 ; Preserve previous value 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. @@ -199,13 +199,13 @@ beep: .pause1: mov ecx, 65535 .pause2: - dec cx ; count down + dec cx ; count 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 - 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) out 0x61, al ; Send new value @@ -220,10 +220,10 @@ beep: ;; - dx nonewline: ;; Write character - mov ah, 0x09 ; write character with attribute - mov bh, 0x00 ; page number + mov ah, 0x09 ; write character with attribute + mov bh, 0x00 ; page number 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 ;; Get current cursor position @@ -277,7 +277,7 @@ readbyte: int 0x16 ;; Read character is in al - sub al, 'a' ; Normalise + sub al, 'a' ; Normalise mov bl, al shl bl, 0x04 ; First character is upper 4 bits