Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .constant
- OBJREF 0x40
- .end-constant
- .main
- LDC_W OBJREF
- INVOKEVIRTUAL read_num
- HALT
- .end-main
- .method mult_16(a)
- ILOAD a
- DUP
- IADD
- DUP
- IADD
- DUP
- IADD
- DUP
- IADD
- IRETURN
- .end-method
- .method read_num()
- .var
- cifra
- totale
- .end-var
- while: IN
- ISTORE cifra
- ILOAD cifra //controlla se valore valido
- IFEQ while
- ILOAD cifra //controlla se compreso tra 0-9
- BIPUSH 0x30
- ISUB
- IFLT check_end
- ILOAD cifra
- BIPUSH 0x3A
- ISUB
- IFLT convert_num
- ILOAD cifra //controlla se compreso tra A-F
- BIPUSH 0x41
- IFLT while
- ILOAD cifra
- BIPUSH 0x47
- ISUB
- IFLT convert_let
- GOTO while
- check_end: ILOAD cifra
- BIPUSH 0x0A
- ISUB
- IFEQ return
- GOTO while
- convert_num: ILOAD cifra
- BIPUSH 0x30
- ISUB
- ISTORE cifra
- GOTO next
- convert_let: ILOAD cifra
- BIPUSH 0x37
- ISUB
- ISTORE cifra
- GOTO next
- next:
- LDC_W OBJREF
- ILOAD totale
- INVOKEVIRTUAL mult_16
- ISTORE totale
- ILOAD totale
- ILOAD cifra
- IADD
- ISTORE totale
- GOTO while
- return:
- ILOAD totale
- IRETURN
- .end-method
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement