71 lines
1.5 KiB
Plaintext
71 lines
1.5 KiB
Plaintext
( tests/draw )
|
|
|
|
%RTN { JMP2r }
|
|
%RTN? { JMP2r? }
|
|
%ABS { DUP #07 SHR #ff SWP MUL? }
|
|
%ABS2 { DUP2 #000f SFT2 #ffff SWP2 SWP POP MUL2? }
|
|
|
|
;cursor { x 2 y 2 }
|
|
;a { x 2 y 2 }
|
|
;b { x 2 y 2 }
|
|
;s { x 2 y 2 }
|
|
;d { x 2 y 2 }
|
|
;err { short 2 }
|
|
;err2 { short 2 }
|
|
;i { byte 1 }
|
|
;color { byte 1 }
|
|
|
|
|0100 @RESET
|
|
|
|
#0020 #0020 #0070 #0080 #01 ,draw-line JSR2
|
|
#0020 #0080 #0070 #0030 #02 ,draw-line JSR2
|
|
#00a0 #0020 #0050 #00b0 #03 ,draw-line JSR2
|
|
#00b0 #0090 #0030 #0010 #01 ,draw-line JSR2
|
|
|
|
BRK
|
|
|
|
@draw-line ( x1 y1 x2 y2 )
|
|
|
|
=color
|
|
=b.y =b.x =a.y =a.x
|
|
~b.x ~a.x SUB2 ABS2 =d.x
|
|
~b.y ~a.y SUB2 ABS2 #0000 SWP2 SUB2 =d.y
|
|
#ffff #00 ~a.x ~b.x LTS2 #0002 MUL2 ADD2 =s.x
|
|
#ffff #00 ~a.y ~b.y LTS2 #0002 MUL2 ADD2 =s.y
|
|
~d.x ~d.y ADD2 =err
|
|
|
|
$loop
|
|
|
|
~a.x =Screen.x ~a.y =Screen.y ~color =Screen.color
|
|
,$end ~a.x ~b.x EQU2 ~a.y ~b.y EQU2 #0101 EQU2 JMP2?
|
|
~err #0002 MUL2 =err2
|
|
|
|
,$skipy ~err2 ~d.y LTS2 JMP2?
|
|
~err ~d.y ADD2 =err
|
|
~a.x ~s.x ADD2 =a.x
|
|
$skipy
|
|
|
|
,$skipx ~err2 ~d.x GTS2 JMP2?
|
|
~err ~d.x ADD2 =err
|
|
~a.y ~s.y ADD2 =a.y
|
|
$skipx
|
|
|
|
,$loop JMP2
|
|
|
|
$end
|
|
|
|
RTN
|
|
|
|
|c000 @FRAME
|
|
|d000 @ERROR
|
|
|
|
|FF00 ;Console { pad 8 char 1 byte 1 short 2 }
|
|
|FF10 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
|
|
|FF20 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|
|
|FF30 ;Controller { buttons 1 }
|
|
|FF40 ;Keys { key 1 }
|
|
|FF50 ;Mouse { x 2 y 2 state 1 chord 1 change 1 }
|
|
|FF60 ;File { pad 8 name 2 length 2 load 2 save 2 }
|
|
|
|
|FFF0 .RESET .FRAME .ERROR ( vectors )
|
|
|FFF8 [ 13fd 1ef3 1bf2 ] ( palette ) |