home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / programs / develop / as65 / docu / as65xx_doc next >
Text File  |  1995-02-27  |  36KB  |  1,092 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.                            OPERATING INSTRUCTIONS
  11.  
  12.                                 AS65, V2.3d
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.                  cross-assembler for the 6502 processor family
  20.                          runable at all AMIGA modells
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.              (c) 1989-93     Thomas Lehmann
  35.                              Zedernstraße 36
  36.                        41239 Mönchengladbach (Germany)
  37.                              Phone: 0049 2166/340012
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48. INDEX
  49.  
  50.  
  51. Assemblerasignments, a survey ....................................
  52. Installation .....................................................
  53.  
  54. Assemblerassignments .............................................
  55.  PSO  "sernr" ....................................................
  56.  PSO  "pro" ......................................................
  57.  PSO  "*=" .......................................................
  58.  PSO  "*!=" ......................................................
  59.  PSO  "showsym" ..................................................
  60.  PSO  "ascii" ....................................................
  61.  PSO  "liston" ...................................................
  62.  PSO  "listoff" ..................................................
  63.  PSO  "tabsize" ..................................................
  64.  PSO  "error" ....................................................
  65.  PSO  "setout" ...................................................
  66.  PSO  "fspeed" ...................................................
  67.  PSO  "showpc" ...................................................
  68.  PSO  "breakpt" ..................................................
  69.  PSO  "conprt" ..................................................
  70.  PSO  "warnoff" ..................................................
  71.  PSO  "warnon" ...................................................
  72.  PSO  "include" ..................................................
  73.  PSO  "endasm" ...................................................
  74.  
  75. Labels and Symbols ...............................................
  76.  PSO  "block" ....................................................
  77.  PSO  "bend" .....................................................
  78.  PSO  "set" ......................................................
  79.  PSO  "equ" ......................................................
  80.  PSO  "=" ........................................................
  81.  PSO  "edo" .....................................................
  82.  PSO  "sdo" .....................................................
  83.  PSO  "elo" .....................................................
  84.  PSO  "slo" .....................................................
  85.  PSO  "macroseg" .................................................
  86.  PSO  "macro" ....................................................
  87.  PSO  "endmac" ...................................................
  88.  PSO  "hidemac" ..................................................
  89.  PSO  "showmac" ..................................................
  90.  PSO  "hidemac" ..................................................
  91.  PSO  "showmac" ..................................................
  92.  
  93. aritmetic speeches ...............................................
  94. aritmetic signs...................................................
  95.  
  96. Conditionell assembling ..........................................
  97.  PSO  "if" .......................................................
  98.  PSO  "ifequ" ....................................................
  99.  PSO  "ifpl" .....................................................
  100.  PSO  "ifmi" .....................................................
  101.  PSO  "ifdef" ....................................................
  102.  PSO  "ifndef" ...................................................
  103.  PSO  "endif" ....................................................
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111. Tables   .........................................................
  112.  PSO  "byte" .....................................................
  113.  PSO  "dbyte" ....................................................
  114.  PSO  "word" .....................................................
  115.  PSO  "rta" ......................................................
  116.  PSO  "text" .....................................................
  117.  PSO  "null" .....................................................
  118.  PSO  "shift" ....................................................
  119.  PSO  "time" .....................................................
  120.  
  121. Assemblerloops ...................................................
  122.  PSO "assloop" ...................................................
  123.  PSO "assend" ....................................................
  124.  
  125. calling the assembler ............................................
  126.  
  127. Assembler Options ................................................
  128.  Option  -w ......................................................
  129.  Option  -p ......................................................
  130.  Option  -P ......................................................
  131.  Option  -f ......................................................
  132.  Option  -a ......................................................
  133.  Option  -s ......................................................
  134.  Option  -S ......................................................
  135.  Option  -l ......................................................
  136.  Option  -L ......................................................
  137.  Option  -e ......................................................
  138.  Option  -E ......................................................
  139.  Option  -d ......................................................
  140.  Option  -o ......................................................
  141.  
  142. Utilitys .........................................................
  143.  ShowOpc .........................................................
  144.  MakeDef .........................................................
  145.  Convert .........................................................
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169. INTRODUCTION
  170.  
  171. The "AS65" assembler is a comfortable and efficient 2 pass cross assembler for
  172. the whole 6502 processor family.
  173.  
  174.  
  175.  
  176.  
  177. A line of the source-file can be constist maximal 250 signs. It is possible to
  178. open 30 files at the same time (include). The number of the files which are
  179. used during the assembling is however unlimited. The largness of code wich is
  180. to assemble and the quantity of possible symbols, labels and macros is only
  181. depending to the used memory. The object code is processor conditionell limited
  182. to 64 kB. (maximum adressing area of the 6502 family).
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192. Now I wish you a good time in developing own programs and with the use of the
  193. "AS65".
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203. Assembler asignments, a survey
  204.  
  205.  
  206. Assembler stearing:
  207. liston                    switch on assembler listing
  208. listoff                   switch off assembler listing
  209. tabsize 5                 tabulator intervall of your editor, for correct
  210.                           output of the created listing
  211. setout "path/directory"   all by the assembler created files to the named
  212.                           directory
  213. fspeed                    switch to maximal assembler speed
  214. showpc $100               show programcounter only every $100 bytes
  215. showpc val                show only once actual programcounter
  216. breakpt                   stop assembling in pass 2
  217. breakpt 2                 same, other writing
  218. breakpt 1                 stop assembling in pass 1
  219. breakpt f                 stop assembling on "full speed" too
  220. conprt                    output an string to the console
  221. warnoff                   no warnings
  222. warnon                    switch on warnings
  223. endasm                    end assembling before time
  224. assloop                   begin of an assembler loop
  225. assend                    end of an assembler loop
  226.  
  227.  
  228. prozessortypes:
  229. pro R65C02                permission of opcodes from ROCKWELL 65C02 cpu
  230.  
  231.  
  232. files:
  233. ascii                     creates a object and a ASCII file
  234. error f                   fault anouncement only in an error-file
  235. error fs                  same, but on screen too
  236. include path/name         pick up another source-file into assembling
  237.  
  238.  
  239. programcounter:
  240. *= $1000                  set program counter, here hex 1000, distance
  241.                           between old and new PC is filling with $ff
  242. *!= $2000                 set PC new, no filling distance
  243.  
  244.  
  245. tables:
  246. byte                      pickup single byte
  247. dbyte                     pickup 16 BIT value high/low, double byte
  248. word                      pickup 16 BIT adress, low/high, e.g. jump tables
  249. rta                       pickup 16 BIT adress minus one, e.g. jump with RTS
  250. text                      pickup ASCII textstring
  251. null                      e.g., hang on a \0
  252. shift                     e.g., shift last sign
  253.  
  254. time                      pickup actual time: Fri Jun 30 01:49:05 1989
  255. time s                    same, other writing
  256. time weekdaye             weekday, 3 letters in english e.g. Mon-Sun
  257. time weekdayg             weekday, 2 letters in german e.g. Mo-So
  258. time year                 year, 1989-????
  259. time monthe               month, 3 letters in english e.g. Jan-Dez
  260. time monthg               month, 3 letters in german e.g. Jan-Dez
  261. time month                month in numbers, 01-12
  262. time day                  day in numbers, 01-31
  263. time hour                 hours, 01-23
  264. time min                  minutes, 00-59
  265. time sec                  seconds, 00-31
  266.  
  267.  
  268. symboltable:
  269. set                       define a variable
  270. equ                       define a constant
  271. =                         same, other writing
  272.  
  273. block                     open a lableblock, locallabels
  274. bend                      close labelblock
  275.  
  276. showsym                   show symboltable on screen
  277. showsym f                 write symboltable into a file
  278. showsym fs                combination of above
  279.  
  280.  
  281. macros:
  282. macroseg                  begin of a macro definition without intern labels
  283. macro                     same, with intern labels
  284. endmacro                  end of a macrodefinition
  285. hidemac                   supress macro output during assembler listing
  286. showmac                   show macro definition during listing
  287.  
  288.  
  289. conditionellassembling:
  290. if                        fulfil if result not the same as 0
  291. ifequ                     fulfil if result is the same as 0
  292. ifpl                      fulfil if result is positiv
  293. ifmi                      fulfil if result is negativ
  294. ifdef                     fulfil if symbol is defined (variable or constant)
  295. ifndef                    opposite from .ifdef
  296. endif                     end of an if-asignment
  297.  
  298.  
  299.  
  300.  
  301. Assembler Assignments
  302.  
  303.  
  304. PSO "pro":
  305. If you want to use opcodes in your program wich are not standart type "6502"
  306. e.g. "mul" in the ROCKWELL 65C00/XX-family, you have to define the processor-
  307. type with the PSO "pro". Because of that you have the shureness that you used
  308. only commands of the namend CPU. That can under circomstances provide you from
  309. looking for faults, if you have used a command from another CPU.
  310. If you want to write a program for a R65C02 and also to use the processor
  311. spezific opcodes write:
  312. pro R65C02
  313. for that command the opcodes of the R65C02 were loading afterwards and useable.
  314. "R" stand for ROCKWELL. possible types of processors or compatibles:
  315.  
  316. R6500 oder R_STD              standarttype and default adjustment
  317. R65C00
  318. R6501
  319. R65C01
  320. R6502
  321. R65C02
  322. R65C102
  323. R65C112
  324. R65C10
  325. R6511
  326.  
  327.  
  328. PSO "*=":
  329. PSO "*!=":
  330. With this both PSO it is possible to influence the programcounter. With "*="
  331. it receives a new value. If the PC was already defined, the adress area between
  332. the actual and the new PC will be filled with $ff.
  333.       *= $2000              ; PC receives the value $2000
  334.       asl a                 ; PC has the value $2001, ($2000+1 byte "asl a")
  335.       *= $3000              ; PC will be set new, area between $2001 to $2fff
  336.                             ; will be filled with $ff
  337.  
  338. The PSO "*!=" reacts as same as "*=" with the exeption that the area between
  339. the new and old PC will not be filled. A use therefore is e.g. a EPROM wich is
  340. devided into two adress areas ($7000-$7FFF und $F000-$FFFF).
  341.  
  342.  
  343. PSO "showsym":
  344. During the assembling the assembler gives the founded symbols respectively
  345. labels determine values. For to show all used symbols on the screen the PSO
  346. "showsym" is necessary.
  347. The output can be divert to a file; use the parameter "f":
  348. showsym f.
  349. The assembler creates a file in the actual directory (if the output is not
  350. divert with "setout") wich has the name of the source file, but with the ending
  351. ".sym". If you want the output of the symboltable at the same time into a file
  352. and on the screen, so use the parameter "fs":
  353. showsym fs.
  354.  
  355.  
  356.  
  357. PSO "ascii":
  358. Beside the objectfile wich is binary, the assembler creates an ASCII file, wich
  359. is readable by an editor. Ending of that file is ".asc".
  360.  
  361.  
  362.  
  363. PSO "liston":
  364. The assembler creates in pass 2 a listing wich shows the adress, the assembling
  365. code and the fitting source line. The listing is created from that position onto
  366. wich "liston" was given. The parameter "f" and "s" are valid too.
  367. The file wich was created has the ending ".lst".
  368. liston f           divert assembler listing into a file.
  369. liston fs          same, and showing onto the screen.
  370.  
  371.  
  372.  
  373. PSO "listoff":
  374. With "listoff" you can switch off the assembler listing wich was switched on
  375. with "liston". So ist is possible that you can let the program shown determine
  376. routines.
  377.  
  378.  
  379.  
  380. PSO "tabsize":
  381. If you have switched your editor to tabulator area to 4 sign and you create a
  382. listing wich should be shown on the screen than use
  383. tabsize 4
  384. for the message for the assembler. Instead of the tabs space is use up to the
  385. next tab-position. Here will the listing always created correct, not
  386. conditionell to the in CLI used tabulator positions. The default position is
  387. TAB 3.
  388.  
  389.  
  390.  
  391. PSO "error":
  392. All error messages the assembler creates will be output to the screen by
  393. default. Do you want to switch off this messages use the PSO "error" without
  394. parameter. The parameter "f" say that all messages should write into a file
  395. with the extension ".err". The parameter "fs" also outputs the messages to the
  396. screen.
  397. error fs
  398.  
  399.  
  400. PSO "setout":
  401. All file wich the assembler creates, (.obj, .asc, .sym, .lst, .err), were
  402. created in the named path. If you want let create files in a RAM Disk so tell
  403. it the assembler with the command
  404. setout RAM:
  405.  
  406.  
  407.  
  408. PSO "fspeed":
  409. The assembler switchs to full speed. No creating of OUTPUT-files. No output off
  410. the assembler listing and the symboltable. During assembling the programcounter
  411. is not shown. This PSO is necessary for fastest possible assembling of your
  412. source code.
  413.  
  414.  
  415.  
  416. PSO "showpc":
  417. In normal position, the adress on wich the assembler is working (actual
  418. programcounter) will be shown byte for byte. This output possibility is needing
  419. much time, wich can be used for more effective in assembling. If there are 
  420. longer programs it is enough if the PC is shown every 265th byte, use:
  421. showpc 256         hex: $100
  422. or
  423. showpc $100
  424.  
  425. To switch of complete the whole showing give parameter "off".
  426. showpc off
  427.  
  428. If you switch off the PC with "off" or "fspeed" but you want to see once then
  429. it is possible to use:
  430. showpc val
  431.  
  432.  
  433.  
  434. PSO "breakpt":
  435. If you want see the assemblerlisting on an determine position more closer it is
  436. the easiest methode to stop on this position. Use the PSO "breakpt".
  437. breakpt
  438. If there is no parameter given, the breakpoint is valid in pass 2.
  439. breakpt 1          stop assembling only on pass 1.
  440. breakpt f          stop assembling too if full speed is used.
  441.  
  442. A combination of the parameters is possible.
  443.  
  444.  
  445.  
  446. PSO "warnoff":
  447. If there is e.g. an overflow in an calculation, the user is shown through a
  448. WARNING.
  449. The PSO "warnoff" supresses such warnings.
  450.  
  451.  
  452.  
  453. PSO "warnon":
  454. This is the opposite from "warnoff". Was "warnoff" activated, with "warnon"
  455. the WARNINGS are shown again.
  456.  
  457.  
  458. PSO "include":
  459. Another source file will be assebled with the command "include". Another file
  460. can be taken over into the assembling. Maximal 30 files can be open at the same
  461. time
  462. include source_name
  463.  
  464.  
  465.  
  466. PSO "endasm":
  467. This PSO marks the end of the assembling. So it is possible to end the
  468. assembling on any position you want. Very useful in a testing phase of a
  469. program.
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477. labels and symbols
  478.  
  479. Name of labels must begin with a letter or with underline character "_". All
  480. orders and the signs "a,x,y" are reserved words/signs and are not possible to
  481. define as labels. There is a difference between big and small writing.
  482. The maximal lengness of a labelname is only limited through the number of signs
  483. per line. Label definitions must begin in first colum !!
  484.  
  485.  
  486.  
  487. PSO "block":
  488. PSO "bend":
  489. This PSO`s are very strong tools for structurell programing. All labels wich
  490. are used between "block" and "bend" are only known in this block. To make a
  491. consequent use possible, the blocks can be boxed.
  492.  
  493.       block
  494. loop  sta $1000,x
  495.       inx
  496.       bne loop
  497.  
  498.       block
  499. loop  sta $1000,x           ; no double defined error
  500.       inx
  501.       bne loop
  502.  
  503.       block
  504. loop  sta $1000,x
  505.       inx
  506.       bne loop
  507.       bend 
  508.       bend
  509.       bend
  510.  
  511.  
  512.  
  513. PSO "set":
  514. With this PSO you can define variables. Variables are in opposite to constants
  515. and automatic labels changeable, that means in every place in a source you can
  516. give them another value and there is no fault warning "double defined".
  517. var_1  set  10
  518. With this order the symbol "var_1" received the value 10, but this value can be
  519. calculate too for another variable or constant, how the following example shows.
  520. var_2  set  var_1+$0a+10
  521.  
  522. In this combination the label "var_2" receives the value 30 (var_1==10+$0a+10).
  523.  
  524.  
  525.  
  526. PSO "equ":
  527. PSO "=":
  528. In opposite to variables, constants are not changeable. Constants are agreed
  529. with "equ" or "=".
  530. const  equ  10
  531. or
  532. const   =   10
  533.  
  534. In this example the symbol "const" receives the value 10.
  535.  
  536.  
  537. Variables and constants have to be defined before first use, otherwise the
  538. error "label not defined" was created in pass 2.
  539.  
  540.  
  541.  
  542. PSO "org":
  543. PSO "edo":
  544. PSO "sdo":
  545. PSO "elo":
  546. PSO "slo":
  547. With  "orq" you will be define an starting adress. After this all defined labels
  548. with "edo" or "sdo" get the actual adress. "edo" will define an constant and
  549. "sdo" an variable, see also auch "equ" / "set".
  550.  
  551.        org   1000     ; starting adress == 1000
  552. const1 edo   1        ; const1 get the value 1000, act. adress is 1000+1
  553. const2 edo   9        ; const2 get the value 1001, act. adress is 1001+9
  554. var1   sdo   10       ; var1 gett the val 1010, act. adress is 1010+10
  555.  
  556.  
  557. In other order to "edo" and "sdo" -> "elo" and "slo" the adress counts down.
  558.  
  559.        org   1000     ; starting adress == 1000
  560. const1 elo   1        ; const1 get the value 1000, act. adress is 1000-1
  561. const2 elo   9        ; const2 get the value  999, act. adress is  999-9
  562. var1   slo   10       ; var1 gett the val 990, act. adress is 990-10
  563.  
  564.  
  565.  
  566. macros:
  567.  
  568. PSO "macroseg":
  569. PSO "macro":
  570. PSO "endmac":
  571. PSO "hidemac":
  572. PSO "showmac":
  573. A function is often used on different places in the program several times.
  574. Normally you can define that function as a subroutine and if you need it you
  575. can call it with "jsr xxxx". But this is not ever possible, because of reasons
  576. of speed or the parameter relivery is to complicate. In this case a comfortable
  577. assembler gives the user help with macros. A macro has to be defined before the
  578. first use. In the following source text you can call it several times. You can
  579. deliver so many parameters as you want.
  580.  
  581. definition for the macro "poke":
  582.  
  583. poke  macroseg              ; begin of the definition for the macro "poke"
  584.       lda #!2               ; suiting of 2nd parameter
  585.       sta !1                ; suiting of 1st parameter
  586.       endmacro              ; end of macrodefinition
  587.  
  588.  
  589. calling the macro "poke":
  590.  
  591.       ?poke $1000,10        ; calling with delivery of two parameters
  592.  
  593. The "?" note the use of a macro. Meets the assembler in the assembling the
  594. order ?poke .., so he assembles the orders witch were told to it in the
  595. definition. In our example the assembler handles so as he has received the
  596. following orders:
  597.  
  598.       lda #10
  599.       sta $1000
  600.  
  601. "macroseg" and "macro" are both noting the begin of a macrodefinition. The
  602. difference between this two orders is visible by calling a macro. A macro
  603. defined with "macro" opens automatically a lableblock witch will be closed by
  604. using "endmacro". This is nexessary in the following example:
  605.  
  606. inc16 macro                 ; macro for raising of a 16-BIT pointer
  607.       inc !1                ; raise low-bte
  608.       bne end               ; no overflow, <>0
  609.       inc !1+1              ; raise high-byte
  610. end
  611.       endmacro
  612.  
  613.  
  614.       ?inc16 pointer
  615. or    ?inc16 $79
  616.  
  617. In every calling "inc16" the assembler has to give the label "end", wich is the
  618. internal jumping target, a value. But to give a several defining of a label is
  619. only possible if the label is in different blocks.
  620.  
  621. Up to now there is only a number or a 16 BIT value delivered to an macro. But
  622. there is also the possibility to deliver a textstring. With that macros are
  623. more universal useful !!! The text must be suited as the last parameter !!!.
  624. The syntax of the textparameter delivery makes clear the next example:
  625.  
  626. error macro
  627.       ldx #<txt             ; low-byte
  628.       ldy #>txt             ; high-byte
  629.       jsr print             ; print text
  630.       lda #!1               ; suit parameter 1
  631.       jmp error             ; error handling
  632. txt   null "!2"             ; suit parameter 2
  633.       endmacro
  634.  
  635.       ?error 10,"Syntax"
  636.  
  637.  
  638.  
  639. PSO "hidemac":
  640. PSO "showmac":
  641. These both PSO`s are stearing the showing of a macro in the assembler listing.
  642. Everytime calling a macro, lines are created and printed too for controlling.
  643. If this is not interesting for you, you can forbid the printing with the PSO
  644. "hidemac". To switch it on again use "showmac".
  645.  
  646.  
  647.  
  648.  
  649. aritmetic speeches:
  650.  
  651. During the assembling the assembler can calculate aritmetic speeches. Brackets
  652. are not implemtinated in this version, I`m sorry.
  653.  
  654. lda offs-1,y
  655. byte %0101*2,1+2*3         ; results 10, 9
  656.  
  657. The speeches are evaluated from left to right (without considering
  658. multiplication / division befor adition / subtraction).
  659. Allowed speeches are labels, numbers, ASCII signs and the programcounter.
  660.  
  661. Input of numbers into 3 number systems are possible:
  662. $ff   hexadecimal: marked with a "$" sign before speech.
  663. 255   decimal
  664. %0101 Binary: marked with a "%" sign before speech.
  665.       Binary numbers are maximal constisting of 16 BIT`s. If not all BIT`s were given, so the
  666.       resulting value will be calculated from right to left.
  667.       %10 results 2
  668.       %00000010 results 2
  669. *     programcounter: you can use the PC with speeches through the sign "*"
  670.       *= $1000
  671. start equ *+4       ; The symbol "start" is given the value $1004.
  672.       word *,*+2    ; put down PC
  673.       *= *+10       ; new PC = actual PC + 10
  674.  
  675.  
  676. aritmetic signs:
  677.  
  678. The speeches mentioned above can be connected by the following aritmetic signs:
  679.  
  680. "+"   adition
  681. "-"   subtraction
  682. "*"   multiplication
  683. "/"   division
  684. "&"   logical AND-connection
  685. "|"   logical OR-connection
  686. "^"   logical EXCLUSIVE OR-connection
  687. "<"   get the low-byte of the first sign
  688. ">"   same, for the high-byte
  689.  
  690.  
  691.  
  692.  
  693. conditionell assembling:
  694.  
  695. PSO "if":
  696. PSO "ifequ":
  697. PSO "ifpl":
  698. PSO "ifmi":
  699. PSO "ifdef":
  700. PSO "ifndef":
  701. PSO "endif":
  702.  
  703. These PSO`s are usefull for the assembling under fixed circumstance,
  704. respectively break of conditions in assemblerloops.
  705.  
  706. PSO                true                         false
  707. ----------------------------------------------------------------
  708. if                 <>0 result not zero          ==0 same as zero
  709. ifequ              ==0  "   " same as zero      <>0 not zero
  710. ifpl               >=0  "   " positiv           < = negativ
  711. ifmi               < 0  "   " negativ           >=0 positiv
  712. ifdef              if symbol is defined         not defined
  713. ifndef             symbol not defined           symbol defined
  714.  
  715. If the condition is fulfiled, the following part will be assembled. If the
  716. condition is not fulfiled, the following part of the sourcetext will be not
  717. assembled up to the next "endif", that means overreading. Attention: A casing
  718. of the conditionell assembling is possible. Is there in the overreading part
  719. any "if", so the assembler awaits two "endif", before it goes on with the
  720. normal assembling.
  721.  
  722. "ifdef" and "ifndef" are testing if a variable or constant is already defined.
  723.  
  724. Example:
  725.  
  726. test    = 1
  727.         *=$1000
  728.         if test-1         ; tests if "test" <> 1
  729.         endasm            ; then end
  730.         endif             ; else normal assembling
  731.         .....             ; from here on will be assembled if "test" ==1
  732.  
  733.  
  734.  
  735.  
  736. tables:
  737.  
  738. PSO "byte":
  739. PSO "dbyte":
  740. PSO "word":
  741. PSO "rta":
  742. PSO "text":
  743. PSO "null":
  744. PSO "shift":
  745. PSO "time":
  746.  
  747. In every bigger machineprogram are exept the proper machinecode tables
  748. necessary. Tables are areas of dates on wich the program can fall back during
  749. its operations. They can include e.g. text, jumadresses or fixed parameter.
  750. To create such tables very easy you can use the following parameter orders.
  751.  
  752.  
  753. PSO "byte":
  754. "byte" is the most important part of this group. With this PSO you can create
  755. every table. During the assembling the values will be taken up into the object
  756. code.
  757. label = $1000
  758. byte 5,"a"+1,$aa,>label
  759.  
  760.  
  761. PSO "dbyte":
  762. In opposite to "byte" you can with "dbyte" take up 16 BIT values immidiate.
  763. This values will be taken over in high/low format into the program.
  764. dbyte $1122
  765. or
  766. byte $11,$22
  767.  
  768.  
  769. PSO "word":
  770. This PSO is necessary to put down 16 BIT adresses in tables. This values will
  771. be taken over in low/high format.
  772. print = $fa21       ; adress of the print routine
  773. error = $fbca
  774. word print,error
  775. or
  776. byte <print,>print,<error,>error
  777.  
  778. PSO "rta":
  779. 16 BIT tables often used to jump on different sub routines with a order number.
  780. A liked programtrick: The wished orderadress will be pushed on the stack for
  781. to jump on the wished routine with an "rts". But take care that the processor
  782. raise the adress on the stack while executing "rts". Therefor it must degrade
  783. for one before putting down. This job has the PSO "rta" (return adress).
  784. jmp_rout    asl a           ; accu includes order number
  785.             tax             ; number*2 to X-register
  786.             lda tab+1,x     ; high byte of order adress-1
  787.             pha             ; on stack, simulated return adress
  788.             lda tab,x       ; low byte of order adress-1
  789.             pha             ; on Stack
  790.             rts             ; jump to routine
  791. tab         rta print,error, exit      ; tabelle of order adresses
  792. or
  793. word print-1,error-1,exit-1
  794. byte <print-1,>print-1,<error-1,>error-1,<exit-1,>exit-1
  795.  
  796.  
  797. PSO "text":
  798. ASCII signs are often needed in a program. With "text" you can put them down in
  799. an easy way. During the assembling the noted text will be calculated byte for
  800. byte into hex values and then layed down under the actual adress. The text-
  801. string has to be between (").
  802.  
  803. text "1234"
  804. or
  805. byte  49,50,51,52
  806.  
  807. The quoation mark itself was signed by a `\`.
  808. Example:
  809. text "\"this text is between 2 quoation marks\"".
  810.  
  811.  
  812.  
  813. PSO "null":
  814. the same meaning as "text", but here the noted text receives a zero byte as an
  815.  endmarking. !! Textlenght +1.
  816.  
  817. null "1234"
  818. or
  819. text "1234"
  820. byte 0
  821. or
  822. byte 49,50,51,52,0
  823.  
  824.  
  825.  
  826. PSO "shift":
  827. In PSO "null" it is expected that you use a zero byte as an ending marking for
  828. text. Another posibility is to set BIT 7 at the last sign of the signchain.
  829. That makes only sence if the order of all used signs are lower than 128 ($80).
  830.  
  831. shift "1234"
  832. or
  833. byte 49,50,51,52|$80       ; "|" = or, is the same as 52+$80
  834.  
  835.  
  836. PSO "time":
  837. The actual date and time are taken over onto the object file on the assembling.
  838. If time given without parameters the string created is as following:
  839. Fri Jun 30 18:43:43 1989
  840. time or time s            the parameter "s" creates the same string
  841. time s                    same, other writing
  842.  
  843. But you have also the posibility to create the time string with your own
  844. imagines. For this switch over the conserning parameter by the action of
  845. "time":
  846. time weekdaye              weekday, 3 letters in english e.g. Mon-Sun
  847. time weekdayg              weekday, 2 letters in german e.g. Mo-So
  848. time year                  year, 1989-????
  849. time monthe                month, 3 letters in english e.g. Jan-Dez
  850. time monthg                month, 3 letters in german e.g. Jan-Dez
  851. time month                 month in numbers, 01-12
  852. time day                   day in numbers, 01-31
  853. time hour                  hours, 01-23
  854. time min                   minutes, 00-59
  855. time sec                   seconds, 00-31
  856.  
  857.  
  858. The following example makes it more clear (i hope so):
  859. time weekdayg
  860. byte " "
  861. time day
  862. byte "."
  863. time monthg
  864. byte " "
  865. time year
  866. If you want to assemble on Montag the 22.03.1991, so the following string will
  867. be created:
  868. "Mo 28.Mai 1989"
  869.  
  870.  
  871.  
  872. assemblerloops:
  873.  
  874. PSO "assloop":
  875. PSO "assend":
  876.  
  877. Sometimes you have to solve a problem very quick, so that you can not use a 
  878. conditionell machine language loop wich asks through a counter for the end of
  879. working. There is the only possibility to write the needed orders x-times into
  880. the machine program. This work is with the help of the assembler loop easier.
  881. With assemlerloops it is possible to assemble a fixed routine as often you want.
  882.  
  883. e.g. copy a memory area:
  884. The orders between "assloop" and "assend" are writen 5 times into the object
  885. file.
  886.  
  887.          *= $2000
  888. counter  set 5
  889.          ldx #00
  890.          sei                 ; switch of interrupt
  891.  
  892.          assloop             ; begin of an assemblerloop
  893.          lda $7000,x         ; get byte
  894.          sta $8000,x         ; put byte
  895.          inx
  896. counter  set counter-1       ; lower counter
  897.          if counter          ; counter not zero ?
  898.          assend              ; yes, go on by .assloop
  899.          endif               ; counter == zero
  900.          cli                 ; end of loop if counter == Null
  901.          ...                 ; more orders
  902.  
  903.  
  904.  
  905.  
  906.  
  907. calling the assembler:
  908.  
  909. The assembler starts by inputting of the following order:
  910.  
  911.      as65 filename [-options]
  912.  
  913. Filename stands for the name of the file wich should be assembled and
  914. [-options] for free of chose parameters specifing. The parameters can be
  915. combinated.
  916.  
  917. The assembler reads assembler source-advice of the 6502 processor family out
  918. of an input file, writes the translated object code in an output file and
  919. creates, if you want, a listing. If the assembler during the assembling finds
  920. an include-advice, it ads assembler-codes from other files. The name of the
  921. source-file wich is given to the assembler by calling him must have the
  922. extension ".asm". Is there no extension, or another then ".asm" will
  923. automaticaly added by the assembler. Include filenames are free choseable.
  924.  
  925.  
  926. Calling the assembler with delivery of a source file
  927.  
  928. as65 test.asm  or  as65 test
  929.  
  930. The object code, wich the assembler produced, will be written into a file.
  931. The filename is divert from the input filename. The extension changes to
  932. ".obj". The file, if it isn`t marked other, will be written into a directory
  933. wich contains the source file.
  934.  
  935.  
  936.  
  937. possible parameters:
  938.  
  939. -w         WARNINGS will be supressed
  940. -p         the programcounter will be not shown during the assembling
  941. -P         the PC will be shown during the assembling
  942. -f         maximal assembler speed
  943. -a         creating an ASCII-file too
  944. -s         symboltable will be shown on the screen
  945. -S         symboltable will be written into a file
  946. -l         the assembler creates a listing, wich is shown on the screen
  947. -L         same, but into a file
  948. -e         all fault messages will be divert to a file, no showing on the screen
  949. -E         same, but fault messages will be shown on the screen too
  950. -i         define include path
  951. -I         extra information while assembling
  952. -D         define constant
  953. -d`name`   load default adjustments
  954. -o`name`   filename of the object file and all created files
  955.  
  956.  
  957.  
  958.  
  959.  
  960. assembler options
  961.  
  962. option -w:
  963. With this option all warnings will be supressed.
  964. see also PSO "warnoff".
  965.  
  966.  
  967. option -p:
  968. option -P:
  969. Normally during the assembling the actual programcounter will be shown on the
  970. screen.
  971. "-p" With this option you switch of that function
  972. If you switched off your PC in your source file with the PSO "showpc off", you
  973. can get this function with the option "-P".
  974. see also PSO "showpc".
  975.  
  976.  
  977. option -f:
  978. With this option the assembler switches over to maximal speed. The showing of
  979. the programcounter will be supressed, it will only created a object file, the
  980. output directory will be set to "RAM:".
  981. see also PSO "fspeed".
  982.  
  983.  
  984. option -a:
  985. The assembler creates beside the object file, wich is binary, an ASCII file
  986. too. The name will be divert from the source file, but it has the extension
  987. ".asc".
  988. see also PSO "ascii".
  989.  
  990.  
  991. option -s:
  992. option -S:
  993. The symbol table will be shown on the screen using option "-s". If you want
  994. the table to write in a file, so use the option "-S". The file receives the
  995. ending ".sym".
  996. see also PSO "showsym".
  997.  
  998.  
  999. option -l:
  1000. option -L:
  1001. If you choose the option "-L", the assembler creates a listing file. The name
  1002. of this listing file will be divert again from the input file, but the exten-
  1003. sion is ".lst". Beside the adress the listing file shows the source statements
  1004. and the equivalent of them in machine language. With the option "-l" you
  1005. divert the output to the screen. There is no creating of a listing file.
  1006. see also PSO "liston"
  1007.  
  1008.  
  1009. option -e:
  1010. option -E:
  1011. Normally the fault messages, wich are appearing during the assembling, are 
  1012. shown on the screen. With the option "-e" you can divert this statement into a
  1013. file. That file will have the extension ".err".
  1014. With the option "-E" the assembler creates an errorfile too, the showing on the
  1015. screen will not be supressed.
  1016. see also PSO "error".
  1017.  
  1018.  
  1019. option -i:
  1020. Search Path for includes.
  1021. -i D/
  1022.  
  1023.  
  1024. Option -I:
  1025. Extra Information while assembling.
  1026.  
  1027.  
  1028. Option -D:
  1029. Define Symbol. "-D Symbol=10" the constant "Symbol" will be defined an takes
  1030. the value of 10. This constant is useable in your source.
  1031.  
  1032.  
  1033. option -d:
  1034. With the also delivert utility "makedef" default files can be created with own
  1035. images. All options we already spoke about can be layed down in this file. With
  1036. the option "-d" now this file can loaded later, so that the parameter delivery
  1037. is basicly easier. If after "-d" no filename is given so the positions of the
  1038. default file "as65.def" will be loaded. The filename must be in single quoation
  1039. marks:
  1040. -d`filename`.
  1041.  
  1042.  
  1043. [option -o:
  1044. All files wich will be created by the assembler will be delivert from the name
  1045. of the sourcefile. Option "-o" says that all files were createt from the name
  1046. given after this option. The name must be in single quoation marks:
  1047. -o`filename`.
  1048.  
  1049. as65 test.asm -o`my_name`
  1050.  
  1051.  
  1052.  
  1053. An example shall make the above mentored options more clear. If you want to
  1054. create an ASCII file, the symboltable shall be shown on the screen and written
  1055. into a file, faultmessages shall bewritten into a file and all filenames shall
  1056. divert from the name "my_name", so the parameter delivery is as follows:
  1057.  
  1058. as65 test.asm -asSeo`my_name`
  1059.  
  1060.  
  1061.  
  1062.  
  1063. utilitys
  1064.  
  1065. ShowOpc:
  1066. --------
  1067. With the also delivert program ShowOpc you can let you show the processor specific orders and the adressing measure concerning to the hex-values. If you want to inform yourself about e.g. the R65C02, input ShowOpc R65C02. A listing is shown about the useable orders in this CPU. If you input only the programname,ShowOpc, without the statement of the processor, you will receive a listing of possible processortypes. Will the parameter "all" wich follows the programname, you can let show all possible processor types one after the other.
  1068.  
  1069.  
  1070.  
  1071. MakeDef:
  1072. --------
  1073. With this program you can make a default file how you want it. It canbe loaded
  1074. by the assembler with the option "-d`name` and a extensive parameter delivery
  1075. is not necessary anymore.
  1076.  
  1077.  
  1078. MakeDef Test:
  1079. -------------
  1080. Creates a default file in the actual directory with the name "Test".
  1081.  
  1082.  
  1083.  
  1084. Convert:
  1085. --------
  1086. This utility creates a file in the MOTOROLA S-RECORD format, input is a binary
  1087. file. The maximum filesize is 64kB . This created file can now be send to an
  1088. e.g. eprommer. The file receives the ending ".tfr".
  1089.  
  1090. convert binary_file
  1091.  
  1092.