Log in

No account? Create an account

Previous Entry | Next Entry


I spent most of the weekend hacking on my assembly assignments, which I did in fact finish. A few highlights:

; Class		:	CIS 40A (Assembly)
; File		:	hw6/hours.asm
; Assignment	:	Homework #6 - convert minutes to hours/minutes
;			(due 11/10/03)
; Song		:	Evanescence - Lies

; Class		:	CIS 40A (Assembly)
; File		:	hw4/your.asm
; Assignment	:	Homework #4 - program that prints three messages
;			(due 11/10/03)
; Song		:	Royksopp - Poor Leno

msg1 db "UBERCRYPT 1.0 KEY GENERATOR",				0
msg2 db "Your passphrase is 'Fred Foonly'.",			0
msg3 db "Enter any 11-digit prime number to continue...",	0

mov BX, CX			; Needs to be in BX for the next line.  Stupid hardware weenies.
mov byte [BX+DI], 0		; Place the null.

mov BX, CX			; You have to use BX with base-index for some strange reason
mov byte [BX+DI], 0		; Place the null.

; At this point, CX is 65534 - the length.
; I'm not really sure why the extra character worth of fudge factor is needed,
; but it is.
mov AX, CX			; I really want to do CX = 65534 - CX, but the instruction
mov CX, 65534			; set doesn't allow that.  This mess is equivalent to that.
sub CX, AX			; With this, CX is now the length of the string.

cmp AX, 0			; Check for 0.  For reasons I have yet to determine (but  
jne therest			; which probably lie in the scaling code), zero values result
				; in divide-by-zero errors, which is rather suboptimal.

(BTW, sorry if the formatting's odd. I'm doing the best I can.)


( Read 2 comments — Leave a comment )
Nov. 10th, 2003 12:26 pm (UTC)
I can't code, but I can understand this....

Is that a good thing or a bad thing? ^.-
Nov. 10th, 2003 02:11 pm (UTC)
Many years since I have touched assembly. Yet, the form which it takes is old and true. I half expected a silly Evanescence.asm related post, and was quite surprised that there were no jokes present.

I like the Song field in your comments header though. *grins*
( Read 2 comments — Leave a comment )