Advertisement
Ham62

Untitled

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