Atari ST series Technical Reference Manual page 81

Hide thumbs Also See for ST series:
Table of Contents

Advertisement

XBIOS Graphics and Sound Functions
endprog:
move.l
#0,-(sp)
trap
#1
******** Fill subroutine.
fill:
*** First, , print Esc-E to clear screen & home cursor
m o v e .w
#27,d7
move
#0,d5
jsr
conout
m o v e .w
# 'E',d7
move
#0,d5
jsr
conout
*** Next, print ESC-v to turn on line-wrap
move.w
#27,d7
move
#0,d5
jsr
conout
m o v e .w
# ' V ,d7
move
#0,d5
jsr
conout
*** Then, fill with parameter passed in d4
d4,d7
move
move
#1998,d5
conout:
move.w
d 7 ,— (sp)
2
move.w
#
,-(sp)
move.w
#3,-(sp)
trap
#13
6
addq.l
#
, sp
dbra
d 5 ,conout
rts
.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
* Push command number for terminate program
* call GEMDOS.
Fills screen with a single character
* output ESC character
* do only once
* do output
* output 'E'
* do only once
* do output
* output ESC character
* do only once
* do output
* output 'v'
* do only once
* do output
* output the chosen character
* repeat 1999 times
* output character
* device number for console keyboard
* function # for Bconout()
* call BIOS
* clean stack
* do next letter
* until done, then return
Bye bye!
73

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents