Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,7 @@
|
|||
ORG 0100H
|
||||
MVI A, 0 ; move immediate
|
||||
LOOP: INR A ; increment
|
||||
; call 'PRINT' subroutine, if required
|
||||
JMP LOOP ; jump unconditionally
|
||||
|
||||
END
|
||||
34
Task/Integer-sequence/8080-Assembly/integer-sequence-2.8080
Normal file
34
Task/Integer-sequence/8080-Assembly/integer-sequence-2.8080
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
ORG 0100H
|
||||
BITS EQU 128 ; 128 bits of precision
|
||||
BYTES EQU BITS / 8 ; Number of bytes we store those bits in
|
||||
|
||||
; Zero out the storage for our number
|
||||
LXI H,BUFR ; HL points at BUFR. (HL is idiomatically used for pointers)
|
||||
MVI C,BYTES ; C holds the number of bytes we'll use
|
||||
XRA A ; XOR with A is a 1-byte instruction to set A to zero
|
||||
INIT: MOV M,A ; Store 0 to address pointed to by HL
|
||||
INX H ; Advance HL to the next byte
|
||||
DCR C ; Count down
|
||||
JNZ INIT ; Keep looping if we're not done
|
||||
|
||||
; The "very long integer" is zeroed, so start the loop
|
||||
LOOP: CALL PRBUFR ; Output our number
|
||||
LXI H,BUFR ; HL Points to BUFR
|
||||
MVI C,BYTES ; Count down (assume fewer than 256 bytes in our integer)
|
||||
NEXT: INR M ; Increment the byte pointed to by HL. Sets the zero flag
|
||||
JNZ LOOP ; If the increment didn't overflow A, start the loop over
|
||||
; This byte overflowed, so we need to advance to the next byte in our number
|
||||
INX H ; We store our byes in order of increasing significance
|
||||
DCR C ; Count down to make sure we don't overflow our buffer
|
||||
JNZ NEXT ; jump to process the next, more significant byte
|
||||
|
||||
; If we get here, we have overflowed our integer!
|
||||
HALT ; TODO: probably something other than "halt the CPU"
|
||||
|
||||
PRBUFR: ; TODO, a subroutine that shows all of the digits in BUFR on the console
|
||||
; Assume that this code trashes all our registers...
|
||||
RET
|
||||
|
||||
BUFR: ; This space will hold our number
|
||||
; We zero this memory before the loop
|
||||
END
|
||||
Loading…
Add table
Add a link
Reference in a new issue