From 2f9a8fa2363bc2330e606724c04a036707baacac Mon Sep 17 00:00:00 2001 From: "(Tim) Efthimis Kritikos" Date: Tue, 14 Mar 2023 07:20:30 +0000 Subject: [PATCH] Improved DOS char print code --- boot_code/Makefile | 6 +++--- boot_code/brainfuck_compiled.asm | 11 ++--------- boot_code/brainfuck_interpreted.asm | 12 ++---------- boot_code/brainfuck_mandelbrot.asm | 14 +++----------- boot_code/dos_layer.asm | 16 ++++++++++++++++ out | Bin 0 -> 16 bytes system/boot_code.asm | 1 + 7 files changed, 27 insertions(+), 33 deletions(-) create mode 100644 boot_code/dos_layer.asm create mode 100644 out diff --git a/boot_code/Makefile b/boot_code/Makefile index 109bd5f..9f714d2 100644 --- a/boot_code/Makefile +++ b/boot_code/Makefile @@ -7,9 +7,9 @@ BUILD_FILES+=$(subst .asm,.bin,${SOURCE}) all: ${BINARIES} -brainfuck_interpreted.bin: brainfuck_interpreter_v0.asm hello_9086.bf.asm -brainfuck_compiled.bin: brainfuck_compiler_v1.asm hello_9086.bf.asm -brainfuck_mandelbrot.bin: brainfuck_compiler_v1.asm mandelbrot.bf.asm +brainfuck_interpreted.bin: brainfuck_interpreter_v0.asm hello_9086.bf.asm dos_layer.asm +brainfuck_compiled.bin: brainfuck_compiler_v1.asm hello_9086.bf.asm dos_layer.asm +brainfuck_mandelbrot.bin: brainfuck_compiler_v1.asm mandelbrot.bf.asm dos_layer.asm %.bf.asm:%.bf ${Q}sed "s/[a-zA-Z\* ]//g;/^$$/d;s/^/.ASCII '/;s/\$$/'/" "$^" > $@ diff --git a/boot_code/brainfuck_compiled.asm b/boot_code/brainfuck_compiled.asm index d79d7de..5a61d47 100644 --- a/boot_code/brainfuck_compiled.asm +++ b/boot_code/brainfuck_compiled.asm @@ -1,6 +1,5 @@ -.ORG 0x84 ; INT 21 -DW 0xFFFF ; Code Segment -DW PRINT_INT_HANDLE ; Program Counter +; Interrupt table and routines +INCLUDE dos_layer.asm org 0x100 INCLUDE brainfuck_compiler_v1.asm @@ -8,12 +7,6 @@ INCLUDE brainfuck_compiler_v1.asm prog: INCLUDE hello_9086.bf.asm -PRINT_INT_HANDLE: -push AX -MOV AL,DL -out byte #0xA5 -POP AX -iret output_program: diff --git a/boot_code/brainfuck_interpreted.asm b/boot_code/brainfuck_interpreted.asm index 21177f6..221e59d 100644 --- a/boot_code/brainfuck_interpreted.asm +++ b/boot_code/brainfuck_interpreted.asm @@ -1,18 +1,10 @@ -.ORG 0x84 ; INT 21 -DW 0xFFFF ; Code Segment -DW PRINT_INT_HANDLE ; Program Counter +; Interrupt table and routines +INCLUDE dos_layer.asm ORG 0x100 mov sp,#STACK INCLUDE brainfuck_interpreter_v0.asm -PRINT_INT_HANDLE: -push AX -MOV AL,DL -out byte #0xA5 -POP AX -iret - .BLKB 200 STACK: diff --git a/boot_code/brainfuck_mandelbrot.asm b/boot_code/brainfuck_mandelbrot.asm index 7e6e71b..a3bd259 100644 --- a/boot_code/brainfuck_mandelbrot.asm +++ b/boot_code/brainfuck_mandelbrot.asm @@ -1,17 +1,9 @@ -.ORG 0x84 ; INT 21 -DW 0xFFFF ; Code Segment -DW PRINT_INT_HANDLE ; Program Counter +; Interrupt table and routines +INCLUDE dos_layer.asm -ORG 0x100 +.ORG 0x100 INCLUDE brainfuck_compiler_v1.asm -PRINT_INT_HANDLE: -push AX -MOV AL,DL -out byte #0xA5 -POP AX -iret - prog: INCLUDE mandelbrot.bf.asm diff --git a/boot_code/dos_layer.asm b/boot_code/dos_layer.asm new file mode 100644 index 0000000..f27ef3b --- /dev/null +++ b/boot_code/dos_layer.asm @@ -0,0 +1,16 @@ +.ORG 0x84 ; INT 21 +DW 0xFFFF ; Code Segment +DW PRINT_INT_HANDLE ; Program Counter + +PRINT_INT_HANDLE: +push AX +CMP AH,#0x02 +jz PRINT_CHAR +pop AX +iret + +PRINT_CHAR: +MOV AL,DL +out byte #0xA5 +POP AX +iret diff --git a/out b/out new file mode 100644 index 0000000000000000000000000000000000000000..cab8bb614e182f3e47f2307e357beccd304850f9 GIT binary patch literal 16 XcmWG&_`_Vnc)sJpv!xN|85kG