Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-3-7-sonnet-20250219-thinking-32k· AnthropicHugging Face LMArena Human Preference 140K

Can you show the original Z80 source code of the ZX Spectrum BASIC function CLS (Clear…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Qwenqwen3-235b-a22b-no-thinking’s answer.
  1. User

    Can you show the original Z80 source code of the ZX Spectrum BASIC function CLS (Clear screen) as it is stored in the ROM of the ZX Spectrum computer?

  2. Claude Assistant
    ; THE 'CLS' COMMAND ROUTINE
    ; The CLS command clears the display
    ; Address: 0x0DAF (3503)
    CLS:    CALL    CL_ALL          ; routine CL-ALL
            RES     5,(IY+$02)      ; update TV_FLAG - signal main screen in use
            RES     3,(IY+$02)      ; update TV_FLAG - signal mode is 'L'
            LD      HL,$5C3C        ; address system variable TV_FLAG
            BIT     5,(HL)          ; is the lower screen in use ?
            JR      NZ,CLS_LOWER    ; forward to CLS-LOWER if so
            LD      HL,$5C88        ; address system variable COORDS
            LD      (HL),$00        ; set x coordinate to zero
            INC     HL              ; address y coordinate
            LD      (HL),$00        ; set to zero
            LD      (IY+$31),$02    ; set DF_SZ to 2 lines
            CALL    CL_SET          ; routine CL-SET
            LD      A,$FD           ; select upper screen
            CALL    CHAN_OPEN       ; routine CHAN-OPEN
            LD      A,$01           ; success
            RET                     ; return
    
    ; THE 'CLS-LOWER' ROUTINE
    CLS_LOWER:
            CALL    CL_CHAN         ; routine CL-CHAN
            LD      A,$FE           ; select lower screen
            CALL    CHAN_OPEN       ; routine CHAN-OPEN
            LD      A,$01           ; success
            RET                     ; return
    

    Would you like me to explain or break down this code?

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.