mirror of
https://github.com/mikpe/pdp10-tools.git
synced 2026-04-14 23:58:09 +00:00
rename pdp10_extint.erl to extint.erl
This commit is contained in:
@@ -157,7 +157,7 @@ dot_byte_image(#s_dot_byte{exprs = Exprs}, Tunit, SectionName, Dot) ->
|
||||
|
||||
dot_long_image(#s_dot_long{exprs = Exprs}, Tunit, SectionName, Dot) ->
|
||||
integer_data_directive(Exprs, Tunit, SectionName, Dot, _Size = 4, _Context = long,
|
||||
fun pdp10_extint:uint36_to_ext/1).
|
||||
fun extint:uint36_to_ext/1).
|
||||
|
||||
integer_data_directive(Exprs, Tunit, SectionName, Dot, Size, Context, ValueToExt) ->
|
||||
{ok, {Values, Relocs}} = exprs_values(Exprs, Tunit, SectionName, Dot, Size, Context),
|
||||
@@ -165,17 +165,17 @@ integer_data_directive(Exprs, Tunit, SectionName, Dot, Size, Context, ValueToExt
|
||||
|
||||
dot_short_image(#s_dot_short{exprs = Exprs}, Tunit, SectionName, Dot) ->
|
||||
integer_data_directive(Exprs, Tunit, SectionName, Dot, _Size = 2, _Context = short,
|
||||
fun pdp10_extint:uint18_to_ext/1).
|
||||
fun extint:uint18_to_ext/1).
|
||||
|
||||
%% TODO: merge with .short handling?
|
||||
dot_2byte_image(#s_dot_2byte{exprs = Exprs}, Tunit, SectionName, Dot) ->
|
||||
integer_data_directive(Exprs, Tunit, SectionName, Dot, _Size = 2, _Context = short,
|
||||
fun pdp10_extint:uint18_to_ext/1).
|
||||
fun extint:uint18_to_ext/1).
|
||||
|
||||
%% TODO: merge with .long handling?
|
||||
dot_4byte_image(#s_dot_4byte{exprs = Exprs}, Tunit, SectionName, Dot) ->
|
||||
integer_data_directive(Exprs, Tunit, SectionName, Dot, _Size = 4, _Context = long,
|
||||
fun pdp10_extint:uint36_to_ext/1).
|
||||
fun extint:uint36_to_ext/1).
|
||||
|
||||
insn_image(Stmt, Tunit, SectionName, Dot) ->
|
||||
#s_insn{ high13 = High13
|
||||
@@ -188,7 +188,7 @@ insn_image(Stmt, Tunit, SectionName, Dot) ->
|
||||
((case At of true -> 1; false -> 0 end) bsl (36 - 14)) bor
|
||||
((Index band ((1 bsl 4) - 1)) bsl (36 - 18)) bor
|
||||
(Address band ((1 bsl 18) - 1))),
|
||||
{ok, {pdp10_extint:uint36_to_ext(Word), Dot + 4, Relocs}}.
|
||||
{ok, {extint:uint36_to_ext(Word), Dot + 4, Relocs}}.
|
||||
|
||||
exprs_values(Exprs, Tunit, SectionName, Dot, Size, Context) ->
|
||||
exprs_values(Exprs, Tunit, SectionName, Dot, Size, Context, [], []).
|
||||
|
||||
@@ -303,10 +303,10 @@ uint9_image(Uint9) ->
|
||||
Uint9 band 511.
|
||||
|
||||
uint18_image(Uint18) ->
|
||||
pdp10_extint:uint18_to_ext(Uint18).
|
||||
extint:uint18_to_ext(Uint18).
|
||||
|
||||
uint36_image(Uint36) ->
|
||||
pdp10_extint:uint36_to_ext(Uint36).
|
||||
extint:uint36_to_ext(Uint36).
|
||||
|
||||
image_size(Image) -> image_size(Image, 0).
|
||||
|
||||
|
||||
@@ -296,7 +296,7 @@ outfp_fputw(Word, {c36, IoDev}) ->
|
||||
Bytes = [B0, B1, B2, B3, B4],
|
||||
stdio8:fputs(Bytes, IoDev);
|
||||
outfp_fputw(Word, {h36, OutFP}) ->
|
||||
stdio9:fputs(pdp10_extint:uint36_to_ext(Word), OutFP).
|
||||
stdio9:fputs(extint:uint36_to_ext(Word), OutFP).
|
||||
|
||||
%% Optional debugging output ===================================================
|
||||
|
||||
|
||||
@@ -236,12 +236,12 @@ output_byte(Byte, Input, Relocs, File, GlobalMap, FileMap, FP, FragOffset) ->
|
||||
{error, _Reason} = Error -> Error
|
||||
end.
|
||||
|
||||
buffer_to_word(4, Buffer) -> pdp10_extint:uint36_from_ext(Buffer);
|
||||
buffer_to_word(2, Buffer) -> pdp10_extint:uint18_from_ext(Buffer);
|
||||
buffer_to_word(4, Buffer) -> extint:uint36_from_ext(Buffer);
|
||||
buffer_to_word(2, Buffer) -> extint:uint18_from_ext(Buffer);
|
||||
buffer_to_word(1, [Byte]) -> Byte.
|
||||
|
||||
word_to_buffer(4, Word) -> pdp10_extint:uint36_to_ext(Word);
|
||||
word_to_buffer(2, Word) -> pdp10_extint:uint18_to_ext(Word);
|
||||
word_to_buffer(4, Word) -> extint:uint36_to_ext(Word);
|
||||
word_to_buffer(2, Word) -> extint:uint18_to_ext(Word);
|
||||
word_to_buffer(1, Byte) -> [Byte].
|
||||
|
||||
%% Relocations -----------------------------------------------------------------
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
%%% You should have received a copy of the GNU General Public License
|
||||
%%% along with pdp10-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-module(pdp10_extint).
|
||||
-module(extint).
|
||||
|
||||
-export([ uint18_to_ext/1
|
||||
, uint18_from_ext/1
|
||||
@@ -717,9 +717,9 @@ read_uint9(FP) ->
|
||||
Other -> Other % {ok, _Nonet} or {error, _Reason}
|
||||
end.
|
||||
|
||||
read_uint18(FP) -> read(FP, 2, fun pdp10_extint:uint18_from_ext/1).
|
||||
read_uint18(FP) -> read(FP, 2, fun extint:uint18_from_ext/1).
|
||||
|
||||
read_uint36(FP) -> read(FP, 4, fun pdp10_extint:uint36_from_ext/1).
|
||||
read_uint36(FP) -> read(FP, 4, fun extint:uint36_from_ext/1).
|
||||
|
||||
read(FP, N, ConvFun) when N >= 0 -> read(FP, N, ConvFun, []).
|
||||
|
||||
@@ -741,10 +741,10 @@ write_uint9(FP, UInt9) ->
|
||||
pdp10_stdio:fputc(UInt9, FP).
|
||||
|
||||
write_uint18(FP, UInt18) ->
|
||||
fputs(pdp10_extint:uint18_to_ext(UInt18), FP).
|
||||
fputs(extint:uint18_to_ext(UInt18), FP).
|
||||
|
||||
write_uint36(FP, UInt36) ->
|
||||
fputs(pdp10_extint:uint36_to_ext(UInt36), FP).
|
||||
fputs(extint:uint36_to_ext(UInt36), FP).
|
||||
|
||||
fputs(Nonets, FP) ->
|
||||
pdp10_stdio:fputs(Nonets, FP).
|
||||
|
||||
@@ -110,12 +110,12 @@ store_strings([String | Strings], Mem, Stack, Acc) ->
|
||||
store_strings(Strings, Mem, NewStack, [Pointer | Acc]).
|
||||
|
||||
store_string([B0, B1, B2, B3 | Rest], Mem, Stack) ->
|
||||
Word = pdp10_extint:uint36_from_ext([B0, B1, B2, B3]),
|
||||
Word = extint:uint36_from_ext([B0, B1, B2, B3]),
|
||||
write_word(Mem, Stack, Word),
|
||||
store_string(Rest, Mem, Stack + 4);
|
||||
store_string(Tail, Mem, Stack) ->
|
||||
Pad = lists:duplicate(4 - length(Tail), 0),
|
||||
Word = pdp10_extint:uint36_from_ext(Tail ++ Pad),
|
||||
Word = extint:uint36_from_ext(Tail ++ Pad),
|
||||
write_word(Mem, Stack, Word),
|
||||
Stack + 4.
|
||||
|
||||
@@ -184,7 +184,7 @@ map_zero_core(_Mem, _VAddr, _Size) -> ok.
|
||||
copy_file_to_core(Mem, VAddr, FP, Size) when Size >= 4 ->
|
||||
case read(FP, 4) of
|
||||
{ok, Nonets} ->
|
||||
Word = pdp10_extint:uint36_from_ext(Nonets),
|
||||
Word = extint:uint36_from_ext(Nonets),
|
||||
write_word(Mem, VAddr, Word),
|
||||
copy_file_to_core(Mem, VAddr + 4, FP, Size - 4);
|
||||
{error, _Reason} = Error -> Error
|
||||
@@ -192,7 +192,7 @@ copy_file_to_core(Mem, VAddr, FP, Size) when Size >= 4 ->
|
||||
copy_file_to_core(Mem, VAddr, FP, Size) when Size > 0 ->
|
||||
case read(FP, Size) of
|
||||
{ok, Nonets} ->
|
||||
Word = pdp10_extint:uint36_from_ext(Nonets ++ lists:duplicate(4 - Size, 0)),
|
||||
Word = extint:uint36_from_ext(Nonets ++ lists:duplicate(4 - Size, 0)),
|
||||
write_word(Mem, VAddr, Word);
|
||||
{error, _Reason} = Error -> Error
|
||||
end;
|
||||
|
||||
Reference in New Issue
Block a user