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 0000000..cab8bb6 Binary files /dev/null and b/out differ diff --git a/system/boot_code.asm b/system/boot_code.asm index bdedd99..d46d84e 100644 --- a/system/boot_code.asm +++ b/system/boot_code.asm @@ -40,6 +40,7 @@ TEST_: ADD AX,#0xDEAD RET +;quick&dirty PRINT_INT_HANDLE: push AX MOV AL,DL