Last active
January 29, 2020 00:49
-
-
Save Zer0xFF/fb2c27716c0aceb335aa231ccc744ecc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jmp start | |
start: | |
; AL keep track of the result | |
MOV CL, 1 ; CL keeps track of the number we're dividing | |
MOV BL, 71; BL keep track of memory location | |
loop: | |
inc BL | |
inc CL | |
PUSH CL | |
POP AL | |
call 50 | |
mov [BL], AL | |
cmp BL, 90 | |
jnz loop | |
org 50 | |
PUSH AL | |
POP DL | |
mod DL, 5 ; reminder of division by 5 should be 0, else not divisble by 5 | |
cmp DL, 00 | |
jz j_ret | |
mov AL, 00 | |
j_ret: | |
ret | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jmp start | |
ORG 4 | |
db 01 | |
db 50 | |
db 44 | |
db 60 | |
db 64 | |
db 2f | |
db 99; signed integer aka negative value | |
db 02 | |
db 61 | |
db 7E | |
start: | |
Mov AL, 4; AL specifies start location | |
MOV BL, D; specifies end location + 1 | |
call 50 | |
halt | |
org 50 | |
PUSH AL ; we increment AL, so we'd like to back it up | |
PUSH BL ; we use BL for compare, so we back it up | |
PUSH BL ; we copy BL to DL, so we back it up, again | |
pop DL | |
mov CL, [AL] | |
; AL holds memory location | |
; BL hold AL memory value | |
; CL holds biggest value | |
; DL hold last memory location | |
next: | |
cmp DL, AL; checking to make sure we're still haven't passed allowed address | |
jz j_ret | |
inc AL | |
mov BL, [AL] | |
CMP BL, CL; BL - CL; if CL is bigger negative bit sets, check next value | |
JS next | |
; if we're here BL was bigger, move it to CL | |
push BL | |
POP CL | |
JMP next | |
j_ret: | |
POP BL | |
POP AL | |
ret | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jmp start | |
db 40 | |
db 60 | |
db 5 | |
ORG 5 | |
iret | |
start: | |
MOV DL, C0 | |
STI | |
loop: | |
OUT 07 | |
jmp loop | |
ORG 40 | |
CLI | |
push AL | |
PUSH BL | |
mov AL, [DL] | |
cmp AL, 23 | |
jnz make_hash | |
mov AL, 20 | |
jmp print_cursor | |
make_hash: | |
mov AL, 23 | |
print_cursor: | |
mov [DL], AL | |
POP BL | |
POP AL | |
STI | |
iret | |
ORG 60 | |
CLI | |
in 07 | |
cmp AL, 0D | |
jz new_line | |
mov [DL], AL | |
inc DL | |
jmp j_ret | |
new_line: | |
mov AL, 20 | |
mov [DL], AL | |
AND DL, F0 | |
ADD DL, 10 | |
j_ret: | |
STI | |
IRET | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment