Editing
OS-9 Assembly Code Development
(section)
From F256 Foenix
Jump to navigation
Jump to search
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!
== Program and Data Module Structure == There are 9 different types of modules in 4 possible languages: {| class="wikitable" |+ ! colspan="3" |Module Types ! ! colspan="2" |Language |- |'''Code''' |'''Module Type''' |'''Name''' | |'''Code''' |'''Language''' |- |$1x |Program Module |Prgm | |$x0 |Data (non-executable) |- |$2x |Subroutine Module |Sbrtn | |$x1 |6809 Object Code |- |$3x |Multi-module |Multi | |$x2 |BASIC09 I-Code |- |$4x |Data Module |Data | |$x3 |PASCAL I-Code |- |$5x-$Bx |User-definable module | | |$x4-$xF |Reserved for Future Use |- |$Cx |OS-9 System Module |Systm | | | |- |$Dx |OS-9 File Manager Module |FlMgr | | | |- |$Ex |OS-9 Device Driver Module |Drivr | | | |- |$Fx |OS-9 Device Descriptor Module |Devic | | | |} The two most used will be Program Modules and Data Modules. === Program Modules === The format of a program module varies depending on whether you have a single source file for your program or multiple source files. Note: multiple source files format cannot use direct page addressing due to the way they are compiled. ==== Single Source File Format ==== The following is a skeleton for a single source file memory module (program). <code>********************************************************************</code> <code>* [Program Name]</code> <code>* [Description]</code> <code>*</code> <code>* by [Author Name]</code> <code>*</code> <code>* Edt/Rev YYYY/MM/DD Modified by</code> <code>* Comment</code> <code>* ------------------------------------------------------------------</code> <code> nam [executablename]</code> <code> ttl [Full Program Name]</code> <code> ifp1</code> <code> use defsfile</code> <code> endc</code> <code>tylg set Prgrm+Objct</code> <code>atrv set ReEnt+rev</code> <code>rev set $00</code> <code>edition set 1</code> <code> '''mod eom,name,tylg,atrv,start,size'''</code> <code> [Data Section - Variables and Data Structures Here]</code> <code>size equ .</code> <code>name fcs /[executablename]/</code> <code> fcb edition</code> <code>start</code> <code> [Program Section - Program Code Here]</code> <code> </code> <code> os9 F$Exit</code> <code> '''emod'''</code> <code>eom equ *</code> <code> end</code> OS9 can load programs (modules) only if they are in module header format. A module (program) is defined between the '''mod''' and '''emod''' pseudo instructions. * '''mod:''' Creates the module header and starts CRC check. '''mod''' has 6 attributes: # Module size (computed from the ''<u>eom</u>'' label at the end of the code - 2 bytes) # Module name offset (offset where the string of the name is contained, here that is defined at the ''<u>name</u>'' label with the ''fcs'' pseudo instruction - 2 bytes # Module type & language (in this case a Program in 6809 object code - 1 byte) # Module attribute-revision (1 byte). Attributes are reentrant (ReEnt) or not reentrant (0). Revision is a number 0-15. If two or more modules with the same name are in the module directory, then OS-9 only keeps the highest revision number module. # Module execution offset (here that is defined with the ''<u>start</u>'' label - 2 bytes) # Module variable storage size (defined by the ''<u>size</u>'' label immediately after the variable area, includes stack space - 2 bytes) * '''emod''': Outputs the correct 3 byte CRC. This is generated by the assembler over the entire module. For more information about memory modules, see OS-9 Fundamentals: [https://www.youtube.com/watch?v=YpoqTyrty8k OS-9 Fundamentals on YouTube by Boisy Pitre] ==== Multiple Source File Format ==== === Data Modules === Here is a portion of the font module, which is a data module in NitrOS-9. <code> nam font</code> <code> ttl F256 font</code> </code> <code> use defsfile</code> </code> <code>tylg set Data</code> <code>atrv set ReEnt+rev</code> <code>rev set $01</code> </code> <code> mod eom,name,tylg,atrv,start,0</code> <code>name fcs /font/</code> </code> <code>start</code> <code>L0000 fcb $00,$00,$00,$00,$00,$00,$00,$00 </code> <code>L0008 fcb $7C,$82,$AA,$82,$BA,$92,$82,$7C </code> </code> <code>*More data here</code> </code> <code> emod</code> <code>eom equ *</code> <code> end</code>
Summary:
Please note that all contributions to F256 Foenix are considered to be released under the Creative Commons Zero (Public Domain) (see
F256 Foenix:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Page actions
Page
Discussion
Read
Edit
Edit source
History
Page actions
Page
Discussion
More
Tools
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Search
Tools
What links here
Related changes
Special pages
Page information