Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
TRSDOS
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Example code== The following [[Z80]] [[assembly language|assembler]] source code is for a subroutine named {{mono|HELLO_WORLD}}. This is an introductory program which will print a message to the video display and then exit. Though simple, it demonstrates how an assembler source code is formatted and interacts with the display hardware through TRSDOS. The example uses TRS-80 Model 4 running TRSDOS/LS-DOS 6.x, produced by Tandy/Radio Shack and Logical Systems, with most any assembler sold by Radio Shack or Misosys Inc. (Series I/EDTASM, ALDS, EDAS or MRAS with {{code|-GC}} switch). {| |-valign="top" |<syntaxhighlight lang="text" highlight="13" style="font-size:85%"> 3000 3E 69 3002 EF 3003 21 14 30 3006 3E 0A 3008 EF 3009 0E 0D 300B 3E 02 300D EF 300E 21 00 00 3011 3E 16 3013 EF 3014 48 65 6C 6C 3018 6F 2C 20 77 301C 6F 72 6C 64 3020 21 0D 0D 3023 </syntaxhighlight> |<syntaxhighlight lang="tasm" highlight="13" style="font-size:85%"> ; hello_world_TRS-80 Model 4 ; Print "Hello, world!" then exit to TRSDOS Ready ; ; Entry registers: none ; Return registers: none ; ; values below are decimal unless suffixed by H ; the term "pseudo-op" means same as "assembler directive", is not Z80 code ; @CLS EQU 105 ; EQU pseudo-op sets @CLS text label = TRSDOS Supervisor Code @DSP EQU 2 ; set @DSP text label = TRSDOS SVC to send char to display @DSPLY EQU 10 ; set @DSPLY text label = SVC for text string display @EXIT EQU 22 ; set @EXIT text label = SVC for returning to TRSDOS Ready ; ORG 3000H ; ORG pseudo-op sets standard start address under TRSDOS 6.x START LD A,@CLS ; CLS = Clear Screen, erase display and home cursor RST 40 ; Z80 Restart instruction for system SVC processor, execute @CLS LD HL,MSG ; point to message string with HL (required by @DSPLY SVC) LD A,@DSPLY ; send text string to *DO Display Output device (video screen) RST 40 ; execute @DSPLY SVC (13d byte needed to terminate string) LD C,13 ; now send another carriage return, needed in reg C LD A,@DSP ; to set off Hello message from TRSDOS Ready prompt RST 40 ; once we exit to system LD HL,0 ; indicate no error condition to Command Interpreter LD A,@EXIT ; return to TRSDOS Ready RST 40 ; (stack integrity maintained, could as well have used a RET!) MSG DB 'Hello, world!',13 ; DB = Define Byte pseudo-op assembles ASCII string to Z80 memory CR DB 13 ; 13d byte is ASCII carriage return char, moves cursor down END START ; END pseudo-op required by assembler ; to produce transfer record to program entry point </syntaxhighlight> |}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)