EasyManua.ls Logo

Atari ST series - Page 81

Atari ST series
420 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
XBIOS Graphics and Sound Functions
endprog:
move.l #0,-(sp) * Push command number for terminate program
trap #1 * call GEMDOS. Bye bye!
******** Fill subroutine. Fills screen with a single character
fill:
*** First,
, print Esc-E to clear screen & home cursor
move.w
move
jsr
#27,d7
#0,d5
conout
* output ESC character
* do only once
* do output
move.w
move
jsr
# E',d7
#0,d5
conout
* output 'E'
* do only once
* do output
*** Next,
print ESC-v
to turn on line-wrap
move.w
move
jsr
#27,d7
#0,d5
conout
* output ESC character
* do only once
* do output
move.w
move
jsr
#' V ,d7
#0,d5
conout
* output 'v'
* do only once
* do output
*** Then,
fill with parameter passed in d4
move
move
d4,d7
#1998,d5
* output the chosen character
* repeat 1999 times
conout:
move.w
move.w
move.w
trap
addq.l
dbra
rts
d7, (sp)
#2,-(sp)
#3,-(sp)
#13
#6, sp
d5,conout
* output character
* device number for console keyboard
* function # for Bconout()
* call BIOS
* clean stack
* do next letter
* until done, then return
.end
While the source code for the machine language version
of the program is over twice as long as that of the C version,
the executable program it produces can be as small as one
tenth the size of the C version of the program. Another in
teresting difference is that in the machine language version,
the Malloc() function wasn't used to allocate memory for the
second screen. As noted in Chapter 1, you can't allocate
memory using this function unless you first relinquish part
of the Transient Program Area (TPA) using the Mshrink()
command.
Since machine language programs deal with memory
more directly than C programs, it isn't necessary to use com
plex memory management techniques in such a simple exam
ple program. Since we know that the program sits at the bot
tom of free memory and the stack starts at the top of free
memory and works its way down, it's simple to move the
stack pointer down far enough to create a safe area at the top
73

Related product manuals