Jump to content

Memory layout of a data structure: Difference between revisions

m
→‎version 2: define all unassigned bits as unassigned (24 pin RS-232 is actually a 25 pin RS-232). -- ~~~~
m (→‎{{header|REXX}}: added version 2. -- ~~~~)
m (→‎version 2: define all unassigned bits as unassigned (24 pin RS-232 is actually a 25 pin RS-232). -- ~~~~)
Line 767:
exit /*stick a fork in it, we're done.*/
/*──────────────────────────────────RS_232 subroutine───────────────────*/
rs_232: arg pins,x; parse arg ,ox; @.= /*x is uppercased when using ARG.*/
@. = '??? unassigned bit' /*assigned default for all bits. */
@.24.1 = 'PG protective ground'
@.24.2 = 'TD transmitted data' ; @.9.3 = @.24.2
Line 778 ⟶ 779:
@.24.9 = '+ positive voltage'
@.24.10 = '- negative voltage'
@.24.11 = 'B11 unassigned bit 11'
@.24.12 = 'SCD secondary CD'
@.24.13 = 'SCS secondary CTS'
Line 785:
@.24.16 = 'SRD secondary RD'
@.24.17 = 'RC receiver clock'
@.24.18 = 'B18 unassigned bit 18'
@.24.19 = 'SRS secondary RTS'
@.24.20 = 'DTR data terminal ready' ; @.9.4 = @.24.20
Line 792 ⟶ 791:
@.24.23 = 'DRS data rate select'
@.24.24 = 'XTC external clock'
select
 
when right(x,1)=='B' then bits= strip(x,'T',"B")
select
when right(x,1)=='BX' then bits= x2b(strip(x,'T',"BX"))
when right(x,1)=='X' thenotherwise bits=x2b(strip d2x(x,'T',"X"))
otherwise end bits=x2b( d2x(x))/*select*/
end /*select*/
 
bits=right(bits,pins,0) /*right justify the pin readings.*/
say; say '───────── For a' pins "pin RS─232 plug, with a reading of: " ox
Cookies help us deliver our services. By using our services, you agree to our use of cookies.