Skip to content

Commit

Permalink
Ensure that the first code executed is our decryption routine
Browse files Browse the repository at this point in the history
This pull-request closes #37, by making sure the first code we
run in our binary is our decryption code (if that is enabled).

Previously we ran some code:

        call foo
        [decrypt code]
        [start of encrypted code]
        foo:
        [end of encrypted code]

If we called a routine that was after the decryption code we'd
be running gibberish.  This seemed to work by accident in some
systems, but was obviously broken.
  • Loading branch information
skx committed Mar 28, 2024
1 parent b0a3740 commit aa3d0e7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions game.z80
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,6 @@ MACRO POP_ALL
;
ORG ENTRYPOINT

; Call system-specific setup routine before we do anything else.
call bios_init

;
; Our game can be compiled with optional "encryption", which uses
; a simple scheme to hide the strings in our binary.
Expand Down Expand Up @@ -181,6 +178,10 @@ enc_loop:
enc_end:
ENDIF

; Call system-specific setup routine before we do anything else.
call bios_init


; Here we're going to copy our game-state to the end of RAM
;
; We do this so that everything "resets" if the player dies/wins
Expand Down

0 comments on commit aa3d0e7

Please sign in to comment.