;Put the name in OP1 ld hl,GramTempName rst rMov9ToOP1 ;Now we create the var ld a,16h ld hl,(TempWord4) bcall(_CreateVar) inc de inc de ;Copy the source to RAM ;If size is 0, just exit. ld bc,(TempWord4) ld a,b or c jr nz,+_ pop hl ret _: ld hl,(TempWord5) ld a,(TempWord3) call nz,ReadArc ;Now we copy the temp var's name back to OP1 and call it good :) ld hl,OP4 rst rMov9ToOP1 ; ;Here is our pre-compiling code ; ;If the size is 0, exit ; ld hl,(TempWord4) ; ld a,h \ or l ; ret z ; ; ;Put the name in OP1 ; ld hl,GramTempName ; rst rMov9ToOP1 ; ; ;How much RAM do we have that we can allocate? ; bcall(_MemChk) ; ; ;Take off some bytes to make room for the VAT entry and size bytes ; ld bc,-20 ;at some point I have to actually calculate this. It might be -19. ; add hl,bc ; jp nc,err_LowMem ;Not even enough room for a new VAT pointer ! ; ; ;Now we create the var, occupying all of RAM ; ld a,16h ; ld (size_of_buffer),hl ; bcall(_CreateVar) ; ; ;Keep the pointer to the start of the buffer safe ; inc de \ inc de ; ld (start_of_prog),de ; ; ;Copy the source code to the buffer ; ld a,(TempWord3) ; ld bc,(TempWord4) ; ld hl,(TempWord5) ; call ReadArc ; ; ;Now we set up for parsing ; ld (end_of_src),de ; ; ld hl,(start_of_prog) ; ; ld (in_head),hl ; ; ld (out_head),hl ; ; ex de,hl ; ld de,(start_of_prog) ; ld hl,(size_of_buffer) ; add hl,de ; ld (buffer_top),hl ; ld (data_top),hl ; ld h,d ; ld l,e ; ;HL points to the head of the input ; ;DE points to the head of the output ; ; ; ; ld de,(end_of_src) ; ; jp compile_dealloc ; ; _: ; ld a,(hl) ; call compile ; ; ;Make sure that HL