-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscribe.s
95 lines (95 loc) · 2.09 KB
/
scribe.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
* scribe.s
* 2001-06-16
* Daniel Lidström
* www.ite.mh.se/~danli97/
::
RECLAIMDISP clear display
TURNMENUOFF turn off menu
CODE
* status flags to signal increase or decrease
sINCX EQU 0
sINCY EQU 1
* start position
XSTART EQU 65
YSTART EQU 32
GOSBVL =SAVPTR save pointers
INTOFF turn off maskable interrupts
GOSBVL =D0->Row1 A[A] & D0 -> start of screen
R0=A save in R0[A]
C=0 A
LC(2) XSTART x
B=C A B[A] = x coordinate
LC(2) YSTART y
D=C A D[A] = y coordinate
ST=1 sINCX set movement to up-right
ST=0 sINCY
loop C=D A calculate 34*y
C=C+C A
A=C A
CSL A
A=A+C A A[A] = 34*y
C=B A calculate no. of horizontal nibbles
CSRB.F A
CSRB.F A C[A] = hor. nibbles
C=C+A A
A=R0 get screen address
C=C+A A
D0=C D0 -> correct nibble in screen
C=B A compute pixel mask
A=C A
LC(1) 3
A=A&C P
C=0 A
C=C+1 A assume pixel mask is 1
A=A-1 P done?
GOC + >-----+ yes, write pixel
C=C+C P | no, shift left one
A=A-1 P | done?
GOC + >-----+ yes, write pixel
C=C+C P | no, shift left one
A=A-1 P | done?
GOC + >-----+ yes, write pixel
C=C+C P | no, shift left one
+ A=DAT0 P <-----+ read current nibble
A=A!C P OR in new pixel
DAT0=A P write new nibble to screen
B=B+1 A assume x is increasing
?ST=1 sINCX assumption correct?
GOYES + >---+ yes
B=B-1 A | no, decrease two
B=B-1 A | to compensate +1
GONC ++ >---|-+ no carry means x>=0
B=0 A | | x is -1
B=B+1 A | | set x to 1
ST=1 sINCX | | signal x increasing now
GOTO ++ >---|-+ test y
+ LC(2) 130 <---+ | check max x
?C>B A | x below max?
GOYES ++ >-----+ yes, test y
ST=0 sINCX | signal x decreasing now
++ D=D+1 A <-----+ comments here are the same as for x
?ST=1 sINCY
GOYES +
D=D-1 A
D=D-1 A
GONC ++
D=0 A
D=D+1 A
ST=1 sINCY
GOTO ++
+ LC(2) 63
?C>D A
GOYES ++
ST=0 sINCY
++ LCHEX 1FF load all keys
OUT=C
GOSBVL =CINRTN read keys
?C#0 B got any keys?
GOYES exit yes, exit
GOTO loop no, continue loop
exit INTON turn on maskable interrupts
GOVLNG =GETPTRLOOP restore rpl pointers, exit
ENDCODE
FLUSH flush keyboard
;