home *** CD-ROM | disk | FTP | other *** search
- ; EZ MACROS by Michael LaChapelle (MJL!)
- ; last update: 9/19/89
- Text
- CursConf #0,#5 ;get initial flash rate...
- Move d0,flashrate__ ;...and save it for CURSOR macro
-
- Data
- hextable__ dc.b '0123456789ABCDEF' ;data for PRINTHEX
- crlf__ dc.b $0d,$0a,0,0
- up__ dc.b 'A',0,0
- down__ dc.b 'B',0,0
- right__ dc.b 'C',0,0
- left__ dc.b 'D',0,0
- cls__ dc.b 'E',0,0
- home__ dc.b 'H',0,0
- EEOS__ dc.b 'J',0,0
- EEOLn__ dc.b 'K',0,0
- Insert__ dc.b 'L',0,0
- Delete__ dc.b 'M',0,0
- CharColor__ dc.b 'b'
- CColor__ dc.b ' ',0
- BackColor__ dc.b 'c'
- BColor__ dc.b ' ',0
- ClrtoCrs__ dc.b 'd',0,0
- SaveCrs__ dc.b 'j',0,0
- RestoreCrs__ dc.b 'k',0,0
- ClearLine__ dc.b 'l',0,0
- ClrfromSt__ dc.b 'o',0,0
- ReverseOn__ dc.b 'p',0,0
- ReverseOff__ dc.b 'q',0,0
- WrapOn__ dc.b 'v',0,0
- WrapOff__ dc.b 'w',0,0
- position__ dc.b 'Y'
- positiony__ dc.b ' '
- positionx__ dc.b ' '
- dc.b 0,0
- BSS
- flashrate__ ds.w 1 ;for CURSOR
- InputBuffer__ ds.b 82
- Registers: ;register save area (for BP)
- D0__ DS.W 1
- D02__ DS.W 1
- D1__ DS.W 1
- D12__ DS.W 1
- D2__ DS.W 1
- D22__ DS.W 1
- D3__ DS.W 1
- D32__ DS.W 1
- D4__ DS.W 1
- D42__ DS.W 1
- D5__ DS.W 1
- D52__ DS.W 1
- D6__ DS.W 1
- D62__ DS.W 1
- D7__ DS.W 1
- D72__ DS.W 1
- A0__ DS.W 1
- A02__ DS.W 1
- A1__ DS.W 1
- A12__ DS.W 1
- A2__ DS.W 1
- A22__ DS.W 1
- A3__ DS.W 1
- A32__ DS.W 1
- A4__ DS.W 1
- A42__ DS.W 1
- A5__ DS.W 1
- A52__ DS.W 1
- A6__ DS.W 1
- A62__ DS.W 1
- A7__ DS.W 1
- A72__ DS.W 1
- ST0__ DS.W 1
- ST02__ DS.W 1
- ST1__ DS.W 1
- ST12__ DS.W 1
- ST2__ DS.W 1
- ST22__ DS.W 1
- ST3__ DS.W 1
- ST32__ DS.W 1
-
- Text
-
- off=0 ;cursor equates
- on=1
- flash=2
- steady=3
- solid=3
-
- for_read=0 ;for OPEN #FOR_READ...
- for_write=1 ;for OPEN #FOR_WRITE...
- for_rw=2 ;for OPEN #FOR_RW...
-
- Push: Macro $\1 ;PUSH <register D0-D7, A0-A6>
- Move.l \1,-(sp) ;(saves register on stack)
- Endm
-
- Pop: Macro $\1 ;POP <register D0-D7, A0-A6>
- Move.l (sp)+,\1 ;(pulls value from stack)
- Endm
-
- Pull: Macro $\1 ;PULL <register D0-D7, A0-A6>
- Pop \1
- Endm
-
- CR: Macro ;CR
- PrintLine crlf__ ;(prints a CR, LF)
- Endm
-
- CapsIn: Macro ;CAPSIN
- conin_we ;(converts letter to uppercase,)
- and.b #$5F,d0 ;(without echo)
- Endm
-
- KeyIn: Macro ;KEYIN
- conin_we ;(get any key, without echo)
- Endm
-
- CheckKey: Macro ;CHECKKEY
- RawConIO #$FF ;(returns key in D0, or '0' if no)
- tst d0 ;(key pressed)
- endm
-
- Up: Macro ;UP
- PrintLine Up__ ;(moves cursor up 1 line)
- Endm ;(no scroll)
-
- Down: Macro ;DOWN
- PrintLine Down__ ;(moves cursor down 1 line)
- Endm ;(no scroll)
-
- Right: Macro ;RIGHT
- PrintLine Right__ ;(moves cursor right 1 space)
- Endm
-
- Left: Macro ;LEFT
- PrintLine Left__ ;(moves cursor left 1 space)
- Endm
-
- Cls: Macro ;CLS
- PrintLine Cls__ ;(clears screen)
- Endm
-
- Home: Macro ;HOME
- PrintLine Home__ ;(homes cursor, no screen clear)
- Endm
-
- EraseEOS: Macro ;ERASEEOS
- PrintLine EEOS__ ;(erase to end of screen)
- Endm
-
- EraseEOLn: Macro ;ERASEEOLN
- PrintLine EEOLn__ ;(erase to end of line)
- Endm
-
- InsertLine: Macro ;INSERTLINE
- PrintLine Insert__ ;(insert line)
- Endm
-
- DeleteLine: Macro ;DELETELINE
- PrintLine Delete__ ;(delete line)
- Endm
-
- CharColor: Macro $\1 ;CHARCOLOR <color 0-15>
- move.b \1,CColor__ ;(sets character color)
- PrintLine CharColor__
- Endm
-
- BackColor: Macro $\1 ;BACKCOLOR <color 0-15>
- move.b \1,BColor__ ;(sets character background color)
- PrintLine BackColor__
- Endm
-
- ClearToCursor: Macro ;CLEARTOCURSOR
- PrintLine ClrtoCrs__ ;(clears from screen start to cursor)
- Endm
-
- SaveCursor: Macro ;SAVECURSOR
- PrintLine SaveCrs__ ;(save cursor position)
- Endm
-
- RestoreCursor: Macro ;RESTORECURSOR
- PrintLine RestoreCrs__ ;(restore cursor to saved position)
- Endm
-
- ClearLine: Macro ;CLEARLINE
- PrintLine ClearLine__ ;(erase entire line)
- Endm
-
- ClearFromStart: Macro ;CLEARFROMSTART
- PrintLine ClrFromSt__ ;(clear from line start to cursor)
- Endm
-
- ReverseOn: Macro ;REVERSEON
- PrintLine ReverseOn__ ;(inverse letters)
- Endm
-
- ReverseOff: Macro ;REVERSEOFF
- PrintLine ReverseOff__ ;(return to normal letters)
- Endm
-
- WrapOn: Macro ;WRAPON
- PrintLine WrapOn__ ;(turn on word-wrap)
- Endm
-
- WrapOff: Macro ;WRAPOFF
- PrintLine WrapOff__ ;(turn word-wrap off)
- Endm
-
- Position: Macro $\1,$\2 ;POSITION <x 0-39/79>,<y 0-24>
- move \1,d0 ;(positions cursor)
- add #32,d0
- move.b d0,positionx__
- move \2,d0
- add #32,d0
- move.b d0,positiony__
- PrintLine position__
- Endm
-
- VPrint: Macro $\1 ;VPRINT <variable/label>
- PrintLine \1 ;(variable print)
- Endm
-
- VPrint_at: Macro $\1,$\2,$\3 ;VPRINT_AT <x>,<y>,<var/label>
- Position \1,\2 ;(displays var output at x,y)
- VPrint \3
- Endm
-
- VPrintCR: Macro $\1 ;VPRINTCR <var/label>
- VPrint \1 ;(print var/label, do CRLF)
- CR
- Endm
-
- VPrintCR_At: Macro $\1,$\2,$\3 ;VPRINTCR_AT <x>,<y>,<var/label>
- Position \1,\2 ;(print var at x,y, do CRLF)
- VPrintCR \3
- Endm
-
- Print: Macro $\1 ;PRINT '<string>'
- PrintLine \prt ;(print literal string)
- bra.s \prtend
- \prt dc.b \1,0
- align
- \prtend:
- Endm
-
- Print_at: Macro $\1,$\2,$\3 ;PRINT_AT <x>,<y>,'<string>'
- Position \1,\2 ;(print string at x,y)
- Print \3
- Endm
-
- PrintCR: Macro $\1 ;PRINTCR '<string>'
- Print \1 ;(print literal string, do CRLF)
- CR
- Endm
-
- PrintCR_At: Macro $\1,$\2,$\3 ;PRINTCR_AT <x>,<y>,'<string>'
- Position \1,\2 ;(print string at x,y, do CRLF)
- PrintLine \prtcr
- bra.s \prtcrend
- \prtcr dc.b \3
- dc.b $0d,$0a,0
- align
- \prtcrend:
- Endm
-
- Input: Macro $\1,$\2 ;INPUT <var/label>,<max length>
- move.b \2,INPUTBUFFER__ ;(places input in var, actual)
- ReadLine INPUTBUFFER__ ;(length in D0)
- Push d0 ;(also places zero byte at end)
- CR ;(of input text)
- Pop d0
- lea \1,a0
- lea INPUTBUFFER__+2,a1
- move d0,d1
- subq #1,d1
- \InLoop: move.b (a1)+,(a0)+
- dbra d1,\InLoop
- move.b #0,(a0)+
- Endm
-
- Input_at: Macro $\1,$\2,$\3,$\4 ;INPUT_AT <x>,<y>,<var/label>,<len>
- Position \1,\2 ;(positions cursor to x,y,)
- Input \3,\4 ;(does INPUT)
- Endm
-
- Cursor: Macro %\1 ;CURSOR ON (turns cursor on)
- Ifeq \1,Off ;CURSOR OFF (turns cursor off)
- CursConf #0,#Off ;CURSOR STEADY (no flash)
- Endif ;CURSOR SOLID ( " )
- Ifeq \1,On ;CURSOR FLASH (flash cursor)
- CursConf #0,#On
- Endif
- Ifeq \1,Steady
- CursConf #0,#Steady
- Endif
- Ifeq \1,Solid
- CursConf #0,#Solid
- Endif
- Ifeq \1,Flash
- CursConf FlashRate__,#Flash
- Endif
- Endm
-
- PrintHex: Macro $\1 ;PRINTHEX <#/var/label>
- move.b \1,d0 ;(displays hexidecimal value)
- ext.w d0
- move d0,a1
- lsr.b #4,d0
- andi #$0f,d0
- lea hextable__,a2
- move.b (a2,d0),d2
- lsl #8,d2
- move a1,d0
- andi #$0f,d0
- move.b (a2,d0),d2
- move d2,d0
- Push d2
- lsr #8,d0
- ConOut d0
- pop d0
- ConOut d0
- Endm
-
- PrintHexCR: Macro $\1 ;PRINTHEXCR <#/var/label>
- PrintHex \1 ;(print hex value, do CRLF)
- CR
- Endm
-
- PrintHex_At: Macro $\1,$\2,$\3 ;PRINTHEX_AT <x>,<y>,<#/var/label>
- Position \1,\2 ;(print hex at x,y)
- PrintHex \3
- Endm
-
- PrintHexCR_At: Macro $\1,$\2,$\3 ;PRINTHEXCR_AT <x>,<y>,<#/var/label>
- PrintHex_At \1,\2,\3 ;(print hex at x,y, do CRLF)
- CR
- Endm
-
- Dump: Macro $\1 ;DUMP <#/var/label>
- PrintHex \1 ;(display hex word value)
- PrintHex \1+1
- Endm
-
- DumpHex: Macro $\1 ;DUMPHEX <#/var/label>
- Dump \1 ;(16-bit hex dump)
- Endm
-
- DumpCR: Macro $\1 ;DUMPCR <#/var/label>
- PrintHex \1 ;(display hex, do CRLF)
- PrintHexCR \1+1
- Endm
-
- DumpHexCR: Macro $\1 ;DUMPHEXCR <#/var/label>
- DumpCR \1 ;(16-bit hex dump, do CRLF)
- Endm
-
- Dump_At: Macro $\1,$\2,$\3 ;DUMP_AT <x>,<y>,<#/var/label>
- PrintHex_At \1,\2 ;(display hex at x/y)
- PrintHex \3
- Endm
-
- DumpHex_At: Macro $\1,$\2,$\3 ;DUMPHEX_AT <x>,<y>,<#/var/label>
- Dump_At \1,\2,\3 ;(16-bit dump at x/y)
- Endm
-
- DumpCR_At: Macro $\1,$\2,$\3 ;DUMPCR_AT <x>,<y>,<#/var/label>
- PrintHex_At \1,\2 ;(display hex at x/y, do CRLF)
- PrintHexCR \3
- Endm
-
- DumpHexCR_At: Macro $\1,$\2,$\3 ;DUMPHEXCR_AT <x>,<y>,<#/var/label>
- DumpCR_At \1,\2,\3 ;(16-bit dump at x/y, do CRLF)
- Endm
-
- BP: Macro $\1 ;BP <text>
- Print \1 ;(halt and display msg [BreakPoint])
- KeyIn
- ClearLine
- Endm
-
- BreakPoint: Macro $\1 ;BREAKPOINT <text>
- BP \1
- Endm
-
- BPDump: Macro $\1 ;BPDUMP <text>
- MoveM.L D0-D7/A0-A6,Registers ;(BreakPoint and DUMP registers)
- Move.L SP,A7__
- Move.L (SP),ST0__
- Move.L +4(SP),ST1__
- Move.L +8(SP),ST2__
- Move.L +12(SP),ST3__
- PrintCR \1
- CR
- Print ' --A0-- --A1-- --A2-- --A3-- '
- PrintCR ' --A4-- --A5-- --A6-- --SP-- '
- Dump A0__
- Dump A02__
- Print ' '
- Dump A1__
- Dump A12__
- Print ' '
- Dump A2__
- Dump A22__
- Print ' '
- Dump A3__
- Dump A32__
- Print ' '
- Dump A4__
- Dump A42__
- Print ' '
- Dump A5__
- Dump A52__
- Print ' '
- Dump A6__
- Dump A62__
- Print ' '
- Dump A7__
- DumpCR A72__
- CR
- Print ' --D0-- --D1-- --D2-- --D3-- '
- PrintCR ' --D4-- --D5-- --D6-- --D7-- '
- Dump D0__
- Dump D02__
- Print ' '
- Dump D1__
- Dump D12__
- Print ' '
- Dump D2__
- Dump D22__
- Print ' '
- Dump D3__
- Dump D32__
- Print ' '
- Dump D4__
- Dump D42__
- Print ' '
- Dump D5__
- Dump D52__
- Print ' '
- Dump D6__
- Dump D62__
- Print ' '
- Dump D7__
- DumpCR D72__
- CR
- PrintCR ' Stack0 Stack1 Stack2 Stack3 '
- Dump ST0__
- Dump ST02__
- Print ' '
- Dump ST1__
- Dump ST12__
- Print ' '
- Dump ST2__
- Dump ST22__
- Print ' '
- Dump ST3__
- DumpCR ST32__
- MoveM.L Registers,D0-D7/A0-A6
- KeyIn
- CR
- EndM
-
- End
-