diff --git a/CMakeLists.txt b/CMakeLists.txt index 7617fdd..4c1a393 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ #----------------------------------------------------------------------------------------- set(PROJ_NAME DragonVM) set(MAJOR_VER 0) -set(MINOR_VER 2) +set(MINOR_VER 3) #----------------------------------------------------------------------------------------- #Setup diff --git a/build.nr b/build.nr index d6d863f..2973cf2 100644 --- a/build.nr +++ b/build.nr @@ -1 +1 @@ -1590 +1592 diff --git a/create_win_release.sh b/create_win_release.sh index cd3aeae..e3cc50d 100644 --- a/create_win_release.sh +++ b/create_win_release.sh @@ -14,15 +14,15 @@ rm dragon/disk1.dr ./dtools new-vdisk dragon/disk1.dr 1048576 printf "\n${green}Compiling MBR Block...\n${clear}" -./dasm dss/mbr.dss -o dragon/mbr.bin --save-disassembly disassembly/mbr.dds --verbose +./dasm dss/drake.dss -o dragon/drake.bin --save-disassembly disassembly/drake.dds --verbose printf "\n${green}Loading MBR Block...\n${clear}" -./dtools load-binary dragon/disk1.dr dragon/mbr.bin 0x00000000 +./dtools load-binary dragon/disk1.dr dragon/drake.bin 0x00000000 printf "${green}Compiling Test Program 1...\n" -./dasm dss/test1.dss -o test1.bin --save-disassembly disassembly/test1.dds --verbose +./dasm dss/tests/test1.dss -o test1.bin --save-disassembly disassembly/test1.dds --verbose printf "${green}Compiling Test Program 2...\n" -./dasm dss/test2.dss -o test2.bin --save-disassembly disassembly/test2.dds --verbose +./dasm dss/tests/test2.dss -o test2.bin --save-disassembly disassembly/test2.dds --verbose printf "${green}Creating Windows Release...\n" cd .. @@ -36,7 +36,7 @@ cp ./bin/font.bmp ./win-release cp -r ./bin/config ./win-release cp -r ./bin/disassembly/bios.dds ./win-release/disassembly -cp -r ./bin/disassembly/mbr.dds ./win-release/disassembly +cp -r ./bin/disassembly/drake.dds ./win-release/disassembly cp -r ./bin/disassembly/test1.dds ./win-release/disassembly cp -r ./bin/disassembly/test2.dds ./win-release/disassembly cp -r ./bin/dragon ./win-release @@ -47,9 +47,9 @@ rm ./bin/disassembly/test2.dds mkdir ./win-release/dss4 mkdir ./win-release/dss/bios cp ./bin/dss/bios/* ./win-release/dss/bios -cp ./bin/dss/mbr.dss ./win-release/dss -cp ./bin/dss/test1.dss ./win-release/dss -cp ./bin/dss/test2.dss ./win-release/dss +cp ./bin/dss/drake.dss ./win-release/dss +cp ./bin/dss/tests/test1.dss ./win-release/dss +cp ./bin/dss/tests/test2.dss ./win-release/dss cp C:/msys64/ucrt64/bin/libgcc_s_seh-1.dll ./win-release cp C:/msys64/ucrt64/bin/libstdc++-6.dll ./win-release diff --git a/extra/config/testMachine.dvm b/extra/config/testMachine.dvm index 5886c4e..2b46009 100644 --- a/extra/config/testMachine.dvm +++ b/extra/config/testMachine.dvm @@ -2,8 +2,8 @@ Disks = dragon/disk1.dr Bios = dragon/bios.bin CMOS = dragon/cmos.dr cpuext = extmov, extalu -fixed_clock = false -clock_rate_sec = 512 +fixed_clock = true +clock_rate_sec = 644 SingleColor_foreground = #009900FF SingleColor_background = #111111FF \ No newline at end of file diff --git a/extra/dragon info/DragonVM Information Sheet b/extra/dragon info/info similarity index 82% rename from extra/dragon info/DragonVM Information Sheet rename to extra/dragon info/info index 41f9e30..de764e6 100644 --- a/extra/dragon info/DragonVM Information Sheet +++ b/extra/dragon info/info @@ -93,11 +93,13 @@ 0x04: Text SIngle Color - Direct Print buffer & Flush Buffer 0x05: Text Single Color - Flush Buffer 0x06: Text Single Color - Print Buffer Without Flushing + 0x07: Text Single Color - Print Buffered String 0xE0: Refresh Screen 0xE1: Clear Screen 0x04: Text Single Color Character (1 Byte) 0x05: Text Single Color Inverted colors (1 Byte) + 0x06: (2 bytes) Text Single Color Buffered String Address 0x16FF ------- 0x1700 GENERIC SERIAL INTERFACE (64 Bytes) @@ -144,4 +146,23 @@ MAX INTERRUPT 0xAA 0x80: Disk Interface Finished 0xA0: Keyboard Interface - Key Pressed 0xA1: Keyboard Interface - Key Released -0xA2: Keyboard Interface - Text Entered \ No newline at end of file +0xA2: Keyboard Interface - Text Entered + + + +#========================================================================================================================================== +# DPT - Partition Table +#========================================================================================================================================== + +Disk Address: 0x200 - 0x400 (512 bytes) +Header: (0x200 - 0x20B) (12 bytes) + 0x000: (2 bytes) - 0xF1CA - This number identifies this block as a DPT partition table + 0x002: (2 bytes) - DPT version + 0x004: (1 byte) - Partition count (max 5) + 0x005: (7 bytes) - Reserved +Partition Table: (0x20C - 0x3FF) (500 bytes) + Entry: (100 bytes) (x5) + 0x00: (4 bytes) - Start Address + 0x04: (4 bytes) - Size + 0x08: (28 bytes) - Reserved + 0x40: (64 bytes) - Partition label diff --git a/extra/dragon/bios.bin b/extra/dragon/bios.bin index d220f3c..8b67f00 100644 Binary files a/extra/dragon/bios.bin and b/extra/dragon/bios.bin differ diff --git a/extra/dragon/cmos.dr b/extra/dragon/cmos.dr index 72114fc..a305b77 100644 Binary files a/extra/dragon/cmos.dr and b/extra/dragon/cmos.dr differ diff --git a/extra/dss/activeTest.dss b/extra/dss/activeTest.dss new file mode 100644 index 0000000..f9f0e16 --- /dev/null +++ b/extra/dss/activeTest.dss @@ -0,0 +1,21 @@ +##================================================================================================================================= +## This is the test2 program for the Dragon Virtual Machine. This example simply demonstrates the Virtual Display in Text-Single-Color +## mode, by printing an increasing counter followed by whatever is in the $string variable. The program also clears the screen +## every 10 lines. +##================================================================================================================================= + +.load 0x1740 + +.data + $string "Hello World!!" + +.code + mov R10, 0x0C + mov R9, $string + int 0x30 + +end_loop: + jmp $end_loop + hlt + +.fixed 512, 0x00 \ No newline at end of file diff --git a/extra/dss/bios/data.dss b/extra/dss/bios/data.dss index 89f9b68..41ea5be 100644 --- a/extra/dss/bios/data.dss +++ b/extra/dss/bios/data.dss @@ -1,8 +1,9 @@ @guard _DATA_DSS_ -@export BIOS_API bios_api.dss +@export BIOS_API dss/bios_api.dss ## ============================= Memory Mapped Devices and Registers ============================= +@export_comment /BIOS_API "These are the base addresses of the memory map." @group MemoryAddresses MBR 0x1380 INT_VEC 0x1080 @@ -11,6 +12,7 @@ CMOS 0x1000 VGA 0x1600 @end +@export_comment /BIOS_API "\n" @group CMOS_Settings MEM_START { MemoryAddresses.CMOS + 0x0000 } @@ -38,6 +40,7 @@ SIGNAL { MemoryAddresses.VGA + 0x0003 } TEXT_SINGLE_CHAR { MemoryAddresses.VGA + 0x0004 } TEXT_SIGNLE_INVERT { MemoryAddresses.VGA + 0x0005 } + TEXT_SIGNLE_STR { MemoryAddresses.VGA + 0x0006 } BUFF_START { MemoryAddresses.VGA + 0x00E0 } @end @@ -61,6 +64,7 @@ PRINT_FLUSH_BUFF 0x04 FLUSH_BUFF 0x05 PRINT_BUFF 0x06 + PRINT_STRING 0x07 REFRESH_SCREEN 0xE0 CLEAR_SCREEN 0xE1 @@ -78,8 +82,8 @@ .data $_bios_version_number_maj 0x00, 0x00 - $_bios_version_number_min 0x00, 0x03 - $_bios_name " DragonBIOS " + $_bios_version_number_min 0x00, 0x04 + $_bios_name "DragonBIOS " $_clock_str " Clock: " $_mem_str " Memory: " $_hz_str " Hz" diff --git a/extra/dss/bios/logo_screen.dss b/extra/dss/bios/display_info.dss similarity index 64% rename from extra/dss/bios/logo_screen.dss rename to extra/dss/bios/display_info.dss index 105461c..9be5451 100644 --- a/extra/dss/bios/logo_screen.dss +++ b/extra/dss/bios/display_info.dss @@ -1,109 +1,78 @@ -@guard _LOGO_SCREEN_DSS_ - -_print_logo_screen: +@guard _DISPLAY_INFO_DSS_ +_print_machine_info: + mov R9, $_bios_logo_2_line_1 + mov R10, 0x0C + int 0x30 ## Print Next Logo Line + mov R10, 0x02 + int 0x30 ## Print New Line mov R9, $_bios_logo_2_line_2 - mov R10, 0x0A - int 0x30 - - - - - mov R9, $_bios_logo_2_line_2 - mov R10, 0x0A - int 0x30 - - mov R10, 0x03 + mov R10, 0x0C + int 0x30 ## Print Next Logo Line + mov R10, 0x01 + mov R9, 32 + int 0x30 ## Print ' ' character + mov R10, 0x0B + int 0x30 ## Invert colors + mov R10, 0x0C mov R9, $_bios_name int 0x30 ## Print BIOS Name - mov R10, 0x04 mov R9, [$_bios_version_number_maj] int 0x30 ## Print BIOS Version (Major) - mov R10, 0x01 mov R9, 46 int 0x30 ## Print '.' character - mov R10, 0x04 mov R9, [$_bios_version_number_min] int 0x30 ## Print BIOS Version (Minor) - + mov R10, 0x0B + int 0x30 ## Invert colors mov R10, 0x02 int 0x30 ## Print New Line - - - - mov R9, $_bios_logo_2_line_3 - mov R10, 0x0A - int 0x30 - - mov R10, 0x03 + mov R10, 0x0C + int 0x30 ## Print Next Logo Line + mov R10, 0x0C mov R9, $_clock_str int 0x30 ## Print Clock label - mov R10, 0x04 mov R9, [CMOS_Settings.CLOCK_SPEED] int 0x30 ## Print Clock speed - - mov R10, 0x03 + mov R10, 0x0C mov R9, $_hz_str int 0x30 ## Print hz label - mov R10, 0x02 int 0x30 ## Print New Line - - - - mov R9, $_bios_logo_2_line_4 - mov R10, 0x0A - int 0x30 - - mov R10, 0x03 + mov R10, 0x0C + int 0x30 ## Print Next Logo Line + mov R10, 0x0C mov R9, $_mem_str int 0x30 ## Print Memory label - mov R10, 0x04 mov R9, [CMOS_Settings.MEM_START] int 0x30 ## Print Memory start - mov R10, 0x01 mov R9, 47 int 0x30 ## Print '/' character - mov R10, 0x04 mov R9, [CMOS_Settings.MEM_SIZE] int 0x30 ## Print Memory size - - mov R10, 0x03 + mov R10, 0x0C mov R9, $_byte_str int 0x30 ## Print bytes label - mov R10, 0x02 int 0x30 ## Print New Line - - - - mov R9, $_bios_logo_2_line_5 mov R7, 4 mov ACC, 19 - mov R10, 0x0B - int 0x30 _print_machine_info_logo_loop: inc R7 - mov R10, 0x0A - int 0x30 - addip R9, 54 ## 90 is the length of a line - mov R10, 0x08 - int 0x30 + mov R10, 0x0C + int 0x30 ## Print Next Logo Line + addip R9, 54 ## 54 is the length of a line mov R10, 0x02 - int 0x30 - debug_break + int 0x30 ## Print New Line jls $_print_machine_info_logo_loop, R7 - mov R10, 0x0B - int 0x30 - ret \ No newline at end of file diff --git a/extra/dss/bios/drivers.dss b/extra/dss/bios/drivers.dss index 0fba845..810b1c2 100644 --- a/extra/dss/bios/drivers.dss +++ b/extra/dss/bios/drivers.dss @@ -53,6 +53,7 @@ _int_30_handler: jeq $_int_30_flush_buffer_text_single, 0x0009 jeq $_int_30_store_string_text_single, 0x000A jeq $_int_30_invert_colors_text_single, 0x000B + jeq $_int_30_print_string_buffered, 0x000C jeq $_int_30_clear_screen, 0x00E0 jeq $_int_30_refresh_screen, 0x00E1 jmp $_int_30_end @@ -114,6 +115,12 @@ _int_30_invert_colors_text_single: _int_30_invert_colors_text_single_normal: movb [VGA_Registers.TEXT_SIGNLE_INVERT], 0 jmp $_int_30_end +_int_30_print_string_buffered: + mov [VGA_Registers.TEXT_SIGNLE_STR], R9 + debug_break + movb [VGA_Registers.SIGNAL], Sig_VGA_Text_Single_Color.PRINT_STRING + jmp $_int_30_end + _int_30_clear_screen: diff --git a/extra/dss/bios/entry.dss b/extra/dss/bios/entry.dss index 2f37e4c..101083f 100644 --- a/extra/dss/bios/entry.dss +++ b/extra/dss/bios/entry.dss @@ -15,7 +15,7 @@ int 0x20 ## -Calling int 0x20 with 0x00 as parameter, to set new handler up push 0 - call $_print_machine_info + call $_print_machine_info ## Print BIOS logo and machine info ## MBR Loading and FL, 0b1111111111111110 ## Disable interrupts @@ -32,136 +32,10 @@ ## ======================================================================== @include +@include + +## This file contains the .data section, so it needs to be the last thing included @include +## =============================================================================== -_print_machine_info: - - - mov R9, $_bios_logo_2_line_1 - mov R10, 0x0A - int 0x30 - - mov R10, 0x08 ## Print and flush buffer - int 0x30 - - mov R10, 0x02 - int 0x30 - - - - mov R9, $_bios_logo_2_line_2 - mov R10, 0x0A - int 0x30 - - mov R10, 0x08 ## Print and flush buffer - int 0x30 - - - - mov R10, 0x0A - mov R9, $_bios_name - int 0x30 ## Print BIOS Name - - mov R10, 0x05 - mov R9, [$_bios_version_number_maj] - int 0x30 ## Print BIOS Version (Major) - - mov R10, 0x06 - mov R9, 46 - int 0x30 ## Print '.' character - - mov R10, 0x05 - mov R9, [$_bios_version_number_min] - int 0x30 ## Print BIOS Version (Minor) - - mov R10, 0x02 - int 0x30 ## Print New Line - - - - - - - mov R9, $_bios_logo_2_line_3 - mov R10, 0x0A - int 0x30 - - mov R10, 0x08 ## Print and flush buffer - int 0x30 - - - - mov R10, 0x0A - mov R9, $_clock_str - int 0x30 ## Print Clock label - - mov R10, 0x05 - mov R9, [CMOS_Settings.CLOCK_SPEED] - int 0x30 ## Print Clock speed - - mov R10, 0x0A - mov R9, $_hz_str - int 0x30 ## Print hz label - - mov R10, 0x02 - int 0x30 ## Print New Line - - - - - - - mov R9, $_bios_logo_2_line_4 - mov R10, 0x0A - int 0x30 - - mov R10, 0x08 ## Print and flush buffer - int 0x30 - - - - mov R10, 0x0A - mov R9, $_mem_str - int 0x30 ## Print Memory label - - mov R10, 0x05 - mov R9, [CMOS_Settings.MEM_START] - int 0x30 ## Print Memory start - - mov R10, 0x06 - mov R9, 47 - int 0x30 ## Print '/' character - - mov R10, 0x05 - mov R9, [CMOS_Settings.MEM_SIZE] - int 0x30 ## Print Memory size - - mov R10, 0x0A - mov R9, $_byte_str - int 0x30 ## Print bytes label - - mov R10, 0x02 - int 0x30 ## Print New Line - - - - - - mov R9, $_bios_logo_2_line_5 - mov R7, 4 - mov ACC, 19 -_print_machine_info_logo_loop: - inc R7 - mov R10, 0x0A - int 0x30 - addip R9, 54 ## 90 is the length of a line - mov R10, 0x08 - int 0x30 - mov R10, 0x02 - int 0x30 - jls $_print_machine_info_logo_loop, R7 - - - ret - -.fixed 4096, 0x00 ## BIOS Needs to be 4096 Bytes exactly +.fixed 4096, 0xFF ## BIOS Needs to be 4096 Bytes exactly diff --git a/extra/dss/mbr.dss b/extra/dss/drake.dss similarity index 100% rename from extra/dss/mbr.dss rename to extra/dss/drake.dss diff --git a/extra/dss/extmov_unit_tests.dss b/extra/dss/tests/extmov_unit_tests.dss similarity index 100% rename from extra/dss/extmov_unit_tests.dss rename to extra/dss/tests/extmov_unit_tests.dss diff --git a/extra/dss/newTest.dss b/extra/dss/tests/newTest.dss similarity index 100% rename from extra/dss/newTest.dss rename to extra/dss/tests/newTest.dss diff --git a/extra/dss/test1.dss b/extra/dss/tests/test1.dss similarity index 100% rename from extra/dss/test1.dss rename to extra/dss/tests/test1.dss diff --git a/extra/dss/test2.dss b/extra/dss/tests/test2.dss similarity index 100% rename from extra/dss/test2.dss rename to extra/dss/tests/test2.dss diff --git a/extra/make_and_debug b/extra/make_and_debug index 3cd9d86..07bb9e3 100755 --- a/extra/make_and_debug +++ b/extra/make_and_debug @@ -17,9 +17,9 @@ if [ $? -eq 0 ]; then /bin/bash ./load_mbr cd .. printf "${green}Compiling Test Program...\n" - ./dasm dss/newTest.dss -o newTest.bin --extmov --extalu --save-disassembly disassembly/newTest.dds --verbose + ./dasm dss/activeTest.dss -o activeTest.bin --extmov --extalu --save-disassembly disassembly/activeTest.dds --verbose printf "\n${green}Running Application...\n\n${clear}" - ./ddb config/testMachine.dvm --force-load newTest.bin 0x00 --verbose-load + ./ddb config/testMachine.dvm --force-load activeTest.bin 0x00 --verbose-load cp dragon/disk1.dr ../extra/dragon/disk1.dr cp dragon/cmos.dr ../extra/dragon/cmos.dr fi diff --git a/extra/make_and_run b/extra/make_and_run index fd22f20..1862670 100755 --- a/extra/make_and_run +++ b/extra/make_and_run @@ -17,9 +17,9 @@ if [ $? -eq 0 ]; then /bin/bash ./load_mbr cd .. printf "${green}Compiling Test Program...\n" - ./dasm dss/newTest.dss -o newTest.bin --extmov --extalu --save-disassembly disassembly/newTest.dds --verbose + ./dasm dss/activeTest.dss -o activeTest.bin --extmov --extalu --save-disassembly disassembly/activeTest.dds --verbose printf "\n${green}Running Application...\n\n${clear}" - ./dvm config/testMachine.dvm --force-load newTest.bin 0x00 + ./dvm config/testMachine.dvm --force-load activeTest.bin 0x00 cp dragon/disk1.dr ../extra/dragon/disk1.dr cp dragon/cmos.dr ../extra/dragon/cmos.dr fi diff --git a/extra/scripts/load_mbr b/extra/scripts/load_mbr index ff0b049..865c596 100644 --- a/extra/scripts/load_mbr +++ b/extra/scripts/load_mbr @@ -5,9 +5,9 @@ clear='\033[0m' printf "\n${green}Reloading MBR Block...\n${clear}" cd .. -cp ../extra/dss/mbr.dss ./dss/mbr.dss -./dasm dss/mbr.dss -o dragon/mbr.bin --save-disassembly disassembly/mbr.dds --verbose -./dtools load-binary dragon/disk1.dr dragon/mbr.bin 0x00000000 +cp ../extra/dss/drake.dss ./dss/drake.dss +./dasm dss/drake.dss -o dragon/drake.bin --save-disassembly disassembly/drake.dds --verbose +./dtools load-binary dragon/disk1.dr dragon/drake.bin 0x00000000 printf "\n" cp dragon/disk1.dr ../extra/dragon/disk1.dr -rm dragon/mbr.bin +rm dragon/drake.bin diff --git a/extra/scripts/run-test-1.bat b/extra/scripts/run-test-1.bat index 2b89fff..a1e9d8c 100644 --- a/extra/scripts/run-test-1.bat +++ b/extra/scripts/run-test-1.bat @@ -1,2 +1,2 @@ -dasm dss/test1.dss -o test1.bin --save-disassembly disassembly/test1.dds --verbose +dasm dss/tests/test1.dss -o test1.bin --save-disassembly disassembly/test1.dds --verbose ddb config/testMachine.dvm --force-load test1.bin 0x00 --verbose-load --hide-vdisplay \ No newline at end of file diff --git a/extra/scripts/run-test-2.bat b/extra/scripts/run-test-2.bat index 7080b39..918bb9a 100644 --- a/extra/scripts/run-test-2.bat +++ b/extra/scripts/run-test-2.bat @@ -1,2 +1,2 @@ -dasm dss/test2.dss -o test2.bin --save-disassembly disassembly/test2.dds --verbose +dasm dss/tests/test2.dss -o test2.bin --save-disassembly disassembly/test2.dds --verbose ddb config/testMachine.dvm --force-load test2.bin 0x00 --verbose-load --hide-vdisplay \ No newline at end of file diff --git a/src/hardware/VirtualDisplay.cpp b/src/hardware/VirtualDisplay.cpp index 5576b32..64d9ef9 100644 --- a/src/hardware/VirtualDisplay.cpp +++ b/src/hardware/VirtualDisplay.cpp @@ -54,6 +54,19 @@ namespace dragon char c = (char)mem.read8(vga_addr + tRegisters::TextSingleCharacter); single_text_add_char_to_line(c); } + else if (signal == tSignalValues::TextSingleColor_DirectPrintString) + { + uint16_t first_char_addr = mem.read16(vga_addr + tRegisters::TextSingleString); + char c = ' '; + int h = 0; + while (c != 0) + { + char c = (char)mem.read8(first_char_addr); + single_text_add_char_to_line(c); + first_char_addr++; + if (c == 0) break; + } + } else if (signal == tSignalValues::TextSingleColor_StoreChar) { char c = (char)mem.read8(vga_addr + tRegisters::TextSingleCharacter); diff --git a/src/hardware/VirtualDisplay.hpp b/src/hardware/VirtualDisplay.hpp index 093cc18..5834ef9 100644 --- a/src/hardware/VirtualDisplay.hpp +++ b/src/hardware/VirtualDisplay.hpp @@ -15,6 +15,7 @@ namespace dragon inline static constexpr uint8_t Signal = 0x03; inline static constexpr uint8_t TextSingleCharacter = 0x04; inline static constexpr uint8_t TextSingleInvertColors = 0x05; + inline static constexpr uint8_t TextSingleString = 0x06; }; public: struct tVideoModeValues { @@ -29,6 +30,7 @@ namespace dragon inline static constexpr uint8_t TextSingleColor_DirectPrintBuffAndFlush = 0x04; inline static constexpr uint8_t TextSingleColor_FlushBuffer = 0x05; inline static constexpr uint8_t TextSingleColor_DirectPrintBuffNoFlush = 0x06; + inline static constexpr uint8_t TextSingleColor_DirectPrintString = 0x07; inline static constexpr uint8_t RefreshScreen = 0xE0; inline static constexpr uint8_t ClearSCreen = 0xE1;