Motorola M68000 User's Guide Page 233

  • Download
  • Add to my manuals
  • Print
  • Page
    / 256
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 232
Appendix B 219
**********************************************
Amiga shell - This must run under the CLI
Link with amiga.lib
* You may have to modify the following include if your
* include files are not in the same directory.
include ";include/libraries/dos_lib.i"
code
* External references
xref _AbsExecBase
xref _LVOOpenLibrary
xref _LVOCloseLibrary
*
* Initialization code to open the DOS library and the console device
lea DOSName,Al
get name of dos library
clr.l
dO
and latest version
movea.1
_AbsExecBase,a6
get base of exec
jsr
_LVOOpenLibrary(a6)
open dos library
move. 1
dO, DOSBase
save base address
move.1
#1006,d2
new file
move.1
#con,dl
get console name
movea.1
JDOSBase,a6
dos lib base to a6
jsr
_LVOOpen<a6)
open console
move.1
dO,console
save file pointer
Your program goes here
<PROGRAM>
Code to clean up and exit to the CLI
fini: move.l console,dl
movea.l _D0SBase,a6
jsr _LV0Close(a6)
movea.l _DOSBase,al
movea.l _AbsExecBase,a6
jsr _LVOCloseLibrary(a6)
clr.l dO
rts
*
* Standard I/O subroutines
*
getc: movem.l dl-d7/a0-a6,-(sp)
move.l console,dl
move.l #buff,d2
moveq.l #l,d3
movea.l _D0SBase,a6
jsr _LVORead(a6)
clr.l dO
move.b buff,d0
movem.l (sp)+,dl-d7/a0-a6
get file pointer
dos lib base to a6
close console
dos lib base to al
exec base to a6
close dos library
indicate no error
return to cli
save regs.
file pointer to dl
buffer pointer to d2
count to d3
dos lib base to a6
read data
make sure high order bits clear
get the char,
restore regs.
Page view 232
1 2 ... 228 229 230 231 232 233 234 235 236 237 238 ... 255 256

Comments to this Manuals

No comments