Showing posts with label DOS. Show all posts
Showing posts with label DOS. Show all posts

Sunday, January 19, 2025

A for loop in 16-bit assembly for DOSBox

 Here’s a simplified working example of a for loop in 16-bit assembly for DOSBox. This program displays numbers from 1 to 10 without any additional subroutines or complications.


Simplified Working Example: For Loop


.model small .stack 100h .data newline db 13, 10, '$' ; Newline characters number_msg db 'Number: $' ; Message to display .code main: ; Set up the data segment mov ax, @data mov ds, ax ; Initialize CX for the loop (10 iterations) mov cx, 10 ; Loop 10 times mov bx, 1 ; Counter starts at 1 for_loop: ; Print "Number: " lea dx, number_msg mov ah, 09h int 21h ; Print the current number in BX mov ax, bx ; Copy counter to AX for printing call print_digit ; Print a newline lea dx, newline mov ah, 09h int 21h ; Increment the counter inc bx ; Loop back until CX = 0 loop for_loop ; Exit the program mov ah, 4Ch int 21h ; Subroutine to print a single-digit number in AX print_digit proc add al, '0' ; Convert the number to ASCII mov dl, al ; Store the ASCII character in DL mov ah, 02h ; DOS function to print a character int 21h ret print_digit endp end main

Key Changes:

  1. Simplified the Logic:

    • Removed unnecessary subroutines for multi-digit numbers.
    • The program only works for single-digit numbers (1 to 10), which avoids complexity.
  2. Print Single Digits:

    • The number in AX is converted to an ASCII character by adding '0' (ASCII 48).
  3. Basic DOS Interrupts:

    • INT 21h, AH=09h: Used to display strings.
    • INT 21h, AH=02h: Used to display a single character.
  4. Exits Cleanly:

    • The program uses INT 21h, AH=4Ch to exit back to DOSBox

Expected Output:


Number: 1 Number: 2 Number: 3 Number: 4 Number: 5 Number: 6 Number: 7 Number: 8 Number: 9 Number: :

(Note: The number 10 will be displayed as : due to the single-digit logic in this simplified example. If you need to handle two-digit numbers, let me know!)

Monday, January 13, 2025

How to create new folder in far manager

 To create a new folder in Far Manager, follow these steps:

  1. Navigate to the directory where you want to create the new folder using the arrow keys.

  2. Press F7 to open the "Create Directory" dialog.

  3. Enter the name of the new folder in the prompt.

  4. Press Enter to create the folder.

After this, you should see the newly created folder in the current directory. Far Manager allows you to manage files and directories efficiently using its keyboard shortcuts and built-in dialogs.

Tkinter Introduction - Top Widget, Method, Button

First, let's make shure that our tkinter module is working ok with simple  for loop that will spawn 5 instances of blank Tk window .  ...