Difference between revisions of "VDUV"

From BeebWiki
Jump to: navigation, search
(Initial page.)
 
m (Updated.)
Line 35: Line 35:
 
   .newvduvec
 
   .newvduvec
 
   BCS plotexit                  :\ VDU 23,nn
 
   BCS plotexit                  :\ VDU 23,nn
   PHA                            :\ Start by converting coordinates
+
   \ Start by converting the coordinates
   LDA &361:BNE plotcoords       :\ already adjusted
+
   LDY &361:PHA:BNE plotcoords   :\ already adjusted
   LDX #&20:LDY #&0C:JSR plotadd  :\ plot=plot+origin
+
   LDY #&0C:AND #4:BNE plotabs   :\ plot absolute, add origin
  PLA:PHA:AND #4:BNE plotabs     :\ already absolute
+
   LDY #&24                       :\ plot relative, add last
   LDX #&20:LDY #&24:JSR plotadd  :\ plot=plot+last
 
 
   .plotabs
 
   .plotabs
 +
  LDX #&20:JSR plotadd          :\ plot=plot+base
 
   \ If needed, scale the coordinates here
 
   \ If needed, scale the coordinates here
 
   \ For instance, this scales X from 0-2N to 0-N
 
   \ For instance, this scales X from 0-2N to 0-N

Revision as of 14:59, 26 September 2024

Specification

This vector is called by the VDU drivers to pass on unknown VDU sequences from VDU 23 and VDU 25 (PLOT). It can be used to implement extra PLOT calls, PLOT functions in non-graphics MODEs, and additional VDU 23 calls. The Graphics Extension ROM claims VDUV to provide its additional VDU calls. PLOT calls &F0-&FF and VDU 23 calls 28-31 are always passed to VDUV.

 On entry:
   CC=Unknown PLOT command
   CS=Unknown VDU 23 sequence
    A=PLOT number or VDU 23 number
   All registers can be trashed by the handler

CC - PLOT command

 &031F   = PLOT number, also in A
 &0320,1 = PLOT X
 &0322,3 = PLOT Y
 &0324,5 = last X
 &0326,7 = last Y
 &0314,5 = previous X
 &0316,7 = previous Y
 &0361   = 0:coords not converted, <>0:coords already adjusted

The various VDU workspace locations contain the coordinates of the PLOT command and the previous locations to use when drawing lines or shapes. On entry, if &0361 contains &00 the coordinates need to be translated by adding to the graphics origin and converting relative coordinates to absolute coordinates. If &0361 is non-zero, the coordinates have already been converted.

Before exit, the coordinates need be be cycled, with LAST copied to PREVIOUS and PLOT copied to LAST, ready for the next PLOT call.

The following is skeleton code.

 .newvduvec
 BCS plotexit                   :\ VDU 23,nn
 \ Start by converting the coordinates
 LDY &361:PHA:BNE plotcoords    :\ already adjusted
 LDY #&0C:AND #4:BNE plotabs    :\ plot absolute, add origin
 LDY #&24                       :\ plot relative, add last
 .plotabs
 LDX #&20:JSR plotadd           :\ plot=plot+base
 \ If needed, scale the coordinates here
 \ For instance, this scales X from 0-2N to 0-N
 LDX #0
 LDA &321,X:ASL A:ROR &321,X:ROR &320,X
 \
 .plotcoords
 PLA:AND #3:BEQ plotupdate      :\ %xxxxxx00 - MOVE
 :
 \ PERFORM THE PLOT ACTION HERE
 :
 .plotupdate
 LDX #3
 .plotuplp
 LDA &324,X:STA &314,X          :\ LAST->PREV
 LDA &320,X:STA &324,X          :\ PLOT->LAST
 DEX:BPL plotuplp
 .plotexit
 RTS
 :
 .plotadd
 JSR plotadd2:INX:INX:INY:INY
 .plotadd2
 CLC
 LDA &300,X:ADC &300,Y:STA &300,X
 LDA &301,X:ADC &301,Y:STA &301,X
 RTS

See mdfs.net/blah/blah for sample demo code.

CS - VDU 23 sequence

 &031B command, also in A
 &031C parameter 1
 &031D parameter 2
 &031E parameter 3
 &031F parameter 4
 &0320 parameter 5
 &0321 parameter 6
 &0322 parameter 7
 &0323 parameter 8