Brent Dax (brentdax) wrote,
Brent Dax
brentdax

  • Mood:

Weekend

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.)
Subscribe

  • Paging madlori (and anyone who knows her)

    An interesting thing just happened on Facebook chat. Lori Summers [2:29:44] Got my message ? Brent Royal-Gordon [2:33:45] I did. Lori Summers…

  • guest post

    kate is the best better than the rest the best the best haikus about kate: kate's my favourite i want to lick her ballsack it would taste so…

  • Practice

    This December, I will have been practicing programming seriously for ten years. That will mark the tenth anniversary of me starting to learn Perl. I…

  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 2 comments