Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Alright, I fail at this.

Name: Anonymous 2007-02-24 0:19 ID:Ap4Fgg3r

For a class I'm taking, we're working with some simplified coding, to learn how the machine handles memory.  Our assignment now seems simple: Create a program that takes in three values, and outputs the highest.  Easy in any other programming language I've ever done, but we have to do it in Visible Virtual Machine (http://www.cba.uri.edu/faculty/vvm/)

So we have the commands:
ADD (Add number)
SUB (Subtract number)

BRP (Branch if positive)
BRZ (Branch if zero)
BR  (Branch)

DAT (data)
HLT (Halt, stop)
IN (Input)
LDA (Load accumulator)
OUT (Output)
STO (Store)

So, I figure, it'll have to be something like
IN
STO 97
IN
STO 98
IN
STO 99
LDA 97
SUB 98
BRP xx
LDA 97
SUB 99
BRP xx
LDA 98
SUB 99
BRP xx

So basically, it gets three numbers, subtracts the second from the first, and branches to.. Somewhere, if it's positive (Meaning the first is bigger.)  Then the same with the first and third, then second and third.  After that, I'm completely confused.

Has anyone else here done something like this, and are possibly able to help me?  I don't need the exact program, just some direction. >_>;

Name: Anonymous 2007-02-24 1:09 ID:U36DelIW

1) Compile the required code in C/C++
2) Use a debugger to observe the code generated in assembly
3) Convert the ASM to fit your VM opcodes
4) ???
5) Profit

Name: Anonymous 2007-02-24 1:19 ID:cVQf8hQM

what you have:

if A > B
  output A;
  release.
if A > C
  output A;
  release.
if B > C
  output B;
  release.
output C.
release.


what you want:

if A > B if A > C
  output A;
  release.
if B > A if B > C
  output B;
  release.
output C.
release.

Name: Anonymous 2007-02-24 1:36 ID:VvSPNaGb

THIS VMM SHIT SUCKS
FUCKING SERIOUSLY
THERE IS NO IMMEDIATE OR INDIRECT ADDRESSING MODES
WTF IS THIS, 1972????

Real machine languages aren't this demented.

Anyway, you need to allocate another location to hold the highest number 'so far'.

LDA 97 // first number
SUB 98 // second number
BRP SECOND_IS_HIGHER
// First is higher
// so load it again and store it in a temporary location
LDA 97
STA 90
JMP CHECK_NEXT
SECOND_IS_HIGHER:
LDA 98
STA 90

CHECK_NEXT:
// 90 now has the highest number between 97 and 98
// Next task is to compare 90 with 99
// whichever is highest is highest number
LDA 90
SUB 99
BRP THIRD_IS_HIGHER
// Earlier number from before is higher
// so output it
OUT 90
HLT // and GTFO

THIRD_IS_HIGHER:
OUT 99
HLT // and GTFO

Name: Anonymous 2007-02-24 1:42 ID:tXfLWgnh

>>4
FUCK NO! You don't need to allocate shit besides the space of the three values.

00 IN
01 STO 99//A
02 IN
03 STO 98//B
04 IN
05 STO 97//C
06 LDA 98//ACC = B
07 SUB 99//ACC = B - A
08 BRP 18//IF B > A
09 LDA 97//ACC = C
10 SUB 99//ACC = C - A
11 BRP 15//IF C > A
12 LDA 99
13 OUT   //OUTPUT A
14 HALT
15 LDA 97
16 OUT   //OUTPUT C
17 HALT
18 LDA 97//ACC = B
19 SUB 98//ACC = C - B
20 BRP 24//IF B > C
21 LDA 98
22 OUT   //OUTPUT B
23 HALT
24 LDA 97
25 OUT   //OUTPUT C
26 HALT

Also, this language sucks cocks. LEARN TO MIPS!

Name: Anonymous 2007-02-24 8:55 ID:Ap4Fgg3r

Fuck win.  You guys are awesome.  Thank you for your help. :x

Name: Anonymous 2007-02-24 11:00 ID:cazPlm9W

XOR ECX, ECX
DEC ECX
a: DESU
LOOP a

Name: Anonymous 2007-02-24 12:57 ID:FkSwu7KN

Name: Anonymous 2007-02-24 17:07 ID:cazPlm9W

Name: Anonymous 2007-02-24 17:30 ID:Heaven

Do your own damn homework, kid.

Name: Anonymous 2007-02-24 21:48 ID:VpX2sXgN

>>1
Too bad Ruby on Rails is slow as fuck.

Name: Anonymous 2007-02-24 22:29 ID:CZwHfbeW

forced Visible Virtual Machine Language of Homeworks, thread over.

Name: Anonymous 2007-06-12 18:54 ID:AKtkPjxJ

Knuth posts here

Name: Anonymous 2007-06-12 19:06 ID:mqhHcLRv

>>13
For real!?

Name: Anonymous 2007-06-12 23:07 ID:Heaven

>>14

there is no way in fucking hell knuths posts here.

Name: DEK 2007-06-13 2:30 ID:8UAkpsTe

>>15

Says who?

Name: Anonymous 2007-06-13 4:42 ID:d1YkjiuA

>>16
Ronald Knuuth. Brother of Anal Touring

Name: Donald Knuth 2007-06-13 4:51 ID:3/uPfQyM

I do post here; however, I was not a namefag so I went as Anonymous. I'm an EXPERT PROGRAMMER who wrote entire typesetting systems which you couldn't comprehend in a million years at the age of 3. I wrote books containing every single algorithm you'll misunderstand and implement in a broken, inefficient way over and over in every lame attempt of a program you write. I know all this, for I am an EXPERT PROGRAMMER.

Name: George Zimmer 2007-06-13 7:51 ID:QECBR89/

I do post here; however, I was not a namefag so I went as Anonymous. I'm an EXPERT ENTREPRENEUR who started entire wearhouses which you couldn't comprehend in a million years at the age of 3. I wrote books containing every single piece of underwear you'll misuse and wear in a broken, inefficient way over and over in every lame attempt of getting laid. I know all this, for I am an EXPERT ENTREPRENEUR.

I guarantee it.

Name: Anonymous 2007-06-13 12:59 ID:Heaven

>>19
gtfo

Name: Anonymous 2007-06-13 13:57 ID:EzMESqjw

>>19
I laughed

Name: Anonymous 2009-01-14 12:25

LISP

Name: Anonymous 2009-02-25 7:05

Ruby is a toy?

Name: Anonymous 2010-06-25 14:51

WARNING: NECRO POST

Name: Anonymous 2010-12-22 14:40

Name: Anonymous 2011-02-03 7:55

Name: Anonymous 2011-02-04 15:36

Name: Anonymous 2012-03-23 23:40

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

All work and no play makes Jack a dull boy

Name: Sgt.Kabuࣥ갡kiman腿 2012-05-28 22:54

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List