0

I have an important assignment to do but I am new to assembly programming and I understand some basics but I don't exactly know how to put together some of these codes. Please help? I really am trying. It would be appreciated if you could fill in some of the blanks for me.
I have to : Draw the multi-page table of ascii characters, showing for each character value (0..255) the character and its decimal and hex values (optional: octal + binary), using direct screen output (seg B800). Use lines to format the table. Make the output look good; use color as needed.

This is all I have so far:

org 100h

; jump over data string
jmp start 

; data string:
msg1 db 'ascii table pg 1', 0   ; I dont know how I could input the data to be used for
msg2 db 'ascii table pg 2', 0   ; the ascii table nor how to seperate them to three pages
msg3 db 'ascii table pg 3', 0


start:
    
    ; set video mode
    mov ax, 0300h   
    int 10h         
    
    ; cancel blinking and enable all 16 colors
    mov ax, 1003h
    mov bx, 0
    int 10h
    
    ; set segment register
    mov ax, 0b800h
    mov ds, ax
    
    ; color the screen          ;How to put background and text color?
    mov ax, 0600h
        mov ch, 1
            mov cl, 1
            mov dh, 24
        mov dl, 78
        mov bh, 100b
    int 10h

    
                                ; how to create table with lines?


                                ; how to wait for key response and turn to page n ?
     
     
     
     
     
     
save:                           ; he gave us this save code with a loop but I don't know 
                                ; what to use it for
    mov cx, 80*25
    mov ax, 0b800h
    mov es, ax
    sub bx, bx
 L: mov ax, es: [bx]
    mov word ptr [bx], ax
    add bx, 2
    loop L
      


    


    
    mov ah, 1                         ; I believe this is wait for key response and make
    int 21h                           ; the input as "r"
   

    ; I want to create if  else statements here but dont know how with asm
      I would want to create :
      if r = "+"
          if 0 < n < 3                 ; I'm guessing it might turn out as 3 pages
               clear screen
               n = n+1
               open page n               
          else
               print "already at end of table" 
      if r = "-"
          if 1 < n < 4
               clear screen
               n = n-1
               open page n               
          else
               print "already at beginning of table" 
      if r = esc
          clear screen
          jmp ret
      else 
          print "incorrect command : next pg + , prev pg - , quit ESC"
      
                  


    ; exit and return control to OS
    ret 
    
end
1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by DRzBklynite
0

I'd like to edit my above code with questions to make it more efficiently understandable.
Please help :/

org 100h

; jump over data string
jmp start 

; data string:
msg1 db 'ascii table pg 1', 0   ; I dont know how I could input the data to be used for
msg2 db 'ascii table pg 2', 0   ; the ascii table nor how to seperate them to three pages
msg3 db 'ascii table pg 3', 0


start:
    
    ; set video mode
    mov ax, 0300h   
    int 10h         
    
    ; cancel blinking and enable all 16 colors
    mov ax, 1003h
    mov bx, 0
    int 10h
    
    ; set segment register
    mov ax, 0b800h
    mov ds, ax
    
    ; color the screen          ;How to put background and text color?
    mov ax, 0600h
        mov ch, 1
            mov cl, 1
            mov dh, 24
        mov dl, 78
        mov bh, 100b
    int 10h

    
                                ; how to create table with lines?

                                
    n = 1                       ; how to make n = 1 initially?
    
    
         
                                ; how to open page n and insert data string
                                
                            
                                
     
     
     
     
     
     
save:                           ; he gave us this save code with a loop but I don't know 
                                ; what to use it for
    mov cx, 80*25
    mov ax, 0b800h
    mov es, ax
    sub bx, bx
 L: mov ax, es: [bx]
    mov word ptr [bx], ax
    add bx, 2
    loop L
      




    
    mov ah, 1                    ; I believe this is wait for key response and make
    int 21h                      ; the input as "r"
                                          
                                                                               
                                             
    ; I want to create if  else statements here to open page nbut dont know how with asm
      I would want to create :
      if r = "+"
          if 0 < n < 3                 ; I'm guessing it might turn out as 3 pages
               clear screen
               n = n+1
               jmp open page               
          else
               print "already at end of table" 
      if r = "-"
          if 1 < n < 4
               clear screen
               n = n-1
               jmp open page               
          else
               print "already at beginning of table" 
      if r = esc
          clear screen
          jmp ret
      else 
          print "incorrect command : next pg + , prev pg - , quit ESC"
      
                  


    ; exit and return control to OS
    ret 
    
end
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.