From 509a59924c1e5109d9b73ef3a36fad4b3a0f4a13 Mon Sep 17 00:00:00 2001 From: StjepanBM1 Date: Sun, 27 Aug 2023 09:46:34 +0200 Subject: [PATCH] OS/1: 5.1.0 --- LICENSE.txt | 0 Makefile | 16 +- README.txt | 21 +- bin/kernel.bin | Bin 7082 -> 8211 bytes bin/os1.bin | Bin 7594 -> 8723 bytes boot/libx86.S | 6 +- img/os1.img | Bin 368640 -> 368640 bytes kernel/README.txt | 7 + kernel/cpu/gdt.S | 22 + kernel/fs/load.S | 137 ++++++ kernel/{libk/disk.S => fs/status.S} | 4 +- kernel/kernel.S | 75 +++- kernel/kernel.ld | 6 +- kernel/libk/panic.S | 164 ++++++++ kernel/libk/screen.S | 35 -- kernel/libk/stdio.S | 120 +++--- kernel/mp/cmd.S | 21 + kernel/mp/main.S | 271 ++++++++++++ kernel/pinb/curs/home_curs.S | 8 +- kernel/pinb/pinb.S | 2 +- kernel/pinb/shell/cmd.S | 16 - kernel/pinb/shell/shell.S | 215 ---------- utils/Makefile | 54 +++ utils/README.txt | 9 + utils/boot/Makefile | 23 + utils/boot/libx86.S | 55 +++ utils/boot/x86.S | 38 ++ utils/boot/x86.ld | 32 ++ utils/dir_strut.sh | 3 + utils/distribute/distribute | 17 + utils/kernel/Makefile | 23 + utils/kernel/README.txt | 7 + utils/kernel/cpu/gdt.S | 22 + utils/kernel/fs/load.S | 137 ++++++ utils/kernel/fs/status.S | 279 ++++++++++++ utils/kernel/kernel.S | 82 ++++ utils/kernel/kernel.ld | 30 ++ utils/kernel/libk/panic.S | 164 ++++++++ utils/kernel/libk/stdio.S | 106 +++++ utils/kernel/mp/cmd.S | 21 + utils/kernel/mp/main.S | 271 ++++++++++++ utils/kernel/pinb/curs/desk_curs.S | 92 ++++ utils/kernel/pinb/curs/dsst_curs.S | 105 +++++ utils/kernel/pinb/curs/home_curs.S | 317 ++++++++++++++ utils/kernel/pinb/curs/paint_curs.S | 630 ++++++++++++++++++++++++++++ utils/kernel/pinb/dstat/dstat.S | 108 +++++ utils/kernel/pinb/home.S | 421 +++++++++++++++++++ utils/kernel/pinb/notes/notes.S | 68 +++ utils/kernel/pinb/paint/paint.S | 523 +++++++++++++++++++++++ utils/kernel/pinb/pinb.S | 55 +++ utils/kernel/pinb/pong/pong.S | 21 + utils/kernel/pinb/prod/p_wnd.S | 157 +++++++ utils/kernel/pinb/prod/words.S | 10 + utils/kernel/pinb/sets/stng.S | 97 +++++ utils/nonboot/Makefile | 23 + utils/nonboot/linker.ld | 32 ++ utils/nonboot/nonboot.S | 42 ++ 57 files changed, 4843 insertions(+), 377 deletions(-) delete mode 100644 LICENSE.txt create mode 100644 kernel/README.txt create mode 100644 kernel/cpu/gdt.S create mode 100644 kernel/fs/load.S rename kernel/{libk/disk.S => fs/status.S} (98%) create mode 100644 kernel/libk/panic.S delete mode 100644 kernel/libk/screen.S create mode 100644 kernel/mp/cmd.S create mode 100644 kernel/mp/main.S delete mode 100644 kernel/pinb/shell/cmd.S delete mode 100644 kernel/pinb/shell/shell.S create mode 100644 utils/Makefile create mode 100644 utils/README.txt create mode 100644 utils/boot/Makefile create mode 100644 utils/boot/libx86.S create mode 100644 utils/boot/x86.S create mode 100644 utils/boot/x86.ld create mode 100755 utils/dir_strut.sh create mode 100755 utils/distribute/distribute create mode 100644 utils/kernel/Makefile create mode 100644 utils/kernel/README.txt create mode 100644 utils/kernel/cpu/gdt.S create mode 100644 utils/kernel/fs/load.S create mode 100644 utils/kernel/fs/status.S create mode 100644 utils/kernel/kernel.S create mode 100644 utils/kernel/kernel.ld create mode 100644 utils/kernel/libk/panic.S create mode 100644 utils/kernel/libk/stdio.S create mode 100644 utils/kernel/mp/cmd.S create mode 100644 utils/kernel/mp/main.S create mode 100644 utils/kernel/pinb/curs/desk_curs.S create mode 100644 utils/kernel/pinb/curs/dsst_curs.S create mode 100644 utils/kernel/pinb/curs/home_curs.S create mode 100644 utils/kernel/pinb/curs/paint_curs.S create mode 100644 utils/kernel/pinb/dstat/dstat.S create mode 100644 utils/kernel/pinb/home.S create mode 100644 utils/kernel/pinb/notes/notes.S create mode 100644 utils/kernel/pinb/paint/paint.S create mode 100644 utils/kernel/pinb/pinb.S create mode 100644 utils/kernel/pinb/pong/pong.S create mode 100644 utils/kernel/pinb/prod/p_wnd.S create mode 100644 utils/kernel/pinb/prod/words.S create mode 100644 utils/kernel/pinb/sets/stng.S create mode 100644 utils/nonboot/Makefile create mode 100644 utils/nonboot/linker.ld create mode 100644 utils/nonboot/nonboot.S diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index e69de29..0000000 diff --git a/Makefile b/Makefile index b60cf39..b4f9d29 100644 --- a/Makefile +++ b/Makefile @@ -4,25 +4,25 @@ override ISO = os1.iso override BINS := $(shell find ./ -type f -name '*.bin') .PHONY:all -all: loader kern binary disk run +all: load kern binary disk run # -# Builds the bootloader -loader: +# Builds the LOAD (bootloader) +load: make -C boot # -# Builds the main kernel +# Builds the main kernel (called Copland) kern: make -C kernel # -# Create a system binary by combining boot.bin & kernel.bin +# Create a system binary by combining nload.bin & kernel.bin binary: cat bin/boot.bin bin/kernel.bin > bin/os1.bin # # Creates a low density 360 KiB -disk: loader kern binary +disk: load kernel binary dd if=/dev/zero of=img/$(FLP) bs=512 count=720 dd if=bin/os1.bin of=img/$(FLP) conv=notrunc @@ -35,8 +35,7 @@ disk: loader kern binary # # Creates an ISO image cdiso: 144img - mkisofs -quiet -V 'os1-500' -input-charset iso8859-1 -o img/$(ISO) -b $(FLP) img/ - + mkisofs -quiet -V 'os1-ar-510' -input-charset iso8859-1 -o img/$(ISO) -b $(FLP) img/ # # Runs the os1.img in QEMU run: disk @@ -51,4 +50,5 @@ runcd: cdiso clean: make -C boot clean make -C kernel clean + make -C pinboard clean rm $(BINS) img/$(FLP) img/$(ISO) diff --git a/README.txt b/README.txt index 2f96de4..5d28f57 100644 --- a/README.txt +++ b/README.txt @@ -1,14 +1,9 @@ - Operating System/1 5.0.0 -================================ + Operating System/1 Average Release 5.1.0 +================================================ - Operating System/1 or OS/1 for short is a simple - 16-bit operating system, based on a megalithic kernel - called DUNE. OS/1 5.0.0 runs in real mode and is written - entirely in x86 assembly. - - * Changes: - ============ - - improved Paint - - 3.x UI style - - Disk status program - - and others + Changes: + - usage of Unreal / Big Real / Voodoo mode + - multiple disk drive support (drives A & B) + - switch to a more stable kernel + - switch to a Monitor Program as the default shell + - minor changes to Pinboard diff --git a/bin/kernel.bin b/bin/kernel.bin index eaf05813e83df3c276d1dce58ecc5f14afb40449..7244aa482b5eda85754683ccf93c90e1b985e8d4 100755 GIT binary patch delta 3153 zcmai$e^eCL6~||P@Pv@WS z`^^2md+)q?yKml|EiClfLOoX4uD696uQYyqnyY!xX+5kv#&uXu4C9V+?OfLte^25! z(VUx`Lze_hFV^`pOTB^zt9AL;Zt_`Bbn|e|X_3uI7F2 zh@PhEvAWZ4a5WtFt)TaDRENIr-FtZ(s2VvEB9C*brg3ZL+hw$Z%-l=ao;qW z&K=cZqanO~oa1_u;Gix%s3mEBYLY!P$v7_K=~+s2;ZE%8o!VOIAA7-}vxVNO6;|us z^xoYIXSuL6tO>eMW;MZ4l%F@jA(WaXIDjHF!P_W@nm|Ok&;$a?ohE2N(Ko|xl=Nn( zL0Q}kTTwPNLj}sNW++8D-i*%|min4u9m@C?SdB8j1@ck0dRrh5^{p0IfO4b-vQRFx zfDPsA7MO~X&didA+v> z!}r3lU+s)JOfb)i6QSsyL}_;`-jaUX3T>(sX@wS5n&5{$>i*Ay5KyJbe%P(nr6M${ z(sVymt91zouc%U{AIj9aBm|Et?QDf#sM3%8utu$$gtzRfl;elxUbQX*X|*aX_rrX( zE)!viDy{N^O|6@cFo#V|SEU#Ikg7J&)IU(Am;5kXZJK4x4XH`yrY7vD0LQb7H+~$?wdZtSP2U5f&-} zu_kq#j7>L~)&xLzU$`E>Jtgj*yki(RhKBl~WJr210G=UMSgwi|suQyHGoyu53E9zI z!DC!~>gk|hv^+5On&n!dA~7YVSUG1t9kj^n87*WqUe2Oq9?M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w=>f#lYl;=J^zC6vnb5D;`ir$Fh+KZ6&i3+1$!RI`^z{ zIKt+>#fq1eH<uq** zk2v9n9=y86x=Bv3^^l3e_>6ofEbC!EEBZCT>ncpN7-#aYI0eVJyJW49MK0^olC7o& zuBz5l*}$zc)o$cWn`eY8%zymQ>|#t&&kcDi;HT^tLrNps>OL` zYfVFaoylwwr-(~%0~mUe{$HFeiqF*7)m56S3&j=OD$!hT5!cjjGFRuY+Jc%!i&(!# ztcqnC3+P-Cr_fV8_>5;G%BYF?)s2=)%Y#LB*at$7OXvBcesNJ{4elehb^o=|`!z}3 Z-QBTs|9hN0Ek)#~v1zIQb7vgK{R49b&piMD diff --git a/boot/libx86.S b/boot/libx86.S index 8d9387b..bde16e8 100644 --- a/boot/libx86.S +++ b/boot/libx86.S @@ -15,7 +15,7 @@ mov $0x00, %ch # Track / Cylinder number mov $0x02, %cl # Sector number mov $0x00, %dh # Head number - movb (_dev), %dl # Disk drive (0 - drive A; 1 - drive B) + movb (_dev), %dl # Disk drive (0 - drive A; 1 - drive B) int $0x13 # Disk interrupt (0x13) @@ -23,9 +23,11 @@ ret # Return + disk_info: + disk_error: clc - cmpb $3, (trys) # If num of tries is less than 3 + cmpb $3, (trys) # If num of tries is less than 3 jl read_disk # jump to read_disk mov $0x03, %ax # Clear the screen diff --git a/img/os1.img b/img/os1.img index b14c5ea54665d383a841b29a1e2fd7d4314be248..4ff230d3bdf8f32bd30a19604bfb3a8400af9d65 100644 GIT binary patch delta 3182 zcmai$3s6+o8OQHFL0*d@jDX+)sZ}SUm`JEv6$R89;se_nwKa=ek+AI2Wl^-2CAv-n zp)}^oWA83TW2fUZw#p;oi_6A!Y~z#|Gl|-oF>OuT?}`{vm?G-E{m!{Ql4hLVnVtXn z-S2oWokR~kM(%~e0>j5(_7;yNrR!ntEyJJ)^1 z+Z+8PI+ASB#U<{vkU)gak{UP_$~9a~Q?NDRKFrcfUwUDoUjAdu$l$PIKIQM!A6;;Y ztA3wr)6-PFG0xN*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pSO^}RAvTmEY=p;2qZBza?K+U!%XD1l7OC>#O-+ky@P0B+=>ZY zV`lJRqju}vKT!pz9cMZm#K z+5qhwxjlatg`$CGeek4r7LL!Ouzc8ZDC7)V zE`=wC?O6(s4O;<)#DV@^I5X(KL1EMYv=7q8Q4?ZKPPpEWOGxle#qLB|Dx$M9Yr( z2$SrXBl&tpPuJOw8Sns)8De~h=8;V!abLsu<=`8Wlba$gg_X zVCxPQ_MyDXrB;PKDBo~#t6)bt!o{gV6^e_?0TtGv*txu?LOx3T`-1;>C&UG?DaZkT zzZ1d(+BSM3zF?L=ybcccX>s@bbxu(Gw5WUkU91)ergx^d!Kps2C#dBQz@)ph$&?`0 z)WOm|dd?K@+bB&mh@-Ddvu=CC_LFkCr)&}U5h-`gw zfNqM&9?___2)mLzDs7G!G@k!Uvr{E1A-p(vQu3&>wwl|M+>*7~%%t($XkwIEkJGZF z%$Us8&J59%sBsZZLu_J!=HV*s=1M;bWxwUwx3sKKR^i2i+SpKbaF9)tg8!V-p1)QdAy(^Avu5@nNZ4t|u}Wz*A@>^y}JD{Lq_LYS)v zijuq8Qdwv%DPONFd%4PLDZ^YfPen&4%KYVv7bu%7mF1RFr8*-uEsYH>DJfrDQCL~5 zEGVxosjMiolv|Z)$}(I4h8}0Xi@g=)sfx0)!t&xQWtFf-DX*|9>ngUC7pL;tqLM1B zQn5}c3T3J?SziUauwC5$j(elpn8_K%Rn|i5{XxFj`@*)%`uT!BWl3QPt|PQ`-_@}P w3^83@U7>ydyPdra+4QHB|2?zUQp|6pn05H*@iE|IY)LVT-LLr4%r(Y;09A6>00000 diff --git a/kernel/README.txt b/kernel/README.txt new file mode 100644 index 0000000..e341510 --- /dev/null +++ b/kernel/README.txt @@ -0,0 +1,7 @@ + OS/1 AR 5.1.0 Kernel "Copland" +====================================== + + Simple Unreal mode operating system kernel written + in assembly for GNU GAS. Copland offers support for + multiple disk drives. To compile Copland you need a + i386-elf specific GAS (as) and GNU Linker (ld). diff --git a/kernel/cpu/gdt.S b/kernel/cpu/gdt.S new file mode 100644 index 0000000..b9159b8 --- /dev/null +++ b/kernel/cpu/gdt.S @@ -0,0 +1,22 @@ + + /* + GDT by OS-Dev wiki : + www.osdev.org + */ + + .code16 + .global _gdt_inf + .section .text + + _gdt_inf: + .word gdt_end - gdt - 1 + .long gdt + + gdt: + .long 0 + .long 0 + + flatd: + .byte 0xFF, 0xFF, 0, 0, 0, 0b10010010, 0b11001111, 0 + + gdt_end: diff --git a/kernel/fs/load.S b/kernel/fs/load.S new file mode 100644 index 0000000..afd0763 --- /dev/null +++ b/kernel/fs/load.S @@ -0,0 +1,137 @@ + + .code16 + .global _load_A + .global _load_B + .section .text.filesys + + # + # _load_B: Load the data from the disk drive A. + # And jump to the 0x7e00 address of the disk. + _load_A: + clc + incb (tries) + + mov $0x02, %ah + mov $0x40, %al + mov $0x7e00,%bx + mov $0x00, %ch + mov $0x02, %cl + mov $0x00, %dh + mov $0x00, %dl + int $0x13 + + jc _err_A + + ljmp $0x0000,$0x7e00 + + # + # _load_B: Load the data from the disk drive B. + # And jump to the 0x7e00 address of the disk. + _load_B: + clc + incb (tries) + + mov $0x02, %ah + mov $0x40, %al + mov $0x7e00,%bx + mov $0x00, %ch + mov $0x02, %cl + mov $0x00, %dh + mov $0x01, %dl + int $0x13 + + jc _err_B + + ljmp $0x0000,$0x7e00 + + # + # _err_A: Disk load error for _load_A function + _err_A: + clc + cmpb $3, (tries) + jl _load_A + + mov $0x03, %ax + int $0x10 + + xor %ax, %ax + int $0x13 + + mov $0x13, %ah + mov $0x01, %al + mov $0x00, %bh + mov $0x0c, %bl + mov $0x2e, %cx + mov $0x00, %dh + mov $0x00, %dl + mov $_ler_A,%bp + int $0x10 + + call _disk_status + + mov $0x13, %ah + mov $0x01, %al + mov $0x00, %bh + mov $0x0f, %bl + mov $0x24, %cx + mov $0x01, %dh + mov $0x00, %dl + mov $_retmg,%bp + int $0x10 + + mov $0x00, %ax + int $0x16 + + call _clear + + ret + + # + # _err_B: Disk load error for _load_B function + _err_B: + clc + cmpb $3, (tries) + jl _load_B + + mov $0x03, %ax + int $0x10 + + xor %ax, %ax + int $0x13 + + mov $0x13, %ah + mov $0x01, %al + mov $0x00, %bh + mov $0x0c, %bl + mov $0x2e, %cx + mov $0x00, %dh + mov $0x00, %dl + mov $_ler_B,%bp + int $0x10 + + call _disk_status + + mov $0x13, %ah + mov $0x01, %al + mov $0x00, %bh + mov $0x0f, %bl + mov $0x24, %cx + mov $0x01, %dh + mov $0x00, %dl + mov $_retmg,%bp + int $0x10 + + mov $0x00, %ax + int $0x16 + + call _clear + + ret + + .section .rodata + _ler_A: .asciz "/!\\ Failed to load the data from drive A /!\\\r\n" + _ler_B: .asciz "/!\\ Failed to load the data from drive B /!\\\r\n" + _retmg: .asciz "\r\nPress any key to return to MP-OS/1" + + .section .data + tries: .byte 0 diff --git a/kernel/libk/disk.S b/kernel/fs/status.S similarity index 98% rename from kernel/libk/disk.S rename to kernel/fs/status.S index 526b38f..aaea6ef 100644 --- a/kernel/libk/disk.S +++ b/kernel/fs/status.S @@ -5,7 +5,7 @@ */ .code16 - .section .text.libk + .section .text.filesys .global _disk_status # @@ -276,4 +276,4 @@ _s_BB: .asciz " Fixed disk undefined error\r\n" _s_CC: .asciz " Fixed disk write fault on selected drive\r\n" _s_E0: .asciz " Fixed disk status error / Error reg = 0\r\n" - _s_FF: .asciz " Sense operation failed\r\n" \ No newline at end of file + _s_FF: .asciz " Sense operation failed\r\n" diff --git a/kernel/kernel.S b/kernel/kernel.S index 868c0cb..e1b74ab 100644 --- a/kernel/kernel.S +++ b/kernel/kernel.S @@ -4,26 +4,79 @@ .global _kernel .extern _printk + .extern _panic - .fill 218, 1, 0 - jmp _kernel + .extern _load_A + .extern _load_B - _kernel: + .extern _format_A + .extern _format_B + + .extern _input + + .extern _pinb + + _kernel: # Kernel entry point + xor %ax, %ax # Reset the disk system + int $0x13 + + call _clear + + # Stack Setup xor %ax, %ax - xor %dx, %dx - mov %ax, %es - mov %ss, %ax + mov %ax, %ds + mov %ax, %ss mov $_kernel,%sp + cld + + # Print boot msg. #2 + mov $0x13, %ah # Value 0x13 (print str.) + mov $0x01, %al # String type + mov $0x00, %bh # Video page num. + mov $0x0f, %bl # Attribute (White on Black) + mov $0x0B, %cx # String len. = 13 chars. + mov $0x00, %dh # Row 2 + mov $0x00, %dl # Column 0 + mov $_msg1, %bp # String to print + int $0x10 # Call interrupt + + # Setup Stack + xor %ax, %ax + mov %ax, %ds + mov %ax, %ss # Stack start = 0 + mov $0x7e00,%sp # Stack pointer = 0x7e00 + + cli # Clear ints. + push %ds # Save %ds + + lgdt _gdt_inf # Load the GDT + + mov %cr0, %eax # Switch to Prot. Mode + or $1, %al # By setting the + mov %eax, %cr0 # Prot. Mode bit + + mov $0x08, %bx # Select desc. 1 + mov %bx, %ds # 0x08 = 1000b + + and $0xFE, %al # Back to real mode + mov %eax, %cr0 # by toggling the bit agian + + pop %ds # Return the %ds + sti # Store ints. + + # Load MP-OS/1 + #call _monitor_program - call _clear + call _clear - mov $_msg2, %si + mov $_mp_str_title, %si call _printk - jmp _pinb + jmp _input cli hlt - .section .rodata - _msg2: .asciz "\xDB\xDB\xDB OS/1 5.0.0\r\n" + .section .rodata # Read-only data + _msg1: .asciz "\xDB\xDB\xDB OS/1 WE" # Boot message (2/2). + _mp_str_title: .asciz "\xDB Monitor Program for OS/1 (MP-OS/1) Version 1.0.0\r\n To start the GUI type pinb\r\n" \ No newline at end of file diff --git a/kernel/kernel.ld b/kernel/kernel.ld index 7f971f4..0b88984 100644 --- a/kernel/kernel.ld +++ b/kernel/kernel.ld @@ -7,16 +7,14 @@ SECTIONS .text : SUBALIGN(0) { *(.text.kern); + *(.text.filesys); *(.text.libk); - *(.text.pinb); - *(.text.pinb.app); *(.text) } .rodata : SUBALIGN(0) { - *(.rodata.pinb); - *(.rodata.pinb.app); + *(.rodata.mp); *(.rodata); } diff --git a/kernel/libk/panic.S b/kernel/libk/panic.S new file mode 100644 index 0000000..7febe4e --- /dev/null +++ b/kernel/libk/panic.S @@ -0,0 +1,164 @@ + + .section .text.libk + .global _panic + .code16 + + _panic: + call _clear + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0x4f, %bl + mov $2240, %cx + int $0x10 + + mov $_pm_0, %si + call _printk + + mov $_pm_1, %si + call _printk + + mov $_pm_2, %si + call _printk + + # + # Print registers + # + + mov $_pm_ax,%si + call _printk + movw %ax, (regi) + call _preg + + mov $_pm_bx,%si + call _printk + movw %bx, (regi) + call _preg + + mov $_pm_cx,%si + call _printk + movw %cx, (regi) + call _preg + + mov $_pm_dx,%si + call _printk + movw %dx, (regi) + call _preg + + mov $_nwln, %si + call _printk + + # + # + # + + mov $_pm_sp,%si + call _printk + movw %sp, (regi) + call _preg + + mov $_pm_bp,%si + call _printk + movw %bp, (regi) + call _preg + + mov $_pm_si,%si + call _printk + movw %si, (regi) + call _preg + + mov $_pm_di,%si + call _printk + movw %di, (regi) + call _preg + + mov $_nwln, %si + call _printk + + # + # + # + + mov $_pm_cs,%si + call _printk + movw %cs, (regi) + call _preg + + mov $_pm_ds,%si + call _printk + movw %ds, (regi) + call _preg + + mov $_pm_es,%si + call _printk + movw %es, (regi) + call _preg + + mov $_pm_fs,%si + call _printk + movw %fs, (regi) + call _preg + + mov $_nwln, %si + call _printk + + # + # + # + + mov $_pm_gs,%si + call _printk + movw %gs, (regi) + call _preg + + mov $_pm_ss,%si + call _printk + movw %ss, (regi) + call _preg + + # + # OS Info + # + mov $_pm_3, %si + call _printk + + mov $_pm_i1, %si + call _printk + + mov $_pm_i2, %si + call _printk + + mov $0x00, %ax + int $0x16 + int $0x19 + + cli + hlt + + .section .rodata + _nwln: .asciz "\r\n" + _pm_0: .asciz "**** OS KERNEL HALTED ****\r\n\r\n" + _pm_1: .asciz " OS kernel has experienced a fatal error and has halted program execution.\r\n" + _pm_2: .asciz " Press any key to reboot. Registers dumped:\r\n\r\n" + + _pm_ax: .asciz " AX : " + _pm_bx: .asciz " BX : " + _pm_cx: .asciz " CX : " + _pm_dx: .asciz " DX : " + + _pm_sp: .asciz " SP : " + _pm_bp: .asciz " BP : " + _pm_si: .asciz " SI : " + _pm_di: .asciz " DI : " + + _pm_cs: .asciz " CS : " + _pm_ds: .asciz " DS : " + _pm_es: .asciz " ES : " + _pm_fs: .asciz " FS : " + _pm_gs: .asciz " GS : " + _pm_ss: .asciz " SS : " + + _pm_3: .asciz "\r\n\r\n OS Information:\r\n" + _pm_i1: .asciz " Kernel: v5.1.0 \"Copland\"\r\n" + _pm_i2: .asciz " OS: OS/1 Average Release 5.1.0" diff --git a/kernel/libk/screen.S b/kernel/libk/screen.S deleted file mode 100644 index 3e1d39c..0000000 --- a/kernel/libk/screen.S +++ /dev/null @@ -1,35 +0,0 @@ - - .code16 - .section .text.libk - - .global _clear - .global _set_GM - - # - # _clear: clear the screen, and set the resolution to 80x28 - # - _clear: - mov $0x03, %ax - int $0x10 - - # Set pallete register - mov $0x1003,%ax - mov $0x00, %bl - int $0x10 - - # Set up the font - mov $0x11, %ah - mov $0x11, %al - int $0x10 - - ret - - # - # _set_GM: clear the screen and set to the graphics mode - # - _set_GM: - mov $0x00, %ah - mov $0x06, %al - int $0x10 - - ret diff --git a/kernel/libk/stdio.S b/kernel/libk/stdio.S index 2861df6..4d5181f 100644 --- a/kernel/libk/stdio.S +++ b/kernel/libk/stdio.S @@ -1,94 +1,75 @@ - + .code16 - .section .text.libk - .global _printk - .global _printk_wh - .global _printk_gr - .global _printk_rc - + .global _preg + .global _clear .global _strcmp - + .section .text.libk # - # _printk: standard print string function + # _clear: clears the screen # - _printk: - mov $0x0e, %ah - - ._printk_l: - lodsb - - cmp $0x00, %al - je ._printk_d + _clear: + mov $0x03, %ax + int $0x10 - int $0x10 + # Set pallete register + mov $0x1003,%ax + mov $0x00, %bl + int $0x10 - jmp ._printk_l + # Set up the font + mov $0x11, %ah + mov $0x11, %al + int $0x10 - ._printk_d: - ret + ret # - # _printk_wh: print a string in a "random" color + # _printk: prints strings in SI register # - _printk_rc: - add $0x01, %bl - mov $0x0e, %ah - - ._prc_l: - lodsb - - cmp $0x00, %al - je ._prc_d + _printk: + lodsb + or %al, %al + jz _printk_done - add $0x01, %bl - int $0x10 + mov $0x0e, %ah + mov $0x00, %bh + mov $0x0f, %bl + int $0x10 - jmp ._prc_l + jmp _printk - ._prc_d: + _printk_done: ret # - # _printk_bl: print a string in black + # _preg: prints value of a register # - _printk_bl: - mov $0x00, %bl - mov $0x0e, %ah - - ._pgr_l: - lodsb - - cmp $0x00, %al - je ._pgr_d + _preg: + mov $ostr, %di + mov (regi), %ax + mov $hstr, %si + mov $0x04, %cx - int $0x10 + .preg_loop: + rol $0x04, %ax # Might cause problems later on, if enabled pc returns an error + mov %ax, %bx + and $0x0f, %bx - jmp ._pgr_l + movb (%bx, %si), %bl - ._pgr_d: - ret - - # - # _printk_wh: print a string in white - # - _printk_wh: - mov $0x0F, %bl - mov $0x0e, %ah - - ._pwh_l: - lodsb - - cmp $0x00, %al - je ._pwh_d + movb %bl, (%di) - int $0x10 + inc %di + dec %cx - jmp ._pwh_l + jnz .preg_loop - ._pwh_d: - ret + mov $ostr, %si + call _printk + + ret # # _strcmp: compare two strings in registers @@ -116,3 +97,10 @@ _strcmp_d: stc ret + + .section .data + .global regi + ostr: .asciz "0000 " + hstr: .asciz "0123456789ABCDEF" + + regi: .word 0 diff --git a/kernel/mp/cmd.S b/kernel/mp/cmd.S new file mode 100644 index 0000000..2f705f6 --- /dev/null +++ b/kernel/mp/cmd.S @@ -0,0 +1,21 @@ + + # Power + _mp_cmd_rebt: .asciz "reboot" # Warm reboot (int 0x19) + _mp_cmd_shutd: .asciz "shutdown" # Power off the sys. (QEMU, Virtualbox) + + # Memory + _mp_cmd_mem: .asciz "mem" # Get the amount of free (low) memory in hex + + # Disk(s) + _mp_cmd_dstat: .asciz "dstat" # Status from the disk drive / check for disk drive errors + + _mp_cmd_load_a: .asciz "load a" # Load data from disk in drive A (from 0x7e00+) and jump to 0x7e00 + _mp_cmd_load_b: .asciz "load b" # Load data from disk in drive B (from 0x7e00+) and jump to 0x7e00 + + # Others + _mp_cmd_ver: .asciz "ver" # Display version string + _mp_cmd_clear: .asciz "clear" # Clear the screen + _mp_cmd_help: .asciz "help" # Help command + + # Pinboard + _mp_cmd_pinb: .asciz "pinb" # Start the pinboard enviroment diff --git a/kernel/mp/main.S b/kernel/mp/main.S new file mode 100644 index 0000000..0abc9cb --- /dev/null +++ b/kernel/mp/main.S @@ -0,0 +1,271 @@ + + /* + Monitor Program for OS/1 + (MP-OS/1) + ================================ + + Monitor Program for OS/1 or MP-OS/1 is a + simple program that allows users to + "monitor" the system. Its main function + is to let the user load and write data + to the disk(s). + + */ + + + .code16 + .section .text.mp + .global _input + #.global _monitor_program + + # + # _monitor_program - main program point. + # - takes user input + # - if it matches a command, then + # execute it + # - if there is no match, then return + # an error. + # + _input: + mov $_mp_prompt, %si + call _printk + + mov $_input_buffer, %di + call _get_input + + mov $_input_buffer, %si + cmpb $0x0000, (%si) + je _input + + # + # Basics (reboot, shutdown) + # + mov $_input_buffer, %si + mov $_mp_cmd_rebt, %di + call _strcmp + jc _reboot + + mov $_input_buffer, %si + mov $_mp_cmd_shutd, %di + call _strcmp + jc _shutdown + + # + # Memory (mem. stat. , peek & poke) + # + mov $_input_buffer, %si + mov $_mp_cmd_mem, %di + call _strcmp + jc _mem + + # + # Load command(s) + # + mov $_input_buffer, %si + mov $_mp_cmd_load_a,%di + call _strcmp + jc _loada + + mov $_input_buffer, %si + mov $_mp_cmd_load_b,%di + call _strcmp + jc _loadb + + # + # Disk status + # + mov $_input_buffer, %si + mov $_mp_cmd_dstat, %di + call _strcmp + jc _dstat + + # + # Others (ver. and clear) + # + mov $_input_buffer, %si + mov $_mp_cmd_clear,%di + call _strcmp + jc _clear + + mov $_input_buffer, %si + mov $_mp_cmd_ver,%di + call _strcmp + jc _ver + + # + # Help command + # + mov $_input_buffer, %si + mov $_mp_cmd_help, %di + call _strcmp + jc _help + + # + # Pinboard enviroment + # + mov $_input_buffer, %si + mov $_mp_cmd_pinb, %di + call _strcmp + jc _penv + + # Command not found? Return an "?" + mov $_input_buffer, %si + call _printk + mov $_mp_str_err, %si + call _printk + hlt + + jmp _input + + _get_input: + xor %cl, %cl + + _get_input_l: + mov $0x00, %ah + int $0x16 + + cmp $0x08, %al + je _backspace + + cmp $0x0d, %al + je _returnk + + cmp $0xff, %cl + je _get_input_l + + mov $0x0e, %ah + int $0x10 + + stosb + inc %cl + jmp _get_input_l + + _backspace: + cmp $0x00, %cl + je _get_input_l + + dec %di + movb $0x00, (%di) + dec %cl + + mov $0x0e, %ah + mov $0x08, %al + int $0x10 + + mov $0x20, %al + int $0x10 + + mov $0x08, %al + int $0x10 + + jmp _get_input_l + + _returnk: + mov $0x00, %al + stosb + + mov $0x0e, %ah + mov $0x0d, %al + int $0x10 + + mov $0x0a, %al + int $0x10 + + ret + + ################################# + # COMMANDS # + ################################# + + _reboot: + int $0x19 + + _shutdown: + xor %ax, %ax + xor %bx, %bx + + mov $0x1000,%ax + mov %ss, %ax + mov $0xf000,%sp + mov $0x5307,%ax + mov $0x0001,%bx + mov $0x0003,%cx + int $0x15 + + _mem: + xor %ax, %ax + clc + + int $0x12 + + movw %ax, (regi) + call _preg + + mov $_mp_str_mem, %si + call _printk + + jmp _input + + _ver: + mov $_mp_str_ver, %si + call _printk + + jmp _input + + _clear: + mov $0x03, %ax + int $0x10 + + # Set pallete register + mov $0x1003,%ax + mov $0x00, %bl + int $0x10 + + # Set up the font + mov $0x11, %ah + mov $0x11, %al + int $0x10 + jmp _input + + _dstat: + xor %dx, %dx + xor %ax, %ax + call _disk_status + jmp _input + + _loada: + call _load_A + jmp _input + + _loadb: + call _load_B + jmp _input + + _help: + mov $_mp_str_help, %si + call _printk + + jmp _input + + _penv: + jmp _pinb + + .section .rodata.mp + _mp_new_line: .asciz "\r\n" + + _mp_str_ver: .asciz " Monitor Program for OS/1 (MP-OS/1) Version 1.0.0\r\n" + _mp_str_mem: .asciz "KB of low memory free (in hex.)\r\n" + + _mp_prompt: .asciz "% " + _mp_str_err: .asciz "?\r\n\n" + + _mp_str_help: .asciz " List of commands:\r\n - reboot\r\n - shutdown\r\n - mem\r\n - dstat\r\n - load a\r\n - load b\r\n - ver\r\n - clear\r\n - help\r\n" + + .section .data + + # + # _input_buffer - stores user input (256-byte limit) + # + _input_buffer: .fill 256,1,0 + + .include "mp/cmd.S" diff --git a/kernel/pinb/curs/home_curs.S b/kernel/pinb/curs/home_curs.S index 41eec92..6d664ec 100644 --- a/kernel/pinb/curs/home_curs.S +++ b/kernel/pinb/curs/home_curs.S @@ -190,13 +190,13 @@ .shell: cmp $0x03, %dh - je _shell + je _kernel cmp $0x04, %dh - je _shell + je _kernel cmp $0x05, %dh - je _shell + je _kernel cmp $0x06, %dh - je _shell + je _kernel /* cmp $0x09, %dh diff --git a/kernel/pinb/pinb.S b/kernel/pinb/pinb.S index d80e43f..519ed9b 100644 --- a/kernel/pinb/pinb.S +++ b/kernel/pinb/pinb.S @@ -51,5 +51,5 @@ hlt .section .rodata.pinb - _pm_0: .asciz " Pinboard Enviroment for OS/1 5.0.0" + _pm_0: .asciz " Pinboard Enviroment for OS/1 v5.x" _bar: .asciz " \xB3 Home \xB3" diff --git a/kernel/pinb/shell/cmd.S b/kernel/pinb/shell/cmd.S deleted file mode 100644 index e6b6a2c..0000000 --- a/kernel/pinb/shell/cmd.S +++ /dev/null @@ -1,16 +0,0 @@ - - # Power - _sh_cmd_rebt: .asciz "reboot" # Warm reboot (int 0x19) - _sh_cmd_shutd: .asciz "shutdown" # Power off the sys. (QEMU, Virtualbox) - - # Memory - _sh_cmd_mem: .asciz "mem" # Get the amount of free (low) memory in hex - - # Disk(s) - _sh_cmd_dstat: .asciz "dstat" # Status from the disk drive / check for disk drive errors - - # Others - _sh_cmd_ver: .asciz "ver" # Display version string - _sh_cmd_clear: .asciz "clear" # Clear the screen - _sh_cmd_help: .asciz "help" # Help command - _sh_cmd_exit: .asciz "exit" # return to PinB. diff --git a/kernel/pinb/shell/shell.S b/kernel/pinb/shell/shell.S deleted file mode 100644 index 0443629..0000000 --- a/kernel/pinb/shell/shell.S +++ /dev/null @@ -1,215 +0,0 @@ - - .code16 - .section .text.pinb.app - .global _shell - - _shell: - mov $0x03, %ax - int $0x10 - - # Set pallete register - mov $0x1003,%ax - mov $0x00, %bl - int $0x10 - - # Set up the font - mov $0x11, %ah - mov $0x11, %al - int $0x10 - - _input: - mov $_sh_prompt, %si - call _printk - - mov $_input_buffer, %di - call _get_input - - mov $_input_buffer, %si - cmpb $0x0000, (%si) - je _input - - # - # Basics (reboot, shutdown) - # - mov $_input_buffer, %si - mov $_sh_cmd_rebt, %di - call _strcmp - jc _reboot - - mov $_input_buffer, %si - mov $_sh_cmd_shutd, %di - call _strcmp - jc _shutdown - - - # - # Disk status - # - mov $_input_buffer, %si - mov $_sh_cmd_dstat, %di - call _strcmp - jc _dstat - - # - # Others (ver. and clear) - # - mov $_input_buffer, %si - mov $_sh_cmd_clear,%di - call _strcmp - jc _clear - - mov $_input_buffer, %si - mov $_sh_cmd_ver,%di - call _strcmp - jc _ver - - # - # Help command - # - mov $_input_buffer, %si - mov $_sh_cmd_help, %di - call _strcmp - jc _help - - # - # Exit command - # - mov $_input_buffer, %si - mov $_sh_cmd_exit, %di - call _strcmp - jc _exit - - # Command not found? Return the err. msg. - mov $_sh_str_er1, %si - call _printk - mov $_input_buffer, %si - call _printk - mov $_sh_str_er2, %si - call _printk - - jmp _input - - _get_input: - xor %cl, %cl - - _get_input_l: - mov $0x00, %ah - int $0x16 - - cmp $0x08, %al - je _backspace - - cmp $0x0d, %al - je _returnk - - cmp $0xff, %cl - je _get_input_l - - mov $0x0e, %ah - int $0x10 - - stosb - inc %cl - jmp _get_input_l - - _backspace: - cmp $0x00, %cl - je _get_input_l - - dec %di - movb $0x00, (%di) - dec %cl - - mov $0x0e, %ah - mov $0x08, %al - int $0x10 - - mov $0x20, %al - int $0x10 - - mov $0x08, %al - int $0x10 - - jmp _get_input_l - - _returnk: - mov $0x00, %al - stosb - - mov $0x0e, %ah - mov $0x0d, %al - int $0x10 - - mov $0x0a, %al - int $0x10 - - ret - - ################################# - # COMMANDS # - ################################# - _reboot: - int $0x19 - - _shutdown: - xor %ax, %ax - xor %bx, %bx - - mov $0x1000,%ax - mov %ss, %ax - mov $0xf000,%sp - mov $0x5307,%ax - mov $0x0001,%bx - mov $0x0003,%cx - int $0x15 - - _help: - mov $_sh_hlp_msg, %si - call _printk - - jmp _input - - _ver: - mov $_sh_ver_msg, %si - call _printk - - jmp _input - - _clear: - mov $0x03, %ax - int $0x10 - - # Set pallete register - mov $0x1003,%ax - mov $0x00, %bl - int $0x10 - - # Set up the font - mov $0x11, %ah - mov $0x11, %al - int $0x10 - - jmp _input - - _dstat: - xor %dx, %dx - xor %ax, %ax - call _disk_status - jmp _input - - _exit: - jmp _pinb - - .section .rodata.pinb.app - _sh_title: .asciz "==== OS/1 AR 5.0.0 ====\r\n" - _sh_prompt: .asciz "> " - - _sh_ver_msg: .asciz " Operating System/1 v5.0.0\r\n DUNE kernel v2.00\r\n Pinboard Enviroment - Shell v3.0.0\r\n" - _sh_str_er1: .asciz " Command [" - _sh_str_er2: .asciz "] not found.\r\n" - _sh_hlp_msg: .asciz " List of commands:\r\n - help\r\n - ver\r\n - reboot\r\n - shutdown\r\n - dstat\r\n - clear\r\n - exit\r\n" - - .section .data - _input_buffer: .fill 64,1,0 - - .include "pinb/shell/cmd.S" diff --git a/utils/Makefile b/utils/Makefile new file mode 100644 index 0000000..b4f9d29 --- /dev/null +++ b/utils/Makefile @@ -0,0 +1,54 @@ + +override FLP = os1.img +override ISO = os1.iso +override BINS := $(shell find ./ -type f -name '*.bin') + +.PHONY:all +all: load kern binary disk run + +# +# Builds the LOAD (bootloader) +load: + make -C boot + +# +# Builds the main kernel (called Copland) +kern: + make -C kernel + +# +# Create a system binary by combining nload.bin & kernel.bin +binary: + cat bin/boot.bin bin/kernel.bin > bin/os1.bin +# +# Creates a low density 360 KiB +disk: load kernel binary + dd if=/dev/zero of=img/$(FLP) bs=512 count=720 + dd if=bin/os1.bin of=img/$(FLP) conv=notrunc + +# +# Create high density 1.44M floppy image (needed for CD-ISO) +144img: + dd if=/dev/zero of=img/$(FLP) bs=512 count=2880 + dd if=bin/os1.bin of=img/$(FLP) conv=notrunc + +# +# Creates an ISO image +cdiso: 144img + mkisofs -quiet -V 'os1-ar-510' -input-charset iso8859-1 -o img/$(ISO) -b $(FLP) img/ +# +# Runs the os1.img in QEMU +run: disk + qemu-system-i386 -fda img/$(FLP) + +# +# Run the CD-ISO image (os1.iso) - QEMU +runcd: cdiso + qemu-system-i386 -cdrom img/$(ISO) + +.PHONY: clean +clean: + make -C boot clean + make -C kernel clean + make -C pinboard clean + rm $(BINS) img/$(FLP) img/$(ISO) diff --git a/utils/README.txt b/utils/README.txt new file mode 100644 index 0000000..5d28f57 --- /dev/null +++ b/utils/README.txt @@ -0,0 +1,9 @@ + Operating System/1 Average Release 5.1.0 +================================================ + + Changes: + - usage of Unreal / Big Real / Voodoo mode + - multiple disk drive support (drives A & B) + - switch to a more stable kernel + - switch to a Monitor Program as the default shell + - minor changes to Pinboard diff --git a/utils/boot/Makefile b/utils/boot/Makefile new file mode 100644 index 0000000..144d50f --- /dev/null +++ b/utils/boot/Makefile @@ -0,0 +1,23 @@ + +# Change as you like but keep it x86 compatable. +ARCH=i386-elf + +AS=$(ARCH)-as +LD=$(ARCH)-ld + +override BIN := ../bin/boot.bin +override ASM := $(shell find ./ -type f -name '*.S') +override OBJ := $(ASM:.S=.o) + +.PHONY: all +all: $(BIN) + +$(BIN): $(OBJ) + $(LD) -Tx86.ld $(OBJ) -o $@ + +%.o: %.S + $(AS) $< -o $@ + +.PHONY: clean +clean: + rm $(OBJ) diff --git a/utils/boot/libx86.S b/utils/boot/libx86.S new file mode 100644 index 0000000..bde16e8 --- /dev/null +++ b/utils/boot/libx86.S @@ -0,0 +1,55 @@ + + .code16 + .global read_disk + .section .text + .extern STAGE2 + .global _dev + + read_disk: + clc + incb (trys) + + mov $0x02, %ah # Read disk arg. (ah = 0x02) + mov $0x40, %al # Number of sectors to read (64) + mov $0x7e00,%bx # Buffer address (2nd sector) + mov $0x00, %ch # Track / Cylinder number + mov $0x02, %cl # Sector number + mov $0x00, %dh # Head number + movb (_dev), %dl # Disk drive (0 - drive A; 1 - drive B) + + int $0x13 # Disk interrupt (0x13) + + jc disk_error # If clear flag is set jump to disk_error + + ret # Return + + disk_info: + + disk_error: + clc + cmpb $3, (trys) # If num of tries is less than 3 + jl read_disk # jump to read_disk + + mov $0x03, %ax # Clear the screen + int $0x10 + + mov $0x13, %ah # Value 0x13 (print str.) + mov $0x01, %al # String type + mov $0x00, %bh # Video page num. + mov $0x0c, %bl # Attribute (L. Red on Black) + mov $38, %cx # String len. = 38 chars. + mov $0x00, %dh # Row 1 + mov $0x00, %dl # Column 0 + mov $_err0, %bp # String to print + int $0x10 # Call interrupt + + cli + hlt + + .section .rodata + _err0: .asciz "/!\\ Disk read error, system halted /!\\" + + .section .data + # Disk read + trys: .byte 0 + _dev: .byte 0 diff --git a/utils/boot/x86.S b/utils/boot/x86.S new file mode 100644 index 0000000..3a1b795 --- /dev/null +++ b/utils/boot/x86.S @@ -0,0 +1,38 @@ + + .code16 + .global _stage1 + .section .text.s1 + .set STAGE2, 0x7e00 + .global STAGE2 + .extern _dev + + _stage1: # Bootloader entry point + + movb %dl, _dev # Boot device value + + xor %ax, %ax + mov %ax, %ds + mov %ax, %ss + mov $_stage1,%sp + cld + + /* First part of the boot msg. */ + mov $0x03, %ax # Clear the screen + int $0x10 + + mov $0x13, %ah # Value 0x13 (print str.) + mov $0x01, %al # String type + mov $0x00, %bh # Video page num. + mov $0x0f, %bl # Attribute (White on Black) + mov $0x04, %cx # String len. = 4 chars. + mov $0x00, %dh # Row 0 + mov $0x00, %dl # Column 0 + mov $_msg0, %bp # String to print + int $0x10 # Call interrupt + + call read_disk + + jmp 0x7e00 + + .section .rodata # Read-only data + _msg0: .asciz "\xDB\xDB\xDB " # Boot message (1/2). diff --git a/utils/boot/x86.ld b/utils/boot/x86.ld new file mode 100644 index 0000000..2747c6d --- /dev/null +++ b/utils/boot/x86.ld @@ -0,0 +1,32 @@ +OUTPUT_FORMAT(binary); +ENTRY(_stage1); + +SECTIONS +{ + . = 0x7c00; + .text : SUBALIGN(0) + { + *(.text.s1); + *(.text) + } + + .rodata : SUBALIGN(0) + { + *(.rodata) + } + + .data : SUBALIGN(0) + { + *(.data) + } + + .sig : AT(0x7DFE) + { + SHORT(0xaa55); + } + + /DISCARD/ : { + *(.comment); + *(.note*); + } +} diff --git a/utils/dir_strut.sh b/utils/dir_strut.sh new file mode 100755 index 0000000..4244671 --- /dev/null +++ b/utils/dir_strut.sh @@ -0,0 +1,3 @@ + +mkdir -p bin +mkdir -p img diff --git a/utils/distribute/distribute b/utils/distribute/distribute new file mode 100755 index 0000000..7c63288 --- /dev/null +++ b/utils/distribute/distribute @@ -0,0 +1,17 @@ +#!/bin/bash + +if [ $# -lt 3 ] + then + printf "Usage:\n\t./distribute \n" + exit +fi + +echo "First sector file: " $1; +echo "Program binary: " $2; +echo "Program name: " $3; + +cat $1 $2 > temp.bin +dd if=/dev/zero of=$3.img bs=512 count=720 +dd if=temp.bin of=$3.img conv=notrunc + +rm temp.bin diff --git a/utils/kernel/Makefile b/utils/kernel/Makefile new file mode 100644 index 0000000..da33c46 --- /dev/null +++ b/utils/kernel/Makefile @@ -0,0 +1,23 @@ + +# Change as you like but keep it x86 compatable. +ARCH=i386-elf + +AS=$(ARCH)-as +LD=$(ARCH)-ld + +override BIN := ../bin/kernel.bin +override ASM := $(shell find ./ -type f -name '*.S') +override OBJ := $(ASM:.S=.o) + +.PHONY: all +all: $(BIN) + +$(BIN): $(OBJ) + $(LD) -Tkernel.ld $(OBJ) -o $@ + +%.o: %.S + $(AS) $< -o $@ + +.PHONY: clean +clean: + rm $(OBJ) diff --git a/utils/kernel/README.txt b/utils/kernel/README.txt new file mode 100644 index 0000000..e341510 --- /dev/null +++ b/utils/kernel/README.txt @@ -0,0 +1,7 @@ + OS/1 AR 5.1.0 Kernel "Copland" +====================================== + + Simple Unreal mode operating system kernel written + in assembly for GNU GAS. Copland offers support for + multiple disk drives. To compile Copland you need a + i386-elf specific GAS (as) and GNU Linker (ld). diff --git a/utils/kernel/cpu/gdt.S b/utils/kernel/cpu/gdt.S new file mode 100644 index 0000000..b9159b8 --- /dev/null +++ b/utils/kernel/cpu/gdt.S @@ -0,0 +1,22 @@ + + /* + GDT by OS-Dev wiki : + www.osdev.org + */ + + .code16 + .global _gdt_inf + .section .text + + _gdt_inf: + .word gdt_end - gdt - 1 + .long gdt + + gdt: + .long 0 + .long 0 + + flatd: + .byte 0xFF, 0xFF, 0, 0, 0, 0b10010010, 0b11001111, 0 + + gdt_end: diff --git a/utils/kernel/fs/load.S b/utils/kernel/fs/load.S new file mode 100644 index 0000000..afd0763 --- /dev/null +++ b/utils/kernel/fs/load.S @@ -0,0 +1,137 @@ + + .code16 + .global _load_A + .global _load_B + .section .text.filesys + + # + # _load_B: Load the data from the disk drive A. + # And jump to the 0x7e00 address of the disk. + _load_A: + clc + incb (tries) + + mov $0x02, %ah + mov $0x40, %al + mov $0x7e00,%bx + mov $0x00, %ch + mov $0x02, %cl + mov $0x00, %dh + mov $0x00, %dl + int $0x13 + + jc _err_A + + ljmp $0x0000,$0x7e00 + + # + # _load_B: Load the data from the disk drive B. + # And jump to the 0x7e00 address of the disk. + _load_B: + clc + incb (tries) + + mov $0x02, %ah + mov $0x40, %al + mov $0x7e00,%bx + mov $0x00, %ch + mov $0x02, %cl + mov $0x00, %dh + mov $0x01, %dl + int $0x13 + + jc _err_B + + ljmp $0x0000,$0x7e00 + + # + # _err_A: Disk load error for _load_A function + _err_A: + clc + cmpb $3, (tries) + jl _load_A + + mov $0x03, %ax + int $0x10 + + xor %ax, %ax + int $0x13 + + mov $0x13, %ah + mov $0x01, %al + mov $0x00, %bh + mov $0x0c, %bl + mov $0x2e, %cx + mov $0x00, %dh + mov $0x00, %dl + mov $_ler_A,%bp + int $0x10 + + call _disk_status + + mov $0x13, %ah + mov $0x01, %al + mov $0x00, %bh + mov $0x0f, %bl + mov $0x24, %cx + mov $0x01, %dh + mov $0x00, %dl + mov $_retmg,%bp + int $0x10 + + mov $0x00, %ax + int $0x16 + + call _clear + + ret + + # + # _err_B: Disk load error for _load_B function + _err_B: + clc + cmpb $3, (tries) + jl _load_B + + mov $0x03, %ax + int $0x10 + + xor %ax, %ax + int $0x13 + + mov $0x13, %ah + mov $0x01, %al + mov $0x00, %bh + mov $0x0c, %bl + mov $0x2e, %cx + mov $0x00, %dh + mov $0x00, %dl + mov $_ler_B,%bp + int $0x10 + + call _disk_status + + mov $0x13, %ah + mov $0x01, %al + mov $0x00, %bh + mov $0x0f, %bl + mov $0x24, %cx + mov $0x01, %dh + mov $0x00, %dl + mov $_retmg,%bp + int $0x10 + + mov $0x00, %ax + int $0x16 + + call _clear + + ret + + .section .rodata + _ler_A: .asciz "/!\\ Failed to load the data from drive A /!\\\r\n" + _ler_B: .asciz "/!\\ Failed to load the data from drive B /!\\\r\n" + _retmg: .asciz "\r\nPress any key to return to MP-OS/1" + + .section .data + tries: .byte 0 diff --git a/utils/kernel/fs/status.S b/utils/kernel/fs/status.S new file mode 100644 index 0000000..aaea6ef --- /dev/null +++ b/utils/kernel/fs/status.S @@ -0,0 +1,279 @@ + + /* + Status messages taken from: + https://stanislavs.org/helppc/int_s_03-1.html + */ + + .code16 + .section .text.filesys + .global _disk_status + + # + # Check for disk drive errors + # + _disk_status: + mov $0x01, %ah + int $0x13 + + movb %al, (_ec) + + mov $_s_XX, %si + call _printk + + xor %ax, %ax + + movb (_ec), %al + + # + # There is probably a macro that could some all of my issues here + # but I'm to lazy to play around with GAS macros. So here it is: + # the CMP monster. + # + # TODO: Use macros! + # + + cmp $0x00, %al + je _00 + + cmp $0x01, %al + je _01 + + cmp $0x02, %al + je _02 + + cmp $0x03, %al + je _03 + + cmp $0x04, %al + je _04 + + cmp $0x05, %al + je _05 + + cmp $0x06, %al + je _06 + + cmp $0x07, %al + je _07 + + cmp $0x08, %al + je _08 + + cmp $0x09, %al + je _09 + + cmp $0x0A, %al + je _0A + + cmp $0x0B, %al + je _0B + + cmp $0x0C, %al + je _0C + + cmp $0x0D, %al + je _0D + + cmp $0x0E, %al + je _0E + + cmp $0x0F, %al + je _0F + + cmp $0x10, %al + je _10 + + cmp $0x11, %al + je _11 + + cmp $0x20, %al + je _20 + + cmp $0x40, %al + je _40 + + cmp $0x80, %al + je _80 + + cmp $0xAA, %al + je _AA + + cmp $0xBB, %al + je _BB + + cmp $0xCC, %al + je _CC + + cmp $0xE0, %al + je _E0 + + cmp $0xFF, %al + je _FF + + ret + + _00: + mov $_s_00, %si + call _printk + ret + + _01: + mov $_s_01, %si + call _printk + ret + + _02: + mov $_s_02, %si + call _printk + ret + + _03: + mov $_s_03, %si + call _printk + ret + + _04: + mov $_s_04, %si + call _printk + ret + + _05: + mov $_s_05, %si + call _printk + ret + + _06: + mov $_s_06, %si + call _printk + ret + + _07: + mov $_s_07, %si + call _printk + ret + + _08: + mov $_s_08, %si + call _printk + ret + + _09: + mov $_s_09, %si + call _printk + ret + + _0A: + mov $_s_0A, %si + call _printk + ret + + _0B: + mov $_s_0B, %si + call _printk + ret + + _0C: + mov $_s_0C, %si + call _printk + ret + + _0D: + mov $_s_0D, %si + call _printk + ret + + _0E: + mov $_s_0E, %si + call _printk + ret + + _0F: + mov $_s_0F, %si + call _printk + ret + + _10: + mov $_s_10, %si + call _printk + ret + + _11: + mov $_s_11, %si + call _printk + ret + + _20: + mov $_s_20, %si + call _printk + ret + + _40: + mov $_s_40, %si + call _printk + ret + + _80: + mov $_s_80, %si + call _printk + ret + + _AA: + mov $_s_AA, %si + call _printk + ret + + _BB: + mov $_s_BB, %si + call _printk + ret + + _CC: + mov $_s_CC, %si + call _printk + ret + + _E0: + mov $_s_E0, %si + call _printk + ret + + _FF: + mov $_s_FF, %si + call _printk + ret + + _ec: .byte 0 + + .section .rodata + _s_XX: .asciz " Disk status:" + + # + # A lot of strings! + # + + _s_00: .asciz " No disk drive error\r\n" + _s_01: .asciz " Bad command passed to the disk driver\r\n" + _s_02: .asciz " Address mark not found / Bad sector\r\n" + _s_03: .asciz " Diskette write protect error\r\n" + _s_04: .asciz " Sector not found\r\n" + _s_05: .asciz " Fixed disk reset failed\r\n" + _s_06: .asciz " Diskette changed or removed\r\n" + _s_07: .asciz " Bad fixed disk parameter table\r\n" + _s_08: .asciz " DMA overrun\r\n" + _s_09: .asciz " DMA access across 64K boundry\r\n" + _s_0A: .asciz " Bad fixed disk sector flag\r\n" + _s_0B: .asciz " Bad fixed disk cylinder\r\n" + _s_0C: .asciz " Unsupported track/invalid media\r\n" + _s_0D: .asciz " Invalid number of sectors on a fixed disk format\r\n" + _s_0E: .asciz " Fixed disk controlled data address mark detected\r\n" + _s_0F: .asciz " Fixed disk DMA arbitration level out of range\r\n" + _s_10: .asciz " ECC/CRC error on disk read\r\n" + _s_11: .asciz " Recoverable fixed disk data error, data fixed by ECC\r\n" + _s_20: .asciz " Controller error (NEC for diskettes)\r\n" + _s_40: .asciz " Seek failure\r\n" + _s_80: .asciz " Time out, drive not ready\r\n" + _s_AA: .asciz " Fixed disk, drive not ready\r\n" + _s_BB: .asciz " Fixed disk undefined error\r\n" + _s_CC: .asciz " Fixed disk write fault on selected drive\r\n" + _s_E0: .asciz " Fixed disk status error / Error reg = 0\r\n" + _s_FF: .asciz " Sense operation failed\r\n" diff --git a/utils/kernel/kernel.S b/utils/kernel/kernel.S new file mode 100644 index 0000000..e1b74ab --- /dev/null +++ b/utils/kernel/kernel.S @@ -0,0 +1,82 @@ + + .code16 + .section .text.kern + .global _kernel + + .extern _printk + .extern _panic + + .extern _load_A + .extern _load_B + + .extern _format_A + .extern _format_B + + .extern _input + + .extern _pinb + + _kernel: # Kernel entry point + xor %ax, %ax # Reset the disk system + int $0x13 + + call _clear + + # Stack Setup + xor %ax, %ax + mov %ax, %ds + mov %ax, %ss + mov $_kernel,%sp + cld + + # Print boot msg. #2 + mov $0x13, %ah # Value 0x13 (print str.) + mov $0x01, %al # String type + mov $0x00, %bh # Video page num. + mov $0x0f, %bl # Attribute (White on Black) + mov $0x0B, %cx # String len. = 13 chars. + mov $0x00, %dh # Row 2 + mov $0x00, %dl # Column 0 + mov $_msg1, %bp # String to print + int $0x10 # Call interrupt + + # Setup Stack + xor %ax, %ax + mov %ax, %ds + mov %ax, %ss # Stack start = 0 + mov $0x7e00,%sp # Stack pointer = 0x7e00 + + cli # Clear ints. + push %ds # Save %ds + + lgdt _gdt_inf # Load the GDT + + mov %cr0, %eax # Switch to Prot. Mode + or $1, %al # By setting the + mov %eax, %cr0 # Prot. Mode bit + + mov $0x08, %bx # Select desc. 1 + mov %bx, %ds # 0x08 = 1000b + + and $0xFE, %al # Back to real mode + mov %eax, %cr0 # by toggling the bit agian + + pop %ds # Return the %ds + sti # Store ints. + + # Load MP-OS/1 + #call _monitor_program + + call _clear + + mov $_mp_str_title, %si + call _printk + + jmp _input + + cli + hlt + + .section .rodata # Read-only data + _msg1: .asciz "\xDB\xDB\xDB OS/1 WE" # Boot message (2/2). + _mp_str_title: .asciz "\xDB Monitor Program for OS/1 (MP-OS/1) Version 1.0.0\r\n To start the GUI type pinb\r\n" \ No newline at end of file diff --git a/utils/kernel/kernel.ld b/utils/kernel/kernel.ld new file mode 100644 index 0000000..0b88984 --- /dev/null +++ b/utils/kernel/kernel.ld @@ -0,0 +1,30 @@ +OUTPUT_FORMAT(binary); +ENTRY(_kernel); + +SECTIONS +{ + . = 0x7e00; + .text : SUBALIGN(0) + { + *(.text.kern); + *(.text.filesys); + *(.text.libk); + *(.text) + } + + .rodata : SUBALIGN(0) + { + *(.rodata.mp); + *(.rodata); + } + + .data : SUBALIGN(0) + { + *(.data) + } + + /DISCARD/ : { + *(.comment); + *(.note*); + } +} diff --git a/utils/kernel/libk/panic.S b/utils/kernel/libk/panic.S new file mode 100644 index 0000000..7febe4e --- /dev/null +++ b/utils/kernel/libk/panic.S @@ -0,0 +1,164 @@ + + .section .text.libk + .global _panic + .code16 + + _panic: + call _clear + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0x4f, %bl + mov $2240, %cx + int $0x10 + + mov $_pm_0, %si + call _printk + + mov $_pm_1, %si + call _printk + + mov $_pm_2, %si + call _printk + + # + # Print registers + # + + mov $_pm_ax,%si + call _printk + movw %ax, (regi) + call _preg + + mov $_pm_bx,%si + call _printk + movw %bx, (regi) + call _preg + + mov $_pm_cx,%si + call _printk + movw %cx, (regi) + call _preg + + mov $_pm_dx,%si + call _printk + movw %dx, (regi) + call _preg + + mov $_nwln, %si + call _printk + + # + # + # + + mov $_pm_sp,%si + call _printk + movw %sp, (regi) + call _preg + + mov $_pm_bp,%si + call _printk + movw %bp, (regi) + call _preg + + mov $_pm_si,%si + call _printk + movw %si, (regi) + call _preg + + mov $_pm_di,%si + call _printk + movw %di, (regi) + call _preg + + mov $_nwln, %si + call _printk + + # + # + # + + mov $_pm_cs,%si + call _printk + movw %cs, (regi) + call _preg + + mov $_pm_ds,%si + call _printk + movw %ds, (regi) + call _preg + + mov $_pm_es,%si + call _printk + movw %es, (regi) + call _preg + + mov $_pm_fs,%si + call _printk + movw %fs, (regi) + call _preg + + mov $_nwln, %si + call _printk + + # + # + # + + mov $_pm_gs,%si + call _printk + movw %gs, (regi) + call _preg + + mov $_pm_ss,%si + call _printk + movw %ss, (regi) + call _preg + + # + # OS Info + # + mov $_pm_3, %si + call _printk + + mov $_pm_i1, %si + call _printk + + mov $_pm_i2, %si + call _printk + + mov $0x00, %ax + int $0x16 + int $0x19 + + cli + hlt + + .section .rodata + _nwln: .asciz "\r\n" + _pm_0: .asciz "**** OS KERNEL HALTED ****\r\n\r\n" + _pm_1: .asciz " OS kernel has experienced a fatal error and has halted program execution.\r\n" + _pm_2: .asciz " Press any key to reboot. Registers dumped:\r\n\r\n" + + _pm_ax: .asciz " AX : " + _pm_bx: .asciz " BX : " + _pm_cx: .asciz " CX : " + _pm_dx: .asciz " DX : " + + _pm_sp: .asciz " SP : " + _pm_bp: .asciz " BP : " + _pm_si: .asciz " SI : " + _pm_di: .asciz " DI : " + + _pm_cs: .asciz " CS : " + _pm_ds: .asciz " DS : " + _pm_es: .asciz " ES : " + _pm_fs: .asciz " FS : " + _pm_gs: .asciz " GS : " + _pm_ss: .asciz " SS : " + + _pm_3: .asciz "\r\n\r\n OS Information:\r\n" + _pm_i1: .asciz " Kernel: v5.1.0 \"Copland\"\r\n" + _pm_i2: .asciz " OS: OS/1 Average Release 5.1.0" diff --git a/utils/kernel/libk/stdio.S b/utils/kernel/libk/stdio.S new file mode 100644 index 0000000..4d5181f --- /dev/null +++ b/utils/kernel/libk/stdio.S @@ -0,0 +1,106 @@ + + .code16 + .global _printk + .global _preg + .global _clear + .global _strcmp + .section .text.libk + + # + # _clear: clears the screen + # + _clear: + mov $0x03, %ax + int $0x10 + + # Set pallete register + mov $0x1003,%ax + mov $0x00, %bl + int $0x10 + + # Set up the font + mov $0x11, %ah + mov $0x11, %al + int $0x10 + + ret + + # + # _printk: prints strings in SI register + # + _printk: + lodsb + or %al, %al + jz _printk_done + + mov $0x0e, %ah + mov $0x00, %bh + mov $0x0f, %bl + int $0x10 + + jmp _printk + + _printk_done: + ret + + # + # _preg: prints value of a register + # + _preg: + mov $ostr, %di + mov (regi), %ax + mov $hstr, %si + mov $0x04, %cx + + .preg_loop: + rol $0x04, %ax # Might cause problems later on, if enabled pc returns an error + mov %ax, %bx + and $0x0f, %bx + + movb (%bx, %si), %bl + + movb %bl, (%di) + + inc %di + dec %cx + + jnz .preg_loop + + mov $ostr, %si + call _printk + + ret + + # + # _strcmp: compare two strings in registers + # %di and %si + # + _strcmp: + _strcmp_l: + mov (%si), %al + mov (%di), %bl + cmp %bl, %al + jne _notequal + + cmp $0x00, %al + je _strcmp_d + + inc %di + inc %si + + jmp _strcmp_l + + _notequal: + clc + ret + + _strcmp_d: + stc + ret + + .section .data + .global regi + ostr: .asciz "0000 " + hstr: .asciz "0123456789ABCDEF" + + regi: .word 0 diff --git a/utils/kernel/mp/cmd.S b/utils/kernel/mp/cmd.S new file mode 100644 index 0000000..2f705f6 --- /dev/null +++ b/utils/kernel/mp/cmd.S @@ -0,0 +1,21 @@ + + # Power + _mp_cmd_rebt: .asciz "reboot" # Warm reboot (int 0x19) + _mp_cmd_shutd: .asciz "shutdown" # Power off the sys. (QEMU, Virtualbox) + + # Memory + _mp_cmd_mem: .asciz "mem" # Get the amount of free (low) memory in hex + + # Disk(s) + _mp_cmd_dstat: .asciz "dstat" # Status from the disk drive / check for disk drive errors + + _mp_cmd_load_a: .asciz "load a" # Load data from disk in drive A (from 0x7e00+) and jump to 0x7e00 + _mp_cmd_load_b: .asciz "load b" # Load data from disk in drive B (from 0x7e00+) and jump to 0x7e00 + + # Others + _mp_cmd_ver: .asciz "ver" # Display version string + _mp_cmd_clear: .asciz "clear" # Clear the screen + _mp_cmd_help: .asciz "help" # Help command + + # Pinboard + _mp_cmd_pinb: .asciz "pinb" # Start the pinboard enviroment diff --git a/utils/kernel/mp/main.S b/utils/kernel/mp/main.S new file mode 100644 index 0000000..0abc9cb --- /dev/null +++ b/utils/kernel/mp/main.S @@ -0,0 +1,271 @@ + + /* + Monitor Program for OS/1 + (MP-OS/1) + ================================ + + Monitor Program for OS/1 or MP-OS/1 is a + simple program that allows users to + "monitor" the system. Its main function + is to let the user load and write data + to the disk(s). + + */ + + + .code16 + .section .text.mp + .global _input + #.global _monitor_program + + # + # _monitor_program - main program point. + # - takes user input + # - if it matches a command, then + # execute it + # - if there is no match, then return + # an error. + # + _input: + mov $_mp_prompt, %si + call _printk + + mov $_input_buffer, %di + call _get_input + + mov $_input_buffer, %si + cmpb $0x0000, (%si) + je _input + + # + # Basics (reboot, shutdown) + # + mov $_input_buffer, %si + mov $_mp_cmd_rebt, %di + call _strcmp + jc _reboot + + mov $_input_buffer, %si + mov $_mp_cmd_shutd, %di + call _strcmp + jc _shutdown + + # + # Memory (mem. stat. , peek & poke) + # + mov $_input_buffer, %si + mov $_mp_cmd_mem, %di + call _strcmp + jc _mem + + # + # Load command(s) + # + mov $_input_buffer, %si + mov $_mp_cmd_load_a,%di + call _strcmp + jc _loada + + mov $_input_buffer, %si + mov $_mp_cmd_load_b,%di + call _strcmp + jc _loadb + + # + # Disk status + # + mov $_input_buffer, %si + mov $_mp_cmd_dstat, %di + call _strcmp + jc _dstat + + # + # Others (ver. and clear) + # + mov $_input_buffer, %si + mov $_mp_cmd_clear,%di + call _strcmp + jc _clear + + mov $_input_buffer, %si + mov $_mp_cmd_ver,%di + call _strcmp + jc _ver + + # + # Help command + # + mov $_input_buffer, %si + mov $_mp_cmd_help, %di + call _strcmp + jc _help + + # + # Pinboard enviroment + # + mov $_input_buffer, %si + mov $_mp_cmd_pinb, %di + call _strcmp + jc _penv + + # Command not found? Return an "?" + mov $_input_buffer, %si + call _printk + mov $_mp_str_err, %si + call _printk + hlt + + jmp _input + + _get_input: + xor %cl, %cl + + _get_input_l: + mov $0x00, %ah + int $0x16 + + cmp $0x08, %al + je _backspace + + cmp $0x0d, %al + je _returnk + + cmp $0xff, %cl + je _get_input_l + + mov $0x0e, %ah + int $0x10 + + stosb + inc %cl + jmp _get_input_l + + _backspace: + cmp $0x00, %cl + je _get_input_l + + dec %di + movb $0x00, (%di) + dec %cl + + mov $0x0e, %ah + mov $0x08, %al + int $0x10 + + mov $0x20, %al + int $0x10 + + mov $0x08, %al + int $0x10 + + jmp _get_input_l + + _returnk: + mov $0x00, %al + stosb + + mov $0x0e, %ah + mov $0x0d, %al + int $0x10 + + mov $0x0a, %al + int $0x10 + + ret + + ################################# + # COMMANDS # + ################################# + + _reboot: + int $0x19 + + _shutdown: + xor %ax, %ax + xor %bx, %bx + + mov $0x1000,%ax + mov %ss, %ax + mov $0xf000,%sp + mov $0x5307,%ax + mov $0x0001,%bx + mov $0x0003,%cx + int $0x15 + + _mem: + xor %ax, %ax + clc + + int $0x12 + + movw %ax, (regi) + call _preg + + mov $_mp_str_mem, %si + call _printk + + jmp _input + + _ver: + mov $_mp_str_ver, %si + call _printk + + jmp _input + + _clear: + mov $0x03, %ax + int $0x10 + + # Set pallete register + mov $0x1003,%ax + mov $0x00, %bl + int $0x10 + + # Set up the font + mov $0x11, %ah + mov $0x11, %al + int $0x10 + jmp _input + + _dstat: + xor %dx, %dx + xor %ax, %ax + call _disk_status + jmp _input + + _loada: + call _load_A + jmp _input + + _loadb: + call _load_B + jmp _input + + _help: + mov $_mp_str_help, %si + call _printk + + jmp _input + + _penv: + jmp _pinb + + .section .rodata.mp + _mp_new_line: .asciz "\r\n" + + _mp_str_ver: .asciz " Monitor Program for OS/1 (MP-OS/1) Version 1.0.0\r\n" + _mp_str_mem: .asciz "KB of low memory free (in hex.)\r\n" + + _mp_prompt: .asciz "% " + _mp_str_err: .asciz "?\r\n\n" + + _mp_str_help: .asciz " List of commands:\r\n - reboot\r\n - shutdown\r\n - mem\r\n - dstat\r\n - load a\r\n - load b\r\n - ver\r\n - clear\r\n - help\r\n" + + .section .data + + # + # _input_buffer - stores user input (256-byte limit) + # + _input_buffer: .fill 256,1,0 + + .include "mp/cmd.S" diff --git a/utils/kernel/pinb/curs/desk_curs.S b/utils/kernel/pinb/curs/desk_curs.S new file mode 100644 index 0000000..f090beb --- /dev/null +++ b/utils/kernel/pinb/curs/desk_curs.S @@ -0,0 +1,92 @@ + + .code16 + .section .text.pinb + .global _desk_curs + + _desk_curs: + mov $0x01, %ah + mov $0x10, %cx + int $0x10 + + mov $13, %cl + mov $40, %bl + + .dc_loop: + mov $0x02, %ah + mov %cl, %dh + mov %bl, %dl + int $0x10 + + mov $0x00, %ah + int $0x16 + + cmp $0x48, %ah + je .up + + cmp $0x50, %ah + je .down + + cmp $0x4B, %ah + je .left + + cmp $0x4D, %ah + je .right + + cmp $0x20, %al + je .click + + jmp .dc_loop + + .up: + cmp $0x00, %cl + je .dc_loop + + sub $0x01, %cl + jmp .dc_loop + + .down: + cmp $0x1B, %cl + je .dc_loop + + add $0x01, %cl + jmp .dc_loop + + .left: + cmp $0x00, %bl + je .dc_loop + + sub $0x01, %bl + jmp .dc_loop + + .right: + cmp $79, %bl + je .dc_loop + + add $0x01, %bl + jmp .dc_loop + + .click: + cmp $0x00, %dh + je .topb + + jmp .dc_loop + + .topb: + cmp $0x02, %dl + je _home + cmp $0x03, %dl + je _home + cmp $0x04, %dl + je _home + cmp $0x05, %dl + je _home + cmp $0x06, %dl + je _home + cmp $0x07, %dl + je _home + cmp $0x08, %dl + je _home + cmp $0x09, %dl + je _home + + jmp .dc_loop diff --git a/utils/kernel/pinb/curs/dsst_curs.S b/utils/kernel/pinb/curs/dsst_curs.S new file mode 100644 index 0000000..3fa325e --- /dev/null +++ b/utils/kernel/pinb/curs/dsst_curs.S @@ -0,0 +1,105 @@ + + .code16 + .section .text.pinb + .global _disk_curs + + _disk_curs: + mov $0x01, %ah + mov $0x10, %cx + int $0x10 + + mov $17, %cl + mov $3, %bl + + .dsk_loop: + mov $0x02, %ah + mov %cl, %dh + mov %bl, %dl + int $0x10 + + mov $0x00, %ah + int $0x16 + + cmp $0x48, %ah + je .up + + cmp $0x50, %ah + je .down + + cmp $0x4B, %ah + je .left + + cmp $0x4D, %ah + je .right + + cmp $0x20, %al + je .click + + jmp .dsk_loop + + .up: + cmp $0x00, %cl + je .dsk_loop + + sub $0x01, %cl + jmp .dsk_loop + + .down: + cmp $0x1B, %cl + je .dsk_loop + + add $0x01, %cl + jmp .dsk_loop + + .left: + cmp $0x00, %bl + je .dsk_loop + + sub $0x01, %bl + jmp .dsk_loop + + .right: + cmp $79, %bl + je .dsk_loop + + add $0x01, %bl + jmp .dsk_loop + + .click: + cmp $17, %dh + je .bar + + jmp .dsk_loop + + .bar: + cmp $0x03, %dl + je .return + + jmp .dsk_loop + + .return: + mov $0x02, %ah + mov $16, %dh + mov $1, %dl + int $0x10 + + .rloop: + cmp $22, %dh + je .endd + + mov $0x02, %ah + inc %dh + mov $0x01, %dl + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0x1F, %bl + mov $70, %cx + int $0x10 + + jmp .rloop + + .endd: + jmp _home diff --git a/utils/kernel/pinb/curs/home_curs.S b/utils/kernel/pinb/curs/home_curs.S new file mode 100644 index 0000000..6d664ec --- /dev/null +++ b/utils/kernel/pinb/curs/home_curs.S @@ -0,0 +1,317 @@ + + .code16 + .section .text.pinb + .global _home_curs + + _home_curs: + mov $0x01, %ah + mov $0x10, %cx + int $0x10 + + mov $0x03, %bl + mov $0x02, %cl + + .hc_loop: + mov $0x02, %ah + mov %cl, %dh + mov %bl, %dl + int $0x10 + + mov $0x00, %ah + int $0x16 + + cmp $0x48, %ah + je .up + + cmp $0x50, %ah + je .down + + cmp $0x4B, %ah + je .left + + cmp $0x4D, %ah + je .right + + cmp $0x20, %al + je .click + + jmp .hc_loop + + .up: + cmp $0x00, %cl + je .hc_loop + + sub $0x01, %cl + jmp .hc_loop + + .down: + cmp $0x1B, %cl + je .hc_loop + + add $0x01, %cl + jmp .hc_loop + + .left: + cmp $0x00, %bl + je .hc_loop + + sub $0x01, %bl + jmp .hc_loop + + .right: + cmp $79, %bl + je .hc_loop + + add $0x01, %bl + jmp .hc_loop + + .click: + cmp $0x02, %dh + je .bar + + cmp $0x03, %dl + je .shell + cmp $0x04, %dl + je .shell + cmp $0x05, %dl + je .shell + cmp $0x06, %dl + je .shell + cmp $0x07, %dl + je .shell + cmp $0x08, %dl + je .shell + cmp $0x09, %dl + je .shell + + cmp $0x0C, %dl + je .paint + cmp $0x0D, %dl + je .paint + cmp $0x0E, %dl + je .paint + cmp $0x0F, %dl + je .paint + cmp $0x10, %dl + je .paint + + cmp $0x13, %dl + je .notes + cmp $0x14, %dl + je .notes + cmp $0x15, %dl + je .notes + cmp $0x16, %dl + je .notes + cmp $0x17, %dl + je .notes +/* + cmp $0x1A, %dl + je .settings + cmp $0x1B, %dl + je .settings + cmp $0x1C, %dl + je .settings + cmp $0x1D, %dl + je .settings + cmp $0x1E, %dl + je .settings + cmp $0x1F, %dl + je .settings + cmp $0x20, %dl + je .settings + cmp $0x21, %dl + je .settings +*/ + cmp $0x24, %dl + je .extras + cmp $0x25, %dl + je .extras + cmp $0x26, %dl + je .extras + cmp $0x27, %dl + je .extras + cmp $0x28, %dl + je .extras + cmp $0x29, %dl + je .extras + cmp $0x2A, %dl + je .extras + cmp $0x2B, %dl + je .extras + + cmp $0x03, %dl + je .games + cmp $0x04, %dl + je .games + cmp $0x05, %dl + je .games + cmp $0x06, %dl + je .games + cmp $0x07, %dl + je .games + cmp $0x08, %dl + je .games + cmp $0x09, %dl + je .games + cmp $0x0A, %dl + je .games +/* + cmp $0x0C, %dl + je .office + cmp $0x0D, %dl + je .office + cmp $0x0E, %dl + je .office + cmp $0x0F, %dl + je .office + cmp $0x10, %dl + je .office + cmp $0x11, %dl + je .office + cmp $0x12, %dl + je .office + cmp $0x13, %dl + je .office + cmp $0x14, %dl + je .office + + jmp .hc_loop +*/ + + /* + Actions + */ + .bar: + cmp $0x03, %dl + je _pinb + + jmp .hc_loop + + .shell: + cmp $0x03, %dh + je _kernel + cmp $0x04, %dh + je _kernel + cmp $0x05, %dh + je _kernel + cmp $0x06, %dh + je _kernel + +/* + cmp $0x09, %dh + je _pong + cmp $0x0A, %dh + je _pong + cmp $0x0B, %dh + je _pong + cmp $0x0C, %dh + je _pong + cmp $0x0D, %dh + je _pong + cmp $0x0E, %dh + je _pong +*/ + jmp .hc_loop + + .paint: + cmp $0x03, %dh + je _paint + cmp $0x04, %dh + je _paint + cmp $0x05, %dh + je _paint + cmp $0x06, %dh + je _paint + cmp $0x07, %dh + je _paint +/* + cmp $0x09, %dh + je _prod + cmp $0x0A, %dh + je _prod + cmp $0x0B, %dh + je _prod + cmp $0x0C, %dh + je _prod + cmp $0x0D, %dh + je _prod + + jmp .hc_loop +*/ + + .notes: + cmp $0x03, %dh + je _notes + cmp $0x04, %dh + je _notes + cmp $0x05, %dh + je _notes + cmp $0x06, %dh + je _notes + cmp $0x07, %dh + je _notes + + jmp .hc_loop +/* + .settings: + cmp $0x03, %dh + je _settings + cmp $0x04, %dh + je _settings + cmp $0x05, %dh + je _settings + cmp $0x06, %dh + je _settings + cmp $0x07, %dh + je _settings + + jmp .hc_loop +*/ + + .extras: + cmp $0x03, %dh + je _dstat + cmp $0x04, %dh + je _dstat + cmp $0x05, %dh + je _dstat + cmp $0x06, %dh + je _dstat + cmp $0x07, %dh + je _dstat + + jmp .hc_loop + + .games: + cmp $0x09, %dh + je _pong + cmp $0x0A, %dh + je _pong + cmp $0x0B, %dh + je _pong + cmp $0x0C, %dh + je _pong + cmp $0x0D, %dh + je _pong + cmp $0x0E, %dh + je _pong + + jmp .hc_loop +/* + .office: + cmp $0x09, %dh + je _words + cmp $0x0A, %dh + je _words + cmp $0x0B, %dh + je _words + cmp $0x0C, %dh + je _words + cmp $0x0D, %dh + je _words + cmp $0x0E, %dh + je _words +*/ + + jmp .hc_loop diff --git a/utils/kernel/pinb/curs/paint_curs.S b/utils/kernel/pinb/curs/paint_curs.S new file mode 100644 index 0000000..968bcdc --- /dev/null +++ b/utils/kernel/pinb/curs/paint_curs.S @@ -0,0 +1,630 @@ + .code16 + .section .text.pinb.app + .global _paint_curs + + _paint_curs: + + # CL = DH + # BL = DL + + mov $0x01, %ah + mov $0x07, %cx + int $0x10 + + mov $0x02, %dh + mov $0x01, %dl + + pc_loop: + mov $0x02, %ah + int $0x10 + + mov $0x00, %ah + int $0x16 + + # + # Directional keys + # Up, down, left, right + # + + cmp $0x48, %ah + je .up + + cmp $0x50, %ah + je .do_wn + + cmp $0x4B, %ah + je .left + + cmp $0x4D, %ah + je .right + + # + # Base keys + # Space, P, E, N, Esc + # + + cmp $0x20, %al + je .select + + cmp $0x70, %al + je .place + + cmp $0x65, %al + je .erase + + cmp $0x6e, %al + je .new + + cmp $0x1B, %al + je _pinb + + jmp pc_loop + + # + # Directions + # + .up: + cmp $0x00, %dh + je pc_loop + + sub $1, %dh + jmp pc_loop + + .do_wn: + cmp $27, %dh + je pc_loop + + add $1, %dh + jmp pc_loop + + .left: + cmp $0, %dl + je pc_loop + + sub $1, %dl + jmp pc_loop + + .right: + cmp $79, %dl + je pc_loop + + add $1, %dl + jmp pc_loop + + # + # Draw commands + # + .place: + cmp $0x02, %dh + jl pc_loop + + cmp $26, %dh + jg pc_loop + + cmp $0x01, %dl + jl pc_loop + + cmp $72, %dl + jg pc_loop + + mov $0x09, %ah + mov TRANS, %al + mov $0x00, %bh + mov COLOR, %bl + mov $0x01, %cx + int $0x10 + + jmp pc_loop + + .erase: + cmp $0x02, %dh + jl pc_loop + + cmp $26, %dh + jg pc_loop + + cmp $0x01, %dl + jl pc_loop + + cmp $72, %dl + jg pc_loop + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0xF0, %bl + mov $0x01, %cx + int $0x10 + + jmp pc_loop + + .new: + mov $0x02, %ah + mov $0x02, %dh + mov $0x01, %dl + int $0x10 + + .nloop: + cmp $27, %dh + je _paint_curs + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0xF0, %bl + mov $72, %cx + int $0x10 + + mov $0x02, %ah + inc %dh + mov $0x01, %dl + int $0x10 + + jmp .nloop + + # + # Selection + # + .select: + cmp $0x00, %dh + je .exit + + cmp $0x03, %dh + je .black + + cmp $0x04, %dh + je .blue + + cmp $0x05, %dh + je .green + + cmp $0x06, %dh + je .cyan + + cmp $0x07, %dh + je .red + + cmp $0x08, %dh + je .magenta + + cmp $0x09, %dh + je .brown + + cmp $0x0A, %dh + je .l_gray + + cmp $0x0B, %dh + je .d_gray + + cmp $0x0C, %dh + je .l_blue + + cmp $0x0D, %dh + je .l_green + + cmp $0x0E, %dh + je .l_cyan + + cmp $0x0F, %dh + je .l_red + + cmp $0x10, %dh + je .l_mag + + cmp $0x11, %dh + je .yellow + + cmp $0x12, %dh + je .white + + cmp $0x14, %dh + je .shade0 + + cmp $0x15, %dh + je .shade1 + + cmp $0x16, %dh + je .shade2 + + cmp $0x17, %dh + je .shade3 + + cmp $0x19, %dh + je .news + + jmp pc_loop + + .exit: + cmp $0x02, %dl + je _pinb + + jmp pc_loop + + # + # Colors + # + .black: + cmp $75, %dl + je .do_black + cmp $76, %dl + je .do_black + cmp $77, %dl + je .do_black + cmp $78, %dl + je .do_black + cmp $79, %dl + je .do_black + + jmp pc_loop + + .do_black: + movb $0x0F, COLOR + jmp pc_loop + + .blue: + cmp $75, %dl + je .do_blue + cmp $76, %dl + je .do_blue + cmp $77, %dl + je .do_blue + cmp $78, %dl + je .do_blue + cmp $79, %dl + je .do_blue + + jmp pc_loop + + .do_blue: + movb $0x1F, COLOR + jmp pc_loop + + .green: + cmp $75, %dl + je .do_green + cmp $76, %dl + je .do_green + cmp $77, %dl + je .do_green + cmp $78, %dl + je .do_green + cmp $79, %dl + je .do_green + + jmp pc_loop + + .do_green: + movb $0x2F, COLOR + jmp pc_loop + + .cyan: + cmp $75, %dl + je .do_cyan + cmp $76, %dl + je .do_cyan + cmp $77, %dl + je .do_cyan + cmp $78, %dl + je .do_cyan + cmp $79, %dl + je .do_cyan + + jmp pc_loop + + .do_cyan: + movb $0x3F, COLOR + jmp pc_loop + + .red: + cmp $75, %dl + je .do_red + cmp $76, %dl + je .do_red + cmp $77, %dl + je .do_red + cmp $78, %dl + je .do_red + cmp $79, %dl + je .do_red + + jmp pc_loop + + .do_red: + movb $0x4F, COLOR + jmp pc_loop + + .magenta: + cmp $75, %dl + je .do_magenta + cmp $76, %dl + je .do_magenta + cmp $77, %dl + je .do_magenta + cmp $78, %dl + je .do_magenta + cmp $79, %dl + je .do_magenta + + jmp pc_loop + + .do_magenta: + movb $0x5F, COLOR + jmp pc_loop + + .brown: + cmp $75, %dl + je .do_brown + cmp $76, %dl + je .do_brown + cmp $77, %dl + je .do_brown + cmp $78, %dl + je .do_brown + cmp $79, %dl + je .do_brown + + jmp pc_loop + + .do_brown: + movb $0x6F, COLOR + jmp pc_loop + + .l_gray: + cmp $75, %dl + je .do_l_gray + cmp $76, %dl + je .do_l_gray + cmp $77, %dl + je .do_l_gray + cmp $78, %dl + je .do_l_gray + cmp $79, %dl + je .do_l_gray + + jmp pc_loop + + .do_l_gray: + movb $0x7F, COLOR + jmp pc_loop + + .d_gray: + cmp $75, %dl + je .do_d_gray + cmp $76, %dl + je .do_d_gray + cmp $77, %dl + je .do_d_gray + cmp $78, %dl + je .do_d_gray + cmp $79, %dl + je .do_d_gray + + jmp pc_loop + + .do_d_gray: + movb $0x8F, COLOR + jmp pc_loop + + .l_blue: + cmp $75, %dl + je .do_l_blue + cmp $76, %dl + je .do_l_blue + cmp $77, %dl + je .do_l_blue + cmp $78, %dl + je .do_l_blue + cmp $79, %dl + je .do_l_blue + + jmp pc_loop + + .do_l_blue: + movb $0x9F, COLOR + jmp pc_loop + + .l_green: + cmp $75, %dl + je .do_l_green + cmp $76, %dl + je .do_l_green + cmp $77, %dl + je .do_l_green + cmp $78, %dl + je .do_l_green + cmp $79, %dl + je .do_l_green + + jmp pc_loop + + .do_l_green: + movb $0xAF, COLOR + jmp pc_loop + + .l_cyan: + cmp $75, %dl + je .do_l_cyan + cmp $76, %dl + je .do_l_cyan + cmp $77, %dl + je .do_l_cyan + cmp $78, %dl + je .do_l_cyan + cmp $79, %dl + je .do_l_cyan + + jmp pc_loop + + .do_l_cyan: + movb $0xBF, COLOR + jmp pc_loop + + .l_red: + cmp $75, %dl + je .do_l_red + cmp $76, %dl + je .do_l_red + cmp $77, %dl + je .do_l_red + cmp $78, %dl + je .do_l_red + cmp $79, %dl + je .do_l_red + + jmp pc_loop + + .do_l_red: + movb $0xCF, COLOR + jmp pc_loop + + .l_mag: + cmp $75, %dl + je .do_l_mag + cmp $76, %dl + je .do_l_mag + cmp $77, %dl + je .do_l_mag + cmp $78, %dl + je .do_l_mag + cmp $79, %dl + je .do_l_mag + + jmp pc_loop + + .do_l_mag: + movb $0xDF, COLOR + jmp pc_loop + + .yellow: + cmp $75, %dl + je .do_yellow + cmp $76, %dl + je .do_yellow + cmp $77, %dl + je .do_yellow + cmp $78, %dl + je .do_yellow + cmp $79, %dl + je .do_yellow + + jmp pc_loop + + .do_yellow: + movb $0xEF, COLOR + jmp pc_loop + + .white: + cmp $75, %dl + je .do_white + cmp $76, %dl + je .do_white + cmp $77, %dl + je .do_white + cmp $78, %dl + je .do_white + cmp $79, %dl + je .do_white + + jmp pc_loop + + .do_white: + movb $0xF0, COLOR + jmp pc_loop + + # + # Shading / "transparency" + # + .shade0: + cmp $75, %dl + je .do_s0 + cmp $76, %dl + je .do_s0 + cmp $77, %dl + je .do_s0 + cmp $78, %dl + je .do_s0 + cmp $79, %dl + je .do_s0 + + jmp pc_loop + + .do_s0: + movb $0x20, TRANS + jmp pc_loop + + .shade1: + cmp $75, %dl + je .do_s1 + cmp $76, %dl + je .do_s1 + cmp $77, %dl + je .do_s1 + cmp $78, %dl + je .do_s1 + cmp $79, %dl + je .do_s1 + + jmp pc_loop + + .do_s1: + movb $0xB2, TRANS + jmp pc_loop + + + .shade2: + cmp $75, %dl + je .do_s2 + cmp $76, %dl + je .do_s2 + cmp $77, %dl + je .do_s2 + cmp $78, %dl + je .do_s2 + cmp $79, %dl + je .do_s2 + + jmp pc_loop + + .do_s2: + movb $0xB1, TRANS + jmp pc_loop + + .shade3: + cmp $75, %dl + je .do_s3 + cmp $76, %dl + je .do_s3 + cmp $77, %dl + je .do_s3 + cmp $78, %dl + je .do_s3 + cmp $79, %dl + je .do_s3 + + jmp pc_loop + + .do_s3: + movb $0xB0, TRANS + jmp pc_loop + + # New canvas + .news: + cmp $75, %dl + je .new + cmp $76, %dl + je .new + cmp $77, %dl + je .new + cmp $78, %dl + je .new + cmp $79, %dl + je .new + + jmp pc_loop + + cli + hlt + + .section .data + COLOR: .byte 0x00 # Color + TRANS: .byte 0x00 # Transparency diff --git a/utils/kernel/pinb/dstat/dstat.S b/utils/kernel/pinb/dstat/dstat.S new file mode 100644 index 0000000..0a44426 --- /dev/null +++ b/utils/kernel/pinb/dstat/dstat.S @@ -0,0 +1,108 @@ + + .code16 + .section .text.pinb.app + .global _dstat + + _dstat: + + .dtitle: + mov $0x02, %ah + mov $17, %dh + mov $0x01, %dl + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0xF1, %bl + mov $66, %cx + int $0x10 + + mov $_d_title, %si + call _printk + + .backg: + mov $0x02, %ah + mov $17, %dh + mov $0x01, %dl + int $0x10 + + .left: + cmp $21, %dh + je .i1 + + mov $0x02, %ah + inc %dh + mov $0x01, %dl + int $0x10 + + mov $0x09, %ah + mov $0xBA, %al + mov $0x00, %bh + mov $0xF1, %bl + mov $1, %cx + int $0x10 + + jmp .left + + .i1: + mov $0x02, %ah + mov $17, %dh + mov $0x01, %dl + int $0x10 + + .right: + cmp $21, %dh + je .bot + + mov $0x02, %ah + inc %dh + mov $66, %dl + int $0x10 + + mov $0x09, %ah + mov $0xBA, %al + mov $0x00, %bh + mov $0xF1, %bl + mov $1, %cx + int $0x10 + + jmp .right + + .bot: + mov $0x02, %ah + mov $01, %dl + int $0x10 + + mov $0x09, %ah + mov $0xCD, %al + mov $0x00, %bh + mov $0xF1, %bl + mov $66, %cx + int $0x10 + + mov $0x0e, %ah + mov $0xC8, %al + int $0x10 + + mov $0x02, %ah + mov $66, %dl + int $0x10 + mov $0x0e, %ah + mov $0xBC, %al + int $0x10 + .halt: + + mov $0x02, %ah + mov $19, %dh + mov $02, %dl + int $0x10 + + xor %dx, %dx + xor %ax, %ax + call _disk_status + + jmp _disk_curs + + .section .rodata.pinb + _d_title: .asciz " \xB3\xFE\xB3 Disk status " diff --git a/utils/kernel/pinb/home.S b/utils/kernel/pinb/home.S new file mode 100644 index 0000000..19883a7 --- /dev/null +++ b/utils/kernel/pinb/home.S @@ -0,0 +1,421 @@ + + .code16 + .section .text.pinb + .global _home + + _home: + .h_title: + mov $0x02, %ah + mov $02, %dh + mov $01, %dl + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0xF1, %bl + mov $50, %cx + int $0x10 + + mov $_h_title, %si + call _printk + + .h_border: + + mov $0x02, %ah + mov $02, %dh + mov $01, %dl + int $0x10 + + .hb_left: + mov $0x02, %ah + inc %dh + mov $01, %dl + int $0x10 + + mov $0x09, %ah + mov $0xBA, %al + mov $0x00, %bh + mov $0xF1, %bl + mov $01, %cx + int $0x10 + + cmp $16, %dh + je .hb_i1 + + jmp .hb_left + + .hb_i1: + mov $0x02, %ah + mov $02, %dh + mov $01, %dl + int $0x10 + + .hb_right: + mov $0x02, %ah + inc %dh + mov $50, %dl + int $0x10 + + mov $0x09, %ah + mov $0xBA, %al + mov $0x00, %bh + mov $0xF1, %bl + mov $01, %cx + int $0x10 + + cmp $16, %dh + je .hb_bottom + + jmp .hb_right + + .hb_bottom: + mov $0x02, %ah + mov $01, %dl + int $0x10 + + mov $0x09, %ah + mov $0xCD, %al + mov $0x00, %bh + mov $0xF1, %bl + mov $50, %cx + int $0x10 + + mov $0x0e, %ah + mov $0xC8, %al + int $0x10 + + mov $0x02, %ah + mov $50, %dl + int $0x10 + mov $0x0e, %ah + mov $0xBC, %al + int $0x10 + + .h_icons: + .shell: + mov $0x02, %ah + mov $03, %dh + mov $03, %dl + int $0x10 + mov $_h_shell_1,%si + call _printk + + mov $0x02, %ah + mov $04, %dh + mov $03, %dl + int $0x10 + mov $_h_shell_2,%si + call _printk + + mov $0x02, %ah + mov $05, %dh + mov $03, %dl + int $0x10 + mov $_h_shell_3,%si + call _printk + + mov $0x02, %ah + mov $06, %dh + mov $03, %dl + int $0x10 + mov $_h_shell_4,%si + call _printk + + .paint: + mov $0x02, %ah + mov $03, %dh + mov $0x0C, %dl + int $0x10 + mov $_h_paint_1,%si + call _printk + + mov $0x02, %ah + mov $04, %dh + mov $0x0C, %dl + int $0x10 + mov $_h_paint_2,%si + call _printk + + mov $0x02, %ah + mov $05, %dh + mov $0x0C, %dl + int $0x10 + mov $_h_paint_3,%si + call _printk + + mov $0x02, %ah + mov $06, %dh + mov $0x0C, %dl + int $0x10 + mov $_h_paint_4,%si + call _printk + + mov $0x02, %ah + mov $07, %dh + mov $0x0C, %dl + int $0x10 + mov $_h_paint_5,%si + call _printk + + .notes: + mov $0x02, %ah + mov $03, %dh + mov $0x13, %dl + int $0x10 + mov $_h_notes_1,%si + call _printk + + mov $0x02, %ah + mov $04, %dh + mov $0x13, %dl + int $0x10 + mov $_h_notes_2,%si + call _printk + + mov $0x02, %ah + mov $05, %dh + mov $0x13, %dl + int $0x10 + mov $_h_notes_3,%si + call _printk + + mov $0x02, %ah + mov $06, %dh + mov $0x13, %dl + int $0x10 + mov $_h_notes_4,%si + call _printk + + mov $0x02, %ah + mov $07, %dh + mov $0x13, %dl + int $0x10 + mov $_h_notes_5,%si + call _printk + + .settings: + mov $0x02, %ah + mov $03, %dh + mov $0x1A, %dl + int $0x10 + mov $_h_setin_1,%si + call _printk + + mov $0x02, %ah + mov $04, %dh + mov $0x1A, %dl + int $0x10 + mov $_h_setin_2,%si + call _printk + + mov $0x02, %ah + mov $05, %dh + mov $0x1A, %dl + int $0x10 + mov $_h_setin_3,%si + call _printk + + mov $0x02, %ah + mov $06, %dh + mov $0x1A, %dl + int $0x10 + mov $_h_setin_4,%si + call _printk + + mov $0x02, %ah + mov $07, %dh + mov $0x1A, %dl + int $0x10 + mov $_h_setin_5,%si + call _printk + + .dstat: + mov $0x02, %ah + mov $03, %dh + mov $0x24, %dl + int $0x10 + mov $_h_dstat_1,%si + call _printk + + mov $0x02, %ah + mov $04, %dh + mov $0x24, %dl + int $0x10 + mov $_h_dstat_2,%si + call _printk + + mov $0x02, %ah + mov $05, %dh + mov $0x24, %dl + int $0x10 + mov $_h_dstat_3,%si + call _printk + + mov $0x02, %ah + mov $06, %dh + mov $0x24, %dl + int $0x10 + mov $_h_dstat_4,%si + call _printk + + mov $0x02, %ah + mov $07, %dh + mov $0x24, %dl + int $0x10 + mov $_h_dstat_5,%si + call _printk + + .games: + mov $0x02, %ah + mov $0x9, %dh + mov $0x03, %dl + int $0x10 + mov $_pong_1,%si + call _printk + + mov $0x02, %ah + mov $0xA, %dh + mov $0x03, %dl + int $0x10 + mov $_pong_2,%si + call _printk + + mov $0x02, %ah + mov $0xB, %dh + mov $0x03, %dl + int $0x10 + mov $_pong_3,%si + call _printk + + mov $0x02, %ah + mov $0xC, %dh + mov $0x03, %dl + int $0x10 + mov $_pong_4,%si + call _printk + + mov $0x02, %ah + mov $0xD, %dh + mov $0x03, %dl + int $0x10 + mov $_pong_5, %si + call _printk + + mov $0x02, %ah + mov $0xE, %dh + mov $0x03, %dl + int $0x10 + mov $_pong_6, %si + call _printk +/* + .office: + mov $0x02, %ah + mov $0x9, %dh + mov $0x0C, %dl + int $0x10 + mov $_words_1,%si + call _printk + + mov $0x02, %ah + mov $0xA, %dh + mov $0x0C, %dl + int $0x10 + mov $_words_2,%si + call _printk + + mov $0x02, %ah + mov $0xB, %dh + mov $0x0C, %dl + int $0x10 + mov $_words_3,%si + call _printk + + mov $0x02, %ah + mov $0xC, %dh + mov $0x0C, %dl + int $0x10 + mov $_words_4,%si + call _printk + + mov $0x02, %ah + mov $0xD, %dh + mov $0x0C, %dl + int $0x10 + mov $_words_5, %si + call _printk + + mov $0x02, %ah + mov $0xE, %dh + mov $0x0C, %dl + int $0x10 + mov $_words_6, %si + call _printk +*/ + + jmp _home_curs + + .h_halt: + cli + hlt + + .section .rodata.pinb + + # + # Strings + # + _h_title: .asciz " \xB3\xFE\xB3 Home " + + # + # Icons + # + + # Shell (7x3) + _h_shell_1: .asciz "\xDA\xC4\xC4\xC4\xC4\xC4\xBF" + _h_shell_2: .asciz "\xB3\x3E\x20\x20\x20\x20\xB3" + _h_shell_3: .asciz "\xC0\xC4\xC4\xC4\xC4\xC4\xD9" + _h_shell_4: .asciz " Shell" + + # Paint (5x4) + _h_paint_1: .asciz "\xDA\xC4\xC4\xC4\xBF" + _h_paint_2: .asciz "\xB3\xB2\xB1\xB0\xB3" + _h_paint_3: .asciz "\xB3\xB3\x20\x20\xB3" + _h_paint_4: .asciz "\xC0\xC4\xC4\xC4\xD9" + _h_paint_5: .asciz "Paint" + + # Notes (5x4) + _h_notes_1: .asciz "\xDA\xC4\xC4\xC4\xBF" + _h_notes_2: .asciz "\xB3\xC4\xC4\xC4\xB3" + _h_notes_3: .asciz "\xB3\xC4\xC4\xC4\xB3" + _h_notes_4: .asciz "\xC0\xC4\xC4\xC4\xD9" + _h_notes_5: .asciz "Notes" + + # Blank (8x4) + _h_setin_1: .asciz "\xDA\xC4\xC4\xC4\xC4\xC4\xC4\xBF" + _h_setin_2: .asciz "\xB3\x20\x20\x20\x20\x20\x20\xB3" + _h_setin_3: .asciz "\xB3\x20\x20\x20\x20\x20\x20\xB3" + _h_setin_4: .asciz "\xC0\xC4\xC4\xC4\xC4\xC4\xC4\xD9" + _h_setin_5: .asciz " Blank" + + # Disk status (8x4) + _h_dstat_1: .asciz "" + _h_dstat_2: .asciz "\xDA\xC4\xC4\xC4\xC4\xC4\x3F\xBF" + _h_dstat_3: .asciz "\xB3\x20\xC4\xCD\xCD\xC4\x20\xB3" + _h_dstat_4: .asciz "\xC0\xC4\xC4\xC4\xC4\xC4\xC4\xD9" + _h_dstat_5: .asciz "Dsk Stat" + + # Pong (game) + _pong_1: .asciz "\xDA\xC4\xC4\xC4\xC4\xBF" + _pong_2: .asciz "\xB3\xDD\x20\x20\x20\xB3" + _pong_3: .asciz "\xB3\x20\xFE\x20\x20\xB3" + _pong_4: .asciz "\xB3\x20\x20\x20\xDE\xB3" + _pong_5: .asciz "\xC0\xC4\xC4\xC4\xC4\xD9" + _pong_6: .asciz " Pong " + + # Words (word processor) + _words_1: .asciz "\xD6\xC4\xC4\xC4\xC4\xC4\xBF" + _words_2: .asciz "\xBA\x20\xC4\xC4\xC4\x20\xB3" + _words_3: .asciz "\xBA\xCD\xCD\xCD\xCD\xCD\xB3" + _words_4: .asciz "\xBA\xCD\xCD\xCD\xCD\xCD\xB3" + _words_5: .asciz "\xD3\xC4\xC4\xC4\xC4\xC4\xD9" + _words_6: .asciz " Words " diff --git a/utils/kernel/pinb/notes/notes.S b/utils/kernel/pinb/notes/notes.S new file mode 100644 index 0000000..75f32b1 --- /dev/null +++ b/utils/kernel/pinb/notes/notes.S @@ -0,0 +1,68 @@ + + .code16 + .section .text.pinb.app + .global _notes + + _notes: + mov $0x02, %ah + mov $0x00, %dx + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0x1E, %bl + mov $2240, %cx + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0xF1, %bl + mov $80, %cx + int $0x10 + + mov $titlew,%si + call _printk + + mov $0x02, %ah + inc %dh + mov $0x00, %dl + int $0x10 + + .textin: + .textinl: + mov $0x00, %ah + int $0x16 + + cmp $0x0D, %al + je .return + + cmpb %al, exitk + je _pinb + + mov $0x0e, %ah + int $0x10 + + jmp .textinl + + .return: + mov $0x0e, %ah + mov $0x0d, %al + int $0x10 + + mov $0x0a, %al + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0x1E, %bl + mov $80, %cx + int $0x10 + + jmp .textin + + .section .rodata.pinb + titlew: .asciz " Write 2.5.0 \xB3 ESC to exit \xB3 Yes this was copied from OS/1 3.0.0 \xB3" + exitk: .byte 27 diff --git a/utils/kernel/pinb/paint/paint.S b/utils/kernel/pinb/paint/paint.S new file mode 100644 index 0000000..ee49b54 --- /dev/null +++ b/utils/kernel/pinb/paint/paint.S @@ -0,0 +1,523 @@ + + .code16 + .section .text.pinb.app + .global _paint + + _paint: + .screen: + call _clear + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0x1F, %bl + mov $2240, %cx + int $0x10 + + .topb: + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0xF1, %bl + mov $80, %cx + int $0x10 + + mov $_paint_title, %si + call _printk + + mov $0x02, %ah + mov $0x02, %dh + mov $0x01, %dl + int $0x10 + + .canvas: + cmp $27, %dh + je .sidebar + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0xF0, %bl + mov $72, %cx + int $0x10 + + mov $0x02, %ah + inc %dh + mov $0x01, %dl + int $0x10 + + jmp .canvas + + .sidebar: + + mov $0x02, %ah + mov $0x01, %dh + mov $0x01, %dl + int $0x10 + + .sb1: + mov $0x02, %ah + inc %dh + mov $74, %dl + int $0x10 + + cmp $27, %dh + je .sb2 + + mov $0x09, %ah + mov $0xBA, %al + mov $0x00, %bh + mov $0xF0, %bl + mov $1, %cx + int $0x10 + + jmp .sb1 + + .sb2: + mov $0x02, %ah + inc %dh + mov $75, %dl + int $0x10 + + cmp $27, %dh + je .sb3 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0xF0, %bl + mov $1, %cx + int $0x10 + + jmp .sb2 + + .sb3: + mov $0x02, %ah + inc %dh + mov $76, %dl + int $0x10 + + cmp $27, %dh + je .sb4 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0xF0, %bl + mov $1, %cx + int $0x10 + + jmp .sb3 + + .sb4: + mov $0x02, %ah + inc %dh + mov $77, %dl + int $0x10 + + cmp $27, %dh + je .sb5 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0xF0, %bl + mov $1, %cx + int $0x10 + + jmp .sb4 + + .sb5: + mov $0x02, %ah + inc %dh + mov $78, %dl + int $0x10 + + cmp $27, %dh + je .sb6 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0xF0, %bl + mov $1, %cx + int $0x10 + + jmp .sb5 + + .sb6: + mov $0x02, %ah + inc %dh + mov $79, %dl + int $0x10 + + cmp $27, %dh + je .tb1 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0xF0, %bl + mov $1, %cx + int $0x10 + + jmp .sb6 + + .tb1: + mov $0x02, %ah + mov $01, %dh + mov $00, %dl + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0x1F, %bl + mov $80, %cx + int $0x10 + + mov $0x02, %ah + mov $02, %dh + mov $75, %dl + int $0x10 + + mov $0x09, %ah + mov $0xCD, %al + mov $0x00, %bh + mov $0xF0, %bl + mov $5, %cx + int $0x10 + + mov $0x02, %ah + mov $02, %dh + mov $74, %dl + int $0x10 + + mov $0x0e, %ah + mov $0xC9, %al + int $0x10 + + .bb1: + mov $0x02, %ah + mov $26, %dh + mov $75, %dl + int $0x10 + + mov $0x09, %ah + mov $0xCD, %al + mov $0x00, %bh + mov $0xF0, %bl + mov $5, %cx + int $0x10 + + mov $0x02, %ah + mov $26, %dh + mov $74, %dl + int $0x10 + + mov $0x0e, %ah + mov $0xC8, %al + int $0x10 + + .ico: + .black: + mov $0x02, %ah + mov $0x03, %dh + mov $75, %dl + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0x0F, %bl + mov $5, %cx + int $0x10 + .blue: + mov $0x02, %ah + inc %dh + mov $75, %dl + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0x1F, %bl + mov $5, %cx + int $0x10 + .green: + mov $0x02, %ah + inc %dh + mov $75, %dl + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0x2F, %bl + mov $5, %cx + int $0x10 + .cyan: + mov $0x02, %ah + inc %dh + mov $75, %dl + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0x3F, %bl + mov $5, %cx + int $0x10 + .red: + mov $0x02, %ah + inc %dh + mov $75, %dl + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0x4F, %bl + mov $5, %cx + int $0x10 + .magenta: + mov $0x02, %ah + inc %dh + mov $75, %dl + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0x5F, %bl + mov $5, %cx + int $0x10 + .brown: + mov $0x02, %ah + inc %dh + mov $75, %dl + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0x6F, %bl + mov $5, %cx + int $0x10 + .l_gray: + mov $0x02, %ah + inc %dh + mov $75, %dl + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0x7F, %bl + mov $5, %cx + int $0x10 + .d_gray: + mov $0x02, %ah + inc %dh + mov $75, %dl + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0x8F, %bl + mov $5, %cx + int $0x10 + .l_blue: + mov $0x02, %ah + inc %dh + mov $75, %dl + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0x9F, %bl + mov $5, %cx + int $0x10 + .l_green: + mov $0x02, %ah + inc %dh + mov $75, %dl + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0xAF, %bl + mov $5, %cx + int $0x10 + .l_cyan: + mov $0x02, %ah + inc %dh + mov $75, %dl + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0xBF, %bl + mov $5, %cx + int $0x10 + .l_red: + mov $0x02, %ah + inc %dh + mov $75, %dl + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0xCF, %bl + mov $5, %cx + int $0x10 + .l_mag: + mov $0x02, %ah + inc %dh + mov $75, %dl + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0xDF, %bl + mov $5, %cx + int $0x10 + .yellow: + mov $0x02, %ah + inc %dh + mov $75, %dl + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0xEF, %bl + mov $5, %cx + int $0x10 + .white: + mov $0x02, %ah + inc %dh + mov $75, %dl + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0xF0, %bl + mov $5, %cx + int $0x10 + + mov $0x02, %ah + inc %dh + mov $74, %dl + int $0x10 + + mov $0x09, %ah + mov $0xCD, %al + mov $0x00, %bh + mov $0xF0, %bl + mov $6, %cx + int $0x10 + + mov $0x0e, %ah + mov $0xCC, %al + int $0x10 + + .shade0: + mov $0x02, %ah + inc %dh + mov $75, %dl + int $0x10 + + mov $0x09, %ah + mov $0xDB, %al + mov $0x00, %bh + mov $0xF0, %bl + mov $5, %cx + int $0x10 + + .shade1: + mov $0x02, %ah + inc %dh + mov $75, %dl + int $0x10 + + mov $0x09, %ah + mov $0xB2, %al + mov $0x00, %bh + mov $0xF0, %bl + mov $5, %cx + int $0x10 + + .shade2: + mov $0x02, %ah + inc %dh + mov $75, %dl + int $0x10 + + mov $0x09, %ah + mov $0xB1, %al + mov $0x00, %bh + mov $0xF0, %bl + mov $5, %cx + int $0x10 + + .shade3: + mov $0x02, %ah + inc %dh + mov $75, %dl + int $0x10 + + mov $0x09, %ah + mov $0xB0, %al + mov $0x00, %bh + mov $0xF0, %bl + mov $5, %cx + int $0x10 + + mov $0x02, %ah + inc %dh + mov $74, %dl + int $0x10 + + mov $0x09, %ah + mov $0xCD, %al + mov $0x00, %bh + mov $0xF0, %bl + mov $6, %cx + int $0x10 + + mov $0x0e, %ah + mov $0xCC, %al + int $0x10 + + .new: + mov $0x02, %ah + inc %dh + mov $76, %dl + int $0x10 + + mov $0x0e, %ah + mov $0x4E, %al + int $0x10 + + mov $0x65, %al + int $0x10 + + mov $0x77, %al + int $0x10 + + .halt: + + jmp _paint_curs + + cli + hlt + + .section .rodata.pinb.app + _paint_title: .asciz " \xB3\xFE\xB3 Paint v5.0.0" diff --git a/utils/kernel/pinb/pinb.S b/utils/kernel/pinb/pinb.S new file mode 100644 index 0000000..519ed9b --- /dev/null +++ b/utils/kernel/pinb/pinb.S @@ -0,0 +1,55 @@ + .code16 + .section .text.pinb + .global _pinb + + .extern _shell + + _pinb: + .start: + call _clear + mov $_pm_0, %si + call _printk + + .screen: + call _clear + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0x1F, %bl + mov $2240, %cx + int $0x10 + + .t_bar: + mov $0x02, %ah + mov $00, %dh + mov $00, %dl + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0xF1, %bl + mov $80, %cx + int $0x10 + + mov $_bar, %si + call _printk + + .bt_str: + mov $0x02, %ah + mov $27, %dh + mov $44, %dl + int $0x10 + mov $_pm_0, %si + call _printk + + .end: + jmp _desk_curs + + cli + hlt + + .section .rodata.pinb + _pm_0: .asciz " Pinboard Enviroment for OS/1 v5.x" + _bar: .asciz " \xB3 Home \xB3" diff --git a/utils/kernel/pinb/pong/pong.S b/utils/kernel/pinb/pong/pong.S new file mode 100644 index 0000000..c8b6beb --- /dev/null +++ b/utils/kernel/pinb/pong/pong.S @@ -0,0 +1,21 @@ + + .code16 + .section .text.pinb.app + .global _pong + + _pong: + call _clear + + mov $_expl, %si + call _printk + + mov $0x00, %ax + int $0x16 + + jmp _pinb + + cli + hlt + + .section .rodata.pinb + _expl: .asciz "Pong has been removed from OS/1 5.0.0 for being to buggy.\r\nIt will be back in the next Service Pack\r\nAny key to return to Pinboard" diff --git a/utils/kernel/pinb/prod/p_wnd.S b/utils/kernel/pinb/prod/p_wnd.S new file mode 100644 index 0000000..0e7eef0 --- /dev/null +++ b/utils/kernel/pinb/prod/p_wnd.S @@ -0,0 +1,157 @@ + .code16 + .section .text.pinb + .global _prod + + _prod: + .o_title: + mov $0x02, %ah + mov $02, %dh + mov $52, %dl + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0xF1, %bl + mov $21, %cx + int $0x10 + + mov $_o_title, %si + call _printk + + .border: + + mov $0x02, %ah + mov $02, %dh + mov $52, %dl + int $0x10 + + .left: + mov $0x02, %ah + inc %dh + mov $52, %dl + int $0x10 + + mov $0x09, %ah + mov $0xBA, %al + mov $0x00, %bh + mov $0xF1, %bl + mov $01, %cx + int $0x10 + + cmp $10, %dh + je .int1 + + jmp .left + + .int1: + mov $0x02, %ah + mov $02, %dh + mov $01, %dl + int $0x10 + + .right: + mov $0x02, %ah + inc %dh + mov $72, %dl + int $0x10 + + mov $0x09, %ah + mov $0xBA, %al + mov $0x00, %bh + mov $0xF1, %bl + mov $01, %cx + int $0x10 + + cmp $10, %dh + je .bottom + + jmp .right + + .bottom: + mov $0x02, %ah + mov $52, %dl + int $0x10 + + mov $0x09, %ah + mov $0xCD, %al + mov $0x00, %bh + mov $0xF1, %bl + mov $20, %cx + int $0x10 + + mov $0x0e, %ah + mov $0xC8, %al + int $0x10 + + mov $0x02, %ah + mov $72, %dl + int $0x10 + mov $0x0e, %ah + mov $0xBC, %al + int $0x10 + + .icons: + mov $0x02, %ah + mov $02, %dh + mov $52, %dl + int $0x10 + + .words: + mov $0x02, %ah + inc %dh + mov $55, %dl + int $0x10 + mov $_words_1, %si + call _printk + + mov $0x02, %ah + inc %dh + mov $55, %dl + int $0x10 + mov $_words_2, %si + call _printk + + mov $0x02, %ah + inc %dh + mov $55, %dl + int $0x10 + mov $_words_3, %si + call _printk + + mov $0x02, %ah + inc %dh + mov $55, %dl + int $0x10 + mov $_words_4, %si + call _printk + + mov $0x02, %ah + inc %dh + mov $55, %dl + int $0x10 + mov $_words_5, %si + call _printk + + mov $0x02, %ah + inc %dh + mov $55, %dl + int $0x10 + mov $_words_6, %si + call _printk + cli + hlt + + .section .rodata.pinb + _o_title: .asciz " \xB3\xFE\xB3 Home\\Office" + + # + # Icon(s) + # + + _words_1: .asciz "\xD6\xC4\xC4\xC4\xC4\xC4\xBF" + _words_2: .asciz "\xBA\x20\xC4\xC4\xC4\x20\xB3" + _words_3: .asciz "\xBA\xCD\xCD\xCD\xCD\xCD\xB3" + _words_4: .asciz "\xBA\xCD\xCD\xCD\xCD\xCD\xB3" + _words_5: .asciz "\xD3\xC4\xC4\xC4\xC4\xC4\xD9" + _words_6: .asciz " Words " diff --git a/utils/kernel/pinb/prod/words.S b/utils/kernel/pinb/prod/words.S new file mode 100644 index 0000000..99222bd --- /dev/null +++ b/utils/kernel/pinb/prod/words.S @@ -0,0 +1,10 @@ + + .code16 + .section .text.pinb.app + .global _words + + _words: + call _clear + + cli + hlt diff --git a/utils/kernel/pinb/sets/stng.S b/utils/kernel/pinb/sets/stng.S new file mode 100644 index 0000000..92382e6 --- /dev/null +++ b/utils/kernel/pinb/sets/stng.S @@ -0,0 +1,97 @@ + + .code16 + .section .text.pinb.app + .global _settings + + _settings: + + .screen: + call _clear + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0x1F, %bl + mov $2240, %cx + int $0x10 + + .topb: + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0xF1, %bl + mov $80, %cx + int $0x10 + + mov $_s_title, %si + call _printk + + mov $0x02, %ah + mov $0x02, %dh + mov $0x01, %dl + int $0x10 + + .fill: + cmp $27, %dh + je .prev_win + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0xF0, %bl + mov $78, %cx + int $0x10 + + mov $0x02, %ah + inc %dh + mov $0x01, %dl + int $0x10 + + jmp .fill + + .prev_win: + mov $0x02, %ah + mov $0x02, %dh + mov $30, %dl + int $0x10 + + .pw_loop: + cmp $14, %dh + je .items + + mov $0x02, %ah + inc %dh + mov $37, %dl + int $0x10 + + mov $0x09, %ah + mov $0x20, %al + mov $0x00, %bh + mov $0x1F, %bl + mov $40, %cx + int $0x10 + + jmp .pw_loop + + .items: + mov $0x02, %ah + mov $15, %dh + mov $52, %dl + int $0x10 + + mov $_prev, %si + call _printk + + .halt: + + cli + hlt + + .section .rodata.pinb + _s_title: .asciz " \xB3\xFE\xB3 Settings " + + _prev: .asciz " Preview " + + # + # Menu options + # diff --git a/utils/nonboot/Makefile b/utils/nonboot/Makefile new file mode 100644 index 0000000..6b85428 --- /dev/null +++ b/utils/nonboot/Makefile @@ -0,0 +1,23 @@ + +# Change as you like but keep it x86 compatable. +ARCH=i386-elf + +AS=$(ARCH)-as +LD=$(ARCH)-ld + +override BIN := nonboot.bin +override ASM := $(shell find ./ -type f -name '*.S') +override OBJ := $(ASM:.S=.o) + +.PHONY: all +all: $(BIN) + +$(BIN): $(OBJ) + $(LD) -Tlinker.ld $(OBJ) -o $@ + +%.o: %.S + $(AS) $< -o $@ + +.PHONY: clean +clean: + rm $(OBJ) $(BIN) diff --git a/utils/nonboot/linker.ld b/utils/nonboot/linker.ld new file mode 100644 index 0000000..af94151 --- /dev/null +++ b/utils/nonboot/linker.ld @@ -0,0 +1,32 @@ +OUTPUT_FORMAT(binary); +ENTRY(_main); + +SECTIONS +{ + . = 0x7c00; + .text : SUBALIGN(0) + { + *(.text.main); + *(.text) + } + + .rodata : SUBALIGN(0) + { + *(.rodata) + } + + .data : SUBALIGN(0) + { + *(.data) + } + + .sig : AT(0x7DFE) + { + SHORT(0xaa55); + } + + /DISCARD/ : { + *(.comment); + *(.note*); + } +} diff --git a/utils/nonboot/nonboot.S b/utils/nonboot/nonboot.S new file mode 100644 index 0000000..788f81f --- /dev/null +++ b/utils/nonboot/nonboot.S @@ -0,0 +1,42 @@ + + .code16 + .global _main + .section .text.main + + _main: + xor %ax, %ax + mov %ax, %ds + mov %ax, %ss + mov $_main, %sp + cld + + mov $0x03, %ax + int $0x10 + + mov $0x13, %ah # Value 0x13 (print str.) + mov $0x01, %al # String type + mov $0x00, %bh # Video page num. + mov $0x0c, %bl # Attribute (Red on Black) + mov $0x20, %cx # String len. = 32 chars. + mov $0x00, %dh # Row 0 + mov $0x00, %dl # Column 0 + mov $_msg0, %bp # String to print + int $0x10 # Call interrupt + + mov $0x13, %ah # Value 0x13 (print str.) + mov $0x01, %al # String type + mov $0x00, %bh # Video page num. + mov $0x0f, %bl # Attribute (White on Black) + mov $0x3b, %cx # String len. = 59 chars. + mov $0x01, %dh # Row 1 + mov $0x00, %dl # Column 0 + mov $_msg1, %bp # String to print + int $0x10 # Call interrupt + + mov $0x00, %ax + int $0x16 + int $0x19 + + .section .rodata + _msg0: .asciz "/!\\ Unbootable disk inserted /!\\" + _msg1: .asciz "Insert the OS/1 WE 5.0.0 System disk and then press any key"