Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as AVR assembler by Taka ( 7 years ago )
org 0x7C00 ; BIOS loads our programm at this address
bits 16 ; We're working at 16-bit mode here
;%1 is string to
print MACRO 1
mov si, %1
mov ah, 0x0E
.loop lodsb
or al, al
jz done
int 0x10
jmp .loop
done:
%ENDMACRO
;%1 is prompt to output
;%2 is memory address to put string
input_line %MACRO 2
print %1
mov cl,
get_key:
mov ah, 00h
int 16h
mov bh, al ;
cmp bh, 1C ;check to see if we user pressed enter. If so, we are done with input
je done
;if we aren't done
mov si, al ;move the recieved ascii character into si
inc si ;move on to the next character
jmp get_key
done:
mov %2, si
%ENDMACRO
start:
mov ah, 2
mov bh, 0
mov dh, 10
mov dl, 17
int 10h
;cli ; Disable the interrupts
mov si, msg ; SI now points to our message
mov ah, 0x0E ; Indicate BIOS we're going to print chars
.loop lodsb ; Loads SI into AL and increments SI [next char]
or al, al ; Checks if the end of the string
jz msg_done ; Jump to halt if the end
int 0x10 ; Otherwise, call interrupt for printing the char
jmp .loop ; Next iteration of the loop
;sti ;set our interrupts up for use again
msg_done:
mov ah, 2
mov bh, 0
mov dh, 15
mov dl, 25
int 10h
mov si, msg2 ; SI now points to our message
mov ah, 0x0E ; Indicate BIOS we're going to print chars
.loop lodsb ; Loads SI into AL and increments SI [next char]
or al, al ; Checks if the end of the string
jz msg2_done ; Jump to halt if the end
int 0x10 ; Otherwise, call interrupt for printing the char
jmp .loop ; Next iteration of the loop
msg2_done:
get_keyboard:
mov ah, 00h
int 16h
mov bl, ah
cmp bl, 1C
jne get_keyboard
;
;print out username:
print uname_prompt
;
;read in username
;
;print out password:
print p_prompt
;
;read in password
;mov ah, 0x00
;mov al, 0x13
;int 10h
;mov ah, 0x09
;mov al, 0x05
;mov bh, 0x00
;mov bl, 4
;mov cx, 1
;int 10h
halt: hlt ; CPU command to halt the execution
msg: db "Behold, My Glorious Operating System!", 0 ; Our actual message to print
msg2: db "(please press enter)", 0
uname_prompt: db "username:", 0
p_prompt: db "password", 0
;; Magic numbers
times 510 - ($ - $$) db 0
dw 0xAA55
;Taka
org 0x7C00 ; BIOS loads our programm at this address
bits 16 ; We're working at 16-bit mode here
jmp main
clear_screen:
mov ax, 0600h
mov bh, 17h
mov cx, 00
mov dx, 184Fh
int 10h
nop
ret
mov_cursor:
mov ah, 2
mov bh, 0
mov dh, 10
mov dl, 17
int 10h
ret
display_string:
.loop lodsb
or al, al ; Checks if the end of the string
jz done ; Jump to halt if the end
int 0x10 ; Otherwise, call interrupt for printing the char
jmp .loop
done:
ret
mov_cursor2:
mov ah, 2
mov bh, 0
mov dh, 15
mov dl, 25
int 10h
ret
get_chars:
mov ah, 01
int 21h
ret
;get_input:
;mov ah, 00h
;int 16h
next_phase:
call clear_screen
halt: hlt ; CPU command to halt the execution
msg: db "Behold, My Glorious Operating System!", 0 ; Our actual message to print
msg2: db "(please press enter)", 0
msg3: db "AAAAAAAAAAAAAAAAA", 0
;; Magic numbers
main:
call clear_screen
call mov_cursor
mov si, msg ; SI now points to our message
mov ah, 0x0E
call display_string
call mov_cursor2
mov si, msg2
mov ah, 0x0E; set instruction id
call display_string
mov al, 30h
call get_chars
cmp al, 30h
jg next_phase
times 510 - ($ - $$) db 0
dw 0xAA55
Revise this Paste
Parent: 97808