xxxxxxxxxx
org 0x0100
; Data segment
VUID db 2, 1, 0, 2, 0, 6, 2, 3, 1
largestDigit db 0
subtractedDigits db 9 dup(0)
sortedVUID db 9 dup(?)
arrayLength db 9
; Code segment
jmp start ; Jump to start of the program
; Subroutines can be defined here
start:
; Find the largest digit
mov cx, arrayLength
xor bx, bx ; Clear bx
find_largest:
mov al, [VUID + bx]
cmp al, largestDigit
jbe continue_search
mov largestDigit, al
continue_search:
inc bx
loop find_largest
; Subtract each digit from the largest and store it
mov cx, arrayLength
xor bx, bx ; Clear bx
subtract_loop:
mov al, largestDigit
sub al, [VUID + bx]
mov [subtractedDigits + bx], al
inc bx
loop subtract_loop
; Implement sorting algorithm for subtractedDigits and store in sortedVUID
; Sorting needs to be implemented here
; Code for output, if necessary
; Exit program with interrupt
mov ax, 4C00h
int 21h
; Additional subroutines can be placed here
xxxxxxxxxx
It usually takes 10 minutes just to code "Hello World" in assembly.
Python = <o/ *dab* <o/
xxxxxxxxxx
what is assembly ?
a very badass way to program
in 99% your not gone do anything special with it but everyone will respect you !!!
xxxxxxxxxx
mov ax,200 ; decimal
mov ax,0200 ; still decimal
mov ax,0200d ; explicitly decimal
mov ax,0d200 ; also decimal
mov ax,0c8h ; hex
mov ax,$0c8 ; hex again: the 0 is required
mov ax,0xc8 ; hex yet again
mov ax,0hc8 ; still hex
mov ax,310q ; octal
mov ax,310o ; octal again
mov ax,0o310 ; octal yet again
mov ax,0q310 ; octal yet again
mov ax,11001000b ; binary
mov ax,1100_1000b ; same binary constant
mov ax,1100_1000y ; same binary constant once more
mov ax,0b1100_1000 ; same binary constant yet again
mov ax,0y1100_1000 ; same binary constant yet again
xxxxxxxxxx
section .data
input_msg db "Enter an integer: $"
output_good db "It is a good number$"
output_not_good db "It is not a good number$"
section .bss
num resw 1 ; Reserve space for a single word (16 bits) to store the input number
section .text
global _start
_start:
; Display the input message
mov ah, 09h
lea dx, input_msg
int 21h
; Read an integer from the user
mov ah, 01h
int 21h
sub al, '0' ; Convert ASCII character to integer
mov [num], ax ; Store the input number in the 'num' variable
; Compare the input number with 50
mov ax, [num]
cmp ax, 50
; Display the appropriate message based on the comparison result
jg greater_than_50 ; Jump if greater than 50
; If not greater than 50, display "It is not a good number"
mov ah, 09h
lea dx, output_not_good
int 21h
jmp end_program
greater_than_50:
; If greater than 50, display "It is a good number"
mov ah, 09h
lea dx, output_good
int 21h
end_program:
; Exit the program
mov ah, 4Ch
int 21h
xxxxxxxxxx
if you want to start assembly firstly its hard not only coding its also hard to setup
if you on windows you need to install visual studio (compulsory for link.exe)
and need a compiler like NASM https://www.nasm.us/