0
woodpecker

any programmers know LMC??

Recommended Posts

Here is what I have so far. I just cant figure out the LMC code for the gaps I have. I'm trying to input information and have it stored in consecutive mailboxes every input, when 999 is input the program runs. (Basically writing a program loader)


88 INP 901 ; input a value

89 SUB 97 297 ; subtract 999

90 BRZ 01 701 ; done loading, jump to 01 for execution

91 ADD 97 197 ; Restored the instruction by adding 999 back to the calculator

92 STO 01 301 ; store to 01, 02, 03, and so on

93 LDA 92 592 ; load the store instruction’s current value to calculator

94 … ; increment value in calculator by 1

95 … ; modify the store instruction in 92

96 … ; jump back to get another instruction from in basket

97 DAT 999 999 ; value 999 for testing

98 DAT 001 001 ; value 1 for incrementing store index
SONIC WOODY #146

There is a fine line between cockiness and confidence -- which side of the line are you on?

Share this post


Link to post
Share on other sites


LOOP : INPUT // input into acc
STORE temp // Save to temp location
SUB sentinel // check to see if 999
BZ start // YES so goto START
LOAD temp // get the number back from temp
STORE *location // save to mailbox saved in location
ADD one // increment the location pointer
STORE location // save the location pointer
BR loop // get the next input
HALT // end of program

//DATA
one DAT 01 //constant 1
sentinel DAT 999 //constant 999

//VARIBLES
temp DAT //temprary store
location DAT 01 // location pointer, starts as 1




Actually, you should also put a check into ensure that you dont input too many values or you will walk all over your original code and data..

(.)Y(.)
Chivalry is not dead; it only sleeps for want of work to do. - Jerome K Jerome

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

0