Hi, I was using C++ to try to write objects to the screen, and decided to try this in a lower level language. I have searched the web and found some sample code:

name "vga"

; this program draws a tiny rectangle in vga mode. 

org  100h

jmp code

; dimensions of the rectangle: 
; width: 10 pixels 
; height: 5 pixels 

w equ 10
h equ 5


; set video mode 13h - 320x200 

code:   mov ah, 0
        mov al, 13h
        int 10h


; draw upper line: 

    mov cx, 100+w  ; column 
    mov dx, 20     ; row 
    mov al, 15     ; white 
u1: mov ah, 0ch    ; put pixel 
    int 10h

    dec cx
    cmp cx, 100
    jae u1

; draw bottom line: 

    mov cx, 100+w  ; column 
    mov dx, 20+h   ; row 
    mov al, 15     ; white 
u2: mov ah, 0ch    ; put pixel 
    int 10h

    dec cx
    cmp cx, 100
    ja u2

; draw left line: 

    mov cx, 100    ; column 
    mov dx, 20+h   ; row 
    mov al, 15     ; white 
u3: mov ah, 0ch    ; put pixel 
    int 10h

    dec dx
    cmp dx, 20
    ja u3


; draw right line: 

    mov cx, 100+w  ; column 
    mov dx, 20+h   ; row 
    mov al, 15     ; white 
u4: mov ah, 0ch    ; put pixel 
    int 10h

    dec dx
    cmp dx, 20
    ja u4


; pause the screen for dos compatibility: 

;wait for keypress 
  mov ah,00
  int 16h

; return to text mode: 
  mov ah,00
  mov al,03 ;text mode 3 
  int 10h

ret

Again, I did not write this, I found it at http://www.emu8086.com/dr/asm2html/assembler_source_code/0_sample_vga_graphics.asm.html

My question is how would I go about compiling said code?

Recommended Answers

All 2 Replies

This is assembly language.

See these links for more information

Well, thanks for the help. Better than an STFW or RTFM i guess, I found a compiler (and emu) called emu8086.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.