Post Reply 
(42S) Unix permissions (chmod) calculator
11-01-2019, 04:08 PM
Post: #1
(42S) Unix permissions (chmod) calculator
This program calculates and decodes the traditional Unix permission bits in octal form (e.g. 4750, 755...). It uses a series of menus to display the individual bits, with the octal representation in the X register.

To use:

XEQ "CHMOD"

The program will attempt to decode the value in X as an octal value. If that fails, it will begin with 0, i.e. no permission bits set. The octal value should be entered directly in decimal mode, you don't have to switch to octal mode. For example, to decode the value 4640, perform the following steps while in decimal mode:

4640 XEQ "CHMOD"

Use the menus to view and toggle the individual bits.

Main menu:

U - User (Owner)
G - Group
O - Other (World)
SPCL - Special

Press one of these keys to go to the respective submenu and toggle/view the bits in the corresponding class.

User/Group/Other submenu:

R - Read
W - Write
X - Execute

Special submenu:

SU - Set User ID
SG - Set Group ID
STK - "Sticky" bit

In the submenus, a set bit will have a box after its label. Cleared bits will have no box. Press any of the keys to toggle the corresponding bit. The menu and X register will update to reflect the change. Press Exit to go back to the main menu.

Press exit while in the main menu to exit the program.

Code:
00 { 234-Byte Prgm }
01▸LBL "CHMOD"
02 SF 25
03 →DEC
04 FC?C 25
05 CLX
06 4095
07 AND
08 STO 00
09▸LBL 00
10 CLMENU
11 "U"
12 KEY 1 GTO 01
13 "G"
14 KEY 2 GTO 02
15 "O"
16 KEY 3 GTO 03
17 "SPCL"
18 KEY 4 GTO B
19 KEY 9 GTO 99
20 XEQ 10
21 MENU
22 STOP
23 GTO 00
24▸LBL 01
25 64
26 STO 01
27 R↓
28 GTO A
29▸LBL 02
30 8
31 STO 01
32 R↓
33 GTO A
34▸LBL 03
35 1
36 STO 01
37 R↓
38▸LBL A
39 CLMENU
40 "R"
41 4
42 XEQ 04
43 KEY 1 XEQ 11
44 "W"
45 2
46 XEQ 04
47 KEY 2 XEQ 12
48 "X"
49 1
50 XEQ 04
51 KEY 3 XEQ 13
52 KEY 9 GTO 00
53 XEQ 10
54 MENU
55 STOP
56 GTO A
57▸LBL B
58 512
59 STO 01
60 CLMENU
61 "SU"
62 4
63 XEQ 04
64 KEY 1 XEQ 11
65 "SG"
66 2
67 XEQ 04
68 KEY 2 XEQ 12
69 "STK"
70 1
71 XEQ 04
72 KEY 3 XEQ 13
73 KEY 9 GTO 00
74 XEQ 10
75 MENU
76 STOP
77 GTO B
78▸LBL 04
79 RCL 01
80 ×
81 RCL 00
82 AND
83 X≠0?
84 ├"•"
85 RTN
86▸LBL 10
87 RCL 00
88 →OCT
89 RTN
90▸LBL 11
91 4
92 GTO 14
93▸LBL 12
94 2
95 GTO 14
96▸LBL 13
97 1
98▸LBL 14
99 RCL× 01
100 RCL 00
101 XOR
102 STO 00
103▸LBL 99
104 END


.zip  CHMOD.zip (Size: 305 bytes / Downloads: 1)
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)