; To become familiar with the segment feature you
; should assemble this file with and without the
; single object module swicth enabled.
;
;   a65  -o example         ;three object module files
                            ;     code.seg
                            ;     memory.seg
                            ;     rom2.seg
;
;   a65  example            ;one object module file example.obj


         .db h'00,o'77,h'77,d'77,77,077
         .org  h'20         ;start assembly at location 20 hex.
         .segment .memory   ;declare a new segmemt for ram memory
                            ;allocation
         .memory            ;select segment .memory as active(locaton counter)
                            ;for the .code segment(created by the assembler) is
                            ;saved for when we switch back.
         .org  h'8000       ;Ram starts at 8000 hex.
var1:    .rs 1              ;variable 1
var16:   .rs 2              ;16 bit variable
array:   .rs 100*2          ;100 16 bit word array
         .eject             ;lets start on a fresh page of paper.
                            ;notice that an page eject does not print!
                            ;test list off
         .command -l        ;this should not print
         .db "this is a .db test (fcc on some oem assemblers)"
         .command +l        ;this also should not print
                            ;this line should print
         .code              ;switch back to code segment
                            ; origin is where we left off.
loop:    .dw loop,loop2
         .drw loop,loop2
         .equ cr,13         ;equated idienifiers are constant.
         .equ tab,9
         .set temp,23       ;set identifiers may be re-set.
         .set temp,24
         .set temp,25
         .db  1,2,3,4,5,'p'
         .db  6,7,"this is a test\r\n\0"
         .dw  1,h'1234
         .drw 1,h'1234
         .page              ;start on a new 256 byte boundary.
loop2:   .db loop2 >> 3
         .segment .rom2,-x'800  ;my programmer only likes 0..n addresses
         .rom2
         .org h'800
         .db  "this is possibly an external rom programmed seperately."
         .code
         .end loop          ;end of assembly, specifying start address.

