Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,50 @@
|
|||
cpu 8086
|
||||
bits 16
|
||||
org 100h
|
||||
section .text
|
||||
mov di,obuf ; Output buffer
|
||||
mov bl,2 ; BL = police
|
||||
pol: mov cl,1 ; CL = sanitation
|
||||
san: mov dl,1 ; DL = fire
|
||||
fire: cmp bl,cl ; Police equal to sanitation?
|
||||
je next ; Invalid combination
|
||||
cmp bl,dl ; Police equal to fire?
|
||||
je next ; Invalid combination
|
||||
cmp cl,dl ; Sanitation equal to fire?
|
||||
je next ; Invalid combination
|
||||
mov al,bl ; Total equal to 12?
|
||||
add al,cl
|
||||
add al,dl
|
||||
cmp al,12
|
||||
jne next ; If not, invalid combination
|
||||
mov al,bl ; Combination is valid, write the three numbers
|
||||
call num
|
||||
mov al,cl
|
||||
call num
|
||||
mov al,dl
|
||||
call num
|
||||
mov ax,0A0Dh ; And a newline
|
||||
stosw
|
||||
next: mov al,7 ; Load 7 to compare to
|
||||
inc dx ; Increment fire number
|
||||
cmp al,dl ; If 7 or less,
|
||||
jae fire ; next fire number.
|
||||
inc cx ; Otherwise, ncrement sanitation number
|
||||
cmp al,cl ; If 7 or less,
|
||||
jae san ; next sanitation number
|
||||
inc bx ; Increment police number twice
|
||||
inc bx ; (it must be even)
|
||||
cmp al,bl ; If 7 or less,
|
||||
jae pol ; next police number.
|
||||
mov byte [di],'$' ; At the end, terminate the string
|
||||
mov dx,ohdr ; Tell MS-DOS to print it
|
||||
mov ah,9
|
||||
int 21h
|
||||
ret
|
||||
num: mov ah,' ' ; Space
|
||||
add al,'0' ; Add number to output
|
||||
stosw ; Store number and space
|
||||
ret
|
||||
section .data
|
||||
ohdr: db 'P S F',13,10 ; Header
|
||||
obuf: equ $ ; Place to write output
|
||||
Loading…
Add table
Add a link
Reference in a new issue