[Coco] Setting graphics modes with Assembly
Fedor Steeman
petrander at gmail.com
Tue Dec 23 15:23:56 EST 2008
Thanks, Robert, for the help, and that looks like a very elegant and useful
way to set the display offset.
I have dug up Don Inman's book on assembly language graphics and really
coming to terms with this. I keep on experimenting and learning...
Cheers,
Fedor
2008/12/20 Robert Gault <robert.gault at worldnet.att.net>
> The main "error" is the first JMP $ADFB. Since you want to return to your
> program not Basic, this should be JSR $ADFB. The second use of the ROM
> routine is OK because you do want to return to Basic and therefore should
> use JMP.
>
> $FFC0 is not The clear bit for the SAM rather A clear bit. All even bytes
> in that region act as clears, all odd bytes act as sets for a specific
> control toggle.
>
> While it can take more code, it would probably help you to use a generic
> routine to write to the SAM control register where you specify the actual
> control word rather than bytes.
>
> *Enter with regA equal to the 7-bit SAM value, regB = 7, regX=1st SAM byte
> *Leave with SAM set for some video offset
> * $E00/$200=7
> LDA #7 the above result
> JSR SETSAM
> ... Program code
> * Video offset controller for PMODEs
> SETSAM LDB #7 for 7-bit word
> LDX $FFC6 first SAM offset byte
> SAMLUP RORA
> BCC SAM2
> LEAX 1,X
> STA ,X+
> BRA SAM3
> SAM2 STA ,X++
> SAM3 DECB
> BNE SAMLUP
> RTS
>
> The above routine can be used to setup the SAM for any video location
> merely by changing the value in regA. The same type of routine can be used
> to set any SAM mode ($FFC0-$FFC5) just by loading regB with 3 and regX with
> $FFC0.
>
> Fedor Steeman wrote:
>
>> Hi all,
>>
>> I have been studying Chris Lomont's reference guide and, combined with
>> your
>> help, I am starting to come to grips with it. One thing I don't get yet,
>> though, is how to switch from one graphics mode to another. I tried simply
>> appending the following to the already written code, but that doesn't do
>> anything noticeable:
>>
>>
>> LDA #$E8 * load 1110 1000
>> STA VDGSET * set pmode 3
>>
>> Also: how to set the equivalent of SCREEN 1,0 / 1,1 commands?
>>
>> This is my complete code so far:
>>
>> TXTSCR EQU $0400 *Start of text screen
>> HIRES1 EQU $E00 *Start of hi-res graphics screen
>> VDGSET EQU $FF22 *PIA1 data port B: VDG Control output
>> V0CLR EQU $FFC0 *Clear bit for Sam Chip (Graphics mode)
>> V1SET EQU $FFC3 *Set V1 bit in Sam Chip (Graphics mode)
>> V2SET EQU $FFC5 *set V2 bit in Sam Chip (Graphics mode)
>> F0CLR EQU $FFC6 *Display Offset Binary, This is the CLR Bit
>> (Video page offset)
>> F0SET EQU $FFC7
>> F1SET EQU $FFC9
>> F2SET EQU $FFCB
>> POLCAT EQU $A000 *Color Basic rom poll keyboard routine
>>
>> ORG $7000
>> START LDX #HIRES1
>> LDD #$AAAA
>> LOOP1 STD ,X++
>> CMPX #HIRES1+$1800
>> BCS LOOP1
>> GMODE STA V0CLR * set graphics mode
>> STA V1SET * set graphics mode
>> STA V2SET * set graphics mode
>> LDA #$F8 * load 1111 1000
>> STA F0SET * set graphics mode
>> STA F1SET * set graphics mode
>> STA F2SET * set graphics mode
>> STA VDGSET * set pmode 4 equivalent
>> JMP $ADFB * wait for keypress
>> LDA #$E8 * load 1110 1000
>> STA VDGSET * set pmode 3 equivalent?
>> JMP $ADFB
>> END START
>>
>> Thanks for any input!
>>
>> Cheers,
>> Fedor
>>
>> --
>> Coco mailing list
>> Coco at maltedmedia.com
>> http://five.pairlist.net/mailman/listinfo/coco
>>
>>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
>
More information about the Coco
mailing list