home *** CD-ROM | disk | FTP | other *** search
- INCLUDE "include:exec/types.i"
- INCLUDE "Stereo.i"
-
- XREF _AbsExecBase
- XREF _LVOOpenWindow
- XREF _LVOCloseWindow
- XREF _LVOOpenLibrary
- XREF _LVOCloseLibrary
- XREF _LVOAllocMem
- XREF _LVOFreeMem
- XREF _LVODelay
- XREF _LVOMove
- XREF _LVODraw
- XREF _LVOSetAPen
- XREF _LVOWritePixel
- XREF _LVOGetPrefs
- XREF _LVOWindowToBack
- XREF _LVOText
- XREF _LVOSetDrMd
-
- CLEAR_PUBLIC EQU MEMF_CHIP!MEMF_CLEAR
- MyFlag EQU SMART_REFRESH!WINDOWDEPTH!WINDOWDRAG
-
- MLP1 EQU 33
- SWidth EQU 340
- FullH EQU 100
- Begin: move.l a6,-(a7)
- move.l a7,InitSP
- bsr LibsOpen
- bsr Prefs
- bsr OpenNew
- bsr DoGraphs
- bsr CloseNew
- bsr CloseLibs
- move.l InitSP,a7
- move.l (a7)+,a6
- rts
- Prefs:
- move.l a6,-(a7)
- move.l #pf_SIZEOF,d0
- bsr StructureAlloc ;Make space for preferences
- move.l IntuitionLibrary,a6
- move.l d0,a0 ;Point to space
- move.l a0,-(a7)
- move.l #pf_SIZEOF,d0 ;Get all of them
- jsr _LVOGetPrefs(a6)
- move.l (a7)+,a1
- move.b pf_LaceWB(a1),d0 ;Get lace status
- cmp.b #1,d0 ;See if interlace set
- bne.s NoInter
- move.w #FullH,d0
- asl.w #1,d0 ;Double for interlace
- move.w d0,SHeight
- NoInter:
- move.l #pf_SIZEOF,d0
- bsr StructFree
- move.l (a7)+,a6
- rts
- InitNewWindow:
- move.l MyNewWindow,a2
- move.w #290,nw_LeftEdge(a2)
- move.w SHeight,d0
- lsl.w #1,d0
- sub.w #17,d0
- move.l #MyFlag,nw_Flags(a2)
- move.w #16,nw_TopEdge(a2)
- move.w #SWidth,nw_Width(a2)
- move.w d0,nw_Height(a2)
- move.b #3,nw_DetailPen(a2) ;Green
- move.b #2,nw_BlockPen(a2) ;Black
- move.w #SWidth,nw_MinWidth(a2)
- move.w d0,nw_MinHeight(a2)
- move.w #SWidth,nw_MaxWidth(a2)
- move.w d0,nw_MaxHeight(a2)
- move.w #WBENCHSCREEN,nw_Type(a2)
- rts
- OpenNew:
- move.l #nw_SIZE,d0
- bsr StructureAlloc
- move.l d0,a2
- bne.s SucAll
- bra TotFail ;Can't display if not to this point.
- SucAll: move.l a2,MyNewWindow
- bsr.s InitNewWindow ;Initialize new window structure
- move.l MyNewWindow,a0
- movea.l IntuitionLibrary,a6 ;a6 established by IntuOpen
- jsr _LVOOpenWindow(a6) ;Open the new window.
- move.l d0,MyWindow ;Pointer to window structure for new window
- TotFail:
- rts
- CloseNew:
- move.l a6,-(a7)
- movea.l MyWindow,a0
- movea.l IntuitionLibrary,a6
- jsr _LVOCloseWindow(a6)
- move.l _AbsExecBase,a6
- move.l MyNewWindow,a1
- move.l #nw_SIZE,d0
- bsr StructFree
- move.l #0,MyNewWindow
- move.l (a7)+,a6
- rts
- StructureAlloc:
- move.l a6,-(a7) ;Save a6 (intution library base)
- move.l _AbsExecBase,a6 ;Exec functions coming up
- move.l #CLEAR_PUBLIC,d1 ;Public memory
- jsr _LVOAllocMem(a6)
- move.l (a7)+,a6 ;Recover a6
- rts
- StructFree:
- move.l a6,-(a7)
- move.l _AbsExecBase,a6
- move.l a1,d1
- beq.s IsFree
- jsr _LVOFreeMem(a6)
- IsFree: move.l (a7)+,a6
- rts
- *OpenLib opens the library whose name is pointed to by a1. The library
- *base address is returned in d0. a6 is destroyed.
- OpenLib:
- move.l #MLP1,d0 ;Version 33 or later
- movea.l _AbsExecBase,a6
- jsr _LVOOpenLibrary(a6) ;Find Library base.
- rts ;Library base returned in d0
- LibsOpen:
- *Now open intuition
- IntuOpen:
- move.l #IntuitionName,a1 ;Request intuition library.
- bsr.s OpenLib
- move.l d0,IntuitionLibrary
- beq TotFail
- GraphicsOpen:
- * Open the graphics library
- move.l #GraphicsName,a1 ;Request graphics library.
- bsr.s OpenLib
- move.l d0,GraphicsLibrary ;Save pointer
- beq TotFail
- GraphOpen:
- move.l #DosName,a1
- bsr.s OpenLib
- move.l d0,DosLibrary
- beq TotFail
- rts
- CloseLibs:
- move.l _AbsExecBase,a6 ;Be certain we have exec library
- move.l DosLibrary,a1
- bsr CloseLib
- move.l GraphicsLibrary,a1
- bsr CloseLib ;Close graphics library
- move.l IntuitionLibrary,a1
- bsr CloseLib ;Close intuition library
- rts
- CloseLib:
- move.l a1,d0
- beq.s NotOpen
- jsr _LVOCloseLibrary(a6)
- NotOpen:
- rts
- DoGraphs:
- move.l a6,-(a7)
- move.l GraphicsLibrary,a6
- move.l MyWindow,a1
- move.l wd_RPort(a1),a1 ;Get rasterport
- move.l a1,MyRP
- move.l #2,d0
- jsr _LVOSetAPen(a6) ;Set back to black
- move.l #0,d1
- move.w SHeight,d3
- subq.w #1,d3
- ext.l d3
- move.l #1,d4
- bsr.s ClrLin
- move.l MyRP,a1
- move.l #3,d0
- jsr _LVOSetAPen(a6)
- move.l MyRP,a1
- move.l #5,d0
- move.l #16,d1
- jsr _LVOMove(a6)
- move.l MyRP,a1
- move.l #0,d0 ;Jam 1
- jsr _LVOSetDrMd(a6)
- move.l MyRP,a1
- lea String,a0
- lea StrEnd,a2
- sub.l a0,a2
- move.l a2,d0
- jsr _LVOText(a6)
- move.l MyRP,a1
- move.l #1,d0 ;Jam 1
- jsr _LVOSetDrMd(a6)
- move.l #50,d5 ;55 0.4 s delays
- bsr DoDelay
- move.l MyRP,a1
- move.l #0,d2
- move.w SHeight,d3
- subq.w #4,d3
- ext.l d3
- DoLine: move.l #SWidth,d0
- move.w SHeight,d1
- ext.l d1
- asr.l #1,d0
- asr.l #2,d1
- movem.l d0-d1/a1,-(a7)
- jsr _LVOMove(a6)
- movem.l (a7)+,d0-d1/a1
- move.l d2,d0
- move.l d3,d1
- movem.l d0-d1/a1,-(a7)
- jsr _LVODraw(a6)
- moveq.l #1,d5 ;1 0.4 s delay between lines
- bsr DoDelay
- movem.l (a7)+,d0-d1/a1
- addq.l #8,d2
- cmp.l #SWidth-4,d2
- blt.s DoLine
- move.l (a7)+,a6
- move.l #265,d5
- bsr.s DoDelay
- rts
- ClrLin: movem.l d1/a1,-(a7)
- move.l d4,d0
- jsr _LVOMove(a6)
- movem.l (a7)+,d1/a1
- movem.l d1/a1,-(a7)
- move.l #SWidth-1,d0
- jsr _LVODraw(a6)
- movem.l (a7)+,d1/a1
- addq.l #1,d1
- subq.l #1,d3
- bne.s ClrLin
- rts
- DoDelay:
- movem.l d1/a6,-(a7)
- SrtDel: move.l #20,d1 ;Allow 1/2 s per loop
- move.l DosLibrary,a6
- jsr _LVODelay(a6)
- subq.l #1,d5 ;Count down outer loop
- bne.s SrtDel
- movem.l (a7)+,d1/a6
- rts
-
- dseg
-
- InitSP: dc.l 0
- MyRP: dc.l 0
- MyNewWindow:
- dc.l 0
- MyWindow:
- dc.l 0
- IntuitionLibrary:
- dc.l 0
- GraphicsLibrary:
- dc.l 0
- DosLibrary:
- dc.l 0
- SHeight:
- dc.w 100
- IntuitionName:
- dc.b 'intuition.library',0
- GraphicsName:
- dc.b 'graphics.library',0
- DosName:
- dc.b 'dos.library',0
- String:
- dc.b ' A> Spreadsheets R us.'
- StrEnd: dc.b 0
- END
-
-