<commit_before>INCLUDE "includes/gbhw.inc"
INCLUDE "includes/ibmpc1.inc"

_DMACODE EQU $FF80
_OAMDATA EQU _RAM               ; Must be a multiple of $100
_OAMDATALENGTH EQU $A0
_INPUT EQU _OAMDATA+_OAMDATALENGTH ; Put input data at the end of the oam data
_LASTINPUT EQU _INPUT+1

_FLYAMOUNT EQU $20              ; How much to go up
_MAXFLYSPEED EQU $45
_MAXFALLSPEED EQU $35
_FALLSPEED EQU _LASTINPUT+1     ; Save this so we can make it accelerate
_FALLDIR EQU _FALLSPEED+1       ; 0 is down
_YPOSDECIMAL EQU _FALLDIR+1     ; Used for subpixel positioning on the y


            RSSET _RAM          ; Base location is _RAM
HeloYPos    RB 1                ; Set each to an incrementing location
HeloXPos    RB 1
HeloTileNum RB 1
HeloAttrs   RB 1

SECTION "Vblank",ROM0[$0040]
  jp _DMACODE
SECTION "LCDC",ROM0[$0048]
  reti
SECTION "Time_Overflow",ROM0[$0050]
  reti
SECTION "Serial",ROM0[$0058]
  reti
SECTION "p1thru4",ROM0[$0060]
  reti

SECTION "start",ROM0[$0100]
  nop
  jp main

  ROM_HEADER ROM_NOMBC, ROM_SIZE_32KBYTE, RAM_SIZE_0KBYTE

INCLUDE "includes/memory.asm"

main:
  nop
  di                            ; disable interrupts
  ld sp, $ffff                  ; set the stack pointer to the highest memory location

  call initdma                  ; move dma code to hram

  ld a, IEF_VBLANK              ; enable the vblank interrupt
  ld [rIE], a

  ei                            ; re-enable interrupts

initscreen:
  ld a, %11100100               ; Palette colors, darkest to lightest

  ld [rBGP], a                  ; Set background palette
  ldh [rOBP0],a                 ; Set sprite palette 0
  ldh [rOBP1],a                 ; And palette 1

  ld a, 0                       ; Set background scroll position to upper left
  ld [rSCX], a
  ld [rSCY], a

  call StopLCD                  ; Need to stop LCD before loading vram

  ld hl, Sprites                ; Load the tile data into Vram
  ld de, _VRAM
  ld bc, 16*(SpritesEnd-Sprites)
  call mem_Copy

  ld a, 0                       ; Clear sprite table
  ld hl, _OAMDATA
  ld bc, _OAMDATALENGTH
  call mem_Set

  call StartLCD                 ; Free to start the LCD again

  ld a, 2                       ; Clear screen with background tile
  ld hl, _SCRN0
  ld bc, SCRN_VX_B*SCRN_VY_B    ; width * height
  call mem_SetVRAM

initsprite:
  ld a, 64                      ; Initialize helo sprite
  ld [HeloYPos], a
  ld a, 16
  ld [HeloXPos], a
  ld a, 1
  ld [HeloTileNum], a
  ld a, %00000000
  ld [HeloAttrs], a
  ld a, 0
  ld [_FALLSPEED], a
  ld a, 0
  ld [_FALLDIR], a

loop:
  halt
  nop                           ; Always need nop after halt

  call getinput

  ld a, [_INPUT]                ; Check keys

  push af                       ; Avoid clobbering a with the and

  and PADF_LEFT                 ; See if up is pressed
  call nz, moveleft

  pop af
  push af                       ; Don't clobber the a again

  and PADF_RIGHT                ; See if down is pressed
  call nz, moveright

  pop af
  push af

  and PADF_UP
  call nz, moveup

  pop af

  call dofall

  jr loop

moveleft:
  push af

  ld a, [HeloXPos]

  cp 8                          ; If the x position is 8 already, return
  jr z, .popret

  dec a                         ; Move up
  ld [HeloXPos], a
.popret:
  pop af
  ret

moveright:
  push af

  ld a, [HeloXPos]

  cp 160                        ; If the y position is 160, return
  jr z, .popret

  inc a                         ; Move down
  ld [HeloXPos], a
.popret:
  pop af
  ret

moveup:
  push af

  ld a, [_LASTINPUT]
  and PADF_UP<commit_msg>Use A key instead of up. Decrease fly amount<commit_after>INCLUDE "includes/gbhw.inc"
INCLUDE "includes/ibmpc1.inc"

_DMACODE EQU $FF80
_OAMDATA EQU _RAM               ; Must be a multiple of $100
_OAMDATALENGTH EQU $A0
_INPUT EQU _OAMDATA+_OAMDATALENGTH ; Put input data at the end of the oam data
_LASTINPUT EQU _INPUT+1

_FLYAMOUNT EQU $10              ; How much to go up
_MAXFLYSPEED EQU $45
_MAXFALLSPEED EQU $35
_FALLSPEED EQU _LASTINPUT+1     ; Save this so we can make it accelerate
_FALLDIR EQU _FALLSPEED+1       ; 0 is down
_YPOSDECIMAL EQU _FALLDIR+1     ; Used for subpixel positioning on the y


            RSSET _RAM          ; Base location is _RAM
HeloYPos    RB 1                ; Set each to an incrementing location
HeloXPos    RB 1
HeloTileNum RB 1
HeloAttrs   RB 1

SECTION "Vblank",ROM0[$0040]
  jp _DMACODE
SECTION "LCDC",ROM0[$0048]
  reti
SECTION "Time_Overflow",ROM0[$0050]
  reti
SECTION "Serial",ROM0[$0058]
  reti
SECTION "p1thru4",ROM0[$0060]
  reti

SECTION "start",ROM0[$0100]
  nop
  jp main

  ROM_HEADER ROM_NOMBC, ROM_SIZE_32KBYTE, RAM_SIZE_0KBYTE

INCLUDE "includes/memory.asm"

main:
  nop
  di                            ; disable interrupts
  ld sp, $ffff                  ; set the stack pointer to the highest memory location

  call initdma                  ; move dma code to hram

  ld a, IEF_VBLANK              ; enable the vblank interrupt
  ld [rIE], a

  ei                            ; re-enable interrupts

initscreen:
  ld a, %11100100               ; Palette colors, darkest to lightest

  ld [rBGP], a                  ; Set background palette
  ldh [rOBP0],a                 ; Set sprite palette 0
  ldh [rOBP1],a                 ; And palette 1

  ld a, 0                       ; Set background scroll position to upper left
  ld [rSCX], a
  ld [rSCY], a

  call StopLCD                  ; Need to stop LCD before loading vram

  ld hl, Sprites                ; Load the tile data into Vram
  ld de, _VRAM
  ld bc, 16*(SpritesEnd-Sprites)
  call mem_Copy

  ld a, 0                       ; Clear sprite table
  ld hl, _OAMDATA
  ld bc, _OAMDATALENGTH
  call mem_Set

  call StartLCD                 ; Free to start the LCD again

  ld a, 2                       ; Clear screen with background tile
  ld hl, _SCRN0
  ld bc, SCRN_VX_B*SCRN_VY_B    ; width * height
  call mem_SetVRAM

initsprite:
  ld a, 64                      ; Initialize helo sprite
  ld [HeloYPos], a
  ld a, 16
  ld [HeloXPos], a
  ld a, 1
  ld [HeloTileNum], a
  ld a, %00000000
  ld [HeloAttrs], a
  ld a, 0
  ld [_FALLSPEED], a
  ld a, 0
  ld [_FALLDIR], a

loop:
  halt
  nop                           ; Always need nop after halt

  call getinput

  ld a, [_INPUT]                ; Check keys

  push af                       ; Avoid clobbering a with the and

  and PADF_LEFT                 ; See if up is pressed
  call nz, moveleft

  pop af
  push af                       ; Don't clobber the a again

  and PADF_RIGHT                ; See if down is pressed
  call nz, moveright

  pop af
  push af

  and PADF_A
  call nz, moveup

  pop af

  call dofall

  jr loop

moveleft:
  push af

  ld a, [HeloXPos]

  cp 8                          ; If the x position is 8 already, return
  jr z, .popret

  dec a                         ; Move up
  ld [HeloXPos], a
.popret:
  pop af
  ret

moveright:
  push af

  ld a, [HeloXPos]

  cp 160                        ; If the y position is 160, return
  jr z, .popret

  inc a                         ; Move down
  ld [HeloXPos], a
.popret:
  pop af
  ret

moveup:
  push af

  ld a, [_LASTINPUT]
  and PADF_A
{'fraction_non_alphanumeric': 0.057146849238507755, 'fraction_numerical': 0.02738577616319687, 'mean_word_length': 1.7320610687022902, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '176303', 'n_tokens_mistral': 2818, 'n_tokens_neox': 2448, 'n_words': 899}