diff --git a/asm/DosBox/.gitignore b/asm/DosBox/.gitignore deleted file mode 100644 index d8a022e..0000000 --- a/asm/DosBox/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -dosbox.app -Boxer.app -programming_boot_sector_games_ebook unlocked.pdf -DosBox.exe -SDL.dll -SDL_Net.dll -asciitable.gif -DOSBox 0.74-3 Options.bat -stderr.txt -stdout.txt diff --git a/asm/DosBox/DOSBox 0.74-3 Options.bat b/asm/DosBox/DOSBox 0.74-3 Options.bat new file mode 100644 index 0000000..a48d102 --- /dev/null +++ b/asm/DosBox/DOSBox 0.74-3 Options.bat @@ -0,0 +1 @@ +DOSBox.exe -editconf notepad.exe -editconf %SystemRoot%\system32\notepad.exe -editconf %WINDIR%\notepad.exe \ No newline at end of file diff --git a/asm/DosBox/Readme.md b/asm/DosBox/Readme.md index 27fb996..2a95d00 100644 --- a/asm/DosBox/Readme.md +++ b/asm/DosBox/Readme.md @@ -1,8 +1,3 @@ -# first.asm # -This is a simple hello world which I tinkered with a bit - -# second.asm # -This is a simple keyboard reading program # DosBox # using dosbox (or Boxerapp on mac) you can run simpler assembly programs than you can when you are in the infrastructure of the advanced 2019 operating system apis. You are much closer to the bare metal. diff --git a/asm/DosBox/add1.asm b/asm/DosBox/add1.asm deleted file mode 100644 index 22fd014..0000000 --- a/asm/DosBox/add1.asm +++ /dev/null @@ -1,46 +0,0 @@ - - org 0x0100 -start: - mov al,0x04 ; Load register AL with 0x04 - add al,0x03 ; Add 0x03 to register AL - ; - add al,0x30 ; Convert to ASCII digit - call display_letter - - int 0x20 ; Exit to command line. - - ; Display letter contained in AL (ASCII) -display_letter: - push ax - push bx - push cx - push dx - push si - push di - mov ah,0x0e ; Load AH with code for terminal output - mov bx,0x000f ; Load BH page zero adn BL color (graphic mode) - int 0x10 ; Call the BIOS for displaying one letter - pop di - pop si - pop dx - pop cx - pop bx - pop ax - ret ; Returns to caller - - ; Read keyboard into AL (ASCII) -read_keyboard: - push bx - push cx - push dx - push si - push di - mov ah,0x00 ; Load AH with code for keyboard read - int 0x16 ; Call the BIOS for reading keyboard - pop di - pop si - pop dx - pop cx - pop bx - ret ; Returns to caller - \ No newline at end of file diff --git a/asm/DosBox/add1.com b/asm/DosBox/add1.com deleted file mode 100644 index 005c534..0000000 Binary files a/asm/DosBox/add1.com and /dev/null differ diff --git a/asm/DosBox/disp_bin.asm b/asm/DosBox/disp_bin.asm deleted file mode 100644 index 58fc8dd..0000000 --- a/asm/DosBox/disp_bin.asm +++ /dev/null @@ -1,60 +0,0 @@ - - org 0x0100 -start: - mov bx,0x64 ; start with decimal 100 -nextrightmostbinary: - shr bx,1 ; shift bx to the right by one - jc printone ; was there a 1 on the right of bx -printone: - mov al,1 - jmp displaybinary -printzero: - mov al,0 -displaybinary: - add al,0x30 - call display_letter - - call newline - - -; -------------- - int 0x20 - ; Display letter contained in AL (ASCII) -display_letter: - push ax - push bx - push cx - push dx - push si - push di - mov ah,0x0e ; Load AH with code for terminal output - mov bx,0x000f ; Load BH page zero adn BL color (graphic mode) - int 0x10 ; Call the BIOS for displaying one letter - pop di - pop si - pop dx - pop cx - pop bx - pop ax - ret ; Returns to caller - - ; Read keyboard into AL (ASCII) -read_keyboard: - push bx - push cx - push dx - push si - push di - mov ah,0x00 ; Load AH with code for keyboard read - int 0x16 ; Call the BIOS for reading keyboard - pop di - pop si - pop dx - pop cx - pop bx - ret ; Returns to caller - -newline: - mov al,0x0A - call display_letter - ret \ No newline at end of file diff --git a/asm/DosBox/disp_bin.com b/asm/DosBox/disp_bin.com deleted file mode 100644 index 324b04a..0000000 Binary files a/asm/DosBox/disp_bin.com and /dev/null differ diff --git a/asm/DosBox/display_binary.asm b/asm/DosBox/display_binary.asm deleted file mode 100644 index 58fc8dd..0000000 --- a/asm/DosBox/display_binary.asm +++ /dev/null @@ -1,60 +0,0 @@ - - org 0x0100 -start: - mov bx,0x64 ; start with decimal 100 -nextrightmostbinary: - shr bx,1 ; shift bx to the right by one - jc printone ; was there a 1 on the right of bx -printone: - mov al,1 - jmp displaybinary -printzero: - mov al,0 -displaybinary: - add al,0x30 - call display_letter - - call newline - - -; -------------- - int 0x20 - ; Display letter contained in AL (ASCII) -display_letter: - push ax - push bx - push cx - push dx - push si - push di - mov ah,0x0e ; Load AH with code for terminal output - mov bx,0x000f ; Load BH page zero adn BL color (graphic mode) - int 0x10 ; Call the BIOS for displaying one letter - pop di - pop si - pop dx - pop cx - pop bx - pop ax - ret ; Returns to caller - - ; Read keyboard into AL (ASCII) -read_keyboard: - push bx - push cx - push dx - push si - push di - mov ah,0x00 ; Load AH with code for keyboard read - int 0x16 ; Call the BIOS for reading keyboard - pop di - pop si - pop dx - pop cx - pop bx - ret ; Returns to caller - -newline: - mov al,0x0A - call display_letter - ret \ No newline at end of file diff --git a/asm/DosBox/display_binary.com b/asm/DosBox/display_binary.com deleted file mode 100644 index 324b04a..0000000 Binary files a/asm/DosBox/display_binary.com and /dev/null differ diff --git a/asm/DosBox/div1.asm b/asm/DosBox/div1.asm deleted file mode 100644 index ca2f51d..0000000 --- a/asm/DosBox/div1.asm +++ /dev/null @@ -1,57 +0,0 @@ - - org 0x0100 -start: - mov ax,0x64 - mov cl,0x21 - div cl - - add al,0x30 - call display_letter - - mov al,' ' - call display_letter - mov al,ah - - add al,0x30 - call display_letter - - - - -; -------------- - int 0x20 - ; Display letter contained in AL (ASCII) -display_letter: - push ax - push bx - push cx - push dx - push si - push di - mov ah,0x0e ; Load AH with code for terminal output - mov bx,0x000f ; Load BH page zero adn BL color (graphic mode) - int 0x10 ; Call the BIOS for displaying one letter - pop di - pop si - pop dx - pop cx - pop bx - pop ax - ret ; Returns to caller - - ; Read keyboard into AL (ASCII) -read_keyboard: - push bx - push cx - push dx - push si - push di - mov ah,0x00 ; Load AH with code for keyboard read - int 0x16 ; Call the BIOS for reading keyboard - pop di - pop si - pop dx - pop cx - pop bx - ret ; Returns to caller - \ No newline at end of file diff --git a/asm/DosBox/div1.com b/asm/DosBox/div1.com deleted file mode 100644 index 0b58c4a..0000000 Binary files a/asm/DosBox/div1.com and /dev/null differ diff --git a/asm/DosBox/first.asm b/asm/DosBox/first.asm deleted file mode 100644 index 3122233..0000000 --- a/asm/DosBox/first.asm +++ /dev/null @@ -1,28 +0,0 @@ -; nasm -f bin first.asm -o first.com - -; -; The incredible Hello, World program -; - -org 0x0100 ; Start point of program for a COM file -start: - mov bx,string ; Load register BX with address of 'string' -repeat: - mov al,[bx] ; Load a byte in AL from address pointed by BX - test al,al ; Test AL for zero - je end ; Jump if equal to 'end' label (jump if zero) - push bx ; Save BX register in stack - mov ah,0x0e ; Load AH with code for terminal output - mov bx,0x000f ; BH is page zero. BL is color (graphic mode) - int 0x10 ; Call the BIOS for displaying one letter - mov al,'e' - int 0x10 - pop bx ; Restore BX register from stack - inc bx ; Increase BX register by 1 (next letter) - jmp repeat ; Jump to 'repeat' label - -end: - int 0x20 ; Exit to command-line - -string: - db "Hello Cool Pla0ce!",0 diff --git a/asm/DosBox/first.com b/asm/DosBox/first.com deleted file mode 100644 index 927593d..0000000 Binary files a/asm/DosBox/first.com and /dev/null differ diff --git a/asm/DosBox/guess.asm b/asm/DosBox/guess.asm deleted file mode 100644 index 6d8f2a7..0000000 --- a/asm/DosBox/guess.asm +++ /dev/null @@ -1,61 +0,0 @@ - - org 0x0100 - - in al,(0x40) - and al,0x07 - add al,0x30 - mov cl,al -game_loop: - mov al,'?' - call display_letter - call read_keyboard - cmp al,cl - jne game_loop - call display_letter - mov al,':' - call display_letter - mov al,')' - call display_letter - - -; -------------- - int 0x20 - ; Display letter contained in AL (ASCII) -display_letter: - push ax - push bx - push cx - push dx - push si - push di - mov ah,0x0e ; Load AH with code for terminal output - mov bx,0x000f ; Load BH page zero adn BL color (graphic mode) - int 0x10 ; Call the BIOS for displaying one letter - pop di - pop si - pop dx - pop cx - pop bx - pop ax - ret ; Returns to caller - - ; Read keyboard into AL (ASCII) -read_keyboard: - push bx - push cx - push dx - push si - push di - mov ah,0x00 ; Load AH with code for keyboard read - int 0x16 ; Call the BIOS for reading keyboard - pop di - pop si - pop dx - pop cx - pop bx - ret ; Returns to caller - -newline: - mov al,0x0A - call display_letter - ret \ No newline at end of file diff --git a/asm/DosBox/guess.com b/asm/DosBox/guess.com deleted file mode 100644 index d1b8ee5..0000000 Binary files a/asm/DosBox/guess.com and /dev/null differ diff --git a/asm/DosBox/inc1.asm b/asm/DosBox/inc1.asm deleted file mode 100644 index a469032..0000000 --- a/asm/DosBox/inc1.asm +++ /dev/null @@ -1,58 +0,0 @@ - - org 0x0100 -start: - mov al,0x30 -count1: - call display_letter - inc al - cmp al,0x39 - jne count1 -count2: - call display_letter - dec al - cmp al,0x30 - jne count2 - - - -; -------------- - int 0x20 - ; Display letter contained in AL (ASCII) -display_letter: - push ax - push bx - push cx - push dx - push si - push di - mov ah,0x0e ; Load AH with code for terminal output - mov bx,0x000f ; Load BH page zero adn BL color (graphic mode) - int 0x10 ; Call the BIOS for displaying one letter - pop di - pop si - pop dx - pop cx - pop bx - pop ax - ret ; Returns to caller - - ; Read keyboard into AL (ASCII) -read_keyboard: - push bx - push cx - push dx - push si - push di - mov ah,0x00 ; Load AH with code for keyboard read - int 0x16 ; Call the BIOS for reading keyboard - pop di - pop si - pop dx - pop cx - pop bx - ret ; Returns to caller - -newline: - mov al,0x0A - call display_letter - ret \ No newline at end of file diff --git a/asm/DosBox/inc1.com b/asm/DosBox/inc1.com deleted file mode 100644 index 8fb512a..0000000 Binary files a/asm/DosBox/inc1.com and /dev/null differ diff --git a/asm/DosBox/library1.asm b/asm/DosBox/library1.asm deleted file mode 100644 index b3f6fda..0000000 --- a/asm/DosBox/library1.asm +++ /dev/null @@ -1,38 +0,0 @@ - - int 0x20 ; Exit to command line. - - ; Display letter contained in AL (ASCII) -display_letter: - push ax - push bx - push cx - push dx - push si - push di - mov ah,0x0e ; Load AH with code for terminal output - mov bx,0x000f ; Load BH page zero adn BL color (graphic mode) - int 0x10 ; Call the BIOS for displaying one letter - pop di - pop si - pop dx - pop cx - pop bx - pop ax - ret ; Returns to caller - - ; Read keyboard into AL (ASCII) -read_keyboard: - push bx - push cx - push dx - push si - push di - mov ah,0x00 ; Load AH with code for keyboard read - int 0x16 ; Call the BIOS for reading keyboard - pop di - pop si - pop dx - pop cx - pop bx - ret ; Returns to caller - \ No newline at end of file diff --git a/asm/DosBox/library1.com b/asm/DosBox/library1.com deleted file mode 100644 index 62964cf..0000000 Binary files a/asm/DosBox/library1.com and /dev/null differ diff --git a/asm/DosBox/library2.asm b/asm/DosBox/library2.asm deleted file mode 100644 index fbcaa19..0000000 --- a/asm/DosBox/library2.asm +++ /dev/null @@ -1,62 +0,0 @@ - - ;org 0x0100 - - ;mov ax,0x0100 - ;call display_number - ;int 0x20 - -; -------------- - int 0x20 - ; Display letter contained in AL (ASCII) -display_letter: - push ax - push bx - push cx - push dx - push si - push di - mov ah,0x0e ; Load AH with code for terminal output - mov bx,0x000f ; Load BH page zero adn BL color (graphic mode) - int 0x10 ; Call the BIOS for displaying one letter - pop di - pop si - pop dx - pop cx - pop bx - pop ax - ret ; Returns to caller - - ; Read keyboard into AL (ASCII) -read_keyboard: - push bx - push cx - push dx - push si - push di - mov ah,0x00 ; Load AH with code for keyboard read - int 0x16 ; Call the BIOS for reading keyboard - pop di - pop si - pop dx - pop cx - pop bx - ret ; Returns to caller - - ; - ; Display the value of AX as a decimal number - ; -display_number: - mov dx,0 - mov cx,10 - div cx ; AX = DX: AX / CX - push dx - cmp ax,0 ; if ax is zero - je display_number_1 ; jump - call display_number ; else calls itself again -display_number_1: - pop ax - add al,'0' ; convert remainder to ascii digit - call display_letter ; display on the screen - ret - - \ No newline at end of file diff --git a/asm/DosBox/library2.com b/asm/DosBox/library2.com deleted file mode 100644 index cd3ffae..0000000 Binary files a/asm/DosBox/library2.com and /dev/null differ diff --git a/asm/DosBox/logical1.asm b/asm/DosBox/logical1.asm deleted file mode 100644 index f5eda25..0000000 --- a/asm/DosBox/logical1.asm +++ /dev/null @@ -1,52 +0,0 @@ - - org 0x0100 -start: - mov al,0x32 - and al,0x0f - add al,0x30 - call display_letter - - call newline - - -; -------------- - int 0x20 - ; Display letter contained in AL (ASCII) -display_letter: - push ax - push bx - push cx - push dx - push si - push di - mov ah,0x0e ; Load AH with code for terminal output - mov bx,0x000f ; Load BH page zero adn BL color (graphic mode) - int 0x10 ; Call the BIOS for displaying one letter - pop di - pop si - pop dx - pop cx - pop bx - pop ax - ret ; Returns to caller - - ; Read keyboard into AL (ASCII) -read_keyboard: - push bx - push cx - push dx - push si - push di - mov ah,0x00 ; Load AH with code for keyboard read - int 0x16 ; Call the BIOS for reading keyboard - pop di - pop si - pop dx - pop cx - pop bx - ret ; Returns to caller - -newline: - mov al,0x0A - call display_letter - ret \ No newline at end of file diff --git a/asm/DosBox/logical1.com b/asm/DosBox/logical1.com deleted file mode 100644 index 69da885..0000000 Binary files a/asm/DosBox/logical1.com and /dev/null differ diff --git a/asm/DosBox/m.bat b/asm/DosBox/m.bat deleted file mode 100644 index 89ca987..0000000 --- a/asm/DosBox/m.bat +++ /dev/null @@ -1,7 +0,0 @@ -@echo off -if "%1"=="" goto fileMissing -nasm -f bin %1.asm -o %1.com -goto end -:fileMissing -echo What do you want to Make? -:end diff --git a/asm/DosBox/ml.bat b/asm/DosBox/ml.bat deleted file mode 100644 index a5dceff..0000000 --- a/asm/DosBox/ml.bat +++ /dev/null @@ -1,7 +0,0 @@ -@echo off -if "%1"=="" goto error -nasm -f bin %1.asm -l %1.lst -o %1.com -goto end -:error -echo What do you want to Make? -:end diff --git a/asm/DosBox/mul1.asm b/asm/DosBox/mul1.asm deleted file mode 100644 index 0e5dfed..0000000 --- a/asm/DosBox/mul1.asm +++ /dev/null @@ -1,50 +0,0 @@ - - org 0x0100 -start: - mov al,0x03 - mov cl,0x02 - mul cl - - add al,0x30 - call display_letter - - - - -; -------------- - int 0x20 - ; Display letter contained in AL (ASCII) -display_letter: - push ax - push bx - push cx - push dx - push si - push di - mov ah,0x0e ; Load AH with code for terminal output - mov bx,0x000f ; Load BH page zero adn BL color (graphic mode) - int 0x10 ; Call the BIOS for displaying one letter - pop di - pop si - pop dx - pop cx - pop bx - pop ax - ret ; Returns to caller - - ; Read keyboard into AL (ASCII) -read_keyboard: - push bx - push cx - push dx - push si - push di - mov ah,0x00 ; Load AH with code for keyboard read - int 0x16 ; Call the BIOS for reading keyboard - pop di - pop si - pop dx - pop cx - pop bx - ret ; Returns to caller - \ No newline at end of file diff --git a/asm/DosBox/mul1.com b/asm/DosBox/mul1.com deleted file mode 100644 index 416f6b4..0000000 Binary files a/asm/DosBox/mul1.com and /dev/null differ diff --git a/asm/DosBox/second.asm b/asm/DosBox/second.asm deleted file mode 100644 index 9a54297..0000000 --- a/asm/DosBox/second.asm +++ /dev/null @@ -1,21 +0,0 @@ -; nasm -f bin second.asm -o second.com - -; -; The incredible keyboard reading program -; - -org 0x0100 ; Start point of program for a COM file -start: - - mov ah,0x00 ; keyboard read - int 0x16 ; Call the BIOS to read it - - cmp al,0x1b ; ESC key pressed? - je exit_to_command_line - mov ah,0x0e ; Load AH with code for terminal output - mov bx,0x000f ; BH is page zero. BL is color (graphic mode) - int 0x10 ; Call the BIOS for displaying one letter - jmp start - -exit_to_command_line: - int 0x20 \ No newline at end of file diff --git a/asm/DosBox/second.com b/asm/DosBox/second.com deleted file mode 100644 index 8803088..0000000 Binary files a/asm/DosBox/second.com and /dev/null differ diff --git a/asm/DosBox/shift1.asm b/asm/DosBox/shift1.asm deleted file mode 100644 index 935eba9..0000000 --- a/asm/DosBox/shift1.asm +++ /dev/null @@ -1,53 +0,0 @@ - - org 0x0100 -start: - mov al,0x02 - shl al,1 - add al,0x30 - call display_letter - mov al,0x02 - shl al,1 - shl al,1 - add al,0x30 - call display_letter - - - - -; -------------- - int 0x20 - ; Display letter contained in AL (ASCII) -display_letter: - push ax - push bx - push cx - push dx - push si - push di - mov ah,0x0e ; Load AH with code for terminal output - mov bx,0x000f ; Load BH page zero adn BL color (graphic mode) - int 0x10 ; Call the BIOS for displaying one letter - pop di - pop si - pop dx - pop cx - pop bx - pop ax - ret ; Returns to caller - - ; Read keyboard into AL (ASCII) -read_keyboard: - push bx - push cx - push dx - push si - push di - mov ah,0x00 ; Load AH with code for keyboard read - int 0x16 ; Call the BIOS for reading keyboard - pop di - pop si - pop dx - pop cx - pop bx - ret ; Returns to caller - \ No newline at end of file diff --git a/asm/DosBox/shift1.com b/asm/DosBox/shift1.com deleted file mode 100644 index 04fdb3f..0000000 Binary files a/asm/DosBox/shift1.com and /dev/null differ diff --git a/asm/DosBox/sieve.asm b/asm/DosBox/sieve.asm deleted file mode 100644 index 7ee7dc0..0000000 --- a/asm/DosBox/sieve.asm +++ /dev/null @@ -1,105 +0,0 @@ - - ; - ; Sieve of Eratosthenes - ; - - - - - org 0x0100 - -table: equ 0x8000 -table_size: equ 1000 - -start: - mov bx,table - mov cx,table_size - mov al,0 -p1: - mov [bx],al ; Write AL into the address pointed by BX - inc bx ; increase bx - loop p1 ; Decrease CX, jump if non zero - - mov ax,2 ; start at number 2 -p2: mov bx,table; BX = table address - add bx,ax ; BX=BX+AX - cmp byte [bx],0 ; is it prime? - jne p3 - push ax - call display_number - mov al,0x2c ; Comma - call display_letter - pop ax - - mov bx,table - add bx,ax - -p4: add bx,ax - cmp bx,table+table_size - jnc p3 - mov byte [bx],1 - jmp p4 - -p3: inc ax - cmp ax,table_size - jne p2 - -; -------------- - int 0x20 - - - ; Display letter contained in AL (ASCII) -display_letter: - push ax - push bx - push cx - push dx - push si - push di - mov ah,0x0e ; Load AH with code for terminal output - mov bx,0x000f ; Load BH page zero adn BL color (graphic mode) - int 0x10 ; Call the BIOS for displaying one letter - pop di - pop si - pop dx - pop cx - pop bx - pop ax - ret ; Returns to caller - - ; Read keyboard into AL (ASCII) -read_keyboard: - push bx - push cx - push dx - push si - push di - mov ah,0x00 ; Load AH with code for keyboard read - int 0x16 ; Call the BIOS for reading keyboard - pop di - pop si - pop dx - pop cx - pop bx - ret ; Returns to caller - - - ; - ; Display the value of AX as a decimal number - ; -display_number: - mov dx,0 - mov cx,10 - div cx ; AX = DX: AX / CX - push dx - cmp ax,0 ; if ax is zero - je display_number_1 ; jump - call display_number ; else calls itself again - -display_number_1: - pop ax - add al,'0' ; convert remainder to ascii digit - call display_letter ; display on the screen - ret - - \ No newline at end of file diff --git a/asm/DosBox/sieve.com b/asm/DosBox/sieve.com deleted file mode 100644 index 2b74e9e..0000000 Binary files a/asm/DosBox/sieve.com and /dev/null differ diff --git a/asm/DosBox/sieve2.asm b/asm/DosBox/sieve2.asm deleted file mode 100644 index 07f459f..0000000 --- a/asm/DosBox/sieve2.asm +++ /dev/null @@ -1,107 +0,0 @@ - - ; - ; Sieve of Eratosthenes - ; - - - - - org 0x0100 - -table: equ 0x8000 -table_size: equ 1000 - -start: - mov bx,table - mov cx,table_size - mov al,0 -p1: - mov [bx],al ; Write AL into the address pointed by BX - inc bx ; increase bx - loop p1 ; Decrease CX, jump if non zero - - mov ax,2 ; start at number 2 -p2: mov bx,table; BX = table address - add bx,ax ; BX=BX+AX - cmp byte [bx],0 ; is it prime? - jne p3 - push ax - call display_number - mov al,0x0d ; Comma - call display_letter - mov al,0x0a ; Comma - call display_letter - pop ax - - mov bx,table - add bx,ax - -p4: add bx,ax - cmp bx,table+table_size - jnc p3 - mov byte [bx],1 - jmp p4 - -p3: inc ax - cmp ax,table_size - jne p2 - -; -------------- - int 0x20 - - - ; Display letter contained in AL (ASCII) -display_letter: - push ax - push bx - push cx - push dx - push si - push di - mov ah,0x0e ; Load AH with code for terminal output - mov bx,0x000f ; Load BH page zero adn BL color (graphic mode) - int 0x10 ; Call the BIOS for displaying one letter - pop di - pop si - pop dx - pop cx - pop bx - pop ax - ret ; Returns to caller - - ; Read keyboard into AL (ASCII) -read_keyboard: - push bx - push cx - push dx - push si - push di - mov ah,0x00 ; Load AH with code for keyboard read - int 0x16 ; Call the BIOS for reading keyboard - pop di - pop si - pop dx - pop cx - pop bx - ret ; Returns to caller - - - ; - ; Display the value of AX as a decimal number - ; -display_number: - mov dx,0 - mov cx,10 - div cx ; AX = DX: AX / CX - push dx - cmp ax,0 ; if ax is zero - je display_number_1 ; jump - call display_number ; else calls itself again - -display_number_1: - pop ax - add al,'0' ; convert remainder to ascii digit - call display_letter ; display on the screen - ret - - \ No newline at end of file diff --git a/asm/DosBox/sieve2.com b/asm/DosBox/sieve2.com deleted file mode 100644 index db61181..0000000 Binary files a/asm/DosBox/sieve2.com and /dev/null differ diff --git a/asm/DosBox/sub1.asm b/asm/DosBox/sub1.asm deleted file mode 100644 index 6dfa17e..0000000 --- a/asm/DosBox/sub1.asm +++ /dev/null @@ -1,45 +0,0 @@ - - org 0x0100 -start: - mov al,0x0F - sub al,0x03 - add al,0x30 - call display_letter - - int 0x20 - - ; Display letter contained in AL (ASCII) -display_letter: - push ax - push bx - push cx - push dx - push si - push di - mov ah,0x0e ; Load AH with code for terminal output - mov bx,0x000f ; Load BH page zero adn BL color (graphic mode) - int 0x10 ; Call the BIOS for displaying one letter - pop di - pop si - pop dx - pop cx - pop bx - pop ax - ret ; Returns to caller - - ; Read keyboard into AL (ASCII) -read_keyboard: - push bx - push cx - push dx - push si - push di - mov ah,0x00 ; Load AH with code for keyboard read - int 0x16 ; Call the BIOS for reading keyboard - pop di - pop si - pop dx - pop cx - pop bx - ret ; Returns to caller - \ No newline at end of file diff --git a/asm/DosBox/sub1.com b/asm/DosBox/sub1.com deleted file mode 100644 index f298fdf..0000000 Binary files a/asm/DosBox/sub1.com and /dev/null differ diff --git a/asm/DosBox/tictac.asm b/asm/DosBox/tictac.asm deleted file mode 100644 index 96ba3d8..0000000 --- a/asm/DosBox/tictac.asm +++ /dev/null @@ -1,228 +0,0 @@ - - ; - ; Sieve of Eratosthenes - ; - - - org 0x0100 - -board: equ 0x0300 - -start: - mov bx,board ; Put address of game board in BX - mov cx,9 ; Count 9 squares - mov al,'1' ; Setup al to contain 0x31 (ASCII for 1) -b09: - mov [bx],al ; save it into the square (one byte) - inc al ; Increase AL, this gives us the next digit - inc bx ; Increase direction - loop b09 ; Decrement CX, jump if non-zero -b10: - call show_board - call find_line - - call get_movement ; Get movement - mov byte [bx],'X' ; Put X into square - - call show_board ; Show board - call find_line - - call get_movement ; Get movement - mov byte [bx],'0' ; Put 0 into square - - jmp b10 - -get_movement: - call read_keyboard - cmp al,0x1b ; Esc key pressed? - je do_exit ; Yes, exit - sub al,0x31 ; Subtract code for ASCII digit 1 - jc get_movement ; Is it less than? Wait for another key - cmp al,0x09 ; Comparison with 9 - jnc get_movement ; Is it greater than or equal to? Wait - cbw ; expand al to 16 bits using ah - mov bx,board ; bx points to board - add bx,ax ; add the key entered - mov al,[bx] ; get square content - cmp al,0x40 ; comparison with 0x40 - jnc get_movement ; is it greater than or equal to? Wait - call show_crlf ; line change - ret ; return, now bx points to square - - -find_line: - ; First horizontal row - mov al,[board] ; X.. ... ... - cmp al,[board+1] ; .X. ... ... - jne b01 - cmp al,[board+2] ; ..X ... ... - je won -b01: - ; Leftmost vertical row - cmp al,[board+3] ; ... X.. ... - jne b04 - cmp al,[board+6] ; ... ... X.. - je won -b04: - ; First diagonal - cmp al,[board+4] ; ... .X. ... - jne b05 - cmp al,[board+8] ; ... ... ..X - je won -b05: - ; Second horizontal row - mov al,[board+3] ; ... X.. ... - cmp al,[board+4] ; ... .X. ... - jne b02 - cmp al,[board+5] ; ... ..X ... - je won -b02: - ; Third horizontal row - mov al,[board+6] ; ... ... X.. - cmp al,[board+7] ; ... ... .X. - jne b03 - cmp al,[board+8] ; ... ... ..X - je won -b03: - ; Middle vertical row - mov al,[board+1] ; .X. ... ... - cmp al,[board+4] ; ... .X. ... - jne b06 - cmp al,[board+7] ; ... ... .X. - je won -b06: - ; Rightmost vertical row - mov al,[board+2] ; ..X ... ... - cmp al,[board+5] ; ... ..X ... - jne b07 - cmp al,[board+8] ; ... ... ..X - je won -b07: - ; Second diagonal - cmp al,[board+4] ; ... .X. ... - jne b08 - cmp al,[board+6] ; ... ... X.. - je won -b08: - ret - -won: - ; At this point Al contains the latter which made the line call display_letter - mov al,0x20 ; space - call display_letter - mov al,0x77 ; w - call display_letter - mov al,0x69 ; i - call display_letter - mov al,0x6e ; n - call display_letter - mov al,0x73 ; s - call display_letter - -do_exit: - int 0x20 - -show_board: - mov bx,board - call show_row - call show_div - mov bx,board+3 - call show_row - call show_div - mov bx,board+6 - jmp show_row - -show_row: - call show_square - mov al,0xb3 - call display_letter - call show_square - mov al,0xb3 - call display_letter - call show_square - -show_crlf: - mov al,0x0d - call display_letter - mov al,0x0a - jmp display_letter - -show_div: - mov al,0xc4 - call display_letter - mov al,0xc5 - call display_letter - mov al,0xc4 - call display_letter - mov al,0xc5 - call display_letter - mov al,0xc4 - call display_letter - jmp show_crlf - -show_square: - mov al,[bx] - inc bx - jmp display_letter - - - - -; -------------- - - ; Display letter contained in AL (ASCII) -display_letter: - push ax - push bx - push cx - push dx - push si - push di - mov ah,0x0e ; Load AH with code for terminal output - mov bx,0x000f ; Load BH page zero adn BL color (graphic mode) - int 0x10 ; Call the BIOS for displaying one letter - pop di - pop si - pop dx - pop cx - pop bx - pop ax - ret ; Returns to caller - - - ; Read keyboard into AL (ASCII) -read_keyboard: - push bx - push cx - push dx - push si - push di - mov ah,0x00 ; Load AH with code for keyboard read - int 0x16 ; Call the BIOS for reading keyboard - pop di - pop si - pop dx - pop cx - pop bx - ret ; Returns to caller - - - ; - ; Display the value of AX as a decimal number - ; -display_number: - mov dx,0 - mov cx,10 - div cx ; AX = DX: AX / CX - push dx - cmp ax,0 ; if ax is zero - je display_number_1 ; jump - call display_number ; else calls itself again - -display_number_1: - pop ax - add al,'0' ; convert remainder to ascii digit - call display_letter ; display on the screen - ret - - \ No newline at end of file diff --git a/asm/DosBox/tictac.com b/asm/DosBox/tictac.com deleted file mode 100644 index 2c2fc5d..0000000 Binary files a/asm/DosBox/tictac.com and /dev/null differ