Skip to content

Commit

Permalink
initalcommit
Browse files Browse the repository at this point in the history
  • Loading branch information
nmosier committed Jan 16, 2020
1 parent ad7519d commit 85435db
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ cgen-main*
*.z80
*.s
*.8xp
!demo/*
5 changes: 3 additions & 2 deletions cgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -795,9 +795,10 @@ namespace zc {
block->instrs().push_back(new MultInstruction(&rv_bc));
block->instrs().push_back(new LoadInstruction(&rv_a, &rv_c));
break;
case word_size:
case word_size: abort();
case long_size:
abort();
emit_crt("__imulu", block);
break;
}
break;

Expand Down
3 changes: 3 additions & 0 deletions demo/constants.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
int main(int argc, char **argv) {
return 1 * 2 + 3 / 4 - 1 % 6 & 8;
}
59 changes: 59 additions & 0 deletions demo/constants.z80
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#include "ti84pce.inc"

_indcall .equ __indcall

.org userMem - 2
.db tExtTok, tAsm84CeCmp

_start:
ld hl, 25
push hl
call _main
pop de
ld iy,flags
ret

#include "crt.z80"

_main:
push ix
ld ix,0
add ix,sp
ld sp,ix
ld hl,8
push hl
ld hl,6
push hl
ld hl,1
pop bc
call __idivu
push bc
pop hl
push hl
ld hl,4
push hl
ld hl,3
pop bc
call __idivu
push hl
ld hl,2
push hl
ld hl,1
pop de
call __imulu
pop de
add hl,de
pop de
or a,a
sbc hl,de
pop bc
call __iand
jp __frameunset_main
jp __LABEL__0
__LABEL__0:
jp __frameunset_main
__frameunset_main:
lea ix,ix+0
ld sp,ix
pop ix
ret

0 comments on commit 85435db

Please sign in to comment.