Assembly Isn't That Bad:
Moderator: Coders of Rage
- davidthefat
- Chaos Rift Maniac
- Posts: 529
- Joined: Mon Nov 10, 2008 3:51 pm
- Current Project: Fully Autonomous Robot
- Favorite Gaming Platforms: PS3
- Programming Language of Choice: C++
- Location: California
- Contact:
Assembly Isn't That Bad:
So I thought assembly would be a very hard thing to learn, but surprisingly, it's not bad as all. It is not scary, or anything. I understand it. So why are people so scared of it? BTW, I have only done basic operations and using inline assembly. May be using it more will prove to be a pain. Also personally, I think the AT&T syntax makes more sense.
- Ginto8
- ES Beta Backer
- Posts: 1064
- Joined: Tue Jan 06, 2009 4:12 pm
- Programming Language of Choice: C/C++, Java
Re: Assembly Isn't That Bad:
Assembly isn't hard per se, but if you want to do more complex things, you end up doing a lot more work to do simple things. I haven't done a ton of stuff with assembly, but C at least is probably the lowest amount of abstraction that I'm comfortable with for most things.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
- davidthefat
- Chaos Rift Maniac
- Posts: 529
- Joined: Mon Nov 10, 2008 3:51 pm
- Current Project: Fully Autonomous Robot
- Favorite Gaming Platforms: PS3
- Programming Language of Choice: C++
- Location: California
- Contact:
Re: Assembly Isn't That Bad:
Oh whether I like it or not is not a choice . I'll eventually have to learn it anyway. I plan on double majoring in Computer Engineering and Computer Science and taking extra theoretical physics courses (don't say it is a stupid idea, I want to work on quantum computers, robotics, artificial intelligence, computer architectures, and just anything computer research related) when I go to college. Personally, I am the type that rather take a lego making machine over a ton of legos. If you know what I mean.
- short
- ES Beta Backer
- Posts: 548
- Joined: Thu Apr 30, 2009 2:22 am
- Current Project: c++, c
- Favorite Gaming Platforms: SNES, PS2, SNES, SNES, PC NES
- Programming Language of Choice: c, c++
- Location: Oregon, US
Re: Assembly Isn't That Bad:
This is why:So why are people so scared of it? BTW, I have only done basic operations and using inline assembly.
Code: Select all
;***********************************************************
;*
;* Lab6.asm
;*
;* USART RECEIVER
;*
;***********************************************************
;*
;* Author: Benjamin Adamson
;*
;* Date: February 26, 2011
;*
;***********************************************************
;************************************************************
;* Include files
;************************************************************
.include "m128def.inc" ; Include definition file
;***********************************************************
;* Internal Register Definitions and Constants
;***********************************************************
.def mpr = r16 ; Multi-purpose register
.def waitcnt = r17 ; Wait Loop Counter
.def ilcnt = r18 ; Inner Loop Counter
.def olcnt = r19 ; Outer Loop Counter
.def deviceid = r22 ; Device ID
.def actioncode = r23 ; Action Code
.def temp = r24 ; Temporary register
.def flag = r25 ; flag register to signal wheter to ignore commands
.equ WTime = 100 ; Time to wait in wait loop
.equ WTimeReverse = 200 ; Time to wait in reverse wait loop
.equ WskrR = 0 ; Right Whisker Input Bit
.equ WskrL = 1 ; Left Whisker Input Bit
.equ EngEnR = 4 ; Right Engine Enable Bit
.equ EngEnL = 7 ; Left Engine Enable Bit
.equ EngDirR = 5 ; Right Engine Direction Bit
.equ EngDirL = 6 ; Left Engine Direction Bit
;/////////////////////////////////////////////////////////////
;These macros are the values to make the TekBot Move.
;/////////////////////////////////////////////////////////////
.equ MovFwd = (1<<EngDirR|1<<EngDirL); Move Forwards Command
.equ MovBck = $00 ; Move Backwards Command
.equ TurnR = (1<<EngDirL) ; Turn Right Command
.equ TurnL = (1<<EngDirR) ; Turn Left Command
.equ Halt = (1<<EngEnR|1<<EngEnL) ; Halt Command
;***********************************************************
;* Start of Code Segment
;***********************************************************
.cseg ; Beginning of code segment
;-----------------------------------------------------------
; Interrupt Vectors
;-----------------------------------------------------------
.org $0000 ; Beginning of IVs
rjmp INIT ; Reset interrupt
; Set up the interrupt vectors for the interrupts
.org $0002 ; IRQ0 handler
rcall HitRight ; Call hit right function
reti ; Return from interrupt
.org $0004 ; IRQ1 Handler
rcall HitLeft ; Call hit left function
reti ; Return from interrupt
.org $003C ; USART1, Rx Complete Handler
rcall DecodeAndExecute ; Call DecodeAndExecute function
reti ; Return from interrupt
.org $0046 ; End of Interrupt Vectors
;--------------------------------------------------------------
; Program Initialization
;--------------------------------------------------------------
INIT:
; Initilize the Stack Pointer
ldi mpr, low(RAMEND) ; Place low RAMEND into mpr
out SPL, mpr ; Load SPL with low byte of RAMEND
ldi mpr, high(RAMEND) ; place high RAMEND into mpr
out SPH, mpr ; Load SPH with high byte of RAMEND
; Setup port B pins 11110000 for output
ldi mpr, (1<<EngEnL)|(1<<EngEnR)|(1<<EngDirR)|(1<<EngDirL)
out DDRB, mpr ; Set the DDRB register for output
; Initialize Port B for output
ldi mpr, $00 ; Initialize Port B for outputs
out PORTB, mpr ; Port B outputs low
; Initialize Port D for inputs
ldi mpr, (0<<WskrL)|(0<<WskrR) ; Set Port D Directional Register
out DDRD, mpr ; for inputs (0 => input, 1 => output)
ldi mpr, (1<<WskrL)|(1<<WskrR) ; Initialize Port D for inputs
out PORTD, mpr ; with Tri-State
; Initialize external interrupts!
; Set the Interrupt Sense Control to falling level edge
ldi mpr, (1<<ISC01)|(0<<ISC00)|(1<<ISC11)|(0<<ISC10)
sts EICRA, mpr ; Set INT0 & INT1 to trigger on falling edge!
ldi mpr, $00 ; Load all zeros into mpr
sts EICRB, mpr ; Use sts, EICRB in extended I/O space!
; External Interrupt Mask!
ldi mpr, (1<<INT0)|(1<<INT1); Load 00000011 into mpr
out EIMSK, mpr ; Load mpr into EIMSK
USART_Init:
; Set frame format: 8data, 2stop bit
ldi mpr, (1<<USBS1)|(3<<UCSZ10)
sts UCSR1C,mpr
; NOTE if anything weird happens verify this initialize USART code.
; Set baud rate
ldi mpr, 0b00000001 ; high byte of '2400'
sts UBRR1H, mpr
ldi mpr, 0b10100000 ; low byte of '2400'
sts UBRR1L, mpr
; Enable receiver and transmitter
ldi mpr, (1<<RXEN1)|(1<<TXEN1)
sts UCSR1B, mpr
SETFLAG:
clr flag
SETUP_MOVEMENT:
ldi actioncode, MovFwd
sei ; Enable global interrupts
;-----------------------------------------------------------
; Main Program
;-----------------------------------------------------------
MAIN: ; The Main program
; Initialize TekBot Foward Movement
out PORTB, actioncode ; Send command to motors
rjmp MAIN ; Create an infinite while loop to signify the
; end of the program.
;****************************************************************
;* Subroutines and Functions
;****************************************************************
;----------------------------------------------------------------
; Sub: HitRight
; Desc: Handles functionality of the TekBot when the right whisker
; is triggered.
;----------------------------------------------------------------
HitRight:
cli ; Disable global interrupts!
push mpr ; Save mpr register
push waitcnt ; Save wait register
in mpr, SREG ; Save program state
push mpr ; Save mpr state
; Move Backwards for a second
ldi mpr, MovBck ; Load Move Backwards command
out PORTB, mpr ; Send command to port
ldi waitcnt, WTimeReverse ; Wait for 2 seconds
;rcall Wait ; Call wait function
; Turn left for a second
ldi mpr, TurnL ; Load Turn Left Command
out PORTB, mpr ; Send command to port
ldi waitcnt, WTime ; Wait for 1 second
;rcall Wait ; Call wait function
; Move Forward again
ldi mpr, MovFwd ; Load Move Forwards command
out PORTB, mpr ; Send command to port
pop mpr ; Restore program state
out SREG, mpr ; SREG was stored into mpr, so use mpr to restore SREG
pop waitcnt ; Restore wait register
pop mpr ; Restore mpr
sei ; Enable global interrupts!
ret ; Return from subroutine
;----------------------------------------------------------------
; Sub: HitLeft
; Desc: Handles functionality of the TekBot when the left whisker
; is triggered.
;----------------------------------------------------------------
HitLeft:
cli ; Disable global interrupts
push mpr ; Save mpr register
push waitcnt ; Save wait register
in mpr, SREG ; Save program state
push mpr ; Save mpr state
; Move Backwards for a second
ldi mpr, MovBck ; Load Move Backwards command
out PORTB, mpr ; Send command to port
ldi waitcnt, WTimeReverse ; Wait for 2 seconds
;rcall Wait ; Call wait function
; Turn right for a second
ldi mpr, TurnR ; Load Turn Left Command
out PORTB, mpr ; Send command to port
ldi waitcnt, WTime ; Wait for 1 second
;rcall Wait ; Call wait function
; Move Forward again
ldi mpr, MovFwd ; Load Move Forwards command
out PORTB, mpr ; Send command to port
pop mpr ; Restore program state
out SREG, mpr ; SREG was stored into mpr, so use mpr to restore SREG
pop waitcnt ; Restore wait register
pop mpr ; Restore mpr
sei ; Enable global interrupts!
ret ; Return from subroutine
;----------------------------------------------------------------
; Sub: Wait
; Desc: A wait loop that is 16 + 159975*waitcnt cycles or roughly
; waitcnt*10ms. Just initialize wait for the specific amount
; of time in 10ms intervals. Here is the general eqaution
; for the number of clock cycles in the wait loop:
; ((3 * ilcnt + 3) * olcnt + 3) * waitcnt + 13 + call
;----------------------------------------------------------------
Wait:
push waitcnt ; Save wait register
push ilcnt ; Save ilcnt register
push olcnt ; Save olcnt register
Loop: ldi olcnt, 224 ; load olcnt register
OLoop: ldi ilcnt, 237 ; load ilcnt register
ILoop: dec ilcnt ; decrement ilcnt
brne ILoop ; Continue Inner Loop
dec olcnt ; decrement olcnt
brne OLoop ; Continue Outer Loop
dec waitcnt ; Decrement wait
brne Loop ; Continue Wait loop
pop olcnt ; Restore olcnt register
pop ilcnt ; Restore ilcnt register
pop waitcnt ; Restore wait register
ret ; Return from subroutine
;----------------------------------------------------------------
; Sub: DecodeAndExecute
; Desc: Handles functionality of the TekBot when a transmission is received.
;----------------------------------------------------------------
DecodeAndExecute:
;cli ; clear interrupts
push mpr ; save state mpr
;push r20 ; save r20 state
;push r21 ; save r21 state
; Get status and 9th bit, then data from buffer
;lds r20, UCSR1A ; status?
;lds r21, UCSR1B ; 9th bit?
lds mpr, UDR1 ; data?
out PORTB, mpr
pop mpr
ret
; If error, return -1
;andi r21,(1<<FE1)|(1<<DOR1)|(1<<UPE1)
;breq USART_ReceiveNoError
;ldi r20, HIGH(-1)
;ldi mpr, LOW(-1)
USART_ReceiveNoError:
; Filter the 9th bit, then return
;lsr r20
;andi r20, 0x01
; if the device id has not been read
;lds temp, (UCSR1A << RXC1) ; setup for buffer flushing
cpi flag, 0x00
brne ACTION
DEVICE_ID_RECV:
; check to see if the device ID is equal to this receivers ID
; if it is, store
lds deviceid, UDR1
ldi flag, 0x01
rjmp FLUSH_RECEIVE_BUFFER
ACTION:
lds actioncode, (UDR1<<1)
ldi flag, 0x00
FLUSH_RECEIVE_BUFFER:
; sbis UCSR1A, RXC1
andi temp, 0b10000000
brne END
lds r16, UDR1
rjmp FLUSH_RECEIVE_BUFFER
END:
pop r21 ; restore r21
pop r20 ; restore r20
pop mpr ; restore mpr
sei ; reenable interrupts
ret
edit: I'm not sure why copy/paste screwed with the tab indenting.
My github repository contains the project I am currently working on,
link: https://github.com/bjadamson
link: https://github.com/bjadamson
- davidthefat
- Chaos Rift Maniac
- Posts: 529
- Joined: Mon Nov 10, 2008 3:51 pm
- Current Project: Fully Autonomous Robot
- Favorite Gaming Platforms: PS3
- Programming Language of Choice: C++
- Location: California
- Contact:
Re: Assembly Isn't That Bad:
short wrote:This is why:So why are people so scared of it? BTW, I have only done basic operations and using inline assembly.
It's programs like this that make me hate assembly. I hate that my university has forced me to learn three assembly languages thus far into my bachelors. The code above is for an AVR atmega128 chip to power the infrared receiver, using hardware interrupts. It's difficult as hell to remember what everything is on a piece of hardware I have no interest in ever programming for again.Code: Select all
;*********************************************************** ;* ;* Lab6.asm ;* ;* USART RECEIVER ;* ;*********************************************************** ;* ;* Author: Benjamin Adamson ;* ;* Date: February 26, 2011 ;* ;*********************************************************** ;************************************************************ ;* Include files ;************************************************************ .include "m128def.inc" ; Include definition file ;*********************************************************** ;* Internal Register Definitions and Constants ;*********************************************************** .def mpr = r16 ; Multi-purpose register .def waitcnt = r17 ; Wait Loop Counter .def ilcnt = r18 ; Inner Loop Counter .def olcnt = r19 ; Outer Loop Counter .def deviceid = r22 ; Device ID .def actioncode = r23 ; Action Code .def temp = r24 ; Temporary register .def flag = r25 ; flag register to signal wheter to ignore commands .equ WTime = 100 ; Time to wait in wait loop .equ WTimeReverse = 200 ; Time to wait in reverse wait loop .equ WskrR = 0 ; Right Whisker Input Bit .equ WskrL = 1 ; Left Whisker Input Bit .equ EngEnR = 4 ; Right Engine Enable Bit .equ EngEnL = 7 ; Left Engine Enable Bit .equ EngDirR = 5 ; Right Engine Direction Bit .equ EngDirL = 6 ; Left Engine Direction Bit ;///////////////////////////////////////////////////////////// ;These macros are the values to make the TekBot Move. ;///////////////////////////////////////////////////////////// .equ MovFwd = (1<<EngDirR|1<<EngDirL); Move Forwards Command .equ MovBck = $00 ; Move Backwards Command .equ TurnR = (1<<EngDirL) ; Turn Right Command .equ TurnL = (1<<EngDirR) ; Turn Left Command .equ Halt = (1<<EngEnR|1<<EngEnL) ; Halt Command ;*********************************************************** ;* Start of Code Segment ;*********************************************************** .cseg ; Beginning of code segment ;----------------------------------------------------------- ; Interrupt Vectors ;----------------------------------------------------------- .org $0000 ; Beginning of IVs rjmp INIT ; Reset interrupt ; Set up the interrupt vectors for the interrupts .org $0002 ; IRQ0 handler rcall HitRight ; Call hit right function reti ; Return from interrupt .org $0004 ; IRQ1 Handler rcall HitLeft ; Call hit left function reti ; Return from interrupt .org $003C ; USART1, Rx Complete Handler rcall DecodeAndExecute ; Call DecodeAndExecute function reti ; Return from interrupt .org $0046 ; End of Interrupt Vectors ;-------------------------------------------------------------- ; Program Initialization ;-------------------------------------------------------------- INIT: ; Initilize the Stack Pointer ldi mpr, low(RAMEND) ; Place low RAMEND into mpr out SPL, mpr ; Load SPL with low byte of RAMEND ldi mpr, high(RAMEND) ; place high RAMEND into mpr out SPH, mpr ; Load SPH with high byte of RAMEND ; Setup port B pins 11110000 for output ldi mpr, (1<<EngEnL)|(1<<EngEnR)|(1<<EngDirR)|(1<<EngDirL) out DDRB, mpr ; Set the DDRB register for output ; Initialize Port B for output ldi mpr, $00 ; Initialize Port B for outputs out PORTB, mpr ; Port B outputs low ; Initialize Port D for inputs ldi mpr, (0<<WskrL)|(0<<WskrR) ; Set Port D Directional Register out DDRD, mpr ; for inputs (0 => input, 1 => output) ldi mpr, (1<<WskrL)|(1<<WskrR) ; Initialize Port D for inputs out PORTD, mpr ; with Tri-State ; Initialize external interrupts! ; Set the Interrupt Sense Control to falling level edge ldi mpr, (1<<ISC01)|(0<<ISC00)|(1<<ISC11)|(0<<ISC10) sts EICRA, mpr ; Set INT0 & INT1 to trigger on falling edge! ldi mpr, $00 ; Load all zeros into mpr sts EICRB, mpr ; Use sts, EICRB in extended I/O space! ; External Interrupt Mask! ldi mpr, (1<<INT0)|(1<<INT1); Load 00000011 into mpr out EIMSK, mpr ; Load mpr into EIMSK USART_Init: ; Set frame format: 8data, 2stop bit ldi mpr, (1<<USBS1)|(3<<UCSZ10) sts UCSR1C,mpr ; NOTE if anything weird happens verify this initialize USART code. ; Set baud rate ldi mpr, 0b00000001 ; high byte of '2400' sts UBRR1H, mpr ldi mpr, 0b10100000 ; low byte of '2400' sts UBRR1L, mpr ; Enable receiver and transmitter ldi mpr, (1<<RXEN1)|(1<<TXEN1) sts UCSR1B, mpr SETFLAG: clr flag SETUP_MOVEMENT: ldi actioncode, MovFwd sei ; Enable global interrupts ;----------------------------------------------------------- ; Main Program ;----------------------------------------------------------- MAIN: ; The Main program ; Initialize TekBot Foward Movement out PORTB, actioncode ; Send command to motors rjmp MAIN ; Create an infinite while loop to signify the ; end of the program. ;**************************************************************** ;* Subroutines and Functions ;**************************************************************** ;---------------------------------------------------------------- ; Sub: HitRight ; Desc: Handles functionality of the TekBot when the right whisker ; is triggered. ;---------------------------------------------------------------- HitRight: cli ; Disable global interrupts! push mpr ; Save mpr register push waitcnt ; Save wait register in mpr, SREG ; Save program state push mpr ; Save mpr state ; Move Backwards for a second ldi mpr, MovBck ; Load Move Backwards command out PORTB, mpr ; Send command to port ldi waitcnt, WTimeReverse ; Wait for 2 seconds ;rcall Wait ; Call wait function ; Turn left for a second ldi mpr, TurnL ; Load Turn Left Command out PORTB, mpr ; Send command to port ldi waitcnt, WTime ; Wait for 1 second ;rcall Wait ; Call wait function ; Move Forward again ldi mpr, MovFwd ; Load Move Forwards command out PORTB, mpr ; Send command to port pop mpr ; Restore program state out SREG, mpr ; SREG was stored into mpr, so use mpr to restore SREG pop waitcnt ; Restore wait register pop mpr ; Restore mpr sei ; Enable global interrupts! ret ; Return from subroutine ;---------------------------------------------------------------- ; Sub: HitLeft ; Desc: Handles functionality of the TekBot when the left whisker ; is triggered. ;---------------------------------------------------------------- HitLeft: cli ; Disable global interrupts push mpr ; Save mpr register push waitcnt ; Save wait register in mpr, SREG ; Save program state push mpr ; Save mpr state ; Move Backwards for a second ldi mpr, MovBck ; Load Move Backwards command out PORTB, mpr ; Send command to port ldi waitcnt, WTimeReverse ; Wait for 2 seconds ;rcall Wait ; Call wait function ; Turn right for a second ldi mpr, TurnR ; Load Turn Left Command out PORTB, mpr ; Send command to port ldi waitcnt, WTime ; Wait for 1 second ;rcall Wait ; Call wait function ; Move Forward again ldi mpr, MovFwd ; Load Move Forwards command out PORTB, mpr ; Send command to port pop mpr ; Restore program state out SREG, mpr ; SREG was stored into mpr, so use mpr to restore SREG pop waitcnt ; Restore wait register pop mpr ; Restore mpr sei ; Enable global interrupts! ret ; Return from subroutine ;---------------------------------------------------------------- ; Sub: Wait ; Desc: A wait loop that is 16 + 159975*waitcnt cycles or roughly ; waitcnt*10ms. Just initialize wait for the specific amount ; of time in 10ms intervals. Here is the general eqaution ; for the number of clock cycles in the wait loop: ; ((3 * ilcnt + 3) * olcnt + 3) * waitcnt + 13 + call ;---------------------------------------------------------------- Wait: push waitcnt ; Save wait register push ilcnt ; Save ilcnt register push olcnt ; Save olcnt register Loop: ldi olcnt, 224 ; load olcnt register OLoop: ldi ilcnt, 237 ; load ilcnt register ILoop: dec ilcnt ; decrement ilcnt brne ILoop ; Continue Inner Loop dec olcnt ; decrement olcnt brne OLoop ; Continue Outer Loop dec waitcnt ; Decrement wait brne Loop ; Continue Wait loop pop olcnt ; Restore olcnt register pop ilcnt ; Restore ilcnt register pop waitcnt ; Restore wait register ret ; Return from subroutine ;---------------------------------------------------------------- ; Sub: DecodeAndExecute ; Desc: Handles functionality of the TekBot when a transmission is received. ;---------------------------------------------------------------- DecodeAndExecute: ;cli ; clear interrupts push mpr ; save state mpr ;push r20 ; save r20 state ;push r21 ; save r21 state ; Get status and 9th bit, then data from buffer ;lds r20, UCSR1A ; status? ;lds r21, UCSR1B ; 9th bit? lds mpr, UDR1 ; data? out PORTB, mpr pop mpr ret ; If error, return -1 ;andi r21,(1<<FE1)|(1<<DOR1)|(1<<UPE1) ;breq USART_ReceiveNoError ;ldi r20, HIGH(-1) ;ldi mpr, LOW(-1) USART_ReceiveNoError: ; Filter the 9th bit, then return ;lsr r20 ;andi r20, 0x01 ; if the device id has not been read ;lds temp, (UCSR1A << RXC1) ; setup for buffer flushing cpi flag, 0x00 brne ACTION DEVICE_ID_RECV: ; check to see if the device ID is equal to this receivers ID ; if it is, store lds deviceid, UDR1 ldi flag, 0x01 rjmp FLUSH_RECEIVE_BUFFER ACTION: lds actioncode, (UDR1<<1) ldi flag, 0x00 FLUSH_RECEIVE_BUFFER: ; sbis UCSR1A, RXC1 andi temp, 0b10000000 brne END lds r16, UDR1 rjmp FLUSH_RECEIVE_BUFFER END: pop r21 ; restore r21 pop r20 ; restore r20 pop mpr ; restore mpr sei ; reenable interrupts ret
edit: I'm not sure why copy/paste screwed with the tab indenting.
Eh, I guess I'll have to learn to literally comment every line if I don't want nightmares every night.
- short
- ES Beta Backer
- Posts: 548
- Joined: Thu Apr 30, 2009 2:22 am
- Current Project: c++, c
- Favorite Gaming Platforms: SNES, PS2, SNES, SNES, PC NES
- Programming Language of Choice: c, c++
- Location: Oregon, US
Re: Assembly Isn't That Bad:
Comments on every line are a requirement of my prof something about making sure we understand what we wrote
My github repository contains the project I am currently working on,
link: https://github.com/bjadamson
link: https://github.com/bjadamson
- MrDeathNote
- ES Beta Backer
- Posts: 594
- Joined: Sun Oct 11, 2009 9:57 am
- Current Project: cocos2d-x project
- Favorite Gaming Platforms: SNES, Sega Megadrive, XBox 360
- Programming Language of Choice: C/++
- Location: Belfast, Ireland
- Contact:
Re: Assembly Isn't That Bad:
I would never say thats a stupid idea. I was a theoretical physics student before I was a Comp sci student. I can tell you though that you aren't likely to do much work with quantum computing. All the courses I did were based around quantum mechanics, partical physics, thermodynamics, relativity and a lot more that I can't even remember now. Also you end up doing a lot of pure maths courses.davidthefat wrote:I plan on double majoring in Computer Engineering and Computer Science and taking extra theoretical physics courses (don't say it is a stupid idea, I want to work on quantum computers, robotics, artificial intelligence, computer architectures, and just anything computer research related) when I go to college.
http://www.youtube.com/user/MrDeathNote1988
"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
Re: Assembly Isn't That Bad:
If C is a back rub, assembly is a knife in the back.
- Falco Girgis
- Elysian Shadows Team
- Posts: 10294
- Joined: Thu May 20, 2004 2:04 pm
- Current Project: Elysian Shadows
- Favorite Gaming Platforms: Dreamcast, SNES, NES
- Programming Language of Choice: C/++
- Location: Studio Vorbis, AL
- Contact:
Re: Assembly Isn't That Bad:
There are only two reasons that assembly can ever be hard:
1) It is a nightmare to do anything substantial in assembly
2) It requires intricate knowledge of the CPU and hardware architecture. So naturally the more complex the architecture, the more nightmarish the instruction set and tasks required to achieve a goal.
I'm guessing you were introduced to moving things around in registers and calling simple math instructions. Trust me, there's a shitload more to it than that.
Double majoring in Computer Science and computer engineering? Sorry, but I honestly would say that's a stupid idea. The two already overlap in almost half of the spectrum. I have never heard of a computer engineer not being able to get a job as a computer scientist OR an electrical engineer. CPE is broader than CS. Yes, you go into software less, but you learn a lot more about architecture and hardware.
Since a CPE can get a job as a CS, what is the point? You're wasting precious class money and hours. If you really seek a sincere pursuit of knowledge, this is still not a very intelligent alternative. I will ALWAYS recommend getting a master's as opposed to a double major. Masters are respected, result in pay increases, and are utilized in the work place. A double major is almost useless.
If you're regretting not being CPE (and choosing CS), just finish your degree and get a masters in CPE. It's really not that much of a change. And guess what? You haven't wasted another two years of your time and money for another undergraduate degree that ... sorry to say... is useless...
1) It is a nightmare to do anything substantial in assembly
2) It requires intricate knowledge of the CPU and hardware architecture. So naturally the more complex the architecture, the more nightmarish the instruction set and tasks required to achieve a goal.
I'm guessing you were introduced to moving things around in registers and calling simple math instructions. Trust me, there's a shitload more to it than that.
Double majoring in Computer Science and computer engineering? Sorry, but I honestly would say that's a stupid idea. The two already overlap in almost half of the spectrum. I have never heard of a computer engineer not being able to get a job as a computer scientist OR an electrical engineer. CPE is broader than CS. Yes, you go into software less, but you learn a lot more about architecture and hardware.
Since a CPE can get a job as a CS, what is the point? You're wasting precious class money and hours. If you really seek a sincere pursuit of knowledge, this is still not a very intelligent alternative. I will ALWAYS recommend getting a master's as opposed to a double major. Masters are respected, result in pay increases, and are utilized in the work place. A double major is almost useless.
If you're regretting not being CPE (and choosing CS), just finish your degree and get a masters in CPE. It's really not that much of a change. And guess what? You haven't wasted another two years of your time and money for another undergraduate degree that ... sorry to say... is useless...
- davidthefat
- Chaos Rift Maniac
- Posts: 529
- Joined: Mon Nov 10, 2008 3:51 pm
- Current Project: Fully Autonomous Robot
- Favorite Gaming Platforms: PS3
- Programming Language of Choice: C++
- Location: California
- Contact:
Re: Assembly Isn't That Bad:
I'm aiming for the doctorate just sayin'. I want my job to be very research intensive, like at NASA, IBM, Intel, hell, even AMD. Or some other place like Boeing, Lockheed Martin and ect.GyroVorbis wrote:There are only two reasons that assembly can ever be hard:
1) It is a nightmare to do anything substantial in assembly
2) It requires intricate knowledge of the CPU and hardware architecture. So naturally the more complex the architecture, the more nightmarish the instruction set and tasks required to achieve a goal.
I'm guessing you were introduced to moving things around in registers and calling simple math instructions. Trust me, there's a shitload more to it than that.
Double majoring in Computer Science and computer engineering? Sorry, but I honestly would say that's a stupid idea. The two already overlap in almost half of the spectrum. I have never heard of a computer engineer not being able to get a job as a computer scientist OR an electrical engineer. CPE is broader than CS. Yes, you go into software less, but you learn a lot more about architecture and hardware.
Since a CPE can get a job as a CS, what is the point? You're wasting precious class money and hours. If you really seek a sincere pursuit of knowledge, this is still not a very intelligent alternative. I will ALWAYS recommend getting a master's as opposed to a double major. Masters are respected, result in pay increases, and are utilized in the work place. A double major is almost useless.
If you're regretting not being CPE (and choosing CS), just finish your degree and get a masters in CPE. It's really not that much of a change. And guess what? You haven't wasted another two years of your time and money for another undergraduate degree that ... sorry to say... is useless...
- TheBuzzSaw
- Chaos Rift Junior
- Posts: 310
- Joined: Wed Dec 02, 2009 3:55 pm
- Current Project: Paroxysm
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C++
- Contact:
Re: Assembly Isn't That Bad:
Well yeah, at its most fundamental level, assembly is really quite easy. There are not that many instructions. It is probably easier to learn the entirety of a particular form of assembly than it is to learn all of C/C++. As people stated in the thread, it's when you start trying to do higher level logic that it breaks down and quickly becomes "hard". A good example of this would be trying to implement C++ objects in C. It's not that hard to implement constructors, destructors, virtual functions, etc. but good bloody luck remembering to always call the constructor at the beginning, the destructor at the end, etc.
I learned assembly for my computer architecture course. It was a wonderful exercise, but I would never ever use assembly on anything substantial today.
I learned assembly for my computer architecture course. It was a wonderful exercise, but I would never ever use assembly on anything substantial today.
- Falco Girgis
- Elysian Shadows Team
- Posts: 10294
- Joined: Thu May 20, 2004 2:04 pm
- Current Project: Elysian Shadows
- Favorite Gaming Platforms: Dreamcast, SNES, NES
- Programming Language of Choice: C/++
- Location: Studio Vorbis, AL
- Contact:
Re: Assembly Isn't That Bad:
Great! Seriously! I would like a phD as well... So why would you waste time and money getting an EXTREMELY redundant double major like computer engineering and computer science when you could be furthering your education and obtaining a higher, more respected, more useful degree? There was a time when I wanted to double major in either mathematics or electrical engineering with my computer engineering degree. Just because I "loved the subject and wanted to pursue knowledge." Once you get into college and are introduced to the work-force, you realize that this is really silly. A dual major is literally a waste of time and money. You do NOT need a piece of paper saying that you know something to know something.davidthefat wrote:I'm aiming for the doctorate just sayin'. I want my job to be very research intensive, like at NASA, IBM, Intel, hell, even AMD. Or some other place like Boeing, Lockheed Martin and ect.GyroVorbis wrote:There are only two reasons that assembly can ever be hard:
1) It is a nightmare to do anything substantial in assembly
2) It requires intricate knowledge of the CPU and hardware architecture. So naturally the more complex the architecture, the more nightmarish the instruction set and tasks required to achieve a goal.
I'm guessing you were introduced to moving things around in registers and calling simple math instructions. Trust me, there's a shitload more to it than that.
Double majoring in Computer Science and computer engineering? Sorry, but I honestly would say that's a stupid idea. The two already overlap in almost half of the spectrum. I have never heard of a computer engineer not being able to get a job as a computer scientist OR an electrical engineer. CPE is broader than CS. Yes, you go into software less, but you learn a lot more about architecture and hardware.
Since a CPE can get a job as a CS, what is the point? You're wasting precious class money and hours. If you really seek a sincere pursuit of knowledge, this is still not a very intelligent alternative. I will ALWAYS recommend getting a master's as opposed to a double major. Masters are respected, result in pay increases, and are utilized in the work place. A double major is almost useless.
If you're regretting not being CPE (and choosing CS), just finish your degree and get a masters in CPE. It's really not that much of a change. And guess what? You haven't wasted another two years of your time and money for another undergraduate degree that ... sorry to say... is useless...
Also, I have another bit of bad news for you. 90% of jobs are NOT research intensive, unless you work in R&D which is VERY rare. Only the best of the best work there, and you have to work you way up. How do I know what I'm talking about? I worked as a government contractor for Stanley Associates (fortune 100 engineering company) for the Army on the Redstone arsenal for about 2 years. I literally just interviewed with Boeing and Lockheed Martin (I graduate in two months), my father works as an engineer for NASA, and I have friends who work for Boeing, Lockheed, and all of those other big, private sector companies. It's just a sad fact that "research"--especially for newly graduates with nothing more than an undergraduate degree--is not marketable, not profitable, and not in a company's own selfish self interest.
If you are interested in an earnest pursuit of knowledge, aim for the same goal I'm trying to reach. Get hired by one of those high-paying, high-profile jobs. Do useful, meaningful work for them (with one undergrad), and 90% of them pay for your entire Masters and phD for free. If you "genuinely" want to get into research, your future almost certainly must be within academia. And trust me, it's at the GRADUATE level pursuing a Masters or phD, not as an UNDERGRADUATE wasting more time on redundant bachelors. The difference between undergraduate and graduate is literally the pursuit of a piece of paper to get you a job versus the pursuit of knowledge as an end to itself. You have much to learn, grasshopper.
- ParticleGames
- Chaos Rift Cool Newbie
- Posts: 53
- Joined: Sat Feb 19, 2011 1:20 pm
- Current Project: A map editor for a platformer I plan to develop
- Favorite Gaming Platforms: Wii, Gamecube
- Programming Language of Choice: C++
Re: Assembly Isn't That Bad:
Dual majors aren't bad, but if your majors are as redundant as his then it's just silly. (like you said, Gyrovorbis)
Check out my iPhone app here: http://twilighthop.com
- davidthefat
- Chaos Rift Maniac
- Posts: 529
- Joined: Mon Nov 10, 2008 3:51 pm
- Current Project: Fully Autonomous Robot
- Favorite Gaming Platforms: PS3
- Programming Language of Choice: C++
- Location: California
- Contact:
Re: Assembly Isn't That Bad:
Thanks for the info. Yes, I do have much to learn.GyroVorbis wrote:Great! Seriously! I would like a phD as well... So why would you waste time and money getting an EXTREMELY redundant double major like computer engineering and computer science when you could be furthering your education and obtaining a higher, more respected, more useful degree? There was a time when I wanted to double major in either mathematics or electrical engineering with my computer engineering degree. Just because I "loved the subject and wanted to pursue knowledge." Once you get into college and are introduced to the work-force, you realize that this is really silly. A dual major is literally a waste of time and money. You do NOT need a piece of paper saying that you know something to know something.davidthefat wrote:I'm aiming for the doctorate just sayin'. I want my job to be very research intensive, like at NASA, IBM, Intel, hell, even AMD. Or some other place like Boeing, Lockheed Martin and ect.GyroVorbis wrote:There are only two reasons that assembly can ever be hard:
1) It is a nightmare to do anything substantial in assembly
2) It requires intricate knowledge of the CPU and hardware architecture. So naturally the more complex the architecture, the more nightmarish the instruction set and tasks required to achieve a goal.
I'm guessing you were introduced to moving things around in registers and calling simple math instructions. Trust me, there's a shitload more to it than that.
Double majoring in Computer Science and computer engineering? Sorry, but I honestly would say that's a stupid idea. The two already overlap in almost half of the spectrum. I have never heard of a computer engineer not being able to get a job as a computer scientist OR an electrical engineer. CPE is broader than CS. Yes, you go into software less, but you learn a lot more about architecture and hardware.
Since a CPE can get a job as a CS, what is the point? You're wasting precious class money and hours. If you really seek a sincere pursuit of knowledge, this is still not a very intelligent alternative. I will ALWAYS recommend getting a master's as opposed to a double major. Masters are respected, result in pay increases, and are utilized in the work place. A double major is almost useless.
If you're regretting not being CPE (and choosing CS), just finish your degree and get a masters in CPE. It's really not that much of a change. And guess what? You haven't wasted another two years of your time and money for another undergraduate degree that ... sorry to say... is useless...
Also, I have another bit of bad news for you. 90% of jobs are NOT research intensive, unless you work in R&D which is VERY rare. Only the best of the best work there, and you have to work you way up. How do I know what I'm talking about? I worked as a government contractor for Stanley Associates (fortune 100 engineering company) for the Army on the Redstone arsenal for about 2 years. I literally just interviewed with Boeing and Lockheed Martin (I graduate in two months), my father works as an engineer for NASA, and I have friends who work for Boeing, Lockheed, and all of those other big, private sector companies. It's just a sad fact that "research"--especially for newly graduates with nothing more than an undergraduate degree--is not marketable, not profitable, and not in a company's own selfish self interest.
If you are interested in an earnest pursuit of knowledge, aim for the same goal I'm trying to reach. Get hired by one of those high-paying, high-profile jobs. Do useful, meaningful work for them (with one undergrad), and 90% of them pay for your entire Masters and phD for free. If you "genuinely" want to get into research, your future almost certainly must be within academia. And trust me, it's at the GRADUATE level pursuing a Masters or phD, not as an UNDERGRADUATE wasting more time on redundant bachelors. The difference between undergraduate and graduate is literally the pursuit of a piece of paper to get you a job versus the pursuit of knowledge as an end to itself. You have much to learn, grasshopper.
- MrDeathNote
- ES Beta Backer
- Posts: 594
- Joined: Sun Oct 11, 2009 9:57 am
- Current Project: cocos2d-x project
- Favorite Gaming Platforms: SNES, Sega Megadrive, XBox 360
- Programming Language of Choice: C/++
- Location: Belfast, Ireland
- Contact:
Re: Assembly Isn't That Bad:
Just to clarify I meant the theoretical physics part wasn't stupid not the double major, I agree that those two subjects are far too interrelated and doing both is redundant.GyroVorbis wrote: Double majoring in Computer Science and computer engineering? Sorry, but I honestly would say that's a stupid idea
http://www.youtube.com/user/MrDeathNote1988
"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup