Advertisement
Ham62

ASCII.asm

Aug 17th, 2017
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         org 100h
  2.  
  3. start:
  4.     MOV CX, 320     ;(32*10 lines)
  5.  
  6. .MainLoop:
  7.     MOV ES, CX  ;Save counter in ES
  8.             ;INT 10h/AH=03h overwrites all general registers
  9.  
  10.     MOV AH, 03h ;BIOS function to get cursor position
  11.     MOV BH, 00h ;Returns DL, DH (X, Y)
  12.     INT 10h
  13.  
  14.     MOV SI, DX  ;Save Cursor position in SI
  15.     MOV CX, ES  ;Restore the counter
  16.  
  17.     MOV AX, CS  ;Set DS to CS (where the strings are)
  18.     MOV DS, AX 
  19.  
  20.     LEA DX, [ln11]      ;Get address of last line
  21.     SUB DX, CX      ;Adjust pointer to current line
  22.     MOV AH, 09h
  23.     INT 21h         ;Print it
  24.  
  25.     MOV ES, CX  ;Save counter in ES
  26.  
  27.     CALL FinishLine ;Invert colors of this line of art
  28.  
  29.     MOV CX, ES  ;Restore counter
  30.  
  31.     SUB CX, 32  ;We just drew 32 more character
  32.     JNZ .MainLoop   ;Loop if out counter isn't at zero
  33.  
  34. end:
  35.     ; Beep
  36.     MOV AH, 02h
  37.     MOV DL, 07h
  38.     INT 21h
  39.  
  40.     MOV CX, CS  ;Set DS to CS (where the strings are)
  41.     MOV DS, CX
  42.  
  43.     LEA DX, [ln11]      ;Get address of last line
  44.     MOV AH, 09h
  45.     INT 21h         ;Print the last line
  46.  
  47.     RET     ;Return to DOS
  48.  
  49. FinishLine:
  50.  
  51.     MOV DX, SI  ;Restore cursor position before text draw
  52.  
  53.     ;Set (X, Y) to (CX, BX)
  54.     XOR BX, BX
  55.     MOV BL, DH
  56.     XOR CX, CX
  57.     MOV CL, DL
  58.  
  59.     ;Set DI to cursor position [DI = X + (Y * 80)]
  60.     IMUL AX, BX, 80
  61.     ADD AX, CX
  62.     MOV DI, AX
  63.  
  64.     SHL DI, 1   ;Fix offset for 2 byte per text cell
  65.     INC DI      ;Second byte is color attribute
  66.  
  67.     MOV BX, 0B800h  ;Text mode screen segment
  68.     MOV DS, BX
  69.  
  70.     MOV CX, 31  ;ASCII is 32 characters wide
  71.  
  72. .FixAttributes:
  73.  
  74.     MOV [DI], BYTE 70h  ;set to black text on white background
  75.     ADD DI, 2       ;Each text cell is 2 bytes
  76.  
  77.     DEC CX
  78.     JNZ .FixAttributes
  79.  
  80. .NewLine:
  81.     MOV AH, 0Eh
  82.     MOV AL, 10
  83.     INT 10h     ;\n
  84.  
  85.     MOV AH, 0Eh
  86.     MOV AL, 13
  87.     INT 10h     ;\r
  88.  
  89.     RET
  90.  
  91. section .data
  92.  
  93.     ln1 db  "°°°°ÜÜÜÜßßßßßßßßÜÜÜÜÜÜÜ°°°°°°  ", "$"
  94.     ln2 db  "°°°Û±±°ÜÜßßßßÜ°±°ÜÜÜÜÜ°ßßÜ°°°°°", "$"
  95.     ln3 db  "°°Û±°Üß°±±±±±°ßÜß°±±±±±±±Û°°°°°", "$"
  96.     ln4 db  "°Û±±±±±±±±±ÛÛß±±±±±±ÛÛßܱ۰°°° ", "$"
  97.     ln5 db  "Üß±±±±±±±±±ßßß±±±±±±ßßß±±±Û°°  ", "$"
  98.     ln6 db  "Û±±±±±±±±±±±±±±±ÛÛ±°°°°°°°±Û   ", "$"
  99.     ln7 db  "Û°±±ßÜܱ°°°°°°±ÜßÜÜ°°°°°°±Û    ", "$"
  100.     ln8 db  "°Û°±±±±ßÜÜÜÜÜÛÛÛÛÛÛÛÜÜÜÜÜß     ", "$"
  101.     ln9 db  "°°Û°±±±±±±ßÜßßÛÛÛÛßßÜß±±Û      ", "$"
  102.     ln10 db "°°°ßßßÜÜÜÜÜÜßÜÜÜÜÜÜßÜÜÜß       ", "$"
  103.  
  104.     ln11 db "        Fugggg :DDDDD", "$"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement