Calculates the Fibonacci sequence. The result of each step is output to the 7-segment display (in Hex) until the sequence exceeds 255.
ILDA 0x00 ; Start with 0 ILDB 0x01 ; Next number is 1 LOOP: OUT A ; Display current number ADD B ; A = A + B JC DONE ; If carry flag is set (overflow > 255), stop SWPB ; Swap A and B so B holds the new highest value JMP LOOP DONE: HLT
Writes binary pixel data into the middle column (the 2nd byte) of the rows starting at 0xB8.
; The screen is 3 bytes wide. 0xBF is Row 2, middle byte. LOAD [0xBF] 0b01100110 ; Eyes (Row 2) LOAD [0xC2] 0b01100110 ; Eyes (Row 3) LOAD [0xC8] 0b10000001 ; Mouth edges (Row 5) LOAD [0xCB] 0b01111110 ; Mouth bottom (Row 6) HLT
Uses pointers (*[]) to dynamically calculate addresses and draw a segmented line across the first row of the screen.
LOAD [0x60] 0xB8 ; Store screen start address in pointer 0x60 ILDA 0xFF ; Full block pattern WBA *[0x60] ; Write A to the address stored at 0x60 (0xB8) LDA [0x60] ; Read the pointer address itself into A INC A ; Increment address to 0xB9 WBA [0x60] ; Save new address back into pointer ILDA 0x0F ; Half block pattern WBA *[0x60] ; Write to 0xB9 LDA [0x60] INC A ; Increment address to 0xBA WBA [0x60] ILDA 0xF0 ; Other half block pattern WBA *[0x60] ; Write to 0xBA HLT
Uses the Shift register (C) to move a pixel across the top-left byte of the screen. When the bit falls off (C reaches 0), it resets.
RESET: ILDC 0b10000000 ; Load dot into C (Target for shifts) LOOP: SWPC ; Swap C to A so we can write it WBA [0xB8] ; Draw dot to top-left screen byte SWPC ; Swap A back to C SHR 1 ; Shift dot to the right JZ RESET ; If dot shifted out (ZF=1), reset it JMP LOOP
Pushes three unique variables to the hardware stack, then pops them out in reverse order. Watch the Registers panel as you step through!
ILDA 0xAA ILDB 0xBB ILDC 0xCC PUSH A PUSH B PUSH C POP A ; A gets 0xCC POP B ; B gets 0xBB POP C ; C gets 0xAA HLT