!to "test_stack.prg", cbm *=$c000 jmp test_lit ; SYS 49152 jmp test_lod ; SYS 49155 jmp test_sto ; SYS 49158 jmp test_true ; SYS 49161 jmp test_false ; SYS 49164 jmp test_jpc1 ; SYS 49167 jmp test_jpc2 ; SYS 49170 jmp test_add ; SYS 49173 jmp test_sub ; SYS 49176 jmp test_mul ; SYS 49179 jmp test_divmod ; SYS 49182 jmp test_div ; SYS 49185 jmp test_mod ; SYS 49188 jmp test_incr ; SYS 49191 jmp test_eql1 ; SYS 49194 jmp test_eql2 ; SYS 49197 jmp test_eql3 ; SYS 49200 jmp test_neq1 ; SYS 49203 jmp test_neq2 ; SYS 49206 jmp test_neq3 ; SYS 49209 jmp test_lss1 ; SYS 49212 jmp test_lss2 ; SYS 49215 jmp test_geq1 ; SYS 49218 jmp test_geq2 ; SYS 49221 jmp test_geq3 ; SYS 49224 jmp test_outdec ; SYS 49227 jmp test_outchr ; SYS 49230 jmp test_litv ; SYS 49233 jmp test_lodint ; SYS 49236 jmp test_stoint ; SYS 49239 !source "stack.a" test_lit +initstp +lit 1952 ; $07a0 rts test_lod +initstp +lod var_a rts test_sto +initstp +lit 1952 ; $07a0 +sto var_b rts test_true +initstp +true rts test_false +initstp +false rts test_jpc1 ; Bedingung fuer Sprung erfuellt +initstp +false +jpc + lda #$ff rts + lda #$80 rts test_jpc2 ; Bedingung fuer Sprung nicht erfuellt +initstp +true +jpc + lda #$80 rts + lda #$ff rts test_add +initstp +lit 1472 ; $05c0 +lit 1952 ; $07a0 jsr add ; $0d60 / 3424 rts test_sub +initstp +lit 1952 ; $07a0 +lit 1472 ; $05c0 jsr sub ; $01e0 / 480 rts test_mul +initstp +lit 20 ; $0014 +lit 480 ; $01e0 jsr mul ; $2580 / 9600 rts test_divmod +initstp +lit 19000 ; $4a38 +lit 401 ; $0191 jsr divmod ; $2f, $99 / 47, 153 rts test_div +initstp +lit 19000 ; $4a38 +lit 401 ; $0191 jsr div ; $2f / 47 rts test_mod +initstp +lit 19000 ; $4a38 +lit 401 ; $0191 jsr mod ; $99 / 153 rts test_incr ; $00ff -> $0100 +initstp +lit $ff jsr incr ; $0100 rts test_eql1 ; Bedingung erfuellt +initstp +lit $0191 ; 401 +lit $0191 ; 401 jsr eql rts test_eql2 ; Bedingung nicht erfuellt (high byte) +initstp +lit $0291 ; 657 +lit $0191 ; 401 jsr eql rts test_eql3 ; Bedingung nicht erfuellt (low byte) +initstp +lit $0192 ; 402 +lit $0191 ; 401 jsr eql rts test_neq1 ; Bedingung erfuellt (low byte unterschiedlich) +initstp +lit $0192 ; 402 +lit $0191 ; 401 jsr neq rts test_neq2 ; Bedingung erfuellt (high byte unterschiedlich) +initstp +lit $0291 ; 657 +lit $0191 ; 401 jsr neq rts test_neq3 ; Bedingung nicht erfuellt +initstp +lit $0191 ; 401 +lit $0191 ; 401 jsr neq rts test_lss1 ; Bedingung erfuellt +initstp +lit 780 ; $030c +lit 781 ; $030d jsr lss rts test_lss2 ; Bedingung nicht erfuellt +initstp +lit 780 ; $030c +lit 780 ; $030c jsr lss rts test_geq1 ; Bedingung erfuellt +initstp +lit 781 ; $030d +lit 781 ; $030d jsr geq rts test_geq2 ; Bedingung erfuellt +initstp +lit 781 ; $030d +lit 780 ; $030c jsr geq rts test_geq3 ; Bedingung nicht erfuellt +initstp +lit 780 ; $030c +lit 781 ; $030d jsr geq rts test_outdec +initstp +lit 1952 jsr outdec rts test_outchr +initstp +lit 65 ; "A" jsr outchr rts test_litv +initstp +litv 'X', 0 ; X% +litv 'Y', 'Z' ; YZ% rts test_lodint +initstp +litv 'A', 0 ; A% jsr lodint +litv 'B', 'C' ; BC% jsr lodint rts test_stoint +initstp +lit 1952 +litv 'A', 'B' ; AB% jsr stoint rts *=$c700 var_a !wo $05c0 ; 1472 var_b !wo 0