Scr # 100 0 ( Port setup and variables ) 1 DECIMAL 2 3 54016 CONSTANT PORTA 4 54018 CONSTANT PACTL 5 6 : PORTSET ( -- ) 7 PACTL C@ DUP 4 - PACTL C! 8 16 PORTA C! PACTL C! ; 9 10 128 VARIABLE SERVO 11 120 VARIABLE OPULSE 12 150 VARIABLE TOP 13 14 : LABEL 0 VARIABLE -2 ALLOT ; 15 --> Scr # 101 0 ( Driver routine ) 1 HEX ASSEMBLER 2 100 DP C@ - ALLOT ( PAGE BNDRY ) 3 4 LABEL DRIVER ( -- ) 5 OPULSE LDX, INX, 6 10 # LDA, PORTA STA, 7 BEGIN, NOP, NOP, DEX, EQ 8 UNTIL, ( END FIXED LENGTH ) 9 SERVO LDX, INX, 10 BEGIN, NOP, NOP, NOP, NOP, 11 DEX, EQ 12 UNTIL, ( END VARIABLE LENGTH ) 13 0 # LDA, PORTA STA, 14 E463 @ JMP, ( EXIT VBLANK ) 15 --> Scr # 102 0 ( Oscillating Demo ) 1 DECIMAL 2 3 : DEMO ( -- ) 4 PORTSET 5 0 54286 C! DRIVER 548 ! 6 64 54286 C! ( INSTALL VBI RTN ) 7 BEGIN TOP @ 0 8 DO I SERVO C! 9 100 0 DO LOOP ( DELAY ) 10 LOOP 11 0 TOP @ 12 DO I SERVO C! 13 100 0 DO LOOP ( DELAY ) 14 -1 +LOOP ?TERMINAL 15 UNTIL ; Scr # 103 0 ( Keyboard control demo ) 1 2 : KEYBOARD ( -- ) 3 TOP @ 2 / SERVO ! 4 BEGIN 5 764 C@ > R 255 764 C! 6 SERVO C@ 7 R 6 = 8 IF 1 + 9 ELSE R 7 = 10 IF 1 - 11 ENDIF 12 ENDIF 0 MAX TOP @ MIN 13 SERVO ! 14 R > 22 = 15 UNTIL ;
Back to previous page