Hello World.

Code junkies hangout here

Moderators: ChriThor, LXF moderators

Hello World.

Postby Bazza » Thu Dec 24, 2009 12:55 pm

Hey 1sf...

As I know you wouldn`t be able to do it here is the code
to write "Hello World." directly to the CGA memory area.

This is free from MS-DOS interrupt routines/vectors.

The BIOS, INT 10 is not really needed but it DOES serve
TWO purposes, I`ll let you do some research and tell us
all on here what they are...

Fat chance of that ever happening...

Code: Select all
;                   Standard TEXT mode 3 "Hello World." DEMO.
;                   -----------------------------------------
;  Copyright (C)1991-2009 B.Walker, (G0LCU). Email to:- wisecracker@tesco.net
;  --------------------------------------------------------------------------
;                              "DMA" Hello World.
;                               -----------------
;                Assume ORG 100 for MS-DOS and 32768 for MikeOS.
;                Assembled using the AD86 combination for MS-DOS.
        pushf                     ;Push all necessary registers.
        push   ax                 ;Note:- Totally 8088 compatible.
        push   cx                 ;
        push   dx                 ;
        push   es                 ;
        push   si                 ;
        push   di                 ;
        mov    ax,0003h           ;Set up video mode to "CGA" colour text.
        int    10h                ;Do it. This does two things in default mode.
        cld                       ;Clear direction flag.
        mov    ax,0b800h          ;Point to CGA memory area.
        mov    es,ax              ;Do it.
        mov    dx,0               ;Set up the end point for the transfer.
        mov    si,helloworld      ;Set source index to start of text to move.
        es:                       ;Shift to Extended Segment.
        mov    di,dx              ;Set the start if the destination index.
        mov    cx,12              ;Counter for the number of WORDs to be moved.
        repz                      ;Do it...
        movsw                     ;Print "Hello World." to the CGA memory...
        pop    di                 ;Replace all used registers.
        pop    si                 ;
        pop    es                 ;
        pop    dx                 ;
        pop    cx                 ;
        pop    ax                 ;
        popf                      ;
        ret                       ;
db 72,7,101,7,108,7,108,7,111,7,32,7,87,7,111,7,114,7,108,7,100,7,46,7

The sheer speed of writing directly to any one of the pages of
CGA memory area is breathtaking to say the least.

Have fun... 8-D


I forgot to add, once compiled open up an MS-DOS Prompt
Window, (only available in Vista and above), and see it
working for yourself...

OR, I will post the compiled HW.COM executable somewhere
for you to grab...

Bazza, G0LCU...

Team AMIGA...

The less that I speak, the smarter I sound.
User avatar
LXF regular
Posts: 1594
Joined: Sat Mar 21, 2009 11:16 am
Location: Loughborough

Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest