Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # It seems that t=1 regardless of whether "first" or "second" is bigger
- # I was hoping you could shed some light on what is happening here.
- #first = "5"
- #second = "4"
- first = "4"
- second = "5"
- mov a, data(first) # a = &first (address of first)
- mov b, data(second) # b = &second
- lw c, a # c = *a ( c becomes the object at address a)
- lw d, b # d = *b
- sub c, c, 48 # change ascii to the true number value
- sub d, d, 48 # ^
- #---------------v # print c and d
- #
- add c, c, 48 #
- sw -1, c #
- add d, d, 48 #
- sw -1, 62 # >
- sw -1, 61 # =
- sw -1, d #
- sub c, c, 48 #
- sub d, d, 48 #
- sw -1,10 # LF
- #
- #---------------^
- geq t, c, d # t = c>=d
- #--------------v # print t
- #
- add t, t, 48
- sw -1, t
- sub t, t, 48
- sw -1, 10 # LF
- #
- #--------------^
- halt 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement