Register - Login
Views: 99322703
Main - Memberlist - Active users - Calendar - Wiki - IRC Chat - Online users
Ranks - Rules/FAQ - Stats - Latest Posts - Color Chart - Smilies
04-21-22 08:13:17 AM
Jul - General Chat - mov eax, fail New poll - New thread - New reply
Next newer thread | Next older thread
Rena
I had one (1) message in Discord deleted and proceeded to make a huge, huge mess about how it was a violation of free speech and how moderators are supposed to be spam janitors and nobody should have the right to tell me not to talk about school shootings
Level: 135


Posts: 3732/5390
EXP: 29043353
For next: 291652

Since: 07-22-07

Pronouns: he/him/whatever
From: RSP Segment 6

Since last post: 330 days
Last activity: 330 days

Posted on 10-13-10 09:22:13 PM Link | Quote
10-13-10 04:22:13 PM
Post #3732
So I was in assembly class today writing some code. Let me start by describing the process I go through at the beginning of each class.
1) Turn on computer, plug in USB stick.
2) Wait.
3) Wait.
4) Wait.
5) Log in.
6) Wait.
7) Wait.
8) Wait.
9) Merge registry file to restore the settings for Textpad so it will actually work and not pop up nag boxes.
10) Turn on line numbers again, hoping it'll work this time. It doesn't.
11) Begin coding for an assembler that has to be at least 10 years old.

In class we talk about how things work in "real mode" back in the days of DOS, how you'd write to specific memory ranges to display things and read from some register to access the keyboard... you'd expect, then, we'd use a DOS emulator, but no. The programs run directly on Windows 7, using some third-party library to do most of the work.

The assembler is just the most retarded thing you've ever seen. Some fun details:
You define a string like:
mystring BYTE "this is a string lala",
" more text...", 0

you cannot, however, do this:
mystring BYTE
"this is the first of",
"several lines",0

nor this:
mystring BYTE "",
"here's another long string", 0

the string has to begin on the same line as the name and cannot contain any empty strings, thus throwing any alignment of multi-line strings out the window. There's also an unspecified maximum string length, even though you just leave the null off the end and do
mystring BYTE "some long string... "
mystring2 BYTE "that continues here...", 0


If you want to declare an array?
myarray BYTE 10 DUP(5)
hell, I don't even remember whether this does 10 bytes with value 5 or 5 with value 10.

Hex values end with 'h' and can't start with a letter. So 99h is fine, 0A1h is fine, A1h is not.

Procedure declarations blatantly violate the DRY principle and are also just syntactically backward and inconsistent:
myproc PROC
...some code...
myproc ENDP
END myproc


The entire system runs with a series of batch files that call more batch files that generate temporary batch files in your working directory and don't delete them when finished.


Now, my two favourite issues I've found so far were both found today. The assignment was to take a simple program like:
main PROC
...some code...
main ENDP
END main

and add some more procedures to it. So I add a couple and suddenly, my program isn't doing anything. It assembles without error, but just exits without doing anything. I strip it down to just:
myproc PROC
ret
myproc ENDP
END myproc

main PROC
...some code that just prints a string and exits...
main ENDP
END main

and still, it does nothing.

About this time, the professor just so happens to explain:

Oh by the way, don't copy the "END main" line to your other procedures. That tells it to ignore the remainder of the file.
So... we not only have to tell it where the end of the file is and which function is the entry point... but it doesn't even give a warning if this is done more than once.

I literally stood up, walked to the front of the room, bashed my head into the wall, and sat back down.

So after more coding, I found that once again, my program stopped doing anything. In fact, some variables were getting corrupted. I had a routine that was simply:

get_screen_size PROC
push dx
call GetMaxXY
mov ysize, dh
mov xsize, dl
pop dx
ret
get_screen_size ENDP


GetMaxXY worked fine, but the variables somehow ended up being zero. I found that this problem disappeared if I removed the push and pop surrounding the routine. So I added another call immediately after to dump the register state to see what the heck it was doing.

The program aborted without doing anything.

I got the prof to check it out and he too couldn't see what could possibly be wrong, and we fiddled around for a while until we finally discovered the problem.

The assembler doesn't assemble "pop dx" correctly. It corrupts the stack any time you try to pop a 16-bit value. Somehow, this bug hadn't been noticed before.



You'll never guess who wrote this assembler...


Microsoft.

____________________



[loading witty comment...]
devin

Yoshi
i'm mima irl
Level: 112


Posts: 1597/3519
EXP: 14914502
For next: 423703

Since: 04-29-08

Pronouns: any
From: FL

Since last post: 294 days
Last activity: 6 days

Posted on 10-13-10 09:41:48 PM Link | Quote
x86 sucks, MIPS assembly supremacy

____________________
Aerakin
Ye Olde Layout
Level: 98


Posts: 2164/2550
EXP: 9465433
For next: 188920

Since: 07-06-07

From: From the future

Since last post: 8.0 years
Last activity: 1.2 years

Posted on 10-13-10 09:47:38 PM Link | Quote
Originally posted by THE GREAT SALAMI CAPER
x86 sucks



yes, YES, YES
Joe
Common spammer
🍬
Level: 111


Posts: 1536/3392
EXP: 14485069
For next: 383291

Since: 08-02-07

From: Pororoca

Since last post: 10 hours
Last activity: 8 hours

Posted on 10-13-10 10:49:28 PM Link | Quote
Originally posted by THE GREAT SALAMI CAPER
x86 sucks, MIPS assembly supremacy
I agree absolutely and I've only ever written one instruction other than nop in x86 assembly (mov eax,0x00000411).

I haven't done much more than that in MIPS assembly but the opcodes are so simple I translated them to machine code by hand. And used it to crash Paper Mario. (Now if I could just get the other crash screen to show up...)

____________________
Xkeeper

Level: 263


Posts: 17927/25343
EXP: 296637534
For next: 2322919

Since: 07-03-07

Pronouns: they/them/????????

Since last post: 6 days
Last activity: 5 hours

Posted on 10-13-10 10:56:41 PM Link | Quote
I'll be honest and simply stick the problem to the fact you're using a duct-taped solution involving a bunch of bullshit instead of, say, real tools

That class is a failure.

____________________
Lyskar
12210
-The Chaos within trumps the Chaos without-
Level: 192


Posts: 6674/12211
EXP: 99211518
For next: 662053

Since: 07-03-07

From: 52-2-88-7

Since last post: 7.4 years
Last activity: 7.3 years

Posted on 10-13-10 11:02:31 PM Link | Quote
Stats
Time/Date
10-13-10 05:02:31 PM
Posts
6674
Days Here
1198
Level
119
Metal_Man88's Post
I'm doing a class where the tools are a bit better. Also if you use \ you can create new lines, like blah db 'I am a string', \
' on multiple lines'

TASM migth to the job better, I can throw that to you if needed.

It helps that the professor who made the class actually worked in Assembly and we're using actually DOS/DOS emulation instead of Vista... ...just too bad the prof died and someone only half as good as he is is teaching it...

____________________

Eisnaught - SSQ² - Mobius Roleplay - SSS
Next newer thread | Next older thread
Jul - General Chat - mov eax, fail New poll - New thread - New reply


Rusted Logic

Acmlmboard - commit 47be4dc [2021-08-23]
©2000-2022 Acmlm, Xkeeper, Kaito Sinclaire, et al.

30 database queries.
Query execution time: 0.114694 seconds
Script execution time: 0.017061 seconds
Total render time: 0.131755 seconds