2022-01-18 05:15:28 -08:00
|
|
|
; x86
|
|
|
|
; 16-bit - Real Mode, V86 Mode
|
|
|
|
|
|
|
|
%include "AAL.x86.S"
|
|
|
|
%include "AAL.x86.routines.macros.S"
|
|
|
|
|
|
|
|
|
2022-02-05 08:19:40 -08:00
|
|
|
%macro DblNewLine_Out 0
|
|
|
|
mov AH, Video_TeleType
|
|
|
|
mov AL, char_LF
|
|
|
|
int VideoService
|
|
|
|
mov AL, char_CR
|
|
|
|
int VideoService
|
|
|
|
mov AL, char_LF
|
|
|
|
int VideoService
|
|
|
|
mov AL, char_CR
|
|
|
|
int VideoService
|
|
|
|
%endmacro
|
|
|
|
|
|
|
|
; CmdStr Interface
|
|
|
|
; Inline
|
|
|
|
%macro CmdStr_Get 0
|
|
|
|
mov SI, CmdStr
|
|
|
|
%endmacro
|
|
|
|
|
|
|
|
; Inline
|
|
|
|
%macro CmdStr_Add 0
|
|
|
|
; Put input char to CmdStr
|
|
|
|
mov [SI], AL
|
|
|
|
; Increment DI, and increment cmdstr length.
|
|
|
|
inc SI
|
|
|
|
%endmacro
|
|
|
|
|
|
|
|
|
2022-01-18 05:15:28 -08:00
|
|
|
;=============================================================================================================
|
2022-01-18 18:24:06 -08:00
|
|
|
; Entrypoint
|
2022-01-18 05:15:28 -08:00
|
|
|
;=============================================================================================================
|
|
|
|
start:
|
2022-02-05 08:19:40 -08:00
|
|
|
mov AH, Video_SetMode
|
|
|
|
mov AL, VideoMode_Graphics_640_480_VGA
|
|
|
|
int VideoService
|
|
|
|
|
|
|
|
; Give some times before starting
|
|
|
|
mov AH, BIOS_Wait
|
|
|
|
mov CX, 0x10
|
|
|
|
int SystemService
|
|
|
|
|
|
|
|
String_Out EntryMsg, [EntryMsg_len]
|
|
|
|
DblNewLine_Out
|
|
|
|
|
|
|
|
; Give some times before starting
|
|
|
|
mov AH, BIOS_Wait
|
|
|
|
mov CX, 0x01
|
|
|
|
int SystemService
|
|
|
|
|
|
|
|
String_Out Input_F, [Input_F_len]
|
|
|
|
|
|
|
|
push SI
|
|
|
|
; SI will be used as the char index in CmdStr
|
|
|
|
|
|
|
|
|
|
|
|
CmdStr_Get
|
|
|
|
inputLoop:
|
|
|
|
; Wait for input
|
|
|
|
mov AH, Keyboard_GetKeyStroke
|
|
|
|
mov AL, 0x00
|
|
|
|
int KeyboardService
|
|
|
|
|
|
|
|
CmdStr_Add
|
|
|
|
|
|
|
|
; Prep to outout character
|
|
|
|
mov AH, Video_TeleType
|
|
|
|
mov BH, 0x00
|
|
|
|
|
|
|
|
cmp AL, KeyL_Enter
|
|
|
|
je exe_Command
|
|
|
|
|
|
|
|
; Output character if command not recognized
|
|
|
|
int VideoService
|
|
|
|
|
|
|
|
NewLine_Out
|
2022-01-18 05:15:28 -08:00
|
|
|
|
2022-02-05 08:19:40 -08:00
|
|
|
jmp short inputLoop
|
|
|
|
|
|
|
|
exe_Command:
|
|
|
|
; pop SI
|
|
|
|
mov AL, [CmdStr]
|
|
|
|
|
|
|
|
|
|
|
|
cmp AL, KeyL_N
|
|
|
|
je end_execution
|
|
|
|
|
|
|
|
cmp AL, KeyL_F
|
|
|
|
jne error_CmdNotFound
|
|
|
|
String_Out CmdFile, [CmdFile_len]
|
|
|
|
|
|
|
|
CmdStr_Get
|
|
|
|
jmp short inputLoop
|
|
|
|
|
|
|
|
error_CmdNotFound:
|
|
|
|
String_Out CmdNotFnd, [CmdNotFnd_len]
|
|
|
|
|
|
|
|
CmdStr_Get
|
|
|
|
jmp short inputLoop
|
|
|
|
; End Program
|
|
|
|
; cli
|
|
|
|
; hlt
|
|
|
|
|
|
|
|
jmp short inputLoop
|
|
|
|
|
|
|
|
|
|
|
|
end_execution:
|
|
|
|
String_Out ExitMsg, [ExitMsg_len]
|
|
|
|
|
|
|
|
cli
|
|
|
|
hlt
|
2022-01-18 05:15:28 -08:00
|
|
|
|
2022-01-18 18:24:06 -08:00
|
|
|
hang:
|
2022-01-18 05:15:28 -08:00
|
|
|
jmp short hang
|
|
|
|
|
|
|
|
|
|
|
|
;=============================================================================================================
|
|
|
|
; Data
|
|
|
|
;=============================================================================================================
|
2022-02-05 08:19:40 -08:00
|
|
|
EntryMsg_len : dw 29
|
|
|
|
EntryMsg : db 'Bare x86 Mode: 16 bit (Real)', str_endl
|
|
|
|
; EntryMsg_len : equ $ - EntryMsg
|
|
|
|
|
|
|
|
ExitMsg_len : dw 12
|
|
|
|
ExitMsg : db 'Exiting...', str_endl
|
|
|
|
|
|
|
|
Input_F_len : dw 36
|
|
|
|
Input_F : db 'F) File/Program Browser & Launcher', str_endl
|
|
|
|
|
|
|
|
CmdFile_len : dw 14
|
|
|
|
CmdFile : db 'Command File', str_endl
|
|
|
|
|
|
|
|
CmdNotFnd_len : dw 19
|
|
|
|
CmdNotFnd : db 'Command not found', str_endl
|
|
|
|
|
|
|
|
CmdStr_len : dw 0
|
|
|
|
CmdStr : db ''
|
2022-01-18 05:15:28 -08:00
|
|
|
|
|
|
|
|
2022-01-18 18:24:06 -08:00
|
|
|
%include "AAL.x86.routines.s"
|
2022-01-18 05:15:28 -08:00
|
|
|
|
|
|
|
|
|
|
|
;=============================================================================================================
|
|
|
|
; Wrap up
|
|
|
|
;=============================================================================================================
|
|
|
|
; Byte pad 512 bytes (zeroed)
|
2022-01-18 18:24:06 -08:00
|
|
|
times 512-$+start db 0
|