home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-12-22 | 2.6 KB | 122 lines | [TEXT/YERK] |
- \ Assembler Utility Routines Reese Warner 4/85
- \ 09/10/85 RW Changed auxA/D: to A/D:
- \ 09/16/85 RW Made >num copy out its number
- \ 03/06/86 GDC fixed immediate mode (>num)
- \ 03/07/86 GDC fixed PC modes (9 & 10) (compIdxMode)
-
- 0 -> dlevel
-
- \ converts text into numbers
- : >num { addr len -- n }
- buf255 256 erase
- addr len str255 drop
- buf255 1+ c@ ascii $ =
- IF
- buf255 2+ c@ ascii - =
- IF
- 0 0 buf255 c@ 1- buf255 1+ c!
- buf255 2+ hex (number) decimal drop drop negate
- ELSE
- 0 0 buf255 1+ hex (number) decimal drop drop
- THEN
- ELSE
- buf255 1+ c@ ascii - =
- IF
- 0 0 buf255 c@ 1- buf255 1+ c! buf255 1+ (number) drop drop negate
- ELSE
- 0 0 buf255 (number) drop drop
- THEN
- THEN
- ;
-
- : AsmError { errNum -- }
- ." asmerror# " errNum . ." in Line number " linect . cr
- ." LINE: " tib tiblen type cr
- true -> errflag
- ;
-
- : doyerk null ;
-
- : check { opPtr mask -- }
- 1 mode: opPtr
- val" mode is"
- << mask
- val" mask is "
- and not
- IF
- 203 asmError \ mode and mask do not match
- THEN
- ;
-
- : CompIdxMode { opPtr -- }
- getpcmode: opPtr dup 8 <
- IF
- drop
- mode: opPtr
- THEN
- CASE
- 5 OF
- value: opPtr w,
- ENDOF
- 6 OF
- value: opPtr 255 min 0 max
- auxilSize: opPtr 1- 11 << or
- auxReg: opPtr 12 << or
- A/D: opPtr 15 << or
- w,
- ENDOF
- 8 OF
- value: opPtr ,
- ENDOF
- 9 OF
- value: opPtr w,
- ENDOF
- 10 OF
- value: opPtr 255 min 0 max
- auxilSize: opPtr 1- 11 << or
- auxReg: opPtr 12 << or
- A/D: opPtr 15 << or
- w,
- ENDOF
- 11 OF
- opSize
- CASE
- 0 OF
- value: opPtr 255 and w,
- ENDOF
- 1 OF
- value: opPtr w,
- ENDOF
- 2 OF
- value: opPtr ,
- ENDOF
- ENDCASE
- ENDOF
- ENDCASE
- ;
-
- : modeSize { opPtr -- modeSize }
- getpcmode: opPtr dup 8 <
- IF
- drop
- mode: opPtr
- THEN
- CASE
- 5 OF 1 ENDOF
- 6 OF 1 ENDOF
- 8 OF 2 ENDOF
- 9 OF 1 ENDOF
- 10 OF 1 ENDOF
- 11 OF
- opSize
- CASE
- 0 OF 1 ENDOF
- 1 OF 1 ENDOF
- 2 OF 2 ENDOF
- 2 swap
- ENDCASE
- ENDOF
- 0 swap
- ENDCASE
- ;
-