; skeleton assembly-language program SKEL.ASM
; for use with NASM and Dandamudi macros
;
; References:
; NASM at http://nasm.sourcegorge.net
; macros at http://www.scs.carleton.ca/~sivarama
; (see ASM book on this site)
;
; to assemble on Linux:
;
; nasm -f elf skel.asm
; ld -s -o skel skel.o io.o
;
; (files io.mac and io.o are assumed available)
;
; to run:
;
; ./skel
;
; input: any
; output: messages on screen
;
%include "io.mac"
.DATA
; -------------
; initialized data
;
; ascii 10 and 9 produce whitespace
; with CR and HT
;
strBegin db 10, 9, 'Skeleton program ---', 10, 0
strPrompt db 10, 9, 'Press a key: ', 0
strEnd db 10, 9, 'Program ending.', 10, 10, 0
.UDATA
; -------------
; uninitialized data
;
byteResponse resb 1
.CODE
.STARTUP
PutStr strBegin ; welcome message
PutStr strPrompt ; ask user for response
GetCh [byteResponse] ; get response
; but don't do anything with it
PutStr strEnd ; end program
.EXIT
Tuesday, February 19, 2008
skeleton program
I have found it convenient to have known-good code on file. Here's a very simple program that can serve as a starting place for your work (click for text version):
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment