More Ctrl+C
authorRobert Pengelly <robertapengelly@hotmail.com>
Wed, 18 Sep 2024 19:22:05 +0000 (20:22 +0100)
committerRobert Pengelly <robertapengelly@hotmail.com>
Wed, 18 Sep 2024 19:22:05 +0000 (20:22 +0100)
build/chimaera.img
build/chimaera.vhd
src/apps/hello/Makefile.unix
src/apps/hello/hello.asm
src/apps/hello/hello.c [new file with mode: 0644]
src/apps/hello/test.c [deleted file]
src/kernel/int21.asm
src/kernel/int23.asm
src/utils/binutils/as

index 06c33d3b52a1e49de2404b3882e0e0d74cd7ea67..ba8e0bfeed27209aa84ff3bb1d5c7c4524cf86c6 100644 (file)
Binary files a/build/chimaera.img and b/build/chimaera.img differ
index 235eb5c54e830897e07e2774e19228ef1233a3bf..d02a78b548617f4613338af23fc813ec3323a63e 100644 (file)
Binary files a/build/chimaera.vhd and b/build/chimaera.vhd differ
index 14cc2039acdc84d7bfc1e1c79b1e2e6f3a15c488..df41716fa7f312483fb63e702fb9e2cf1df0a410 100644 (file)
@@ -19,3 +19,6 @@ hello.com: ../../lib/crt/crt0.o crlf.o hello.o writechr.o writehex.o writestr.o
 
 %.o: %.asm
        ../../utils/binutils/sasm -I$(SRCDIR)/../../lib/crt/include -l $*.lst -o $@ $<
+
+#%.asm: %.c
+#      ../../utils/cc/scc -S -o $@ $<
index 4ed55a5b5df606a061f480bea1b55e90ecb475cd..66c03e0a985aa7c55afbb9e0bff02cf70ffbca7a 100644 (file)
@@ -24,6 +24,14 @@ _main:
     mov     bx,     offset _msg_hello
     call    _writestr
     
+.L1:
+
+    mov     ah,     HEX (02)
+    mov     dl,     'A'
+    int     HEX (21)
+    
+    jmp     .L1
+    
 ;    mov     bp,     sp
 ;    
 ;    mov     ax,     bp
@@ -70,10 +78,10 @@ _main:
 ;    call    _writehex
 ;    call    _crlf
     
-    mov     ax,     HEX (4B01)
-    mov     bx,     offset _param_blk
-    mov     dx,     offset _app_name
-    int     HEX (21)
+;    mov     ax,     HEX (4B01)
+;    mov     bx,     offset _param_blk
+;    mov     dx,     offset _app_name
+;    int     HEX (21)
     
 ;    mov     ah,     HEX (62)
 ;    int     HEX (21)
diff --git a/src/apps/hello/hello.c b/src/apps/hello/hello.c
new file mode 100644 (file)
index 0000000..a9a47f7
--- /dev/null
@@ -0,0 +1,32 @@
+/******************************************************************************
+ * @file            hello.c
+ *****************************************************************************/
+/*asm (
+
+    "_start:\n"
+    "xor bp, bp\n"
+    "push bp\n"
+    "mov bp, sp"
+
+);*/
+
+//asm inline ".ret:\n";
+//asm inline "ret\n";
+
+/*asm volatile (
+    "push bp\n"
+    "mov bp, sp\n"
+);*/
+
+unsigned char a;
+unsigned short b;
+unsigned int c;
+
+unsigned char *abc;
+//unsigned long d;
+
+//extern void b ();
+static void dead_code () {}
+
+int main (argc, argv) {
+}
diff --git a/src/apps/hello/test.c b/src/apps/hello/test.c
deleted file mode 100644 (file)
index dc8fabd..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/******************************************************************************
- * @file            hello.c
- *****************************************************************************/
-int main (int argc, char **argv) {
-    return 0;
-}
index e300cf657e80f3aa605a38fbab9d976bbe9e1819..f73c893d5760a256f704491e04097e09b67f6afa 100644 (file)
@@ -1086,6 +1086,26 @@ _int21_02:
 
     push    ax
     
+    call    _check_handle_break
+    jnc     _int21_02.write
+    
+    mov     al,     '^'
+    call    _writechr
+    
+    mov     al,     'C'
+    call    _writechr
+    
+    mov     al,     HEX (0D)
+    call    _writechr
+    
+    mov     al,     HEX (0A)
+    call    _writechr
+    
+    pop     ax
+    jmp     _spawn_int23
+
+_int21_02.write:
+
     mov     al,     dl
     call    _writechr
     
@@ -1190,6 +1210,27 @@ _int21_09:
 
 _int21_09.loop:
 
+    call    _check_handle_break
+    jnc     _int21_09.print
+    
+    mov     al,     '^'
+    call    _writechr
+    
+    mov     al,     'C'
+    call    _writechr
+    
+    mov     al,     HEX (0D)
+    call    _writechr
+    
+    mov     al,     HEX (0A)
+    call    _writechr
+    
+    pop     si
+    pop     ax
+    jmp     _spawn_int23
+
+_int21_09.print:
+
     lodsb
     
     cmp     al,     '$'
index b422cbbe327b211711b01e3f6c1c464119ad8b4e..1af383809f23eb752ce636f1802f38aaec6ed41d 100644 (file)
@@ -5,6 +5,39 @@
 % define        HEX(y)                  0x##y
 %endif
 
+;******************************************************************************
+; @function          _check_handle_break
+;******************************************************************************
+global      _check_handle_break
+_check_handle_break:
+
+    push    es
+    push    bx
+    push    ax
+    
+    xor     bx,     bx
+    mov     es,     bx
+    mov     bx,     HEX (0471)
+    
+    mov     al,     es:[bx]
+    
+    and     al,     HEX (80)
+    jnz     _check_handle_break.break
+    
+    clc
+    jmp     _check_handle_break.done
+
+_check_handle_break.break:
+
+    stc
+
+_check_handle_break.done:
+
+    pop     ax
+    pop     bx
+    pop     es
+    ret
+
 ;******************************************************************************
 ; @function          _regain_control_int23
 ;******************************************************************************
index 1c5f2de0ea49b930fc16bbf187b1adb64cd01832..6d9cd8ff9e955a89b83f3e5fdd0605b6b00a1f26 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 1c5f2de0ea49b930fc16bbf187b1adb64cd01832
+Subproject commit 6d9cd8ff9e955a89b83f3e5fdd0605b6b00a1f26