; This is not executable sample code, just an example of technique ; ; This demonstrates Zeus's flow warnings. ; Zeus tries to keep track of execution flow and warn you if you accidentally execute data. ; Which is generally helpful... but sometimes you don't want those warnings, so here's how ; to deal with them sensibly - you can also use the config tab to turn them all off, but ; if you do that Zeus cannot help you avoid mistakes. ; zoWarnFlow = true ; This turns them on regardless of the config tab setting. ; zoWarnFlow = false ; If not commented out this turns them off regardless of the config tab setting. org 0 ; Start di ; Dummy code jr Start ; ; Code for RST $08 goes at address $08 org $08 ; Dummy code for RST $08 Rst08 ret ; ; Code for RST $10 goes at address $10 org $10 ; Dummy code for RST $10 Rst10 ret ; ; Some (valid) dummy data SomeData db "Dummy, not used",0 ; This won't generate a warning. Zeus knows code does not ; normally execute past a "ret", so it considers this data "safe" ; Some dummy code org $1000 ; Some random address. nop ; This is code, so Zeus regards the next line as a potential bug db "Hello!",0 ; This generates a flow warning - you might well be executing data nop ; by accident there... ; Should you want, for some reason, to write code with a data statement that will be executed ; You can do it like this: noflow ; This tells Zeus to think execution doesn't flow through here db $21,$34,$12 ; So this data block won't generate a warning. (It's a LD HL,$1234) ; Now we have some more code Print ret ; We don't have a print routine for this. See "zeus_ex_print.asm" ; Print the string following the call in memory ; I'm doing this as a proc to illustrate procedures in Zeus. Procedures have local labels by default. PrintStrZ proc ; This is a procedure called "PrintStrZ" ex (sp),hl ; Get the return address into HL push af ; Save A Loop ld a,(hl) ; Read the next data byte inc hl ; And step past it or a ; Is it zero (or a sets the flags) jr z,Exit ; If it is zero we're done and exit call Print ; Print this character jr Loop ; And loop for the next one Exit pop af ; Restore A ex (sp),hl ; And change the return address to point after the string retp ; This both exits the procedure and plants a RET instruction ; Now, let's have some example code that uses following strings. call PrintStrZ ; Print the data following on in memory db "Hello there!",0 ; This will not generate a flow warning - see the last line of this source rst Rst08 ; Print the data following on in memory db "Hello!",0 ; This will not generate a flow warning - see the last line of this source rst Rst10 ; Same again, but with a RST that Zeus isn't told that has following data db "Hello!",0 ; This WILL generate a flow warning. ; Demonstrate how to tell Zeus which subroutines have data following after them. zeusdatafollows Rst08,PrintStrZ ; Give Zeus a list of calls/rsts that have data after them.