[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference 7.286::atarist

Title:Atari ST, TT, & Falcon
Notice:Please read note 1.0 and its replies before posting!
Moderator:FUNYET::ANDERSON
Created:Mon Apr 04 1988
Last Modified:Tue May 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1433
Total number of notes:10312

24.0. "Both resolutions on Screen " by DOOZER::MAUDE (John S. Maude EDU Services Reading UK) Thu Apr 07 1988 13:04

    Hi All,
    
    	Here is my routine to access LOW and MEDIUM resolution at the
    same time : -
    
\	Written in FAST ASM - John S. Maude
\       .___________________________________________________.
\       |               |
\       |               |
\       |       #####   ######  ##      #### #########  |
\       |      ##   ##  ##   ## ##       ##  #   ##  #  |
\       |      ##       ##   ## ##       ##      ##     |
\       |       #####   ######  ##       ##      ##     |
\       |           ##  ##      ##       ##      ##     |
\       |      ##   ##  ##      ##    #  ##      ##     |
\       |       #####   ##      ####### ####    ####    |
\       |               |
\       |               |
\       |               |
\	.___________________________________________________.
\
\ SPLITON  - turn screen split interrupt structure on
\ SPLITOFF - turn screen split interrupt structure off
\ SPLITPOS - move split to line D0 on the screen
\
        ORG $1FFD00     \ Above screen mem, out of the way
\
\ EQUATES
\
xbios   	EQU 14  \ xbios trap #
supexec 	EQU 38  \ execute routine in super mode
xbtimer 	EQU 31  \ set timer
jdisint 	EQU 26  \ disable MFP int.
physbase        EQU 2   \ get physical screen base addr
\
\ SPLITON - start HBL timer interrupt
\
spliton MOVE.L #split,-(SP)     \ HBL routine address
        MOVE.W lines,-(SP)      \ count down LINES lines before int
        MOVE.W #8,-(SP) \ event count mode
        MOVE.W #1,-(SP) \ on timer B
        MOVE.W #xbtimer,-(SP)   \ init timer
        TRAP #xbios     \ using xbios call
        ADD.L #12,SP    \ correct stack
        MOVE.L #splt_rev,-(SP)  \ revector KBD/MIDI vector
        MOVE.W #supexec,-(SP)   \ and VBL vector using a super
        TRAP #xbios     \ routine
        ADD.L #6,SP     \ correct stack
        RTS     \ and return. Interrupt now active.
\
\ SPLITOFF - stop HBL timer interrupt
\
splitoff        MOVE.W #8,-(SP) \ disable interrupt #8 ( timer B )
        MOVE.W #jdisint,-(SP)   \ in MFP
        TRAP #xbios     \ using xbios call
        ADDQ.L #4,SP    \ correct stack
        MOVE.L #splt_unv,-(SP)  \ and , in super mode
        MOVE.W #supexec,-(SP)   \ use unvec to restore default vectors
        TRAP #xbios     \ via xbios
        ADDQ.L #6,SP    \ correct stack
        RTS     \ and return. Interrupt now off.
\
\ SPLITPOS - set position of screen split to line D0
\
splitpos        CMPI.W #8,D0    \ minimum value of D0 is 8
        BLT spos_nd
        CMPI.W #199,D0  \ max value is 199
        BGT spos_nd     \ if outside limits, ignore call
        MOVE.W D0,lines \ save D0
        MOVE.W #physbase,-(SP)  \ get screen address in D0
        TRAP #xbios     \ via xbios call
        ADDQ.L #2,SP    \ tidy stack
        MOVE.L D0,A0    \ screen address now in A0
        MOVE.W lines,D0 \ get lines again
        SUBQ.W #6,lines \ tweak variable for first interrupt
        MULU #160,D0    \ lines*160
        ADD.L A0,D0     \ + base address
        SUB.W #14,D0    \ - 14
        MOVE.W D0,haddr2        \ = the new value of haddr ( loaded
spos_nd RTS     \ on the next VBL

\
\ Revector KBD/MIDI vector to allow interrupts again
\
splt_rev        MOVE.L $118,A0  \ get previous vector
        MOVE.L A0,jump+2        \ and place in jump ( selfmod code )
        MOVE.L #kbvec,$118      \ and then store new vector
        MOVE.L $70,A0   \ then do the same for the VBL
        MOVE.L A0,jump2+2       \ interrupt vector
        MOVE.L #vbvec,$70
        MOVE.B #1,$FFFA03       \ invert active edge
        RTS     \ and return
\
\ New keyboard/midi vector
\
kbvec   MOVE.W #$2500,SR        \ lower interrupt mask priority
jump    JMP splt_rev    \ this jump self-modded by revec
\
\ New VBL vector
\
vbvec   MOVE.W #0,$FF8260       \ switch to low resolution for top 1/2
        MOVE.B lines+1,$FFFA21  \ timer b re-initilized with 1st int.
        MOVE.B #8,$FFFA1B       \ start timer b
        MOVE.L hi4,$FF8240      \ move high palette in
        MOVE.L hi4+4,$FF8244    \ to the lower 4 colours
        MOVE.W haddr2,haddr     \ and set up new value of haddr
jump2   JMP splt_rev    \ this jump self-modded by revec
\
\ SPLT_UNV - restore revectored interrupts
\
splt_unv        MOVE.L jump+2,$118      \ restore previous kbd/midi vector
        MOVE.L jump2+2,$70      \ restore previous vbl vector
        MOVE.B defres,$FF8260   \ reset to default resolution
        RTS     \ and return. Vectors now restored.
\
\ SPLIT - actual horizontal interrupt routine
\
split   MOVE.W D0,-(SP) \ keep D0
        MOVE.B haddr,D0 \ get high byte of haddr
        CMP.B $FF8207,D0        \ and compare with video pointer
        BLS.S split_no  \ smaller ?
        SUBI.B #6,D0    \ check again if within $600
        CMP.B $FF8207,D0        \ is it ?
        BCS.S split_yes \ yes... wait for fine timed routine
split_no        MOVE.W (SP)+,D0 \ get D0 back, and set up an interrupt
        MOVE.B #1,$FFFA21       \ every line now to catch flyback.
        BCLR #0,$FFFA0F \ reset ISR bit in MFP
        RTE     \ and return.
split_yes       MOVE.W #$2700,SR        \ disable interrupts
        MOVE.L A0,-(SP) \ save A0 for later
split_hlp       MOVE.B $FF8207,D0       \ now check the high byte of haddr
        CMP.B haddr,D0  \ against the video pointer
        BCS.S split_hlp \ keep going if not there yet
        MOVEA.L #$FF8209,A0     \ address of fine timing byte in vptr
        MOVE.B haddr+1,D0       \ now check against low byte of haddr
split_llp       CMP.B (A0),D0   \ until the same ( keep looping if
        BCC.S split_llp \ they aren't )
        MOVE.B #1,$FF8260       \ and switch resolutions
        MOVE.L lo4,$FF8240      \ now set up palette
        MOVE.L lo4+4,$FF8244    \ ( lower 4 colours )
        MOVE.L (SP)+,A0 \ restore value of A0
        MOVE.W (SP)+,D0 \ and D0
        MOVE.B #0,$FFFA1B       \ stop timer b to save time ( no more
        BCLR #0,$FFFA0F \ use till next frame ), reset ISR bit
        RTE     \ in MFP, and return
\
\ Variables
\
lines   DC.W 94 \ split position - 6
haddr   DC.W $BE72      \ split position *160 -14 ( +vbase.w )
haddr2  DC.W $BE72      \ alter this one - reloaded in VBL
lo4     DC.W $777,$700,$70,$0   \ 1st 4 colors of top 1/2 palette
hi4     DC.W $777,$700,$70,$0   \ 1st 4 cols of bottom 1/2 palette
defres  DC.W $0 \ default resolution on exit
\
\ END

    John
    
T.RTitleUserPersonal
Name
DateLines