So. i'm slowly but surely starting Machine code programming and I wanted to know if this program is accurate
It gives a 0 which I assume means an overflow:
NEW ROM ONLY
210100 LD HL,1
01FFFF LD BC,65535
09 ADD HL,BC
44 LD B,H
4D LD C,L
C9 RET
I ran it using HexLD and wanted to be sure i wasn't mistaken.
Is it a mistake or does 0 mean overflow?
Machine code question
Machine code question
In Heck, there are two options for perpetual torment:
Eat the Puckerberry and suffer for eternity:
drink nothing but a cocktail of The Last Dab and Mexican Cake blended and served with
habanero slices
Eat the Puckerberry and suffer for eternity:
drink nothing but a cocktail of The Last Dab and Mexican Cake blended and served with
habanero slices
Re: Machine code question
You’ve just added $0001 to $FFFF, and that gives $0000, so your program works fine.
Re: Machine code question
much obliged
In Heck, there are two options for perpetual torment:
Eat the Puckerberry and suffer for eternity:
drink nothing but a cocktail of The Last Dab and Mexican Cake blended and served with
habanero slices
Eat the Puckerberry and suffer for eternity:
drink nothing but a cocktail of The Last Dab and Mexican Cake blended and served with
habanero slices
Re: Machine code question
0 is the result of the sum of both registers, but it is does not mean overflow, the overflow is in the Carry-flag.Crayon21 wrote: ↑Mon Nov 08, 2021 5:38 am So. i'm slowly but surely starting Machine code programming and I wanted to know if this program is accurate
It gives a 0 which I assume means an overflow:
NEW ROM ONLY
210100 LD HL,1
01FFFF LD BC,65535
09 ADD HL,BC
44 LD B,H
4D LD C,L
C9 RET
I ran it using HexLD and wanted to be sure i wasn't mistaken.
Is it a mistake or does 0 mean overflow?
If the registers would be units only then 6+4 would also give 0, but the carryflag would indicate the 10-position.
Re: Machine code question
Hi,
There is a possible confusion with this 'C' register and the 'C' carry-flag from the AF register.
"C" is the lower part of the BC register. (LD A,C ; SUB C ...)
and "C" is the carry-flag condition from several intenal Z80 functions. (RET C ; JR C,* ; JP C,*)
They should rename this stat AF flag differently ...
There is a possible confusion with this 'C' register and the 'C' carry-flag from the AF register.
"C" is the lower part of the BC register. (LD A,C ; SUB C ...)
and "C" is the carry-flag condition from several intenal Z80 functions. (RET C ; JR C,* ; JP C,*)
They should rename this stat AF flag differently ...
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
- 1024MAK
- Posts: 5131
- Joined: Mon Sep 26, 2011 10:56 am
- Location: Looking forward to summer in Somerset, UK...
Re: Machine code question
Well, one is an 8 bit register called C. Which can be combined with the B register to be treated as a 16 bit register (BC).
The carry flag (C) is one of six flag bits in the flag register (F). The flag register is actually 8 bits wide, but two bits are treated as unused. Although it is a real register, you can’t use it like a normal register.
A simple guide on the most used flags is here. More details on the flags / flag register are here. You will find similar information in the various books on the Z80 as well.
Mark
The carry flag (C) is one of six flag bits in the flag register (F). The flag register is actually 8 bits wide, but two bits are treated as unused. Although it is a real register, you can’t use it like a normal register.
A simple guide on the most used flags is here. More details on the flags / flag register are here. You will find similar information in the various books on the Z80 as well.
Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp
Standby alert
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp
Standby alert
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.