Reworked DragonOS file structure
This commit is contained in:
parent
0e25847a69
commit
7f3530ea78
24 changed files with 332 additions and 354 deletions
Binary file not shown.
|
|
@ -1,80 +1,20 @@
|
|||
.load 0x2C00
|
||||
.fixed 1024, 0xFF
|
||||
.entry _kernel0_main
|
||||
.header KERNEL0_BOOT
|
||||
@guard _DISPLAY_DRIVER_DSS_
|
||||
|
||||
@include <../bios_api.dss>
|
||||
@include <palette.dss>
|
||||
@include <keyboard_driver.dss>
|
||||
@include <../../sdk/palette.dss>
|
||||
|
||||
|
||||
## =========================================================================================================================
|
||||
.data
|
||||
$textCell <Text16VModeCell>
|
||||
$test_str "Hello DragonOS! :)"
|
||||
$cursor_x:1
|
||||
|
||||
## =========================================================================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
## =========================================================================================================================
|
||||
.code
|
||||
_kernel0_main:
|
||||
push DefaultPalette.Black
|
||||
push 1
|
||||
call $_clear_screen
|
||||
push $test_str
|
||||
push 1
|
||||
call $_print_string
|
||||
|
||||
mov [$cursor_x], 0
|
||||
|
||||
## Init Keyboard driver
|
||||
push $_key_pressed ## KeyPressed handler address passed to the _init_keyboard subroutine
|
||||
push 1
|
||||
call $_init_keyboard
|
||||
|
||||
_infinite_loop:
|
||||
jmp $_infinite_loop
|
||||
|
||||
hlt
|
||||
## =========================================================================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
## =========================================================================================================================
|
||||
_key_pressed:
|
||||
## debug_break
|
||||
mov R1, [Keyboard_Registers.KEYCODE]
|
||||
|
||||
mov ACC, 13 ## Enter
|
||||
jeq $_key_pressed_enter, R1
|
||||
|
||||
mov ACC, ASCII.LOWERCASE_A
|
||||
jls $_key_pressed_end, R1
|
||||
mov ACC, ASCII.LOWERCASE_Z
|
||||
jgr $_key_pressed_end, R1
|
||||
push R1
|
||||
mov R2, [$cursor_x]
|
||||
push R2
|
||||
push 1
|
||||
push DefaultPalette.Red
|
||||
push 4
|
||||
call $_print_char
|
||||
inc R2
|
||||
mov [$cursor_x], R2
|
||||
jmp $_key_pressed_end
|
||||
|
||||
_key_pressed_enter:
|
||||
mov [$cursor_x], 0
|
||||
mov R10, 0x25
|
||||
int 0x30
|
||||
jmp $_key_pressed_end
|
||||
|
||||
_key_pressed_end:
|
||||
_init_display_driver:
|
||||
ret
|
||||
## =========================================================================================================================
|
||||
|
||||
|
|
@ -1,10 +1,11 @@
|
|||
@guard _KEYBOARD_DRIVER_DSS_
|
||||
|
||||
@include <ascii.dss>
|
||||
@include <../../sdk/ascii.dss>
|
||||
@include <../../sdk/keycodes.dss>
|
||||
|
||||
.code
|
||||
|
||||
_init_keyboard: ## _init_keyboard(func_ptr* key_pressed_handler)
|
||||
_init_keyboard_driver: ## _init_keyboard_driver(func_ptr* key_pressed_handler)
|
||||
arg R9 ## @Param: key_pressed_handler
|
||||
mov R10, 0x00 ## int 0x20 param for set_interrupt_handler
|
||||
mov R8, 0xA0 ## 0xA0 is the hardware interrupt for KeyPressed
|
||||
89
extra/dss/DragonOS/kernel0/kernel0.dss
Normal file
89
extra/dss/DragonOS/kernel0/kernel0.dss
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
.load 0x2C00
|
||||
.fixed 1024, 0xFF
|
||||
.entry _kernel0_main
|
||||
.header KERNEL0_BOOT
|
||||
|
||||
@include <../../sdk/bios_api.dss>
|
||||
@include <../../sdk/palette.dss>
|
||||
@include <../drivers/keyboard_driver.dss>
|
||||
@include <../drivers/display_driver.dss>
|
||||
@include <memory.dss>
|
||||
|
||||
|
||||
## =========================================================================================================================
|
||||
.data
|
||||
$test_str "Hello DragonOS! :)"
|
||||
$cursor_x:1
|
||||
|
||||
## =========================================================================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
## =========================================================================================================================
|
||||
.code
|
||||
_kernel0_main:
|
||||
push DefaultPalette.Black
|
||||
push 1
|
||||
call $_clear_screen
|
||||
push $test_str
|
||||
push 1
|
||||
call $_print_string
|
||||
debug_break
|
||||
|
||||
mov [$cursor_x], 0
|
||||
|
||||
## Init Memory Handler
|
||||
push 0
|
||||
call $_init_memory_handler
|
||||
|
||||
## Init Display driver
|
||||
push 0
|
||||
call $_init_display_driver
|
||||
|
||||
## Init Keyboard driver
|
||||
push $_key_pressed ## KeyPressed handler address passed to the _init_keyboard subroutine
|
||||
push 1
|
||||
call $_init_keyboard_driver
|
||||
|
||||
_infinite_loop:
|
||||
jmp $_infinite_loop
|
||||
|
||||
hlt
|
||||
## =========================================================================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
## =========================================================================================================================
|
||||
_key_pressed:
|
||||
## debug_break
|
||||
mov R1, [Keyboard_Registers.KEYCODE]
|
||||
|
||||
mov ACC, KeyCodes.Return
|
||||
jeq $_key_pressed_enter, R1
|
||||
|
||||
mov ACC, KeyCodes.LowerCase_a
|
||||
jls $_key_pressed_end, R1
|
||||
mov ACC, KeyCodes.LowerCase_z
|
||||
jgr $_key_pressed_end, R1
|
||||
push R1
|
||||
mov R2, [$cursor_x]
|
||||
push R2
|
||||
push 1
|
||||
push DefaultPalette.Red
|
||||
push 4
|
||||
call $_print_char
|
||||
inc R2
|
||||
mov [$cursor_x], R2
|
||||
jmp $_key_pressed_end
|
||||
|
||||
_key_pressed_enter:
|
||||
mov [$cursor_x], 0
|
||||
mov R10, 0x25
|
||||
int 0x30
|
||||
jmp $_key_pressed_end
|
||||
|
||||
_key_pressed_end:
|
||||
ret
|
||||
## =========================================================================================================================
|
||||
7
extra/dss/DragonOS/kernel0/memory.dss
Normal file
7
extra/dss/DragonOS/kernel0/memory.dss
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
@guard _MEMORY_DSS_
|
||||
|
||||
.code
|
||||
|
||||
_init_memory_handler:
|
||||
mov R6, 0xFAAA
|
||||
ret
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
@guard _DATA_DSS_
|
||||
|
||||
@export BIOS_API dss/bios_api.dss
|
||||
@export BIOS_API dss/sdk//bios_api.dss
|
||||
|
||||
@export_comment BIOS_API " --"
|
||||
@export_comment BIOS_API " -- This file is automatically generated by the DragonAssembler (version %dasm_version%) "
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@
|
|||
.entry _drake_bootsector_entry_point
|
||||
.fixed 5120, 0xFF
|
||||
|
||||
@include <../bios_api.dss>
|
||||
@include <palette.dss>
|
||||
@include <keyboard_driver.dss>
|
||||
@include <../sdk/bios_api.dss>
|
||||
@include <../sdk/palette.dss>
|
||||
|
||||
@define OS_LOAD_ADDR 0x2C00
|
||||
|
||||
|
|
@ -48,24 +47,6 @@ _drake_bootsector_entry_point:
|
|||
mov ACC, [$dpt_block]
|
||||
jne $_invalid_dpt_block, 0xF1CA
|
||||
|
||||
## Init Keyboard driver
|
||||
## push $_key_pressed ## KeyPressed handler address passed to the _init_keyboard subroutine
|
||||
## push 1
|
||||
## call $_init_keyboard
|
||||
|
||||
## Enable Double buffering
|
||||
## mov R2, [VGA_Registers.FLAGS]
|
||||
## or R2, 0b0000000000000001
|
||||
## mov [VGA_Registers.FLAGS], ACC
|
||||
|
||||
## @call(_clear_screen, DefaultPalette.DarkBlue)
|
||||
## @_clear_screen(DefaultPalette.DarkBlue)
|
||||
|
||||
## mov R10, 0x22
|
||||
## mov R8, { $dpt_block + DPTStructure.ENTRIES_START + (2 * DPTStructure.ENTRY_SIZE_B) + DPTStructure.ENTRY_PART_LBL }
|
||||
## mov R9, $textCell
|
||||
## int 0x30
|
||||
|
||||
jmp $_endless_loop
|
||||
_invalid_dpt_block: ## TODO: Fix screen drawing on error
|
||||
push $invalid_dpt_block_str
|
||||
|
|
@ -83,14 +64,6 @@ _endless_loop:
|
|||
push 0
|
||||
call $_print_system_info
|
||||
|
||||
## Draw main box
|
||||
## push 0
|
||||
## call $_print_main_box
|
||||
|
||||
## Swap the buffers
|
||||
## push 0
|
||||
## call $_swap_buffers
|
||||
|
||||
mov R10, $dpt_block.PartCount
|
||||
movb ACC, *R10
|
||||
jge $_no_partitions_found, 1
|
||||
|
|
@ -304,123 +277,4 @@ _clear_screen: ## _clear_screen(int8_t color)
|
|||
mov R9, $textCell
|
||||
int 0x30
|
||||
ret
|
||||
## =========================================================================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
## =========================================================================================================================
|
||||
_redraw_screen:
|
||||
movb [VGA_Registers.SIGNAL], Sig_VGA_Text_16_Color.FORCE_REDRAW_SCREEN
|
||||
ret
|
||||
## =========================================================================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
## =========================================================================================================================
|
||||
## _swap_buffers:
|
||||
## movb [VGA_Registers.SIGNAL], Sig_VGA_Text_16_Color.SWAP_BUFFERS
|
||||
## ret
|
||||
## =========================================================================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
## =========================================================================================================================
|
||||
## _key_pressed:
|
||||
## mov ACC, [Keyboard_Registers.KEYCODE]
|
||||
## jne $_key_pressed_end, 0x0127
|
||||
## _key_pressed_end:
|
||||
## ret
|
||||
## =========================================================================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
## =========================================================================================================================
|
||||
## _print_main_box:
|
||||
## movb [$textCell.CoordX], 5
|
||||
## movb [$textCell.CoordY], 2
|
||||
## movb [$textCell.Foreground], DefaultPalette.Sky
|
||||
## movb [$textCell.Background], DefaultPalette.DarkBlue
|
||||
## movb [$textCell.Character], 0x3D
|
||||
##
|
||||
## mov R8, [CMOS_Settings.SCREEN_WIDTH]
|
||||
## subip R8, 10
|
||||
##
|
||||
## push $textCell
|
||||
## push R8
|
||||
## push 2
|
||||
## call $_draw_horizontal_line
|
||||
##
|
||||
## movb [$textCell.CoordX], 5
|
||||
## movb [$textCell.CoordY], 12
|
||||
## push $textCell
|
||||
## push R8
|
||||
## push 2
|
||||
## call $_draw_horizontal_line
|
||||
##
|
||||
## movb [$textCell.CoordX], 4
|
||||
## movb [$textCell.CoordY], 2
|
||||
## movb [$textCell.Character], 0x7C
|
||||
## push $textCell
|
||||
## push 11
|
||||
## push 2
|
||||
## call $_draw_vertical_line
|
||||
##
|
||||
## addip R8, 5
|
||||
## movb [$textCell.CoordX], R8
|
||||
## movb [$textCell.CoordY], 2
|
||||
## push $textCell
|
||||
## push 11
|
||||
## push 2
|
||||
## call $_draw_vertical_line
|
||||
## ret
|
||||
## =========================================================================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
## =========================================================================================================================
|
||||
## _draw_horizontal_line: ## _draw_horizontal_line(TextCell16* cell, int8_t length)
|
||||
## arg R1 ## @Param: cell
|
||||
## arg R2 ## @Param: length
|
||||
## mov R3, R1
|
||||
## addip R3, 3
|
||||
## movb R4, *R3
|
||||
##
|
||||
## mov R10, 0x21
|
||||
## mov R9, R1
|
||||
## _draw_horizontal_line_loop:
|
||||
## int 0x30
|
||||
## movb R5, *R3
|
||||
## inc R5
|
||||
## movb *R3, R5
|
||||
## sub R5, R4
|
||||
## jgr $_draw_horizontal_line_loop, R2
|
||||
## ret
|
||||
## =========================================================================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
## =========================================================================================================================
|
||||
## _draw_vertical_line: ## _draw_line(TextCell16* cell, int8_t length)
|
||||
## arg R1 ## @Param: cell
|
||||
## arg R2 ## @Param: length
|
||||
## mov R3, R1
|
||||
## addip R3, 4
|
||||
## movb R4, *R3
|
||||
##
|
||||
## mov R10, 0x21
|
||||
## mov R9, R1
|
||||
## _draw_vertical_line_loop:
|
||||
## int 0x30
|
||||
## movb R5, *R3
|
||||
## inc R5
|
||||
## movb *R3, R5
|
||||
## sub R5, R4
|
||||
## jgr $_draw_vertical_line_loop, R2
|
||||
## ret
|
||||
## =========================================================================================================================
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
@guard _KEYBOARD_DRIVER_DSS_
|
||||
|
||||
.code
|
||||
|
||||
_init_keyboard: ## _init_keyboard(func_ptr* key_pressed_handler)
|
||||
arg R9 ## @Param: key_pressed_handler
|
||||
mov R10, 0x00 ## int 0x20 param for set_interrupt_handler
|
||||
mov R8, 0xA0 ## 0xA0 is the hardware interrupt for KeyPressed
|
||||
int 0x20
|
||||
ret
|
||||
|
|
@ -1,25 +1,15 @@
|
|||
.load 0x1380
|
||||
.entry _drake_loader_entry_point
|
||||
.fixed 512, 0x00
|
||||
|
||||
@include <../bios_api.dss>
|
||||
@include <../sdk/bios_api.dss>
|
||||
|
||||
.data
|
||||
## $_drake_logo_line_1 " ___ ___ ___ __ ______"
|
||||
## $_drake_logo_line_2 " / _ \/ _ \/ _ | / //_/ __/"
|
||||
## $_drake_logo_line_3 " / // / , _/ __ |/ ,< / _/ "
|
||||
## $_drake_logo_line_4 "/____/_/|_/_/ |_/_/|_/___/ "
|
||||
## $_logo_padding " "
|
||||
|
||||
$ddd <DiskDriverData>
|
||||
|
||||
|
||||
.code
|
||||
_drake_loader_entry_point:
|
||||
## mov R10, 0xE0
|
||||
## int 0x30
|
||||
## push 0
|
||||
## call $_print_logo
|
||||
|
||||
mov [$ddd.Mode], DiskMode.READ
|
||||
mov [$ddd.Disk], 0x00
|
||||
mov [$ddd.Sector], 0x0000
|
||||
|
|
@ -34,21 +24,3 @@ _drake_loader_entry_point:
|
|||
jmp MemoryAddresses.RAM
|
||||
hlt
|
||||
|
||||
## _print_logo:
|
||||
## mov R5, $_drake_logo_line_1
|
||||
## mov R6, 0
|
||||
## mov ACC, 6
|
||||
## _print_logo_loop:
|
||||
## mov R10, 0x0C
|
||||
## inc R6
|
||||
## mov R9, $_logo_padding
|
||||
## int 0x30
|
||||
## mov R9, R5
|
||||
## int 0x30
|
||||
## mov R10, 0x02
|
||||
## int 0x30
|
||||
## addip R5, 29
|
||||
## jls $_print_logo_loop, R6
|
||||
## ret
|
||||
|
||||
.fixed 512, 0x00
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
@guard _PALETTE_DSS_
|
||||
|
||||
@group DefaultPalette
|
||||
Black 0x00
|
||||
Gray 0x01
|
||||
White 0x02
|
||||
Red 0x03
|
||||
Pink 0x04
|
||||
Brown 0x05
|
||||
DarkOrange 0x06
|
||||
Orange 0x07
|
||||
Yellow 0x08
|
||||
DarkGreen 0x09
|
||||
Green 0x0A
|
||||
Lime 0x0B
|
||||
DarkBlue 0x0C
|
||||
Blue 0x0D
|
||||
LightBlue 0x0E
|
||||
Sky 0x0F
|
||||
@end
|
||||
|
||||
.code
|
||||
|
||||
_draw_palette: ## _draw_palette(word x, word y)
|
||||
arg R1
|
||||
movb [$textCell.CoordX], R1
|
||||
arg R2
|
||||
movb [$textCell.CoordY], R2
|
||||
movb [$textCell.Character], 0x20
|
||||
movb [$textCell.Foreground], 0
|
||||
mov R5, 0
|
||||
_draw_palette_loop:
|
||||
movb [$textCell.Background], R5
|
||||
movb R6, [$textCell.CoordX]
|
||||
inc R6
|
||||
movb [$textCell.CoordX], R6
|
||||
|
||||
mov R10, 0x21
|
||||
mov R9, $textCell
|
||||
int 0x30
|
||||
|
||||
inc R5
|
||||
mov ACC, R5
|
||||
jge $_draw_palette_loop, 15
|
||||
ret
|
||||
156
extra/dss/sdk/keycodes.dss
Normal file
156
extra/dss/sdk/keycodes.dss
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
@guard _KEYCODES_DSS_
|
||||
|
||||
@group KeyCodes
|
||||
Delete 0x7F
|
||||
Return 0x0D
|
||||
Escape 0x1B
|
||||
Backspace 0x08
|
||||
Tab 0x09
|
||||
Spacebar 0x20
|
||||
ExclamationMark 0x21
|
||||
DoubleQuote 0x22
|
||||
Hash 0x23
|
||||
Percent 0x25
|
||||
DollarSign 0x24
|
||||
Ampersand 0x26
|
||||
SingleQuote 0x27
|
||||
LeftParenthesis 0x28
|
||||
RightParenthesis 0x29
|
||||
Asterisk 0x2A
|
||||
Plus 0x2B
|
||||
Comma 0x2C
|
||||
Minus 0x2D
|
||||
Period 0x2E
|
||||
ForwardSlash 0x2F
|
||||
Num0 0x30
|
||||
Num1 0x31
|
||||
Num2 0x32
|
||||
Num3 0x33
|
||||
Num4 0x34
|
||||
Num5 0x35
|
||||
Num6 0x36
|
||||
Num7 0x37
|
||||
Num8 0x38
|
||||
Num9 0x39
|
||||
Colon 0x3A
|
||||
Semicolon 0x3B
|
||||
LessThan 0x3C
|
||||
Equals 0x3D
|
||||
GreaterThan 0x3E
|
||||
QuestionMark 0x3F
|
||||
AtSign 0x40
|
||||
|
||||
UpperCase_A 0x41
|
||||
UpperCase_B 0x42
|
||||
UpperCase_C 0x43
|
||||
UpperCase_D 0x44
|
||||
UpperCase_E 0x45
|
||||
UpperCase_F 0x46
|
||||
UpperCase_G 0x47
|
||||
UpperCase_H 0x48
|
||||
UpperCase_I 0x49
|
||||
UpperCase_J 0x4A
|
||||
UpperCase_K 0x4B
|
||||
UpperCase_L 0x4C
|
||||
UpperCase_M 0x4D
|
||||
UpperCase_N 0x4E
|
||||
UpperCase_O 0x4F
|
||||
UpperCase_P 0x50
|
||||
UpperCase_Q 0x51
|
||||
UpperCase_R 0x52
|
||||
UpperCase_S 0x53
|
||||
UpperCase_T 0x54
|
||||
UpperCase_U 0x55
|
||||
UpperCase_V 0x56
|
||||
UpperCase_W 0x57
|
||||
UpperCase_X 0x58
|
||||
UpperCase_Y 0x59
|
||||
UpperCase_Z 0x5A
|
||||
|
||||
LeftBracket 0x5B
|
||||
BackSlash 0x5C
|
||||
RightBracket 0x5D
|
||||
Caret 0x5E
|
||||
Underscore 0x5F
|
||||
BackQuote 0x60
|
||||
LowerCase_a 0x61
|
||||
LowerCase_b 0x62
|
||||
LowerCase_c 0x63
|
||||
LowerCase_d 0x64
|
||||
LowerCase_e 0x65
|
||||
LowerCase_f 0x66
|
||||
LowerCase_g 0x67
|
||||
LowerCase_h 0x68
|
||||
LowerCase_i 0x69
|
||||
LowerCase_j 0x6A
|
||||
LowerCase_k 0x6B
|
||||
LowerCase_l 0x6C
|
||||
LowerCase_m 0x6D
|
||||
LowerCase_n 0x6E
|
||||
LowerCase_o 0x6F
|
||||
LowerCase_p 0x70
|
||||
LowerCase_q 0x71
|
||||
LowerCase_r 0x72
|
||||
LowerCase_s 0x73
|
||||
LowerCase_t 0x74
|
||||
LowerCase_u 0x75
|
||||
LowerCase_v 0x76
|
||||
LowerCase_w 0x77
|
||||
LowerCase_x 0x78
|
||||
LowerCase_y 0x79
|
||||
LowerCase_z 0x7A
|
||||
|
||||
LeftCTRL 0x0100
|
||||
RightCTRL 0x0101
|
||||
LeftALT 0x0102
|
||||
RightALT 0x0103
|
||||
LeftShift 0x0104
|
||||
RightShift 0x0105
|
||||
|
||||
KeyPadDivide 0x0106
|
||||
KeyPadMultiply 0x0107
|
||||
KeyPadMinus 0x0108
|
||||
KeyPadPlus 0x0109
|
||||
KeyPadEnter 0x010A
|
||||
KeyPad1 0x010B
|
||||
KeyPad2 0x010C
|
||||
KeyPad3 0x010D
|
||||
KeyPad4 0x010E
|
||||
KeyPad5 0x010F
|
||||
KeyPad6 0x0110
|
||||
KeyPad7 0x0111
|
||||
KeyPad8 0x0112
|
||||
KeyPad9 0x0113
|
||||
KeyPad0 0x0114
|
||||
KeyPadPeriod 0x0115
|
||||
|
||||
PrintScreen 0x0116
|
||||
Insert 0x0117
|
||||
Home 0x0118
|
||||
PageUp 0x0119
|
||||
End 0x011A
|
||||
PageDown 0x011B
|
||||
RightArrow 0x011C
|
||||
LeftArrow 0x011D
|
||||
DownArrow 0x011E
|
||||
UpArrow 0x011F
|
||||
CapsLock 0x0120
|
||||
NumLock 0x0121
|
||||
ScrollLock 0x0122
|
||||
|
||||
F1 0x0123
|
||||
F2 0x0124
|
||||
F3 0x0125
|
||||
F4 0x0126
|
||||
F5 0x0127
|
||||
F6 0x0128
|
||||
F7 0x0129
|
||||
F8 0x012A
|
||||
F9 0x012B
|
||||
F10 0x012C
|
||||
F11 0x012D
|
||||
F12 0x012E
|
||||
|
||||
LeftSuper 0x012F
|
||||
RightSuper 0x0130
|
||||
@end
|
||||
|
|
@ -14,7 +14,7 @@ printf "${green}\n==============================================================
|
|||
if [ $? -eq 0 ]; then
|
||||
cd scripts
|
||||
/bin/bash ./bios_flash
|
||||
cp ../dss/bios_api.dss ../../extra/dss/bios_api.dss
|
||||
cp ../dss/sdk/bios_api.dss ../../extra/dss/sdk/bios_api.dss
|
||||
/bin/bash ./build_drake
|
||||
/bin/bash ./build_dragonos
|
||||
cd ..
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ printf "${green}\n==============================================================
|
|||
if [ $? -eq 0 ]; then
|
||||
cd scripts
|
||||
/bin/bash ./bios_flash
|
||||
cp ../dss/bios_api.dss ../../extra/dss/bios_api.dss
|
||||
cp ../dss/sdk/bios_api.dss ../../extra/dss/sdk/bios_api.dss
|
||||
/bin/bash ./build_drake
|
||||
/bin/bash ./build_dragonos
|
||||
cd ..
|
||||
|
|
|
|||
|
|
@ -7,5 +7,4 @@ printf "${green}Reloading BIOS...\n${clear}"
|
|||
cd ..
|
||||
cp ../extra/dss/bios/* ./dss/bios/
|
||||
./dasm dss/bios/entry.dss -o dragon/bios.bin -D
|
||||
# ./dasm dss/bios/entry.dss -o dragon/bios.bin --extalu --save-disassembly disassembly/bios.dds --verbose --save-exports
|
||||
cp dragon/bios.bin ../extra/dragon/bios.bin
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ clear='\033[0m'
|
|||
|
||||
printf "\n${green}Compiling DragonOS...\n${clear}"
|
||||
cd ..
|
||||
cp ../extra/dss/DragonOS/* ./dss/DragonOS/
|
||||
cp -r ../extra/dss/DragonOS/* ./dss/DragonOS/
|
||||
|
||||
printf "\n${green}1) kernel0.dss\n${clear}"
|
||||
./dasm dss/DragonOS/kernel0.dss -o dragon/kernel0.bin -D --verbose
|
||||
./dasm dss/DragonOS/kernel0/kernel0.dss -o dragon/kernel0.bin -D --verbose
|
||||
./dtools load-binary dragon/disk1.dr dragon/kernel0.bin 0x00018000
|
||||
|
||||
printf "\n"
|
||||
|
|
|
|||
|
|
@ -9,12 +9,10 @@ cp ../extra/dss/drake/* ./dss/drake/
|
|||
|
||||
printf "\n${green}1) loader.dss\n${clear}"
|
||||
./dasm dss/drake/loader.dss -o dragon/drake_loader.bin -D
|
||||
# ./dasm dss/drake/loader.dss -o dragon/drake_loader.bin --extalu --save-disassembly disassembly/drake_loader.dds --verbose
|
||||
./dtools load-binary dragon/disk1.dr dragon/drake_loader.bin 0x00000000
|
||||
|
||||
printf "\n${green}2) bootsector.dss\n${clear}"
|
||||
./dasm dss/drake/bootsector.dss -o dragon/drake_bootsector.bin -D
|
||||
# ./dasm dss/drake/bootsector.dss -o dragon/drake_bootsector.bin --extalu --save-disassembly disassembly/drake_bootsector.dds --verbose
|
||||
./dtools load-binary dragon/disk1.dr dragon/drake_bootsector.bin 0x00000400
|
||||
|
||||
printf "\n"
|
||||
|
|
|
|||
|
|
@ -107,53 +107,59 @@ namespace dragon
|
|||
return serializer.saveToFile(fileName);
|
||||
}
|
||||
|
||||
void Assembler::printProgramInfo(void)
|
||||
void Assembler::printProgramInfo(int32_t verbose_level)
|
||||
{
|
||||
if (verbose_level == 0xFF) return;
|
||||
int32_t symbol_len = 30;
|
||||
out.nl();
|
||||
|
||||
if (m_symbolTable.size() > 0)
|
||||
out.fg(ostd::ConsoleColors::Yellow).p("Symbols:").nl();
|
||||
for (auto& symbol : m_symbolTable)
|
||||
if (verbose_level == 0 || verbose_level == 2)
|
||||
{
|
||||
out.fg(ostd::ConsoleColors::Red).p(ostd::Utils::getHexStr(symbol.second.address, true, 2));
|
||||
out.fg(ostd::ConsoleColors::Magenta).p(" ").p(symbol.first);
|
||||
out.fg(ostd::ConsoleColors::Blue).nl().p(" ");
|
||||
for (auto& b : symbol.second.bytes)
|
||||
out.p(ostd::Utils::getHexStr(b, false, 1)).p(".");
|
||||
out.nl();
|
||||
if (m_symbolTable.size() > 0)
|
||||
out.fg(ostd::ConsoleColors::Yellow).p("Symbols:").nl();
|
||||
for (auto& symbol : m_symbolTable)
|
||||
{
|
||||
out.fg(ostd::ConsoleColors::Red).p(ostd::Utils::getHexStr(symbol.second.address, true, 2));
|
||||
out.fg(ostd::ConsoleColors::Magenta).p(" ").p(symbol.first);
|
||||
out.fg(ostd::ConsoleColors::Blue).nl().p(" ");
|
||||
for (auto& b : symbol.second.bytes)
|
||||
out.p(ostd::Utils::getHexStr(b, false, 1)).p(".");
|
||||
out.nl();
|
||||
}
|
||||
if (m_symbolTable.size() > 0)
|
||||
out.nl();
|
||||
|
||||
if (m_labelTable.size() > 0)
|
||||
out.fg(ostd::ConsoleColors::Yellow).p("Labels:").nl();
|
||||
for (auto& label : m_labelTable)
|
||||
{
|
||||
out.fg(ostd::ConsoleColors::Magenta).p(label.first.new_fixedLength(symbol_len));
|
||||
out.fg(ostd::ConsoleColors::Red).p(ostd::Utils::getHexStr(label.second.address, true, 2)).nl();
|
||||
}
|
||||
if (m_labelTable.size() > 0)
|
||||
out.nl();
|
||||
|
||||
if (m_structDefs.size() > 0)
|
||||
out.fg(ostd::ConsoleColors::Yellow).p("Structures:").nl();
|
||||
for (auto& str : m_structDefs)
|
||||
{
|
||||
out.fg(ostd::ConsoleColors::Magenta).p(str.name.new_fixedLength(symbol_len));
|
||||
out.fg(ostd::ConsoleColors::Red).p(str.size).p(" bytes").nl();
|
||||
}
|
||||
if (m_structDefs.size() > 0)
|
||||
out.nl();
|
||||
}
|
||||
if (m_symbolTable.size() > 0)
|
||||
out.nl();
|
||||
|
||||
if (m_labelTable.size() > 0)
|
||||
out.fg(ostd::ConsoleColors::Yellow).p("Labels:").nl();
|
||||
for (auto& label : m_labelTable)
|
||||
{
|
||||
out.fg(ostd::ConsoleColors::Magenta).p(label.first.new_fixedLength(symbol_len));
|
||||
out.fg(ostd::ConsoleColors::Red).p(ostd::Utils::getHexStr(label.second.address, true, 2)).nl();
|
||||
}
|
||||
if (m_labelTable.size() > 0)
|
||||
out.nl();
|
||||
|
||||
if (m_structDefs.size() > 0)
|
||||
out.fg(ostd::ConsoleColors::Yellow).p("Structures:").nl();
|
||||
for (auto& str : m_structDefs)
|
||||
{
|
||||
out.fg(ostd::ConsoleColors::Magenta).p(str.name.new_fixedLength(symbol_len));
|
||||
out.fg(ostd::ConsoleColors::Red).p(str.size).p(" bytes").nl();
|
||||
}
|
||||
if (m_structDefs.size() > 0)
|
||||
out.nl();
|
||||
|
||||
|
||||
out.fg(ostd::ConsoleColors::Yellow).p("Program data:").nl();
|
||||
out.fg(ostd::ConsoleColors::Cyan).p(ostd::String("Fixed Size: ").new_fixedLength(symbol_len)).fg(ostd::ConsoleColors::BrightRed).p((int)m_fixedSize).p(" bytes").nl();
|
||||
out.fg(ostd::ConsoleColors::Cyan).p(ostd::String("Program Size:").new_fixedLength(symbol_len)).fg(ostd::ConsoleColors::BrightRed).p((int)m_programSize).p(" bytes").nl();
|
||||
out.fg(ostd::ConsoleColors::Cyan).p(ostd::String("Data Size: ").new_fixedLength(symbol_len)).fg(ostd::ConsoleColors::BrightRed).p((int)m_dataSize).p(" bytes").nl();
|
||||
out.fg(ostd::ConsoleColors::Cyan).p(ostd::String("Fixed Fill: ").new_fixedLength(symbol_len)).fg(ostd::ConsoleColors::BrightRed).p(ostd::Utils::getHexStr(m_fixedFillValue, true, 1)).nl();
|
||||
out.fg(ostd::ConsoleColors::Cyan).p(ostd::String("Load Address:").new_fixedLength(symbol_len)).fg(ostd::ConsoleColors::BrightRed).p(ostd::Utils::getHexStr(m_loadAddress, true, 2)).nl();
|
||||
out.fg(ostd::ConsoleColors::Cyan).p(ostd::String("Entry Point: ").new_fixedLength(symbol_len)).fg(ostd::ConsoleColors::BrightRed).p(ostd::Utils::getHexStr(m_dataSize + m_loadAddress + 3, true, 2)).nl();
|
||||
if (verbose_level == 0 || verbose_level == 1)
|
||||
{
|
||||
out.fg(ostd::ConsoleColors::Yellow).p("Program data:").nl();
|
||||
out.fg(ostd::ConsoleColors::Cyan).p(ostd::String("Fixed Size: ").new_fixedLength(symbol_len)).fg(ostd::ConsoleColors::BrightRed).p((int)m_fixedSize).p(" bytes").nl();
|
||||
out.fg(ostd::ConsoleColors::Cyan).p(ostd::String("Program Size:").new_fixedLength(symbol_len)).fg(ostd::ConsoleColors::BrightRed).p((int)m_programSize).p(" bytes").nl();
|
||||
out.fg(ostd::ConsoleColors::Cyan).p(ostd::String("Data Size: ").new_fixedLength(symbol_len)).fg(ostd::ConsoleColors::BrightRed).p((int)m_dataSize).p(" bytes").nl();
|
||||
out.fg(ostd::ConsoleColors::Cyan).p(ostd::String("Fixed Fill: ").new_fixedLength(symbol_len)).fg(ostd::ConsoleColors::BrightRed).p(ostd::Utils::getHexStr(m_fixedFillValue, true, 1)).nl();
|
||||
out.fg(ostd::ConsoleColors::Cyan).p(ostd::String("Load Address:").new_fixedLength(symbol_len)).fg(ostd::ConsoleColors::BrightRed).p(ostd::Utils::getHexStr(m_loadAddress, true, 2)).nl();
|
||||
out.fg(ostd::ConsoleColors::Cyan).p(ostd::String("Entry Point: ").new_fixedLength(symbol_len)).fg(ostd::ConsoleColors::BrightRed).p(ostd::Utils::getHexStr(m_dataSize + m_loadAddress + 3, true, 2)).nl();
|
||||
}
|
||||
|
||||
out.nl();
|
||||
}
|
||||
|
|
@ -1443,7 +1449,7 @@ namespace dragon
|
|||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Unknown instruction; " << line << " (" << instEdit << ")\n";
|
||||
std::cout << "Unknown instruction 1; " << line << " (" << instEdit << ")\n";
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
|
@ -1834,7 +1840,7 @@ namespace dragon
|
|||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Unknown instruction: " << line << " (" << instEdit << ")\n";
|
||||
std::cout << "Unknown instruction 2: " << line << " (" << instEdit << ")\n";
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ namespace dragon
|
|||
ostd::String source_file_path { "" };
|
||||
ostd::String dest_file_path { "" };
|
||||
bool save_disassembly { false };
|
||||
bool verbose { false };
|
||||
int32_t verbose_level { 0xFF };
|
||||
bool debug_mode { false };
|
||||
bool save_exports { true };
|
||||
ostd::String disassembly_file_path { "" };
|
||||
|
|
@ -115,7 +115,7 @@ namespace dragon
|
|||
static ostd::ByteStream assembleToFile(ostd::String sourceFileName, ostd::String binaryFileName);
|
||||
static ostd::ByteStream assembleToVirtualDisk(ostd::String fileName, hw::VirtualHardDrive& vhdd, uint32_t address);
|
||||
static bool saveDisassemblyToFile(ostd::String fileName);
|
||||
static void printProgramInfo(void);
|
||||
static void printProgramInfo(int32_t verbose_level = 1);
|
||||
|
||||
private:
|
||||
static void insertHeader(void);
|
||||
|
|
|
|||
|
|
@ -55,13 +55,17 @@ namespace dragon
|
|||
else if (edit == "--disable-extalu")
|
||||
disable_extalu = true;
|
||||
else if (edit == "--verbose")
|
||||
args.verbose = true;
|
||||
args.verbose_level = 1;
|
||||
else if (edit == "--verbose-2")
|
||||
args.verbose_level = 2;
|
||||
else if (edit == "--verbose-full")
|
||||
args.verbose_level = 0;
|
||||
else if (edit == "--disable-exports")
|
||||
args.save_exports = false;
|
||||
}
|
||||
if (args.debug_mode)
|
||||
{
|
||||
// args.verbose = true;
|
||||
args.verbose_level = 1;
|
||||
args.save_disassembly = true;
|
||||
}
|
||||
if (!disable_extalu)
|
||||
|
|
@ -85,6 +89,12 @@ namespace dragon
|
|||
tmpCommand = "--verbose";
|
||||
tmpCommand.addRightPadding(commandLength);
|
||||
out.fg(ostd::ConsoleColors::Blue).p(tmpCommand).fg(ostd::ConsoleColors::Green).p("Shows more information about the assembled program.").reset().nl();
|
||||
tmpCommand = "--verbose-2";
|
||||
tmpCommand.addRightPadding(commandLength);
|
||||
out.fg(ostd::ConsoleColors::Blue).p(tmpCommand).fg(ostd::ConsoleColors::Green).p("Shows more information about the assembled program. (Structures/Symbols)").reset().nl();
|
||||
tmpCommand = "--verbose-full";
|
||||
tmpCommand.addRightPadding(commandLength);
|
||||
out.fg(ostd::ConsoleColors::Blue).p(tmpCommand).fg(ostd::ConsoleColors::Green).p("Enables all levels of verbose.").reset().nl();
|
||||
tmpCommand = "-o <destination-binary-file>";
|
||||
tmpCommand.addRightPadding(commandLength);
|
||||
out.fg(ostd::ConsoleColors::Blue).p(tmpCommand).fg(ostd::ConsoleColors::Green).p("Used to specify the output binary file.").reset().nl();
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@ namespace dragon
|
|||
{
|
||||
ostd::String line = lines[i];
|
||||
line.trim();
|
||||
if (line.new_toLower().contains("memory.dss"))
|
||||
std::cout << line << "\n";
|
||||
if (line.new_toLower().startsWith("@include") && line.len() > 8)
|
||||
{
|
||||
line.substr(8).trim();
|
||||
|
|
|
|||
|
|
@ -12,8 +12,7 @@ int main(int argc, char** argv)
|
|||
dragon::code::Assembler::debugMode = args.debug_mode;
|
||||
dragon::code::Assembler::cpuExtensions = args.cpu_extensions;
|
||||
dragon::code::Assembler::assembleToFile(args.source_file_path, args.dest_file_path);
|
||||
if (args.verbose)
|
||||
dragon::code::Assembler::printProgramInfo();
|
||||
dragon::code::Assembler::printProgramInfo(args.verbose_level);
|
||||
if (args.save_disassembly)
|
||||
dragon::code::Assembler::saveDisassemblyToFile(args.disassembly_file_path);
|
||||
return dragon::code::Assembler::Application::RETURN_VAL_EXIT_SUCCESS;
|
||||
|
|
|
|||
Loading…
Reference in a new issue