pdp-11

program on Assembly

南楼画角 提交于 2019-12-11 05:29:33
问题 can somebody please explain what this program is doing? .= torg + 1000 main: mov pc, sp tst –(sp) mov #list1, -(sp) jsr pc, mystery mov r0, res1 tst (sp)+ mov #list2, -(sp) jsr pc, mystery mov r0, res2 tst (sp)+ halt mystery: mov r1, -(sp) mov r4, -(sp) mov r5, -(sp) clr r0 mov 10(sp), r4 mov r4, r5 loop: mov r4, r1 jsr pc, next mov r1, r4 beq return mov r5, r1 jsr pc, next jsr pc, next mov r1, r5 beq return cmp r4, r5 beq setret br loop setret: inc r0 return: mov (sp)+, r5 mov (sp)+, r4 mov

Encoding/decoding PDP-11 assembly language to binary and hex?

依然范特西╮ 提交于 2019-12-08 08:08:09
问题 I've been given an assignment where I'm to write the actionPreformed methods for Encode and Decode buttons for an application where a user can hypothetically encode/decode PDP-11 instructions (that are limited to ADD , SUB , MOV[B] , CMP[B] ). The application is supposed to be able to take a 4 digit hex number or a 16 digit binary and decode it to assembly, or enter one of the assembly instructions and encode it to binary/hex. This is all rather new to me and I can't seem to wrap my head

Is “for(;;)” idiom for infinite loop correctly attributed to PDP-11 C compiler?

大兔子大兔子 提交于 2019-12-06 20:18:47
问题 Recently I found this article that claims that the idea to prefer for(;;) over while(1) for infinite loop came because the C compiler originally available on PDP-11 generated an extra machine instruction for while(1) . Btw now even Visual C++ warnings tend to favor the former. How realistic is such attribution of for(;;) idiom? 回答1: Here's what the V7 Unix compiler cc produces (using SIMH and an image from TUHS): $ cat>a.c main(){ while(1); } $ cat>b.c main(){ for(;;); } $ cc -S a.c $ cc -S b

Is “for(;;)” idiom for infinite loop correctly attributed to PDP-11 C compiler?

▼魔方 西西 提交于 2019-12-05 01:42:40
Recently I found this article that claims that the idea to prefer for(;;) over while(1) for infinite loop came because the C compiler originally available on PDP-11 generated an extra machine instruction for while(1) . Btw now even Visual C++ warnings tend to favor the former . How realistic is such attribution of for(;;) idiom? Here's what the V7 Unix compiler cc produces (using SIMH and an image from TUHS ): $ cat>a.c main(){ while(1); } $ cat>b.c main(){ for(;;); } $ cc -S a.c $ cc -S b.c a.c ( while ) compiles to: .globl _main .text _main: ~~main: jsr r5,csv jbr L1 L2:L4:tst $1 jeq L5 jbr